SharpMap.Converters.WellKnownText.WktStreamTokenizer.ReadAuthority C# (CSharp) Method

ReadAuthority() public method

Reads the authority and authority code.
public ReadAuthority ( string &authority, long &authorityCode ) : void
authority string String to place the authority in.
authorityCode long String to place the authority code in.
return void
        public void ReadAuthority(ref string authority,ref long authorityCode)
        {
            //AUTHORITY["EPGS","9102"]]
            if(GetStringValue() != "AUTHORITY")
                ReadToken("AUTHORITY");
            ReadToken("[");
            authority = this.ReadDoubleQuotedWord();
            ReadToken(",");
            long.TryParse(this.ReadDoubleQuotedWord(),out authorityCode);
            ReadToken("]");
        }

Usage Example

示例#1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="tokenizer"></param>
        /// <returns></returns>
        private static IHorizontalDatum ReadHorizontalDatum(WktStreamTokenizer tokenizer)
        {
            //DATUM["OSGB 1936",SPHEROID["Airy 1830",6377563.396,299.3249646,AUTHORITY["EPSG","7001"]]TOWGS84[0,0,0,0,0,0,0],AUTHORITY["EPSG","6277"]]
            Wgs84ConversionInfo wgsInfo = null;
            string authority            = String.Empty;
            long   authorityCode        = -1;

            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")
                {
                    wgsInfo = ReadWGS84ConversionInfo(tokenizer);
                    tokenizer.NextToken();
                }
                else if (tokenizer.GetStringValue() == "AUTHORITY")
                {
                    tokenizer.ReadAuthority(ref authority, ref authorityCode);
                    tokenizer.ReadToken("]");
                }
            }
            // make an assumption about the datum type.
            IHorizontalDatum horizontalDatum = new HorizontalDatum(ellipsoid, wgsInfo, DatumType.HD_Geocentric, name, authority, authorityCode, String.Empty, String.Empty, String.Empty);

            return(horizontalDatum);
        }
All Usage Examples Of SharpMap.Converters.WellKnownText.WktStreamTokenizer::ReadAuthority