예제 #1
0
파일: Parser.cs 프로젝트: imintsystems/Kean
		public Abstract Parse(string path)
		{
			Collection.IQueue<object> arguments = new Tokenizer().Tokenize(path);
			while(arguments.Count > 0)
			{
				char segmentType = (char)arguments.Dequeue();
				switch (segmentType)
				{
					case 'Z' :
						this.Append(new Close());
						break;
					case 'C':
						this.Append(new CurveTo(
						    new Geometry2D.Single.Point((float)arguments.Dequeue(), (float)arguments.Dequeue()), // first
						    new Geometry2D.Single.Point((float)arguments.Dequeue(), (float)arguments.Dequeue()), // second
						    new Geometry2D.Single.Point((float)arguments.Dequeue(), (float)arguments.Dequeue()))); // end
						break;
					case 'L':
					    this.Append(new LineTo(
							new Geometry2D.Single.Point((float)arguments.Dequeue(), (float)arguments.Dequeue()))); //end
					    break;
					case 'M':
					    this.Append(new MoveTo(
							new Geometry2D.Single.Point((float)arguments.Dequeue(), (float)arguments.Dequeue()))); //end
						break;
					case 'A':
						this.Append(new EllipticalArcTo(
							new Geometry2D.Single.Size((float)arguments.Dequeue(), (float)arguments.Dequeue()),
							(float)arguments.Dequeue(), (float)arguments.Dequeue() == 1, (float)arguments.Dequeue() == 1,
							new Geometry2D.Single.Point((float)arguments.Dequeue(), (float)arguments.Dequeue())));
						break;
				}
			}

			return this.Result;
		}