コード例 #1
0
        public void Check_60_Degree_Handling()
        {
            Coordinate c       = new Coordinate(new EagerLoad(false));
            var        options = new CoordinateFormatOptions();

            options.Format = CoordinateFormatType.Degree_Decimal_Minutes;
            var lat = new CoordinatePart(CoordinateType.Lat);

            lat.Degrees = 89;
            lat.Minutes = 59;
            lat.Seconds = 59.99999;
            var lng = new CoordinatePart(CoordinateType.Long);

            lng.Degrees = 179;
            lng.Minutes = 59;
            lng.Seconds = 59.99999;

            c.Latitude  = lat;
            c.Longitude = lng;

            Assert.AreEqual("N 90º 0' 0\" E 180º 0' 0\"", c.ToString());
            Assert.AreEqual("N 90º 0' E 180º 0'", c.ToString(options));

            lat.Position = CoordinatesPosition.S;
            lng.Position = CoordinatesPosition.W;


            Assert.AreEqual("S 90º 0' 0\" W 180º 0' 0\"", c.ToString());
            Assert.AreEqual("S 90º 0' W 180º 0'", c.ToString(options));
        }
コード例 #2
0
        public double GetCoordinate(CoordinatePart part)
        {
            switch (part)
            {
            case CoordinatePart.None:
                return(double.NaN);

            case CoordinatePart.Left:
                return(this.Left);

            case CoordinatePart.Right:
                return(this.Right);

            case CoordinatePart.Top:
                return(this.Top);

            case CoordinatePart.Bottom:
                return(this.Bottom);

            case CoordinatePart.Width:
                return(this.Width);

            case CoordinatePart.Height:
                return(this.Height);

            default:
                throw new ArgumentOutOfRangeException("part");
            }
        }
コード例 #3
0
        public void CoordinatePart_Constructor_Property_Checks()
        {
            Coordinate coord = new Coordinate();

            double   lat       = coord.Latitude.DecimalDegree;
            double   lng       = coord.Longitude.DecimalDegree;
            string   MGRS      = coord.MGRS.ToString();
            string   UTM       = coord.UTM.ToString();
            string   ECEF      = coord.ECEF.ToString();
            string   Cartesian = coord.Cartesian.ToString();
            DateTime?cel       = coord.CelestialInfo.MoonSet;

            CoordinatePart cpLat = new CoordinatePart(25, CoordinateType.Lat);
            CoordinatePart cpLng = new CoordinatePart(25, CoordinateType.Long);

            //PROP CHANGE ERROR CHECK

            cpLat.DecimalDegree = 27;
            cpLng.Seconds       = 24;

            coord.Latitude = cpLat;
            Assert.AreNotEqual(lat, coord.Latitude.ToDouble());

            coord.Longitude = cpLng;
            Assert.AreNotEqual(lng, coord.Longitude.ToDouble());

            Assert.AreNotEqual(MGRS, coord.MGRS.ToString());
            Assert.AreNotEqual(UTM, coord.UTM.ToString());
            Assert.AreNotEqual(ECEF, coord.ECEF.ToString());
            Assert.AreNotEqual(Cartesian, coord.Cartesian.ToString());
            Assert.AreNotEqual(cel, coord.CelestialInfo.MoonSet);
        }
コード例 #4
0
        public void SetCoordinate(CoordinatePart part, double value)
        {
            switch (part)
            {
            case CoordinatePart.None:
                break;

            case CoordinatePart.Left:
                this.Left = value;
                break;

            case CoordinatePart.Top:
                this.Top = value;
                break;

            case CoordinatePart.Width:
                this.Width = value;
                break;

            case CoordinatePart.Height:
                this.Height = value;
                break;

            case CoordinatePart.Bottom:
            case CoordinatePart.Right:
                throw new NotSupportedException();

            default:
                throw new ArgumentOutOfRangeException("part");
            }
        }
