SharpMap.Converters.WellKnownText.WktStreamTokenizer.ReadToken C# (CSharp) Méthode

ReadToken() private méthode

Reads a token and checks it is what is expected.
private ReadToken ( string expectedToken ) : void
expectedToken string The expected token.
Résultat void
        internal void ReadToken(string expectedToken)
        {
            this.NextToken();
            if (this.GetStringValue()!=expectedToken)
            {
                throw new Exception(String.Format(SharpMap.Map.numberFormat_EnUS, "Expecting ('{3}') but got a '{0}' at line {1} column {2}.", this.GetStringValue(), this.LineNumber, this.Column, expectedToken));
            }
        }

Usage Example

Exemple #1
0
        /// <summary>
        /// Returns a <see cref="AxisInfo"/> given a piece of WKT.
        /// </summary>
        /// <param name="tokenizer">WktStreamTokenizer that has the WKT.</param>
        /// <returns>An AxisInfo object.</returns>
        private static AxisInfo ReadAxis(WktStreamTokenizer tokenizer)
        {
            if (tokenizer.GetStringValue() != "AXIS")
            {
                tokenizer.ReadToken("AXIS");
            }
            tokenizer.ReadToken("[");
            string axisName = tokenizer.ReadDoubleQuotedWord();

            tokenizer.ReadToken(",");
            tokenizer.NextToken();
            string unitname = tokenizer.GetStringValue();

            tokenizer.ReadToken("]");
            switch (unitname.ToUpper())
            {
            case "DOWN": return(new AxisInfo(axisName, AxisOrientationEnum.Down));

            case "EAST": return(new AxisInfo(axisName, AxisOrientationEnum.East));

            case "NORTH": return(new AxisInfo(axisName, AxisOrientationEnum.North));

            case "OTHER": return(new AxisInfo(axisName, AxisOrientationEnum.Other));

            case "SOUTH": return(new AxisInfo(axisName, AxisOrientationEnum.South));

            case "UP": return(new AxisInfo(axisName, AxisOrientationEnum.Up));

            case "WEST": return(new AxisInfo(axisName, AxisOrientationEnum.West));

            default:
                throw new ArgumentException("Invalid axis name '" + unitname + "' in WKT");
            }
        }
All Usage Examples Of SharpMap.Converters.WellKnownText.WktStreamTokenizer::ReadToken