예제 #1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="tokenizer"></param>
        /// <returns></returns>
        private static IHorizontalDatum ReadHorizontalDatum(WktStreamTokenizer tokenizer)
        {
            Wgs84ConversionInfo info = null;
            string authority         = string.Empty;
            long   authorityCode     = -1L;

            tokenizer.ReadToken("[");
            string name = tokenizer.ReadDoubleQuotedWord();

            tokenizer.ReadToken(",");
            tokenizer.ReadToken("SPHEROID");
            IEllipsoid ellipsoid = ReadEllipsoid(tokenizer);

            tokenizer.NextToken();
            while (tokenizer.GetStringValue() == ",")
            {
                tokenizer.NextToken();
                if (tokenizer.GetStringValue() == "TOWGS84")
                {
                    info = ReadWGS84ConversionInfo(tokenizer);
                    tokenizer.NextToken();
                }
                else if (tokenizer.GetStringValue() == "AUTHORITY")
                {
                    tokenizer.ReadAuthority(ref authority, ref authorityCode);
                    tokenizer.ReadToken("]");
                }
            }
            return(new HorizontalDatum(ellipsoid, info, DatumType.HD_Geocentric, name, authority, authorityCode, string.Empty, string.Empty, string.Empty));
        }
예제 #2
0
 /// <summary>
 /// Returns a <see cref="T:Topology.CoordinateSystems.AngularUnit" /> given a piece of WKT.
 /// </summary>
 /// <param name="tokenizer">WktStreamTokenizer that has the WKT.</param>
 /// <returns>An object that implements the IUnit interface.</returns>
 private static IAngularUnit ReadAngularUnit(WktStreamTokenizer tokenizer)
 {
     tokenizer.ReadToken("[");
     string name = tokenizer.ReadDoubleQuotedWord();
     tokenizer.ReadToken(",");
     tokenizer.NextToken();
     double numericValue = tokenizer.GetNumericValue();
     string authority = string.Empty;
     long authorityCode = -1L;
     tokenizer.NextToken();
     if (tokenizer.GetStringValue() == ",")
     {
         tokenizer.ReadAuthority(ref authority, ref authorityCode);
         tokenizer.ReadToken("]");
     }
     return new AngularUnit(numericValue, name, authority, authorityCode, string.Empty, string.Empty, string.Empty);
 }
예제 #3
0
        /// <summary>
        /// Returns a <see cref="T:Topology.CoordinateSystems.AngularUnit" /> given a piece of WKT.
        /// </summary>
        /// <param name="tokenizer">WktStreamTokenizer that has the WKT.</param>
        /// <returns>An object that implements the IUnit interface.</returns>
        private static IAngularUnit ReadAngularUnit(WktStreamTokenizer tokenizer)
        {
            tokenizer.ReadToken("[");
            string name = tokenizer.ReadDoubleQuotedWord();

            tokenizer.ReadToken(",");
            tokenizer.NextToken();
            double numericValue  = tokenizer.GetNumericValue();
            string authority     = string.Empty;
            long   authorityCode = -1L;

            tokenizer.NextToken();
            if (tokenizer.GetStringValue() == ",")
            {
                tokenizer.ReadAuthority(ref authority, ref authorityCode);
                tokenizer.ReadToken("]");
            }
            return(new AngularUnit(numericValue, name, authority, authorityCode, string.Empty, string.Empty, string.Empty));
        }
예제 #4
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="tokenizer"></param>
        /// <returns></returns>
        private static IGeographicCoordinateSystem ReadGeographicCoordinateSystem(WktStreamTokenizer tokenizer)
        {
            tokenizer.ReadToken("[");
            string name = tokenizer.ReadDoubleQuotedWord();

            tokenizer.ReadToken(",");
            tokenizer.ReadToken("DATUM");
            IHorizontalDatum horizontalDatum = ReadHorizontalDatum(tokenizer);

            tokenizer.ReadToken(",");
            tokenizer.ReadToken("PRIMEM");
            IPrimeMeridian primeMeridian = ReadPrimeMeridian(tokenizer);

            tokenizer.ReadToken(",");
            tokenizer.ReadToken("UNIT");
            IAngularUnit angularUnit   = ReadAngularUnit(tokenizer);
            string       authority     = string.Empty;
            long         authorityCode = -1L;

            tokenizer.NextToken();
            List <AxisInfo> axisInfo = new List <AxisInfo>(2);

            if (tokenizer.GetStringValue() == ",")
            {
                tokenizer.NextToken();
                while (tokenizer.GetStringValue() == "AXIS")
                {
                    axisInfo.Add(ReadAxis(tokenizer));
                    tokenizer.NextToken();
                }
                if (tokenizer.GetStringValue() == "AUTHORITY")
                {
                    tokenizer.ReadAuthority(ref authority, ref authorityCode);
                    tokenizer.ReadToken("]");
                }
            }
            if (axisInfo.Count == 0)
            {
                axisInfo.Add(new AxisInfo("Lon", AxisOrientationEnum.East));
                axisInfo.Add(new AxisInfo("Lat", AxisOrientationEnum.North));
            }
            return(new GeographicCoordinateSystem(angularUnit, horizontalDatum, primeMeridian, axisInfo, name, authority, authorityCode, string.Empty, string.Empty, string.Empty));
        }
