Exemplo n.º 1
0
        /// <summary>
        /// Load the section corners from the database using the latitude and longitude.
        /// </summary>
        /// <param name="Location"></param>
        public static TRSClass LoadUsingLatLong(TRSClass Location)
        {
            // first part of search fuction uses sql to find all possible sections
            // Can return 0 to 4 possible sections
            var sections = from s in GetAllSections()
                           where (s.UTMURX > Location.Point.X || s.UTMLRX > Location.Point.X) &&
                           (s.UTMULX < Location.Point.X || s.UTMLLX < Location.Point.X) &&
                           (s.UTMULY > Location.Point.Y || s.UTMURY > Location.Point.Y) &&
                           (s.UTMLLY < Location.Point.Y || s.UTMLRY < Location.Point.Y)
                           select s;

            foreach (var section in sections)
            {
                Location.Township = section.Township;
                Location.Range    = section.Range;
                Location.RangeDirection.Direction = section.RangeDir;
                Location.Section = section.Section;
                Location.Corners.SetPoint(0, section.UTMURX, section.UTMURY);
                Location.Corners.SetPoint(1, section.UTMULX, section.UTMULY);
                Location.Corners.SetPoint(2, section.UTMLLX, section.UTMLLY);
                Location.Corners.SetPoint(3, section.UTMLRX, section.UTMLRY);

                if (Location.Corners.IsWithIn(Location.Point))
                {
                    break;
                }
            }

            return(Location);
        }
        public void Geographic2Legal(ref int Township, ref int Range, ref string RangeDirection, ref int Section, ref string SubSection, ref int FootageNorthSouth, ref string FootageNorthSouthDirection, ref int FootageEastWest, ref string FootageEastWestDirection, double LatitudeDecimalDegrees, double LongitudeDecimalDegrees, ref int ErrorCode, ref string ErrorDescription)
        {
            ErrorClass ErrorObj = new ErrorClass();
            TRSClass   Location = new TRSClass();

            Location.Point.SetLL(LatitudeDecimalDegrees, LongitudeDecimalDegrees);
            Location                   = GeoCalcServiceFunctions.Geo2Legal(Location);
            Township                   = Location.Township;
            Range                      = Location.Range;
            RangeDirection             = Location.RangeDirection.Direction;
            Section                    = Location.Section;
            SubSection                 = Location.SubSection.ToString();
            FootageNorthSouth          = Convert.ToInt32(Location.Footage.NorthSouthValueFeet);
            FootageNorthSouthDirection = Location.Footage.NSDir.Direction;
            FootageEastWest            = Convert.ToInt32(Location.Footage.EastWestValueFeet);
            FootageEastWestDirection   = Location.Footage.EWDir.Direction;
            ErrorCode                  = ErrorObj.Code;
            ErrorDescription           = ErrorObj.Description;
            Location                   = null;
        }
Exemplo n.º 3
0
        public TRSClass Clone()
        {
            TRSClass output = new TRSClass();

            output.Township = Township;
            output.Range    = Range;
            output.RangeDirection.Direction = RangeDirection.Direction;
            output.Section = Section;

            output.SubSection.SetSubSection(SubSection.ToString());

            output.Footage.SetFootageMeters(Convert.ToInt32(Footage.NorthSouthValueMeters), Footage.NSDir.Direction, Convert.ToInt32(Footage.EastWestValueMeters), Footage.EWDir.Direction);
            output.Corners.SetPoint(0, Corners.Corners[0].X, Corners.Corners[0].Y);
            output.Corners.SetPoint(1, Corners.Corners[1].X, Corners.Corners[1].Y);
            output.Corners.SetPoint(2, Corners.Corners[2].X, Corners.Corners[2].Y);
            output.Corners.SetPoint(3, Corners.Corners[3].X, Corners.Corners[3].Y);

            output.Point.SetXY(Point.X, Point.Y);
            return(output);
        }
        public void Legal2Geographic(int Township, int Range, string RangeDirection, int Section, string SubSection, int FootageNorthSouth, string FootageNorthSouthDirection, int FootageEastWest, string FootageEastWestDirection, ref double LatitudeDecimalDegrees, ref double LongitudeDecimalDegrees, ref int ErrorCode, ref string ErrorDescription)
        {
            TRSClass   Location = new TRSClass();
            ErrorClass ErrorObj = new ErrorClass();

            Location.Township = Township;
            Location.Range    = Range;
            Location.RangeDirection.Direction = RangeDirection;
            Location.Section = Section;
            Location.SubSection.SetSubSection(SubSection);
            Location.Footage.NorthSouthValueFeet = FootageNorthSouth;
            Location.Footage.NSDir.Direction     = FootageNorthSouthDirection;
            Location.Footage.EastWestValueFeet   = FootageEastWest;
            Location.Footage.EWDir.Direction     = FootageEastWestDirection;

            Location = GeoCalcServiceFunctions.Legal2Geo(Location);
            LatitudeDecimalDegrees  = Location.Point.Latitude;
            LongitudeDecimalDegrees = Location.Point.Longitude;
            ErrorCode        = ErrorObj.Code;
            ErrorDescription = ErrorObj.Description;
            Location         = null;
        }
Exemplo n.º 5
0
        /// <summary>
        /// Load the section corners from the database using the legal description.
        /// </summary>
        /// <param name="Location"></param>
        public static TRSClass LoadSectionFromDatabase(TRSClass Location)
        {
            //TRSClass output = Location.Clone();
            var sections = GetAllSections();

            sections = (from s in sections
                        where s.Township == Location.Township &&
                        s.Range == Location.Range &&
                        s.RangeDir == Location.RangeDirection.Direction &&
                        s.Section == Location.Section
                        select s).ToList();
            if (sections.Count() != 1)
            {
                return(Location);
            }
            var section = sections.Single();

            Location.Corners.SetPoint(0, section.UTMURX, section.UTMURY);
            Location.Corners.SetPoint(1, section.UTMULX, section.UTMULY);
            Location.Corners.SetPoint(2, section.UTMLLX, section.UTMLLY);
            Location.Corners.SetPoint(3, section.UTMLRX, section.UTMLRY);

            return(Location);
        }