コード例 #5
0
 private void FindLocal()
 {
     try
     {
         if (string.IsNullOrEmpty(textBoxLocal.Text))
         {
             return;
         }
         Cursor = Cursors.WaitCursor;
         Application.DoEvents();
         LatLongNetResult res   = LatLongNet.LatLongNetClient.Search(textBoxLocal.Text);
         CoordinatePart   lat   = new CoordinatePart(Convert.ToDouble(res.Latitude, CultureInfo.GetCultureInfo("en-Us").NumberFormat), CoordinateType.Lat);
         CoordinatePart   longi = new CoordinatePart(Convert.ToDouble(res.Longitude, CultureInfo.GetCultureInfo("en-Us").NumberFormat), CoordinateType.Long);
         numericUpDownLatitude.Value  = Convert.ToDecimal(lat.ToDouble());
         numericUpDownLongitude.Value = Convert.ToDecimal(longi.ToDouble());
         ucGoogleMapCoordenadas.SetPosition(lat.ToDouble(), longi.ToDouble());
         Cursor = Cursors.Default;
         Program.objParametros.LastLocal = textBoxLocal.Text;
         Application.DoEvents();
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
コード例 #6
0
        private static void CoordinatePart_Constructor_PropChange_Checks()
        {
            bool pass = true;

            try
            {
                Coordinate coord = new Coordinate();

                double   lat       = coord.Latitude.DecimalDegree;
                double   lng       = coord.Longitude.DecimalDegree;
                string   MGRS      = coord.MGRS.ToString();
                string   UTM       = coord.UTM.ToString();
                string   ECEF      = coord.ECEF.ToString();
                string   Cartesian = coord.Cartesian.ToString();
                DateTime?cel       = coord.CelestialInfo.MoonSet;

                CoordinatePart cpLat = new CoordinatePart(25, CoordinateType.Lat);
                CoordinatePart cpLng = new CoordinatePart(25, CoordinateType.Long);

                //PROP CHANGE ERROR CHECK

                cpLat.DecimalDegree = 27;
                cpLng.Seconds       = 24;

                coord.Latitude = cpLat;
                if (coord.Latitude.ToDouble() == lat)
                {
                    pass = false;
                }
                coord.Longitude = cpLng;
                if (coord.Longitude.ToDouble() == lng)
                {
                    pass = false;
                }
                if (MGRS == coord.MGRS.ToString())
                {
                    pass = false;
                }
                if (UTM == coord.UTM.ToString())
                {
                    pass = false;
                }
                if (ECEF == coord.ECEF.ToString())
                {
                    pass = false;
                }
                if (Cartesian == coord.Cartesian.ToString())
                {
                    pass = false;
                }
                if (cel == coord.CelestialInfo.MoonSet)
                {
                    pass = false;
                }
            }
            catch { pass = false; }

            Pass.Write("CoordinatePart Constructor Property Change Checks: ", pass);
        }
コード例 #7
0
ファイル: GeoAngle.cs プロジェクト: lihongyang5930/MapMaker
 private GeoAngle(GeoAnglePosition position, int degrees, int minutes, double seconds)
 {
     _part         = new CoordinatePart(degrees, minutes, seconds, (CoordinatesPosition)position);
     Position      = position;
     Degrees       = degrees;
     Minutes       = minutes;
     Seconds       = seconds;
     Dms           = $"{Degrees}°{Minutes}'{Math.Round(Seconds, 2)}\"";
     DecimalDegree = _part.DecimalDegree;
 }
コード例 #8
0
ファイル: Extensions.cs プロジェクト: UIKit0/VisualDesigner
        public static double GetMinCoordinate(this IEnumerable <ICoordinate> items, CoordinatePart part)
        {
            if (!items.Any())
            {
                return(Double.NaN);
            }
            var right = items.Min(item => item.GetCoordinate(part));

            return(right);
        }
コード例 #9
0
        public void CoordinatePart_Parse_Wrap_Check()
        {
            CoordinatePart cp = CoordinatePart.Parse("45");

            Assert.AreEqual(45, cp.ToDouble());
            Assert.AreEqual(CoordinatesPosition.N, cp.Position);

            cp = CoordinatePart.Parse("45", CoordinateType.Long);
            Assert.AreEqual(45, cp.ToDouble());
            Assert.AreEqual(CoordinatesPosition.E, cp.Position);
        }
コード例 #10
0
ファイル: GeoAngle.cs プロジェクト: lihongyang5930/MapMaker
        private GeoAngle(double value, CoordinateType type)
        {
            DecimalDegree = value;

            _part    = new CoordinatePart(value, type);
            Degrees  = _part.Degrees;
            Minutes  = _part.Minutes;
            Seconds  = _part.Seconds;
            Position = (GeoAnglePosition)_part.Position;
            Dms      = $"{Degrees}°{Minutes}'{Math.Round(Seconds, 2)}\"";
        }
コード例 #11
0
        /// <summary>
        /// Splits Coordinate test string to get value to parse and expected output.
        /// Checks proper parsing and value
        /// </summary>
        /// <param name="val">Test string value</param>
        private void Parse_Check(string val)
        {
            var    vals        = val.Split('#'); //First part of string is value to parse, seconds is expected string value after parse
            string coordString = vals[0];
            string expected    = vals[1];

            CoordinatePart c = CoordinatePart.Parse(coordString);//Will throw exception and fail if incorrect (intended behavior)

            //CHECK STRING COMPARISON, BUT REPLACE , and . with * to avoid cultural mismatch
            Assert.AreEqual(expected.Replace(",", "*").Replace(".", "*"), c.ToString().Replace(",", "*").Replace(".", "*"), $"{vals} parsed as {c.ToString().Replace(",", "*").Replace(".", "*")} but {expected.Replace(",", "*").Replace(".", "*")} was expected.");
        }
コード例 #12
0
        /// <summary>
        /// Splits Coordinate test string to get value to parse and expected output.
        /// Checks proper parsing and value
        /// </summary>
        /// <param name="val">Test string value</param>
        private void TryParse_Check(string val)
        {
            var            vals        = val.Split('#'); //First part of string is value to parse, seconds is expected string value after parse
            string         coordString = vals[0];
            string         expected    = vals[1];
            CoordinatePart c;

            Assert.IsTrue(CoordinatePart.TryParse(coordString, out c), $"{coordString} cannot be parsed.");

            //CHECK STRING COMPARISON, BUT REPLACE , and . with * to avoid cultural mismatch
            Assert.AreEqual(expected.Replace(",", "*").Replace(".", "*"), c.ToString().Replace(",", "*").Replace(".", "*"), $"{vals} parsed as {c.ToString().Replace(",", "*").Replace(".", "*")} but {expected.Replace(",", "*").Replace(".", "*")} was expected.");
        }
コード例 #13
0
        public void Coordinate_Roundtrippable_Test()
        {
            CoordinatePart lat = new CoordinatePart(-0, -0, -0, CoordinatesPosition.N);

            Assert.AreEqual("N 0º 0' 0\"", lat.ToString(), "Latitude not expected");
            CoordinatePart lng = new CoordinatePart(-0, -0, -0, CoordinatesPosition.E);

            Assert.AreEqual("E 0º 0' 0\"", lng.ToString(), "Longitude not expected");
            Coordinate c = new Coordinate();

            c.Latitude  = lat;
            c.Longitude = lng;
            Assert.AreEqual("N 0º 0' 0\" E 0º 0' 0\"", c.ToString(), "Coordinate not expected");
        }
コード例 #14
0
        public void Coordinate2DParser_WitUTMCoordinate_ShouldWork(string coordinateString, string latitudeValue, string longitudeValue)
        {
            // Arrange
            var latitude       = new CoordinatePart();
            var longitude      = new CoordinatePart();
            var coordinateType = string.Empty;
            var parser         = this.Coordinate2DParserFactory.Invoke();

            // Act
            parser.ParseCoordinateString(coordinateString, coordinateType, latitude, longitude);

            // Assert
            Assert.AreEqual(latitudeValue, latitude.Value, "Latitude should match");
            Assert.AreEqual(longitudeValue, longitude.Value, "Longitude should match");
        }
コード例 #15
0
        public void CoordinatePart_Initializes_Without_Exceptions()
        {
            Coordinate     c  = new Coordinate();
            CoordinatePart cp = new CoordinatePart(CoordinateType.Lat);

            cp = new CoordinatePart(CoordinateType.Long);
            cp = new CoordinatePart(25, CoordinateType.Lat);
            cp = new CoordinatePart(25, CoordinateType.Long);
            cp = new CoordinatePart(25, 25, CoordinatesPosition.N);
            cp = new CoordinatePart(25, 25, CoordinatesPosition.E);
            cp = new CoordinatePart(25, 25, CoordinatesPosition.S);
            cp = new CoordinatePart(25, 25, CoordinatesPosition.W);
            cp = new CoordinatePart(25, 25, 25, CoordinatesPosition.N);
            cp = new CoordinatePart(25, 25, 25, CoordinatesPosition.E);
            cp = new CoordinatePart(25, 25, 25, CoordinatesPosition.S);
            cp = new CoordinatePart(25, 25, 25, CoordinatesPosition.W);
        }
コード例 #16
0
        public void CoordinatePart_Initialize_Within_Allowed_Ranges()
        {
            Coordinate     c  = new Coordinate();
            CoordinatePart cp = new CoordinatePart(90, CoordinateType.Lat);

            cp = new CoordinatePart(-90, CoordinateType.Lat);
            cp = new CoordinatePart(89, 59, CoordinatesPosition.N);
            cp = new CoordinatePart(89, 59, CoordinatesPosition.S);
            cp = new CoordinatePart(89, 59, 59, CoordinatesPosition.N);
            cp = new CoordinatePart(89, 59, 59, CoordinatesPosition.S);
            cp = new CoordinatePart(180, CoordinateType.Long);
            cp = new CoordinatePart(-180, CoordinateType.Long);
            cp = new CoordinatePart(179, 59, CoordinatesPosition.E);
            cp = new CoordinatePart(179, 59, CoordinatesPosition.W);
            cp = new CoordinatePart(179, 59, 59, CoordinatesPosition.E);
            cp = new CoordinatePart(179, 59, 59, CoordinatesPosition.W);
        }
コード例 #17
0
 public double GetCoordinate(CoordinatePart part)
 {
     switch (part)
     {
         case CoordinatePart.None:
             return double.NaN;
         case CoordinatePart.Left:
             return this.Left;
         case CoordinatePart.Right:
             return this.Right;
         case CoordinatePart.Top:
             return this.Top;
         case CoordinatePart.Bottom:
             return this.Bottom;
         case CoordinatePart.Width:
             return this.Width;
         case CoordinatePart.Height:
             return this.Height;
         default:
             throw new ArgumentOutOfRangeException("part");
     }
 }
コード例 #18
0
        private static void CoordinatePart_Init_Error_Checks()
        {
            bool pass = true;

            try
            {
                Coordinate     c  = new Coordinate();
                CoordinatePart cp = new CoordinatePart(CoordinateType.Lat);
                cp = new CoordinatePart(CoordinateType.Long);
                cp = new CoordinatePart(25, CoordinateType.Lat);
                cp = new CoordinatePart(25, CoordinateType.Long);
                cp = new CoordinatePart(25, 25, CoordinatesPosition.N);
                cp = new CoordinatePart(25, 25, CoordinatesPosition.E);
                cp = new CoordinatePart(25, 25, CoordinatesPosition.S);
                cp = new CoordinatePart(25, 25, CoordinatesPosition.W);
                cp = new CoordinatePart(25, 25, 25, CoordinatesPosition.N);
                cp = new CoordinatePart(25, 25, 25, CoordinatesPosition.E);
                cp = new CoordinatePart(25, 25, 25, CoordinatesPosition.S);
                cp = new CoordinatePart(25, 25, 25, CoordinatesPosition.W);
            }
            catch { pass = false; }
            Pass.Write("CoordinatePart Initialization Error Checks", pass);
        }
コード例 #19
0
        /// <summary>
        /// Gets a longitude coordinate part from a provided string
        /// </summary>
        /// <param name="v">The longitude value to attempt to populate from</param>
        /// <param name="c">The coordinate which contains this longitude coordinate part</param>
        /// <returns>A coordinate containing the parsed longitude</returns>
        protected CoordinatePart GetLongitude(string v, Coordinate c)
        {
            CoordinatePart cp;
            string         longitudeCoordinatesPosition = v.Substring(v.Length - 1, 1);
            string         degreeString = v.FindStringWithinAnchorText(String.Empty, "°", true, true);

            Int32.TryParse(degreeString, out int degree);
            string minuteString = v.FindStringWithinAnchorText("°", "'", true, true);

            Int32.TryParse(minuteString, out int minute);
            string secondString = v.FindStringWithinAnchorText("'", "\"", true, true);

            Double.TryParse(secondString, out double second);

            if (longitudeCoordinatesPosition == "W")
            {
                cp = new CoordinatePart(degree, minute, second, CoordinatesPosition.W);
            }
            else
            {
                cp = new CoordinatePart(degree, minute, second, CoordinatesPosition.E);
            }
            return(cp);
        }
コード例 #20
0
 public void SetCoordinate(CoordinatePart part, double value)
 {
     throw new NotImplementedException();
 }
コード例 #21
0
 public double GetCoordinate(CoordinatePart part)
 {
     throw new NotImplementedException();
 }
コード例 #22
0
        public void SetCoordinate(CoordinatePart part, double value)
        {

            switch (part)
            {
                case CoordinatePart.None:
                    break;
                case CoordinatePart.Left:
                    this.Left = value;
                    break;
                case CoordinatePart.Top:
                    this.Top = value;
                    break;
                case CoordinatePart.Width:
                    this.Width = value;
                    break;
                case CoordinatePart.Height:
                    this.Height = value;
                    break;
                case CoordinatePart.Bottom:
                case CoordinatePart.Right:
                    throw new NotSupportedException();
                default:
                    throw new ArgumentOutOfRangeException("part");
            }
        }
コード例 #23
0
 public void SetCoordinate(CoordinatePart part, double value)
 {
     throw new NotImplementedException();
 }
コード例 #24
0
 public double GetCoordinate(CoordinatePart part)
 {
     throw new NotImplementedException();
 }
コード例 #25
0
 public GpsCoordinates(CoordinatePart latitude, CoordinatePart longitude)
 {
     Longitude = longitude;
     Latitude = latitude;
 }
コード例 #26
0
        //Verifies that Parse is wrapping Try_Parse correctly
        private static void Parse_Wrap_Tests()
        {
            bool pass = true;

            string        coord   = "45.6, 22.4";
            EagerLoad     el      = new EagerLoad(EagerLoadType.Celestial | EagerLoadType.Cartesian | EagerLoadType.ECEF);
            CartesianType cType   = CartesianType.ECEF;
            DateTime      geoDate = new DateTime(2020, 3, 10, 10, 10, 12);

            Coordinate parseCoord;
            Coordinate tryParseCoord;

            parseCoord = Coordinate.Parse(coord);
            Coordinate.TryParse(coord, out tryParseCoord);
            if (!Parse_Wrap_Check(parseCoord, tryParseCoord, false))
            {
                pass = false;
            }

            parseCoord = Coordinate.Parse(coord, geoDate);
            Coordinate.TryParse(coord, geoDate, out tryParseCoord);
            if (!Parse_Wrap_Check(parseCoord, tryParseCoord, false))
            {
                pass = false;
            }

            parseCoord = Coordinate.Parse(coord, cType);
            Coordinate.TryParse(coord, cType, out tryParseCoord);
            if (!Parse_Wrap_Check(parseCoord, tryParseCoord, false))
            {
                pass = false;
            }

            parseCoord = Coordinate.Parse(coord, geoDate, cType);
            Coordinate.TryParse(coord, geoDate, cType, out tryParseCoord);
            if (!Parse_Wrap_Check(parseCoord, tryParseCoord, false))
            {
                pass = false;
            }

            parseCoord = Coordinate.Parse(coord, el);
            Coordinate.TryParse(coord, el, out tryParseCoord);
            if (!Parse_Wrap_Check(parseCoord, tryParseCoord, false))
            {
                pass = false;
            }

            parseCoord = Coordinate.Parse(coord, geoDate, el);
            Coordinate.TryParse(coord, geoDate, el, out tryParseCoord);
            if (!Parse_Wrap_Check(parseCoord, tryParseCoord, false))
            {
                pass = false;
            }

            parseCoord = Coordinate.Parse(coord, cType, el);
            Coordinate.TryParse(coord, cType, el, out tryParseCoord);
            if (!Parse_Wrap_Check(parseCoord, tryParseCoord, false))
            {
                pass = false;
            }

            parseCoord = Coordinate.Parse(coord, geoDate, cType, el);
            Coordinate.TryParse(coord, geoDate, cType, el, out tryParseCoord);
            if (!Parse_Wrap_Check(parseCoord, tryParseCoord, false))
            {
                pass = false;
            }

            //CoordinatePart Check

            CoordinatePart cp = CoordinatePart.Parse("45");

            if (cp.ToDouble() != 45 || cp.Position != CoordinatesPosition.N)
            {
                pass = false;
            }

            cp = CoordinatePart.Parse("45", CoordinateType.Long);
            if (cp.ToDouble() != 45 || cp.Position != CoordinatesPosition.E)
            {
                pass = false;
            }

            Pass.Write("Parse Wrapper Test", pass);
        }
コード例 #27
0
        private static void CoordinatePart_Parses_Test()
        {
            //Parse CoordinatePart Formats
            Console.WriteLine("CoordinatePart Parses...");
            string[]       coordStrings = File.ReadAllLines("CoordinateData\\CoordinateParts.txt");
            CoordinatePart cp;
            bool           pass     = true;
            string         lastType = "";

            foreach (string c in coordStrings)
            {
                c.Trim();
                if (c.Contains("\\"))
                {
                    if (lastType != "")
                    {
                        Pass.Write(lastType.Split('#')[0], pass);
                    }
                    lastType = "";
                    pass     = true;
                    lastType = c;
                }
                else
                {
                    string[] cc = c.Split('#');
                    if (!CoordinatePart.TryParse(cc[0], out cp))
                    {
                        pass = false;
                    }
                    else
                    {
                        if (cp.ToString().Replace(",", "*").Replace(".", "*") != cc[1].Replace(",", "*").Replace(".", "*"))
                        {
                            Debug.WriteLine("...MISMATCH: " + cp.ToString() + " - " + cc[1]);
                            pass = false;
                        }
                    }
                }
            }
            if (lastType != "")
            {
                Pass.Write(lastType.Split(',')[0], pass);
            }
            //Attempt Forces Param
            pass = true;
            try
            {
                if (CoordinatePart.TryParse("95", CoordinateType.Lat, out cp))
                {
                    pass = false;
                }                                                                               //Intentional Fail
                if (CoordinatePart.TryParse("E181", CoordinateType.Lat, out cp))
                {
                    pass = false;
                }                                                                                  //Intentional Fail
                if (CoordinatePart.TryParse("N 95 45", CoordinateType.Lat, out cp))
                {
                    pass = false;
                }                                                                                     //Intentional Fail
                if (CoordinatePart.TryParse("95", CoordinateType.Lat, out cp))
                {
                    pass = false;
                }                                                                                //Intentional Fail
                if (CoordinatePart.TryParse("WD24 45", CoordinateType.Lat, out cp))
                {
                    pass = false;
                }                                                                                     //Intentional Fail
            }
            catch { pass = false; }
            Console.WriteLine();
            Pass.Write("\\\\Intentional Fails", pass);
        }
コード例 #28
0
 public GpsCoordinates(int id, CoordinatePart latitude, CoordinatePart longitude)
     : this(latitude, longitude)
 {
     Id = id;
 }
コード例 #29
0
        public void CoordinatePart_Throws_ArguementOutOfRangeException_When_Ranges_Exceed()
        {
            CoordinatePart cp;
            string         failMsg = "CoordinatePart initialized with exceeded limitations.";

            //Should fail as arguments are out of range.
            Assert.ThrowsException <ArgumentOutOfRangeException>(() => cp = new CoordinatePart(91, CoordinateType.Lat), failMsg);
            Assert.ThrowsException <ArgumentOutOfRangeException>(() => cp = new CoordinatePart(-91, CoordinateType.Lat), failMsg);
            Assert.ThrowsException <ArgumentOutOfRangeException>(() => cp = new CoordinatePart(181, CoordinateType.Long), failMsg);
            Assert.ThrowsException <ArgumentOutOfRangeException>(() => cp = new CoordinatePart(-181, CoordinateType.Long), failMsg);

            Assert.ThrowsException <ArgumentOutOfRangeException>(() => cp = new CoordinatePart(91, 0, CoordinatesPosition.N), failMsg);
            Assert.ThrowsException <ArgumentOutOfRangeException>(() => cp = new CoordinatePart(90, 1, CoordinatesPosition.N), failMsg);
            Assert.ThrowsException <ArgumentOutOfRangeException>(() => cp = new CoordinatePart(89, 60, CoordinatesPosition.N), failMsg);
            Assert.ThrowsException <ArgumentOutOfRangeException>(() => cp = new CoordinatePart(91, 0, CoordinatesPosition.N), failMsg);
            Assert.ThrowsException <ArgumentOutOfRangeException>(() => cp = new CoordinatePart(90, 1, CoordinatesPosition.N), failMsg);
            Assert.ThrowsException <ArgumentOutOfRangeException>(() => cp = new CoordinatePart(89, 60, CoordinatesPosition.N), failMsg);
            Assert.ThrowsException <ArgumentOutOfRangeException>(() => cp = new CoordinatePart(-90, 1, CoordinatesPosition.N), failMsg);
            Assert.ThrowsException <ArgumentOutOfRangeException>(() => cp = new CoordinatePart(89, -1, CoordinatesPosition.N), failMsg);

            Assert.ThrowsException <ArgumentOutOfRangeException>(() => cp = new CoordinatePart(91, 0, CoordinatesPosition.S), failMsg);
            Assert.ThrowsException <ArgumentOutOfRangeException>(() => cp = new CoordinatePart(90, 1, CoordinatesPosition.S), failMsg);
            Assert.ThrowsException <ArgumentOutOfRangeException>(() => cp = new CoordinatePart(89, 60, CoordinatesPosition.S), failMsg);
            Assert.ThrowsException <ArgumentOutOfRangeException>(() => cp = new CoordinatePart(91, 0, CoordinatesPosition.S), failMsg);
            Assert.ThrowsException <ArgumentOutOfRangeException>(() => cp = new CoordinatePart(90, 1, CoordinatesPosition.S), failMsg);
            Assert.ThrowsException <ArgumentOutOfRangeException>(() => cp = new CoordinatePart(89, 60, CoordinatesPosition.S), failMsg);
            Assert.ThrowsException <ArgumentOutOfRangeException>(() => cp = new CoordinatePart(-90, 1, CoordinatesPosition.S), failMsg);
            Assert.ThrowsException <ArgumentOutOfRangeException>(() => cp = new CoordinatePart(89, -1, CoordinatesPosition.S), failMsg);

            Assert.ThrowsException <ArgumentOutOfRangeException>(() => cp = new CoordinatePart(91, 0, 0, CoordinatesPosition.N), failMsg);
            Assert.ThrowsException <ArgumentOutOfRangeException>(() => cp = new CoordinatePart(90, 0, 1, CoordinatesPosition.N), failMsg);
            Assert.ThrowsException <ArgumentOutOfRangeException>(() => cp = new CoordinatePart(89, 59, 60, CoordinatesPosition.N), failMsg);
            Assert.ThrowsException <ArgumentOutOfRangeException>(() => cp = new CoordinatePart(90, 0, 1, CoordinatesPosition.N), failMsg);
            Assert.ThrowsException <ArgumentOutOfRangeException>(() => cp = new CoordinatePart(89, 59, 60, CoordinatesPosition.N), failMsg);
            Assert.ThrowsException <ArgumentOutOfRangeException>(() => cp = new CoordinatePart(-90, 0, 0, CoordinatesPosition.N), failMsg);
            Assert.ThrowsException <ArgumentOutOfRangeException>(() => cp = new CoordinatePart(89, -1, 0, CoordinatesPosition.N), failMsg);
            Assert.ThrowsException <ArgumentOutOfRangeException>(() => cp = new CoordinatePart(89, 1, -1, CoordinatesPosition.N), failMsg);

            Assert.ThrowsException <ArgumentOutOfRangeException>(() => cp = new CoordinatePart(91, 0, 0, CoordinatesPosition.S), failMsg);
            Assert.ThrowsException <ArgumentOutOfRangeException>(() => cp = new CoordinatePart(90, 0, 1, CoordinatesPosition.S), failMsg);
            Assert.ThrowsException <ArgumentOutOfRangeException>(() => cp = new CoordinatePart(89, 59, 60, CoordinatesPosition.S), failMsg);
            Assert.ThrowsException <ArgumentOutOfRangeException>(() => cp = new CoordinatePart(90, 0, 1, CoordinatesPosition.S), failMsg);
            Assert.ThrowsException <ArgumentOutOfRangeException>(() => cp = new CoordinatePart(89, 59, 60, CoordinatesPosition.S), failMsg);
            Assert.ThrowsException <ArgumentOutOfRangeException>(() => cp = new CoordinatePart(-90, 0, 0, CoordinatesPosition.S), failMsg);
            Assert.ThrowsException <ArgumentOutOfRangeException>(() => cp = new CoordinatePart(89, -1, 0, CoordinatesPosition.S), failMsg);
            Assert.ThrowsException <ArgumentOutOfRangeException>(() => cp = new CoordinatePart(89, 1, -1, CoordinatesPosition.S), failMsg);


            Assert.ThrowsException <ArgumentOutOfRangeException>(() => cp = new CoordinatePart(181, 0, CoordinatesPosition.E), failMsg);
            Assert.ThrowsException <ArgumentOutOfRangeException>(() => cp = new CoordinatePart(180, 1, CoordinatesPosition.E), failMsg);
            Assert.ThrowsException <ArgumentOutOfRangeException>(() => cp = new CoordinatePart(179, 60, CoordinatesPosition.E), failMsg);
            Assert.ThrowsException <ArgumentOutOfRangeException>(() => cp = new CoordinatePart(181, 0, CoordinatesPosition.E), failMsg);
            Assert.ThrowsException <ArgumentOutOfRangeException>(() => cp = new CoordinatePart(180, 1, CoordinatesPosition.E), failMsg);
            Assert.ThrowsException <ArgumentOutOfRangeException>(() => cp = new CoordinatePart(179, 60, CoordinatesPosition.E), failMsg);
            Assert.ThrowsException <ArgumentOutOfRangeException>(() => cp = new CoordinatePart(-180, 1, CoordinatesPosition.E), failMsg);
            Assert.ThrowsException <ArgumentOutOfRangeException>(() => cp = new CoordinatePart(179, -1, CoordinatesPosition.E), failMsg);

            Assert.ThrowsException <ArgumentOutOfRangeException>(() => cp = new CoordinatePart(181, 0, CoordinatesPosition.W), failMsg);
            Assert.ThrowsException <ArgumentOutOfRangeException>(() => cp = new CoordinatePart(180, 1, CoordinatesPosition.W), failMsg);
            Assert.ThrowsException <ArgumentOutOfRangeException>(() => cp = new CoordinatePart(179, 60, CoordinatesPosition.W), failMsg);
            Assert.ThrowsException <ArgumentOutOfRangeException>(() => cp = new CoordinatePart(181, 0, CoordinatesPosition.W), failMsg);
            Assert.ThrowsException <ArgumentOutOfRangeException>(() => cp = new CoordinatePart(180, 1, CoordinatesPosition.W), failMsg);
            Assert.ThrowsException <ArgumentOutOfRangeException>(() => cp = new CoordinatePart(179, 60, CoordinatesPosition.W), failMsg);
            Assert.ThrowsException <ArgumentOutOfRangeException>(() => cp = new CoordinatePart(-180, 1, CoordinatesPosition.W), failMsg);
            Assert.ThrowsException <ArgumentOutOfRangeException>(() => cp = new CoordinatePart(179, -1, CoordinatesPosition.W), failMsg);

            Assert.ThrowsException <ArgumentOutOfRangeException>(() => cp = new CoordinatePart(181, 0, 0, CoordinatesPosition.E), failMsg);
            Assert.ThrowsException <ArgumentOutOfRangeException>(() => cp = new CoordinatePart(180, 0, 1, CoordinatesPosition.E), failMsg);
            Assert.ThrowsException <ArgumentOutOfRangeException>(() => cp = new CoordinatePart(179, 59, 60, CoordinatesPosition.E), failMsg);
            Assert.ThrowsException <ArgumentOutOfRangeException>(() => cp = new CoordinatePart(180, 0, 1, CoordinatesPosition.E), failMsg);
            Assert.ThrowsException <ArgumentOutOfRangeException>(() => cp = new CoordinatePart(179, 59, 60, CoordinatesPosition.E), failMsg);
            Assert.ThrowsException <ArgumentOutOfRangeException>(() => cp = new CoordinatePart(-180, 0, 0, CoordinatesPosition.E), failMsg);
            Assert.ThrowsException <ArgumentOutOfRangeException>(() => cp = new CoordinatePart(179, -1, 0, CoordinatesPosition.E), failMsg);
            Assert.ThrowsException <ArgumentOutOfRangeException>(() => cp = new CoordinatePart(179, 1, -1, CoordinatesPosition.E), failMsg);

            Assert.ThrowsException <ArgumentOutOfRangeException>(() => cp = new CoordinatePart(181, 0, 0, CoordinatesPosition.W), failMsg);
            Assert.ThrowsException <ArgumentOutOfRangeException>(() => cp = new CoordinatePart(180, 0, 1, CoordinatesPosition.W), failMsg);
            Assert.ThrowsException <ArgumentOutOfRangeException>(() => cp = new CoordinatePart(179, 59, 60, CoordinatesPosition.W), failMsg);
            Assert.ThrowsException <ArgumentOutOfRangeException>(() => cp = new CoordinatePart(180, 0, 1, CoordinatesPosition.W), failMsg);
            Assert.ThrowsException <ArgumentOutOfRangeException>(() => cp = new CoordinatePart(179, 59, 60, CoordinatesPosition.W), failMsg);
            Assert.ThrowsException <ArgumentOutOfRangeException>(() => cp = new CoordinatePart(-180, 0, 0, CoordinatesPosition.W), failMsg);
            Assert.ThrowsException <ArgumentOutOfRangeException>(() => cp = new CoordinatePart(179, -1, 0, CoordinatesPosition.W), failMsg);
            Assert.ThrowsException <ArgumentOutOfRangeException>(() => cp = new CoordinatePart(179, 1, -1, CoordinatesPosition.W), failMsg);
        }
コード例 #30
0
        private static void CoordinatePart_Init_Range_Checks()
        {
            bool pass = true;

            try
            {
                Coordinate     c  = new Coordinate();
                CoordinatePart cp = new CoordinatePart(90, CoordinateType.Lat);
                cp = new CoordinatePart(-90, CoordinateType.Lat);
                cp = new CoordinatePart(89, 59, CoordinatesPosition.N);
                cp = new CoordinatePart(89, 59, CoordinatesPosition.S);
                cp = new CoordinatePart(89, 59, 59, CoordinatesPosition.N);
                cp = new CoordinatePart(89, 59, 59, CoordinatesPosition.S);
                cp = new CoordinatePart(180, CoordinateType.Long);
                cp = new CoordinatePart(-180, CoordinateType.Long);
                cp = new CoordinatePart(179, 59, CoordinatesPosition.E);
                cp = new CoordinatePart(179, 59, CoordinatesPosition.W);
                cp = new CoordinatePart(179, 59, 59, CoordinatesPosition.E);
                cp = new CoordinatePart(179, 59, 59, CoordinatesPosition.W);

                //Should fail
                try { cp = new CoordinatePart(91, CoordinateType.Lat); pass = false; } catch { }
                try { cp = new CoordinatePart(-91, CoordinateType.Lat); pass = false; } catch { }
                try { cp = new CoordinatePart(181, CoordinateType.Long); pass = false; } catch { }
                try { cp = new CoordinatePart(-181, CoordinateType.Long); pass = false; } catch { }

                try { cp = new CoordinatePart(91, 0, CoordinatesPosition.N); pass = false; } catch { }
                try { cp = new CoordinatePart(90, 1, CoordinatesPosition.N); pass = false; } catch { }
                try { cp = new CoordinatePart(89, 60, CoordinatesPosition.N); pass = false; } catch { }
                try { cp = new CoordinatePart(91, 0, CoordinatesPosition.N); pass = false; } catch { }
                try { cp = new CoordinatePart(90, 1, CoordinatesPosition.N); pass = false; } catch { }
                try { cp = new CoordinatePart(89, 60, CoordinatesPosition.N); pass = false; } catch { }
                try { cp = new CoordinatePart(-90, 1, CoordinatesPosition.N); pass = false; } catch { }
                try { cp = new CoordinatePart(89, -1, CoordinatesPosition.N); pass = false; } catch { }

                try { cp = new CoordinatePart(91, 0, CoordinatesPosition.S); pass = false; } catch { }
                try { cp = new CoordinatePart(90, 1, CoordinatesPosition.S); pass = false; } catch { }
                try { cp = new CoordinatePart(89, 60, CoordinatesPosition.S); pass = false; } catch { }
                try { cp = new CoordinatePart(91, 0, CoordinatesPosition.S); pass = false; } catch { }
                try { cp = new CoordinatePart(90, 1, CoordinatesPosition.S); pass = false; } catch { }
                try { cp = new CoordinatePart(89, 60, CoordinatesPosition.S); pass = false; } catch { }
                try { cp = new CoordinatePart(-90, 1, CoordinatesPosition.S); pass = false; } catch { }
                try { cp = new CoordinatePart(89, -1, CoordinatesPosition.S); pass = false; } catch { }

                try { cp = new CoordinatePart(91, 0, 0, CoordinatesPosition.N); pass = false; } catch { }
                try { cp = new CoordinatePart(90, 0, 1, CoordinatesPosition.N); pass = false; } catch { }
                try { cp = new CoordinatePart(89, 59, 60, CoordinatesPosition.N); pass = false; } catch { }
                try { cp = new CoordinatePart(90, 0, 1, CoordinatesPosition.N); pass = false; } catch { }
                try { cp = new CoordinatePart(89, 59, 60, CoordinatesPosition.N); pass = false; } catch { }
                try { cp = new CoordinatePart(-90, 0, 0, CoordinatesPosition.N); pass = false; } catch { }
                try { cp = new CoordinatePart(89, -1, 0, CoordinatesPosition.N); pass = false; } catch { }
                try { cp = new CoordinatePart(89, 1, -1, CoordinatesPosition.N); pass = false; } catch { }

                try { cp = new CoordinatePart(91, 0, 0, CoordinatesPosition.S); pass = false; } catch { }
                try { cp = new CoordinatePart(90, 0, 1, CoordinatesPosition.S); pass = false; } catch { }
                try { cp = new CoordinatePart(89, 59, 60, CoordinatesPosition.S); pass = false; } catch { }
                try { cp = new CoordinatePart(90, 0, 1, CoordinatesPosition.S); pass = false; } catch { }
                try { cp = new CoordinatePart(89, 59, 60, CoordinatesPosition.S); pass = false; } catch { }
                try { cp = new CoordinatePart(-90, 0, 0, CoordinatesPosition.S); pass = false; } catch { }
                try { cp = new CoordinatePart(89, -1, 0, CoordinatesPosition.S); pass = false; } catch { }
                try { cp = new CoordinatePart(89, 1, -1, CoordinatesPosition.S); pass = false; } catch { }


                try { cp = new CoordinatePart(181, 0, CoordinatesPosition.E); pass = false; } catch { }
                try { cp = new CoordinatePart(180, 1, CoordinatesPosition.E); pass = false; } catch { }
                try { cp = new CoordinatePart(179, 60, CoordinatesPosition.E); pass = false; } catch { }
                try { cp = new CoordinatePart(181, 0, CoordinatesPosition.E); pass = false; } catch { }
                try { cp = new CoordinatePart(180, 1, CoordinatesPosition.E); pass = false; } catch { }
                try { cp = new CoordinatePart(179, 60, CoordinatesPosition.E); pass = false; } catch { }
                try { cp = new CoordinatePart(-180, 1, CoordinatesPosition.E); pass = false; } catch { }
                try { cp = new CoordinatePart(179, -1, CoordinatesPosition.E); pass = false; } catch { }

                try { cp = new CoordinatePart(181, 0, CoordinatesPosition.W); pass = false; } catch { }
                try { cp = new CoordinatePart(180, 1, CoordinatesPosition.W); pass = false; } catch { }
                try { cp = new CoordinatePart(179, 60, CoordinatesPosition.W); pass = false; } catch { }
                try { cp = new CoordinatePart(181, 0, CoordinatesPosition.W); pass = false; } catch { }
                try { cp = new CoordinatePart(180, 1, CoordinatesPosition.W); pass = false; } catch { }
                try { cp = new CoordinatePart(179, 60, CoordinatesPosition.W); pass = false; } catch { }
                try { cp = new CoordinatePart(-180, 1, CoordinatesPosition.W); pass = false; } catch { }
                try { cp = new CoordinatePart(179, -1, CoordinatesPosition.W); pass = false; } catch { }

                try { cp = new CoordinatePart(181, 0, 0, CoordinatesPosition.E); pass = false; } catch { }
                try { cp = new CoordinatePart(180, 0, 1, CoordinatesPosition.E); pass = false; } catch { }
                try { cp = new CoordinatePart(179, 59, 60, CoordinatesPosition.E); pass = false; } catch { }
                try { cp = new CoordinatePart(180, 0, 1, CoordinatesPosition.E); pass = false; } catch { }
                try { cp = new CoordinatePart(179, 59, 60, CoordinatesPosition.E); pass = false; } catch { }
                try { cp = new CoordinatePart(-180, 0, 0, CoordinatesPosition.E); pass = false; } catch { }
                try { cp = new CoordinatePart(179, -1, 0, CoordinatesPosition.E); pass = false; } catch { }
                try { cp = new CoordinatePart(179, 1, -1, CoordinatesPosition.E); pass = false; } catch { }

                try { cp = new CoordinatePart(181, 0, 0, CoordinatesPosition.W); pass = false; } catch { }
                try { cp = new CoordinatePart(180, 0, 1, CoordinatesPosition.W); pass = false; } catch { }
                try { cp = new CoordinatePart(179, 59, 60, CoordinatesPosition.W); pass = false; } catch { }
                try { cp = new CoordinatePart(180, 0, 1, CoordinatesPosition.W); pass = false; } catch { }
                try { cp = new CoordinatePart(179, 59, 60, CoordinatesPosition.W); pass = false; } catch { }
                try { cp = new CoordinatePart(-180, 0, 0, CoordinatesPosition.W); pass = false; } catch { }
                try { cp = new CoordinatePart(179, -1, 0, CoordinatesPosition.W); pass = false; } catch { }
                try { cp = new CoordinatePart(179, 1, -1, CoordinatesPosition.W); pass = false; } catch { }
            }
            catch
            {
                pass = false;
            }
            Pass.Write("CoordinatePart Initialization Range Checks", pass);
        }
コード例 #31
0
        static void Coordinate_Parsers_Tests()
        {
            CoordinatePart cp;
            Coordinate     coordinate;

            //Parse Coordinate Formats
            string[] coordStrings = File.ReadAllLines("Coordinates.txt");
            bool     pass         = true;
            string   lastType     = "";

            Console.WriteLine("Coordinate Parses...");
            foreach (string c in coordStrings)
            {
                if (c.Contains("\\"))
                {
                    if (lastType != "")
                    {
                        Write_Pass(lastType.Split('#')[0], pass);
                    }
                    lastType = "";
                    pass     = true;
                    lastType = c;
                }
                else
                {
                    string[] cc = c.Split('#');
                    if (!Coordinate.TryParse(cc[0], out coordinate))
                    {
                        pass = false;
                    }
                    else
                    {
                        if (coordinate.ToString() != cc[1])
                        {
                            Debug.WriteLine("...MISMATCH: " + coordinate.ToString() + " - " + cc[1]);
                            pass = false;
                        }
                    }
                }
            }
            if (lastType != "")
            {
                Write_Pass(lastType.Split(',')[0], pass);
            }
            //Attempt Forces Param
            pass = true;
            try
            {
                if (Coordinate.TryParse("95F, 54", out coordinate))
                {
                    pass = false;
                }                                                                    //Intentional Fail
                if (Coordinate.TryParse("E 181 30, 56 76", out coordinate))
                {
                    pass = false;
                }                                                                             //Intentional Fail
                if (Coordinate.TryParse("N 95 45, E 45", out coordinate))
                {
                    pass = false;
                }                                                                           //Intentional Fail
                if (Coordinate.TryParse("95 87 46 78 D", out coordinate))
                {
                    pass = false;
                }                                                                           //Intentional Fail
                if (Coordinate.TryParse("W24 45, W45", out coordinate))
                {
                    pass = false;
                }                                                                         //Intentional Fail
            }
            catch { pass = false; }
            Console.WriteLine();
            Write_Pass("\\\\Intentional Fails", pass);
            Console.WriteLine();
            //Parse CoordinatePart Formats
            Console.WriteLine("CoordinatePart Parses...");
            coordStrings = File.ReadAllLines("CoordinateParts.txt");
            pass         = true;
            lastType     = "";
            foreach (string c in coordStrings)
            {
                c.Trim();
                if (c.Contains("\\"))
                {
                    if (lastType != "")
                    {
                        Write_Pass(lastType.Split('#')[0], pass);
                    }
                    lastType = "";
                    pass     = true;
                    lastType = c;
                }
                else
                {
                    string[] cc = c.Split('#');
                    if (!CoordinatePart.TryParse(cc[0], out cp))
                    {
                        pass = false;
                    }
                    else
                    {
                        if (cp.ToString() != cc[1])
                        {
                            Debug.WriteLine("...MISMATCH: " + cp.ToString() + " - " + cc[1]);
                            pass = false;
                        }
                    }
                }
            }
            if (lastType != "")
            {
                Write_Pass(lastType.Split(',')[0], pass);
            }
            //Attempt Forces Param
            pass = true;
            try
            {
                if (CoordinatePart.TryParse("95", CoordinateType.Lat, out cp))
                {
                    pass = false;
                }                                                                               //Intentional Fail
                if (CoordinatePart.TryParse("E181", CoordinateType.Lat, out cp))
                {
                    pass = false;
                }                                                                                  //Intentional Fail
                if (CoordinatePart.TryParse("N 95 45", CoordinateType.Lat, out cp))
                {
                    pass = false;
                }                                                                                     //Intentional Fail
                if (CoordinatePart.TryParse("95", CoordinateType.Lat, out cp))
                {
                    pass = false;
                }                                                                                //Intentional Fail
                if (CoordinatePart.TryParse("WD24 45", CoordinateType.Lat, out cp))
                {
                    pass = false;
                }                                                                                     //Intentional Fail
            }
            catch { pass = false; }
            Console.WriteLine();
            Write_Pass("\\\\Intentional Fails", pass);
        }
コード例 #32
0
        static void Coordinate_Initialization_Tests()
        {
            //Check for errors with initialization as most calculations occur on load
            bool pass = true;

            try
            {
                Coordinate c = new Coordinate();
                c = new Coordinate(25, 25);
                c = new Coordinate(25, 25, new DateTime(2018, 8, 5, 10, 10, 0));

                EagerLoad eg = new EagerLoad();
                eg.Cartesian = false;
                eg.Celestial = false;
                eg.UTM_MGRS  = false;

                c = new Coordinate(eg);
                c = new Coordinate(25, 25, eg);
                c = new Coordinate(25, 25, new DateTime(2018, 8, 5, 10, 10, 0), eg);
            }
            catch { pass = false; }
            Write_Pass("Coordinate Initialization Error Checks", pass);

            try
            {
                pass = true;
                Coordinate     c  = new Coordinate();
                CoordinatePart cp = new CoordinatePart(CoordinateType.Lat, c);
                cp = new CoordinatePart(CoordinateType.Long, c);
                cp = new CoordinatePart(25, CoordinateType.Lat, c);
                cp = new CoordinatePart(25, CoordinateType.Long, c);
                cp = new CoordinatePart(25, 25, CoordinatesPosition.N, c);
                cp = new CoordinatePart(25, 25, CoordinatesPosition.E, c);
                cp = new CoordinatePart(25, 25, CoordinatesPosition.S, c);
                cp = new CoordinatePart(25, 25, CoordinatesPosition.W, c);
                cp = new CoordinatePart(25, 25, 25, CoordinatesPosition.N, c);
                cp = new CoordinatePart(25, 25, 25, CoordinatesPosition.E, c);
                cp = new CoordinatePart(25, 25, 25, CoordinatesPosition.S, c);
                cp = new CoordinatePart(25, 25, 25, CoordinatesPosition.W, c);
            }
            catch { pass = false; }
            Write_Pass("CoordinatePart Initialization Error Checks", pass);
            try
            {
                pass = true;
                UniversalTransverseMercator utm = new UniversalTransverseMercator("Q", 14, 581943.5, 2111989.8);
                utm = new UniversalTransverseMercator("Q", 14, 581943.5, 2111989.8, 6378160.000, 298.25);
            }
            catch { pass = false; }
            Write_Pass("UniversalTransverseMercator Initialization Error Checks", pass);
            try
            {
                pass = true;
                //Outputs 19T CE 51307 93264
                MilitaryGridReferenceSystem mgrs = new MilitaryGridReferenceSystem("T", 19, "CE", 51307, 93264);
                mgrs = new MilitaryGridReferenceSystem("T", 19, "CE", 51307, 93264, 6378160.000, 298.25);
            }
            catch { pass = false; }
            Write_Pass("UniversalTransverseMercator Initialization Error Checks", pass);
            try
            {
                pass = true;
                Coordinate c    = new Coordinate();
                Cartesian  cart = new Cartesian(c);
                cart = new Cartesian(345, -123, 2839);
            }
            catch { pass = false; }
            Write_Pass("Cartesian Initialization Error Checks", pass);
            Console.WriteLine();

            //Init Range Checks
            try
            {
                pass = true;
                EagerLoad eg = new EagerLoad();

                Coordinate c = new Coordinate(90, 180);
                c = new Coordinate(-90, -180);
                c = new Coordinate(90, 180, new DateTime());
                c = new Coordinate(-90, -180, new DateTime());
                c = new Coordinate(90, 180, eg);
                c = new Coordinate(-90, -180, eg);
                c = new Coordinate(90, 180, new DateTime(), eg);
                c = new Coordinate(-90, -180, new DateTime(), eg);

                //Should fail as arguments are out of range.
                try { c = new Coordinate(91, 180); pass = false; }
                catch { }
                //Should fail as arguments are out of range.
                try { c = new Coordinate(90, 181); pass = false; }
                catch { }
                //Should fail as arguments are out of range.
                try { c = new Coordinate(-91, -180); pass = false; }
                catch { }
                //Should fail as arguments are out of range.
                try { c = new Coordinate(-90, -181); pass = false; }
                catch { }

                //Should fail as arguments are out of range.
                try { c = new Coordinate(91, 180, new DateTime()); pass = false; }
                catch { }
                //Should fail as arguments are out of range.
                try { c = new Coordinate(90, 181, new DateTime()); pass = false; }
                catch { }
                //Should fail as arguments are out of range.
                try { c = new Coordinate(-91, -180, new DateTime()); pass = false; }
                catch { }
                //Should fail as arguments are out of range.
                try { c = new Coordinate(-90, -181, new DateTime()); pass = false; }
                catch {  }

                //Should fail as arguments are out of range.
                try { c = new Coordinate(91, 180, new DateTime(), eg); pass = false; }
                catch { }
                //Should fail as arguments are out of range.
                try { c = new Coordinate(90, 181, new DateTime(), eg); pass = false; }
                catch { }
                //Should fail as arguments are out of range.
                try { c = new Coordinate(-91, -180, new DateTime(), eg); pass = false; }
                catch { }
                //Should fail as arguments are out of range.
                try { c = new Coordinate(-90, -181, new DateTime(), eg); pass = false; }
                catch { }
            }
            catch { pass = false; }
            Write_Pass("Cordinate Initialization Range Checks", pass);

            pass = true;
            try
            {
                Coordinate     c  = new Coordinate();
                CoordinatePart cp = new CoordinatePart(90, CoordinateType.Lat, c);
                cp = new CoordinatePart(-90, CoordinateType.Lat, c);
                cp = new CoordinatePart(89, 59, CoordinatesPosition.N, c);
                cp = new CoordinatePart(89, 59, CoordinatesPosition.S, c);
                cp = new CoordinatePart(89, 59, 59, CoordinatesPosition.N, c);
                cp = new CoordinatePart(89, 59, 59, CoordinatesPosition.S, c);
                cp = new CoordinatePart(180, CoordinateType.Long, c);
                cp = new CoordinatePart(-180, CoordinateType.Long, c);
                cp = new CoordinatePart(179, 59, CoordinatesPosition.E, c);
                cp = new CoordinatePart(179, 59, CoordinatesPosition.W, c);
                cp = new CoordinatePart(179, 59, 59, CoordinatesPosition.E, c);
                cp = new CoordinatePart(179, 59, 59, CoordinatesPosition.W, c);

                //Should fail
                try { cp = new CoordinatePart(91, CoordinateType.Lat, c); pass = false; } catch { }
                try { cp = new CoordinatePart(-91, CoordinateType.Lat, c); pass = false; } catch { }
                try { cp = new CoordinatePart(181, CoordinateType.Long, c); pass = false; } catch { }
                try { cp = new CoordinatePart(-181, CoordinateType.Long, c); pass = false; } catch { }

                try { cp = new CoordinatePart(91, 0, CoordinatesPosition.N, c); pass = false; } catch { }
                try { cp = new CoordinatePart(90, 1, CoordinatesPosition.N, c); pass = false; } catch { }
                try { cp = new CoordinatePart(89, 60, CoordinatesPosition.N, c); pass = false; } catch { }
                try { cp = new CoordinatePart(91, 0, CoordinatesPosition.N, c); pass = false; } catch { }
                try { cp = new CoordinatePart(90, 1, CoordinatesPosition.N, c); pass = false; } catch { }
                try { cp = new CoordinatePart(89, 60, CoordinatesPosition.N, c); pass = false; } catch { }
                try { cp = new CoordinatePart(-90, 1, CoordinatesPosition.N, c); pass = false; } catch { }
                try { cp = new CoordinatePart(89, -1, CoordinatesPosition.N, c); pass = false; } catch { }

                try { cp = new CoordinatePart(91, 0, CoordinatesPosition.S, c); pass = false; } catch { }
                try { cp = new CoordinatePart(90, 1, CoordinatesPosition.S, c); pass = false; } catch { }
                try { cp = new CoordinatePart(89, 60, CoordinatesPosition.S, c); pass = false; } catch { }
                try { cp = new CoordinatePart(91, 0, CoordinatesPosition.S, c); pass = false; } catch { }
                try { cp = new CoordinatePart(90, 1, CoordinatesPosition.S, c); pass = false; } catch { }
                try { cp = new CoordinatePart(89, 60, CoordinatesPosition.S, c); pass = false; } catch { }
                try { cp = new CoordinatePart(-90, 1, CoordinatesPosition.S, c); pass = false; } catch { }
                try { cp = new CoordinatePart(89, -1, CoordinatesPosition.S, c); pass = false; } catch { }

                try { cp = new CoordinatePart(91, 0, 0, CoordinatesPosition.N, c); pass = false; } catch { }
                try { cp = new CoordinatePart(90, 0, 1, CoordinatesPosition.N, c); pass = false; } catch { }
                try { cp = new CoordinatePart(89, 59, 60, CoordinatesPosition.N, c); pass = false; } catch { }
                try { cp = new CoordinatePart(90, 0, 1, CoordinatesPosition.N, c); pass = false; } catch { }
                try { cp = new CoordinatePart(89, 59, 60, CoordinatesPosition.N, c); pass = false; } catch { }
                try { cp = new CoordinatePart(-90, 0, 0, CoordinatesPosition.N, c); pass = false; } catch { }
                try { cp = new CoordinatePart(89, -1, 0, CoordinatesPosition.N, c); pass = false; } catch { }
                try { cp = new CoordinatePart(89, 1, -1, CoordinatesPosition.N, c); pass = false; } catch { }

                try { cp = new CoordinatePart(91, 0, 0, CoordinatesPosition.S, c); pass = false; } catch { }
                try { cp = new CoordinatePart(90, 0, 1, CoordinatesPosition.S, c); pass = false; } catch { }
                try { cp = new CoordinatePart(89, 59, 60, CoordinatesPosition.S, c); pass = false; } catch { }
                try { cp = new CoordinatePart(90, 0, 1, CoordinatesPosition.S, c); pass = false; } catch { }
                try { cp = new CoordinatePart(89, 59, 60, CoordinatesPosition.S, c); pass = false; } catch { }
                try { cp = new CoordinatePart(-90, 0, 0, CoordinatesPosition.S, c); pass = false; } catch { }
                try { cp = new CoordinatePart(89, -1, 0, CoordinatesPosition.S, c); pass = false; } catch { }
                try { cp = new CoordinatePart(89, 1, -1, CoordinatesPosition.S, c); pass = false; } catch { }


                try { cp = new CoordinatePart(181, 0, CoordinatesPosition.E, c); pass = false; } catch { }
                try { cp = new CoordinatePart(180, 1, CoordinatesPosition.E, c); pass = false; } catch { }
                try { cp = new CoordinatePart(179, 60, CoordinatesPosition.E, c); pass = false; } catch { }
                try { cp = new CoordinatePart(181, 0, CoordinatesPosition.E, c); pass = false; } catch { }
                try { cp = new CoordinatePart(180, 1, CoordinatesPosition.E, c); pass = false; } catch { }
                try { cp = new CoordinatePart(179, 60, CoordinatesPosition.E, c); pass = false; } catch { }
                try { cp = new CoordinatePart(-180, 1, CoordinatesPosition.E, c); pass = false; } catch { }
                try { cp = new CoordinatePart(179, -1, CoordinatesPosition.E, c); pass = false; } catch { }

                try { cp = new CoordinatePart(181, 0, CoordinatesPosition.W, c); pass = false; } catch { }
                try { cp = new CoordinatePart(180, 1, CoordinatesPosition.W, c); pass = false; } catch { }
                try { cp = new CoordinatePart(179, 60, CoordinatesPosition.W, c); pass = false; } catch { }
                try { cp = new CoordinatePart(181, 0, CoordinatesPosition.W, c); pass = false; } catch { }
                try { cp = new CoordinatePart(180, 1, CoordinatesPosition.W, c); pass = false; } catch { }
                try { cp = new CoordinatePart(179, 60, CoordinatesPosition.W, c); pass = false; } catch { }
                try { cp = new CoordinatePart(-180, 1, CoordinatesPosition.W, c); pass = false; } catch { }
                try { cp = new CoordinatePart(179, -1, CoordinatesPosition.W, c); pass = false; } catch { }

                try { cp = new CoordinatePart(181, 0, 0, CoordinatesPosition.E, c); pass = false; } catch { }
                try { cp = new CoordinatePart(180, 0, 1, CoordinatesPosition.E, c); pass = false; } catch { }
                try { cp = new CoordinatePart(179, 59, 60, CoordinatesPosition.E, c); pass = false; } catch { }
                try { cp = new CoordinatePart(180, 0, 1, CoordinatesPosition.E, c); pass = false; } catch { }
                try { cp = new CoordinatePart(179, 59, 60, CoordinatesPosition.E, c); pass = false; } catch { }
                try { cp = new CoordinatePart(-180, 0, 0, CoordinatesPosition.E, c); pass = false; } catch { }
                try { cp = new CoordinatePart(179, -1, 0, CoordinatesPosition.E, c); pass = false; } catch { }
                try { cp = new CoordinatePart(179, 1, -1, CoordinatesPosition.E, c); pass = false; } catch { }

                try { cp = new CoordinatePart(181, 0, 0, CoordinatesPosition.W, c); pass = false; } catch { }
                try { cp = new CoordinatePart(180, 0, 1, CoordinatesPosition.W, c); pass = false; } catch { }
                try { cp = new CoordinatePart(179, 59, 60, CoordinatesPosition.W, c); pass = false; } catch { }
                try { cp = new CoordinatePart(180, 0, 1, CoordinatesPosition.W, c); pass = false; } catch { }
                try { cp = new CoordinatePart(179, 59, 60, CoordinatesPosition.W, c); pass = false; } catch { }
                try { cp = new CoordinatePart(-180, 0, 0, CoordinatesPosition.W, c); pass = false; } catch { }
                try { cp = new CoordinatePart(179, -1, 0, CoordinatesPosition.W, c); pass = false; } catch { }
                try { cp = new CoordinatePart(179, 1, -1, CoordinatesPosition.W, c); pass = false; } catch { }
            }
            catch
            {
                pass = false;
            }
            Write_Pass("CordinatePart Initialization Range Checks", pass);
        }