Package com.mxgraph.util.svg
Class PathParser
- java.lang.Object
-
- com.mxgraph.util.svg.AbstractParser
-
- com.mxgraph.util.svg.NumberParser
-
- com.mxgraph.util.svg.PathParser
-
- All Implemented Interfaces:
Parser
public class PathParser extends NumberParser
This class implements an event-based parser for the SVG path's d attribute values.
-
-
Field Summary
Fields Modifier and Type Field Description protected PathHandler
pathHandler
The path handler used to report parse events.-
Fields inherited from class com.mxgraph.util.svg.AbstractParser
BUNDLE_CLASSNAME, current, errorHandler, reader
-
-
Constructor Summary
Constructors Constructor Description PathParser(PathHandler handler)
Creates a new PathParser.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
_parsel(boolean expectNumber)
protected void
_parseL(boolean expectNumber)
protected void
doParse()
Method responsible for actually parsing data after AbstractParser has initialized itself.PathHandler
getPathHandler()
Returns the path handler in use.protected void
parsea()
Parses a 'a' command.protected void
parseA()
Parses a 'A' command.protected void
parsec()
Parses a 'c' command.protected void
parseC()
Parses a 'C' command.protected void
parseh()
Parses a 'h' command.protected void
parseH()
Parses a 'H' command.protected void
parsel()
Parses a 'l' command.protected void
parseL()
Parses a 'L' command.protected void
parsem()
Parses a 'm' command.protected void
parseM()
Parses a 'M' command.protected void
parseq()
Parses a 'q' command.protected void
parseQ()
Parses a 'Q' command.protected void
parses()
Parses a 's' command.protected void
parseS()
Parses a 'S' command.protected void
parset()
Parses a 't' command.protected void
parseT()
Parses a 'T' command.protected void
parsev()
Parses a 'v' command.protected void
parseV()
Parses a 'V' command.protected void
reportUnexpected(int ch)
void
setPathHandler(PathHandler handler)
Allows an application to register a path handler.protected boolean
skipCommaSpaces2()
Skips the whitespaces and an optional comma.protected void
skipSubPath()
Skips a sub-path.-
Methods inherited from class com.mxgraph.util.svg.NumberParser
buildFloat, parseFloat
-
Methods inherited from class com.mxgraph.util.svg.AbstractParser
createErrorMessage, getBundleClassName, getCurrent, parse, reportCharacterExpectedError, reportError, reportUnexpectedCharacterError, setErrorHandler, skipCommaSpaces, skipSpaces
-
-
-
-
Field Detail
-
pathHandler
protected PathHandler pathHandler
The path handler used to report parse events.
-
-
Constructor Detail
-
PathParser
public PathParser(PathHandler handler)
Creates a new PathParser.
-
-
Method Detail
-
setPathHandler
public void setPathHandler(PathHandler handler)
Allows an application to register a path handler.If the application does not register a handler, all events reported by the parser will be silently ignored.
Applications may register a new or different handler in the middle of a parse, and the parser must begin using the new handler immediately.
- Parameters:
handler
- The transform list handler.
-
getPathHandler
public PathHandler getPathHandler()
Returns the path handler in use.
-
doParse
protected void doParse() throws ParseException, java.io.IOException
Description copied from class:AbstractParser
Method responsible for actually parsing data after AbstractParser has initialized itself.- Specified by:
doParse
in classAbstractParser
- Throws:
ParseException
java.io.IOException
-
parsem
protected void parsem() throws ParseException, java.io.IOException
Parses a 'm' command.- Throws:
ParseException
java.io.IOException
-
parseM
protected void parseM() throws ParseException, java.io.IOException
Parses a 'M' command.- Throws:
ParseException
java.io.IOException
-
parsel
protected void parsel() throws ParseException, java.io.IOException
Parses a 'l' command.- Throws:
ParseException
java.io.IOException
-
_parsel
protected void _parsel(boolean expectNumber) throws ParseException, java.io.IOException
- Throws:
ParseException
java.io.IOException
-
parseL
protected void parseL() throws ParseException, java.io.IOException
Parses a 'L' command.- Throws:
ParseException
java.io.IOException
-
_parseL
protected void _parseL(boolean expectNumber) throws ParseException, java.io.IOException
- Throws:
ParseException
java.io.IOException
-
parseh
protected void parseh() throws ParseException, java.io.IOException
Parses a 'h' command.- Throws:
ParseException
java.io.IOException
-
parseH
protected void parseH() throws ParseException, java.io.IOException
Parses a 'H' command.- Throws:
ParseException
java.io.IOException
-
parsev
protected void parsev() throws ParseException, java.io.IOException
Parses a 'v' command.- Throws:
ParseException
java.io.IOException
-
parseV
protected void parseV() throws ParseException, java.io.IOException
Parses a 'V' command.- Throws:
ParseException
java.io.IOException
-
parsec
protected void parsec() throws ParseException, java.io.IOException
Parses a 'c' command.- Throws:
ParseException
java.io.IOException
-
parseC
protected void parseC() throws ParseException, java.io.IOException
Parses a 'C' command.- Throws:
ParseException
java.io.IOException
-
parseq
protected void parseq() throws ParseException, java.io.IOException
Parses a 'q' command.- Throws:
ParseException
java.io.IOException
-
parseQ
protected void parseQ() throws ParseException, java.io.IOException
Parses a 'Q' command.- Throws:
ParseException
java.io.IOException
-
parses
protected void parses() throws ParseException, java.io.IOException
Parses a 's' command.- Throws:
ParseException
java.io.IOException
-
parseS
protected void parseS() throws ParseException, java.io.IOException
Parses a 'S' command.- Throws:
ParseException
java.io.IOException
-
parset
protected void parset() throws ParseException, java.io.IOException
Parses a 't' command.- Throws:
ParseException
java.io.IOException
-
parseT
protected void parseT() throws ParseException, java.io.IOException
Parses a 'T' command.- Throws:
ParseException
java.io.IOException
-
parsea
protected void parsea() throws ParseException, java.io.IOException
Parses a 'a' command.- Throws:
ParseException
java.io.IOException
-
parseA
protected void parseA() throws ParseException, java.io.IOException
Parses a 'A' command.- Throws:
ParseException
java.io.IOException
-
skipSubPath
protected void skipSubPath() throws ParseException, java.io.IOException
Skips a sub-path.- Throws:
ParseException
java.io.IOException
-
reportUnexpected
protected void reportUnexpected(int ch) throws ParseException, java.io.IOException
- Throws:
ParseException
java.io.IOException
-
skipCommaSpaces2
protected boolean skipCommaSpaces2() throws java.io.IOException
Skips the whitespaces and an optional comma.- Returns:
- true if comma was skipped.
- Throws:
java.io.IOException
-
-