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
This class implements an event-based parser for the SVG path's d
attribute values.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected 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 -
Method Summary
Modifier and TypeMethodDescriptionprotected void
_parsel
(boolean expectNumber) protected void
_parseL
(boolean expectNumber) protected void
doParse()
Method responsible for actually parsing data after AbstractParser has initialized itself.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
Skips the whitespaces and an optional comma.protected void
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 Details
-
pathHandler
The path handler used to report parse events.
-
-
Constructor Details
-
PathParser
Creates a new PathParser.
-
-
Method Details
-
setPathHandler
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
Returns the path handler in use. -
doParse
Description copied from class:AbstractParser
Method responsible for actually parsing data after AbstractParser has initialized itself.- Specified by:
doParse
in classAbstractParser
- Throws:
ParseException
IOException
-
parsem
Parses a 'm' command.- Throws:
ParseException
IOException
-
parseM
Parses a 'M' command.- Throws:
ParseException
IOException
-
parsel
Parses a 'l' command.- Throws:
ParseException
IOException
-
_parsel
- Throws:
ParseException
IOException
-
parseL
Parses a 'L' command.- Throws:
ParseException
IOException
-
_parseL
- Throws:
ParseException
IOException
-
parseh
Parses a 'h' command.- Throws:
ParseException
IOException
-
parseH
Parses a 'H' command.- Throws:
ParseException
IOException
-
parsev
Parses a 'v' command.- Throws:
ParseException
IOException
-
parseV
Parses a 'V' command.- Throws:
ParseException
IOException
-
parsec
Parses a 'c' command.- Throws:
ParseException
IOException
-
parseC
Parses a 'C' command.- Throws:
ParseException
IOException
-
parseq
Parses a 'q' command.- Throws:
ParseException
IOException
-
parseQ
Parses a 'Q' command.- Throws:
ParseException
IOException
-
parses
Parses a 's' command.- Throws:
ParseException
IOException
-
parseS
Parses a 'S' command.- Throws:
ParseException
IOException
-
parset
Parses a 't' command.- Throws:
ParseException
IOException
-
parseT
Parses a 'T' command.- Throws:
ParseException
IOException
-
parsea
Parses a 'a' command.- Throws:
ParseException
IOException
-
parseA
Parses a 'A' command.- Throws:
ParseException
IOException
-
skipSubPath
Skips a sub-path.- Throws:
ParseException
IOException
-
reportUnexpected
- Throws:
ParseException
IOException
-
skipCommaSpaces2
Skips the whitespaces and an optional comma.- Returns:
- true if comma was skipped.
- Throws:
IOException
-