net.sf.latexdraw.parsers.svg.parsers
Class SVGPathParser

java.lang.Object
  extended by net.sf.latexdraw.parsers.CodeParser
      extended by net.sf.latexdraw.parsers.svg.parsers.AbstractSVGParser
          extended by net.sf.latexdraw.parsers.svg.parsers.SVGNumberParser
              extended by net.sf.latexdraw.parsers.svg.parsers.SVGPathParser
All Implemented Interfaces:
Parser

public class SVGPathParser
extends SVGNumberParser

Defines an SVGPath parser.

This file is part of LaTeXDraw.
Copyright (c) 2005-2012 Arnaud BLOUIN

LaTeXDraw is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

LaTeXDraw is distributed without any warranty; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

10/20/07

Since:
0.1
Version:
3.0
Author:
Arnaud BLOUIN

Field Summary
protected  SVGPathHandler handler
          The handler of the SVGPath.
 
Fields inherited from class net.sf.latexdraw.parsers.CodeParser
codeCore, EOC
 
Constructor Summary
SVGPathParser(java.lang.String code, SVGPathHandler handler)
          The main constructor.
 
Method Summary
 void parse()
          Launches the parsing.
protected  void parseClosepath()
          Parses an SVGPath closepath.
protected  void parseCurveto(boolean isRelative)
          Parses an SVGPath curveto.
protected  void parseEllipticalArcto(boolean isRelative)
          Parses an SVGPath arc.
protected  void parseHorizontalLineto(boolean isRelative)
          Parses an SVGPath horizontal lineto.
protected  void parseLineto(boolean isRelative)
          Parses an SVGPath lineto.
protected  void parseMoveto(boolean isRelative)
          Parses an SVGPath moveto.
protected  void parseQuadraticBezierCurveto(boolean isRelative)
          Parses an SVGPath quadratic curveto.
protected  void parseShorthandCurveto(boolean isRelative)
          Parses an SVGPath smooth curveto.
protected  void parseShorthandQuadraticBezierCurveto(boolean isRelative)
          Parses an SVGPath quadratic smooth curveto.
protected  void parseVerticalLineto(boolean isRelative)
          Parses an SVGPath vertical lineto.
 
Methods inherited from class net.sf.latexdraw.parsers.svg.parsers.SVGNumberParser
isNumber, parseFlag, parseNumber, parseNumberAsString
 
Methods inherited from class net.sf.latexdraw.parsers.svg.parsers.AbstractSVGParser
isComment, isWSP, skipComment, skipWSP, skipWSPComma
 
Methods inherited from class net.sf.latexdraw.parsers.CodeParser
getChar, getCharAt, getCode, getCodeCore, getLinePosition, getPosition, incLinePosition, initialise, isEOC, isEOL, nextChar, setCode, setCodeCore, setLinePosition, setPosition, skipWSPComments
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

handler

protected SVGPathHandler handler
The handler of the SVGPath. @since 0.1

Constructor Detail

SVGPathParser

public SVGPathParser(java.lang.String code,
                     SVGPathHandler handler)
The main constructor.

Parameters:
code - The path to parse.
handler - The handler of the path.
Method Detail

parse

public void parse()
           throws java.text.ParseException
Description copied from interface: Parser
Launches the parsing.

Specified by:
parse in interface Parser
Overrides:
parse in class SVGNumberParser
Throws:
java.text.ParseException - If an error occurs.

parseShorthandCurveto

protected void parseShorthandCurveto(boolean isRelative)
                              throws java.text.ParseException
Parses an SVGPath smooth curveto.

Parameters:
isRelative - True if segment is relative.
Throws:
java.text.ParseException - If a problem occurs.
Since:
0.1

parseClosepath

protected void parseClosepath()
Parses an SVGPath closepath.


parseHorizontalLineto

protected void parseHorizontalLineto(boolean isRelative)
                              throws java.text.ParseException
Parses an SVGPath horizontal lineto.

Parameters:
isRelative - True if segment is relative.
Throws:
java.text.ParseException - If a problem occurs.

parseVerticalLineto

protected void parseVerticalLineto(boolean isRelative)
                            throws java.text.ParseException
Parses an SVGPath vertical lineto.

Parameters:
isRelative - True if segment is relative.
Throws:
java.text.ParseException - If a problem occurs.

parseEllipticalArcto

protected void parseEllipticalArcto(boolean isRelative)
                             throws java.text.ParseException
Parses an SVGPath arc.

Parameters:
isRelative - True if segment is relative.
Throws:
java.text.ParseException - If a problem occurs.

parseCurveto

protected void parseCurveto(boolean isRelative)
                     throws java.text.ParseException
Parses an SVGPath curveto.

Parameters:
isRelative - True if segment is relative.
Throws:
java.text.ParseException - If a problem occurs.

parseQuadraticBezierCurveto

protected void parseQuadraticBezierCurveto(boolean isRelative)
                                    throws java.text.ParseException
Parses an SVGPath quadratic curveto.

Parameters:
isRelative - True if segment is relative.
Throws:
java.text.ParseException - If a problem occurs.

parseShorthandQuadraticBezierCurveto

protected void parseShorthandQuadraticBezierCurveto(boolean isRelative)
                                             throws java.text.ParseException
Parses an SVGPath quadratic smooth curveto.

Parameters:
isRelative - True if segment is relative.
Throws:
java.text.ParseException - If a problem occurs.

parseLineto

protected void parseLineto(boolean isRelative)
                    throws java.text.ParseException
Parses an SVGPath lineto.

Parameters:
isRelative - True if segment is relative.
Throws:
java.text.ParseException - If a problem occurs.

parseMoveto

protected void parseMoveto(boolean isRelative)
                    throws java.text.ParseException
Parses an SVGPath moveto.

Parameters:
isRelative - True if segment is relative.
Throws:
java.text.ParseException - If a problem occurs.