示例#1
0
 /// <summary>
 /// 哈希代码。
 /// </summary>
 /// <returns></returns>
 public override int GetHashCode()
 {
     return(PrimeMeridian.GetHashCode() * 3 + AngularUnit.GetHashCode() * 13);
 }
        /// <summary>
        ///
        /// </summary>
        /// <param name="tokenizer"></param>
        /// <returns></returns>
        private static GeographicCs ReadGeographicCoordinateSystem(WktStreamTokenizer tokenizer)
        {
            /*
             * GEOGCS["OSGB 1936",
             * DATUM["OSGB 1936",SPHEROID["Airy 1830",6377563.396,299.3249646,AUTHORITY["EPSG","7001"]],TOWGS84[0,0,0,0,0,0,0],AUTHORITY["EPSG","6277"]]
             * PRIMEM["Greenwich",0,AUTHORITY["EPSG","8901"]]
             * AXIS["Geodetic latitude","NORTH"]
             * AXIS["Geodetic longitude","EAST"]
             * AUTHORITY["EPSG","4277"]
             * ]
             */
            tokenizer.ReadToken("[");
            string name = tokenizer.ReadDoubleQuotedWord();

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

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

            tokenizer.ReadToken(",");
            tokenizer.ReadToken("UNIT");
            AngularUnit angularUnit = ReadAngularUnit(tokenizer);

            string authority     = String.Empty;
            long   authorityCode = -1;

            tokenizer.NextToken();
            List <IAxis> info = new List <IAxis>(2);

            if (tokenizer.GetStringValue() == ",")
            {
                tokenizer.NextToken();
                while (tokenizer.GetStringValue() == "AXIS")
                {
                    info.Add(ReadAxis(tokenizer));
                    tokenizer.NextToken();
                    if (tokenizer.GetStringValue() == ",")
                    {
                        tokenizer.NextToken();
                    }
                }
                if (tokenizer.GetStringValue() == ",")
                {
                    tokenizer.NextToken();
                }
                if (tokenizer.GetStringValue() == "AUTHORITY")
                {
                    tokenizer.ReadAuthority(ref authority, ref authorityCode);
                    tokenizer.ReadToken("]");
                }
            }
            //This is default axis values if not specified.
            if (info.Count == 0)
            {
                info.Add(new Axis("Lon", Direction.East));
                info.Add(new Axis("Lat", Direction.North));
            }
            GeographicCs geographicCS = new GeographicCs(angularUnit, horizontalDatum,
                                                         primeMeridian, info, name, authorityCode + "");

            return(geographicCS);
        }