예제 #5
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="tokenizer"></param>
        /// <returns></returns>
        private static IProjectedCoordinateSystem ReadProjectedCoordinateSystem(WktStreamTokenizer tokenizer)
        {
            tokenizer.ReadToken("[");
            string name = tokenizer.ReadDoubleQuotedWord();

            tokenizer.ReadToken(",");
            tokenizer.ReadToken("GEOGCS");
            IGeographicCoordinateSystem geographicCoordinateSystem = ReadGeographicCoordinateSystem(tokenizer);

            tokenizer.ReadToken(",");
            IProjection projection    = ReadProjection(tokenizer);
            IUnit       unit          = ReadLinearUnit(tokenizer);
            string      authority     = string.Empty;
            long        authorityCode = -1L;

            tokenizer.NextToken();
            List <AxisInfo> axisInfo = new List <AxisInfo>(2);

            if (tokenizer.GetStringValue() == ",")
            {
                tokenizer.NextToken();
                while (tokenizer.GetStringValue() == "AXIS")
                {
                    axisInfo.Add(ReadAxis(tokenizer));
                    tokenizer.NextToken();
                }
                if (tokenizer.GetStringValue() == "AUTHORITY")
                {
                    tokenizer.ReadAuthority(ref authority, ref authorityCode);
                    tokenizer.ReadToken("]");
                }
            }
            if (axisInfo.Count == 0)
            {
                axisInfo.Add(new AxisInfo("X", AxisOrientationEnum.East));
                axisInfo.Add(new AxisInfo("Y", AxisOrientationEnum.North));
            }
            return(new ProjectedCoordinateSystem(geographicCoordinateSystem.HorizontalDatum, geographicCoordinateSystem, unit as LinearUnit, projection, axisInfo, name, authority, authorityCode, string.Empty, string.Empty, string.Empty));
        }
예제 #6
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="tokenizer"></param>
        /// <returns></returns>
        private static IEllipsoid ReadEllipsoid(WktStreamTokenizer tokenizer)
        {
            tokenizer.ReadToken("[");
            string name = tokenizer.ReadDoubleQuotedWord();

            tokenizer.ReadToken(",");
            tokenizer.NextToken();
            double numericValue = tokenizer.GetNumericValue();

            tokenizer.ReadToken(",");
            tokenizer.NextToken();
            double inverseFlattening = tokenizer.GetNumericValue();

            tokenizer.NextToken();
            string authority     = string.Empty;
            long   authorityCode = -1L;

            if (tokenizer.GetStringValue() == ",")
            {
                tokenizer.ReadAuthority(ref authority, ref authorityCode);
                tokenizer.ReadToken("]");
            }
            return(new Ellipsoid(numericValue, 0, inverseFlattening, true, LinearUnit.Metre, name, authority, authorityCode, string.Empty, string.Empty, string.Empty));
        }
예제 #7
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="tokenizer"></param>
 /// <returns></returns>
 private static IProjectedCoordinateSystem ReadProjectedCoordinateSystem(WktStreamTokenizer tokenizer)
 {
     tokenizer.ReadToken("[");
     string name = tokenizer.ReadDoubleQuotedWord();
     tokenizer.ReadToken(",");
     tokenizer.ReadToken("GEOGCS");
     IGeographicCoordinateSystem geographicCoordinateSystem = ReadGeographicCoordinateSystem(tokenizer);
     tokenizer.ReadToken(",");
     IProjection projection = ReadProjection(tokenizer);
     IUnit unit = ReadLinearUnit(tokenizer);
     string authority = string.Empty;
     long authorityCode = -1L;
     tokenizer.NextToken();
     List<AxisInfo> axisInfo = new List<AxisInfo>(2);
     if (tokenizer.GetStringValue() == ",")
     {
         tokenizer.NextToken();
         while (tokenizer.GetStringValue() == "AXIS")
         {
             axisInfo.Add(ReadAxis(tokenizer));
             tokenizer.NextToken();
         }
         if (tokenizer.GetStringValue() == "AUTHORITY")
         {
             tokenizer.ReadAuthority(ref authority, ref authorityCode);
             tokenizer.ReadToken("]");
         }
     }
     if (axisInfo.Count == 0)
     {
         axisInfo.Add(new AxisInfo("X", AxisOrientationEnum.East));
         axisInfo.Add(new AxisInfo("Y", AxisOrientationEnum.North));
     }
     return new ProjectedCoordinateSystem(geographicCoordinateSystem.HorizontalDatum, geographicCoordinateSystem, unit as LinearUnit, projection, axisInfo, name, authority, authorityCode, string.Empty, string.Empty, string.Empty);
 }
