Package org.h2gis.functions.io.gpx.model
Class AbstractGpxParser
- java.lang.Object
-
- org.xml.sax.helpers.DefaultHandler
-
- org.h2gis.functions.io.gpx.model.AbstractGpxParser
-
- All Implemented Interfaces:
ContentHandler,DTDHandler,EntityResolver,ErrorHandler
- Direct Known Subclasses:
AbstractGpxParserDefault,AbstractGpxParserRte,AbstractGpxParserTrk,AbstractGpxParserWpt
public abstract class AbstractGpxParser extends DefaultHandler
Abstract class of all Gpx-Parsers. It contains the more general attributes, setters and getters used in parsers. It also defines the method characters which is used in all other parsers.- Author:
- Erwan Bocher and Antonin Piasco
-
-
Constructor Summary
Constructors Constructor Description AbstractGpxParser()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcharacters(char[] ch, int start, int length)Fires one or more times for each text node encountered.StringBuildergetContentBuffer()Gives the actual contentBufferStringgetCurrentElement()Gives a string representing the value of the element which is being parsed.GPXLinegetCurrentLine()Gives the line which is being parsed.GPXPointgetCurrentPoint()Gives the point which is being parsed.GPXLinegetCurrentSegment()Gives the segment which is being parsed.StringStackgetElementNames()Gives the actual StringStack elementNamesorg.locationtech.jts.geom.GeometryFactorygetGeometryFactory()Gives a geometryFactory to construct gpx geometriesXMLReadergetReader()Gives the XMLReader used to parse the document.PreparedStatementgetRtePreparedStmt()Gives the preparedstatement used to store route dataPreparedStatementgetRteptPreparedStmt()Gives the prepared statement used to store the route points.PreparedStatementgetTrkPointsPreparedStmt()Gives the prepared statement used to store the track points.PreparedStatementgetTrkPreparedStmt()Gives the prepared statement used to store the track.PreparedStatementgetTrkSegmentsPreparedStmt()Gives the prepared statement used to store the track segments.PreparedStatementgetWptPreparedStmt()Get the PreparedStatement of the waypoints table.booleanisSpecificElement()Indicates if we are in a specific element (waypoint, route or track).voidsetContentBuffer(StringBuilder contentBuffer)Set the contentBuffer.voidsetCurrentElement(String currentElement)Set the string representing the value of the element which is being parsed.voidsetCurrentLine(GPXLine currentLine)Set the line which will be parsed.voidsetCurrentPoint(GPXPoint currentPoint)Set the point which will be parsed.voidsetCurrentSegment(GPXLine currentSegment)Set the segment which will be parsed.voidsetElementNames(StringStack elementNames)Set the actual StringStack elementNamesvoidsetReader(XMLReader reader)Set the XMLReader used to parse the document.voidsetRtePreparedStmt(PreparedStatement rtePreparedStmt)Set the PreparedStatement of the route table.voidsetRteptPreparedStmt(PreparedStatement rteptPreparedStmt)Set the PreparedStatement of the route points table.voidsetSpecificElement(boolean specificElement)Set the indicator to know if we are in a specific element.voidsetTrkPointsPreparedStmt(PreparedStatement trkPointsPreparedStmt)Set the prepared statement used to store the track points.voidsetTrkPreparedStmt(PreparedStatement trkPreparedStmt)Set the prepared statement used to store the track.voidsetTrkSegmentsPreparedStmt(PreparedStatement trkSegmentsPreparedStmt)Set the prepared statement used to store the track segments.voidsetWptPreparedStmt(PreparedStatement wptPreparedStmt)Set the PreparedStatement of the waypoints table.-
Methods inherited from class org.xml.sax.helpers.DefaultHandler
endDocument, endElement, endPrefixMapping, error, fatalError, ignorableWhitespace, notationDecl, processingInstruction, resolveEntity, setDocumentLocator, skippedEntity, startDocument, startElement, startPrefixMapping, unparsedEntityDecl, warning
-
-
-
-
Method Detail
-
characters
public void characters(char[] ch, int start, int length) throws SAXExceptionFires one or more times for each text node encountered. It saves text informations in contentBuffer.- Specified by:
charactersin interfaceContentHandler- Overrides:
charactersin classDefaultHandler- Parameters:
ch- The characters from the XML documentstart- The start position in the arraylength- The number of characters to read from the array- Throws:
SAXException- Any SAX exception, possibly wrapping another exception
-
getContentBuffer
public StringBuilder getContentBuffer()
Gives the actual contentBuffer- Returns:
- get buffer
-
setContentBuffer
public void setContentBuffer(StringBuilder contentBuffer)
Set the contentBuffer.- Parameters:
contentBuffer- set a buffer
-
getCurrentElement
public String getCurrentElement()
Gives a string representing the value of the element which is being parsed.- Returns:
- get the current element
-
setCurrentElement
public void setCurrentElement(String currentElement)
Set the string representing the value of the element which is being parsed.- Parameters:
currentElement- set current element
-
getCurrentPoint
public GPXPoint getCurrentPoint()
Gives the point which is being parsed.- Returns:
- current gpx point
-
setCurrentPoint
public void setCurrentPoint(GPXPoint currentPoint)
Set the point which will be parsed.- Parameters:
currentPoint- set current gpx point
-
getReader
public XMLReader getReader()
Gives the XMLReader used to parse the document.- Returns:
- get
XMLReader
-
setReader
public void setReader(XMLReader reader)
Set the XMLReader used to parse the document.- Parameters:
reader- setXMLReader
-
getElementNames
public StringStack getElementNames()
Gives the actual StringStack elementNames- Returns:
- the element names
-
setElementNames
public void setElementNames(StringStack elementNames)
Set the actual StringStack elementNames- Parameters:
elementNames- set element names
-
isSpecificElement
public boolean isSpecificElement()
Indicates if we are in a specific element (waypoint, route or track).- Returns:
- true if we are in a specific element, false else
-
setSpecificElement
public void setSpecificElement(boolean specificElement)
Set the indicator to know if we are in a specific element.- Parameters:
specificElement- set true it's a specific element type
-
getWptPreparedStmt
public PreparedStatement getWptPreparedStmt()
Get the PreparedStatement of the waypoints table.- Returns:
- the waypoints preparedstatement
-
setWptPreparedStmt
public void setWptPreparedStmt(PreparedStatement wptPreparedStmt)
Set the PreparedStatement of the waypoints table.- Parameters:
wptPreparedStmt- set the waypoints preparedstatement
-
setRtePreparedStmt
public void setRtePreparedStmt(PreparedStatement rtePreparedStmt)
Set the PreparedStatement of the route table.- Parameters:
rtePreparedStmt- set the routes preparedstatement
-
getRtePreparedStmt
public PreparedStatement getRtePreparedStmt()
Gives the preparedstatement used to store route data- Returns:
- get the routes preparedstatement
-
setRteptPreparedStmt
public void setRteptPreparedStmt(PreparedStatement rteptPreparedStmt)
Set the PreparedStatement of the route points table.- Parameters:
rteptPreparedStmt- set the routes preparedstatement
-
getRteptPreparedStmt
public PreparedStatement getRteptPreparedStmt()
Gives the prepared statement used to store the route points.- Returns:
- the routes preparedstatement
-
getTrkPreparedStmt
public PreparedStatement getTrkPreparedStmt()
Gives the prepared statement used to store the track.- Returns:
- the track preparedstatement
-
getTrkPointsPreparedStmt
public PreparedStatement getTrkPointsPreparedStmt()
Gives the prepared statement used to store the track points.- Returns:
- the points preparedstatement
-
getTrkSegmentsPreparedStmt
public PreparedStatement getTrkSegmentsPreparedStmt()
Gives the prepared statement used to store the track segments.- Returns:
- the track preparedstatement
-
setTrkPreparedStmt
public void setTrkPreparedStmt(PreparedStatement trkPreparedStmt)
Set the prepared statement used to store the track.- Parameters:
trkPreparedStmt- set the preparedstatement to save the tracks
-
setTrkSegmentsPreparedStmt
public void setTrkSegmentsPreparedStmt(PreparedStatement trkSegmentsPreparedStmt)
Set the prepared statement used to store the track segments.- Parameters:
trkSegmentsPreparedStmt- set the preparedstatement to save the lines
-
setTrkPointsPreparedStmt
public void setTrkPointsPreparedStmt(PreparedStatement trkPointsPreparedStmt)
Set the prepared statement used to store the track points.- Parameters:
trkPointsPreparedStmt- set the preparedstatement to store points
-
getCurrentSegment
public GPXLine getCurrentSegment()
Gives the segment which is being parsed.- Returns:
- current gpx line
-
setCurrentSegment
public void setCurrentSegment(GPXLine currentSegment)
Set the segment which will be parsed.- Parameters:
currentSegment- input GPX line
-
getGeometryFactory
public org.locationtech.jts.geom.GeometryFactory getGeometryFactory()
Gives a geometryFactory to construct gpx geometries- Returns:
- current geometry factory
-
getCurrentLine
public GPXLine getCurrentLine()
Gives the line which is being parsed.- Returns:
- gpx line
-
setCurrentLine
public void setCurrentLine(GPXLine currentLine)
Set the line which will be parsed.- Parameters:
currentLine- set the line to parse
-
-