net.sf.latexdraw.parsers.svg.parsers
Class SVGLengthParser

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.SVGLengthParser
All Implemented Interfaces:
Parser

public class SVGLengthParser
extends SVGNumberParser

Defines a parser that parses SVG length code.

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/24/07

Version:
3.0
Author:
Arnaud BLOUIN

Nested Class Summary
static class SVGLengthParser.FontSize
          Describes textual value for the font-size attribute.
 
Field Summary
 
Fields inherited from class net.sf.latexdraw.parsers.CodeParser
codeCore, EOC
 
Constructor Summary
SVGLengthParser(java.lang.String code)
          The constructor.
 
Method Summary
static float fontSizetoPoint(java.lang.String fontSize)
          Converts the font-size string value in point value.
 SVGLength parseCoordinate()
          Parses an SVG coordinate.
 SVGLength parseLength()
          Parses an SVG length.
 SVGLength parseNumberOrPercent()
          Parses a number or a percentage (not yet managed).
 
Methods inherited from class net.sf.latexdraw.parsers.svg.parsers.SVGNumberParser
isNumber, parse, 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
 

Constructor Detail

SVGLengthParser

public SVGLengthParser(java.lang.String code)
The constructor.

Parameters:
code - The code to parse.
Method Detail

fontSizetoPoint

public static float fontSizetoPoint(java.lang.String fontSize)
Converts the font-size string value in point value.

Parameters:
fontSize - The font-size value to convert.
Returns:
the font-size value in point, or -1 if a problem occurs.

parseLength

public SVGLength parseLength()
                      throws java.text.ParseException
Parses an SVG length.

Returns:
An SVGLength. The length is always converted in PX.
Throws:
java.text.ParseException - If a problem occurs or if not managed unit are parsed (%, em and ex).

parseCoordinate

public SVGLength parseCoordinate()
                          throws java.text.ParseException
Parses an SVG coordinate.

Returns:
An SVGLength.
Throws:
java.text.ParseException - If a problem occurs or if not managed unit are parsed (%, em and ex).

parseNumberOrPercent

public SVGLength parseNumberOrPercent()
                               throws java.text.ParseException
Parses a number or a percentage (not yet managed).

Returns:
An SVGLength.
Throws:
java.text.ParseException - If a problem occurs or if a percentage is parsed.