예제 #8
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="tokenizer"></param>
 /// <returns></returns>
 private static IHorizontalDatum ReadHorizontalDatum(WktStreamTokenizer tokenizer)
 {
     Wgs84ConversionInfo info = null;
     string authority = string.Empty;
     long authorityCode = -1L;
     tokenizer.ReadToken("[");
     string name = tokenizer.ReadDoubleQuotedWord();
     tokenizer.ReadToken(",");
     tokenizer.ReadToken("SPHEROID");
     IEllipsoid ellipsoid = ReadEllipsoid(tokenizer);
     tokenizer.NextToken();
     while (tokenizer.GetStringValue() == ",")
     {
         tokenizer.NextToken();
         if (tokenizer.GetStringValue() == "TOWGS84")
         {
             info = ReadWGS84ConversionInfo(tokenizer);
             tokenizer.NextToken();
         }
         else if (tokenizer.GetStringValue() == "AUTHORITY")
         {
             tokenizer.ReadAuthority(ref authority, ref authorityCode);
             tokenizer.ReadToken("]");
         }
     }
     return new HorizontalDatum(ellipsoid, info, DatumType.HD_Geocentric, name, authority, authorityCode, string.Empty, string.Empty, string.Empty);
 }
예제 #9
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="tokenizer"></param>
 /// <returns></returns>
 private static IGeographicCoordinateSystem ReadGeographicCoordinateSystem(WktStreamTokenizer tokenizer)
 {
     tokenizer.ReadToken("[");
     string name = tokenizer.ReadDoubleQuotedWord();
     tokenizer.ReadToken(",");
     tokenizer.ReadToken("DATUM");
     IHorizontalDatum horizontalDatum = ReadHorizontalDatum(tokenizer);
     tokenizer.ReadToken(",");
     tokenizer.ReadToken("PRIMEM");
     IPrimeMeridian primeMeridian = ReadPrimeMeridian(tokenizer);
     tokenizer.ReadToken(",");
     tokenizer.ReadToken("UNIT");
     IAngularUnit angularUnit = ReadAngularUnit(tokenizer);
     string authority = string.Empty;
     long authorityCode = -1L;
     tokenizer.NextToken();
     List<AxisInfo> axisInfo = new List<AxisInfo>(2);
     if (tokenizer.GetStringValue() == ",")
     {
         tokenizer.NextToken();
         while (tokenizer.GetStringValue() == "AXIS")
         {
             axisInfo.Add(ReadAxis(tokenizer));
             tokenizer.NextToken();
         }
         if (tokenizer.GetStringValue() == "AUTHORITY")
         {
             tokenizer.ReadAuthority(ref authority, ref authorityCode);
             tokenizer.ReadToken("]");
         }
     }
     if (axisInfo.Count == 0)
     {
         axisInfo.Add(new AxisInfo("Lon", AxisOrientationEnum.East));
         axisInfo.Add(new AxisInfo("Lat", AxisOrientationEnum.North));
     }
     return new GeographicCoordinateSystem(angularUnit, horizontalDatum, primeMeridian, axisInfo, name, authority, authorityCode, string.Empty, string.Empty, string.Empty);
 }
예제 #10
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="tokenizer"></param>
 /// <returns></returns>
 private static IEllipsoid ReadEllipsoid(WktStreamTokenizer tokenizer)
 {
     tokenizer.ReadToken("[");
     string name = tokenizer.ReadDoubleQuotedWord();
     tokenizer.ReadToken(",");
     tokenizer.NextToken();
     double numericValue = tokenizer.GetNumericValue();
     tokenizer.ReadToken(",");
     tokenizer.NextToken();
     double inverseFlattening = tokenizer.GetNumericValue();
     tokenizer.NextToken();
     string authority = string.Empty;
     long authorityCode = -1L;
     if (tokenizer.GetStringValue() == ",")
     {
         tokenizer.ReadAuthority(ref authority, ref authorityCode);
         tokenizer.ReadToken("]");
     }
     return new Ellipsoid(numericValue, 0, inverseFlattening, true, LinearUnit.Metre, name, authority, authorityCode, string.Empty, string.Empty, string.Empty);
 }