Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  /*
   * h2spatial is a library that brings spatial support to the H2 Java database.
   *
   * h2spatial is distributed under GPL 3 license. It is produced by the "Atelier SIG"
   * team of the IRSTV Institute <http://www.irstv.fr/> CNRS FR 2488.
   *
   * Copyright (C) 2007-2014 IRSTV (FR CNRS 2488)
   *
   * h2patial 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 3 of the License, or (at your option) any later
  * version.
  *
  * h2spatial is distributed in the hope that it will be useful, but 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.
  *
  * You should have received a copy of the GNU General Public License along with
  * h2spatial. If not, see <http://www.gnu.org/licenses/>.
  *
  * For more information, please consult: <http://www.orbisgis.org/>
  * or contact directly:
  * info_at_ orbisgis.org
  */
 package org.h2gis.drivers.gpx.model;
 
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(s):
Erwan Bocher and Antonin Piasco
 
 public abstract class AbstractGpxParser extends DefaultHandler {
 
     //To build a geometry
     private GeometryFactory geometryFactory = new GeometryFactory();
     private XMLReader reader;
     private StringBuilder contentBuffer;
     // String with the value of the element which is being parsed
     private String currentElement;
     // Abstract point which will take values of the current point during the parsing
     private GPXPoint currentPoint;
     // This will take values of the current track segment during the parsing
     private GPXLine currentSegment;
     // Abstract line which will take values of the current line during the parsing
     private GPXLine currentLine;
     // A stack to know in which element we are
     private StringStack elementNames;
     // Variable to know if we are in an element supposed to be parser by a specific parser
     private boolean specificElement;
     //PreparedStatement to manage gpx tables
             trkPreparedStmttrkSegmentsPreparedStmttrkPointsPreparedStmt;

    
Fires one or more times for each text node encountered. It saves text informations in contentBuffer.

Parameters:
ch The characters from the XML document
start The start position in the array
length The number of characters to read from the array
Throws:
org.xml.sax.SAXException Any SAX exception, possibly wrapping another exception
 
     @Override
     public void characters(char[] chint startint lengththrows SAXException {
         .append(String.copyValueOf(chstartlength));
     }

    
Gives the actual contentBuffer

Returns:
 
     public StringBuilder getContentBuffer() {
         return ;
     }

    
Set the contentBuffer.

Parameters:
contentBuffer
 
     public void setContentBuffer(StringBuilder contentBuffer) {
         this. = contentBuffer;
     }

    
Gives a string representing the value of the element which is being parsed.

Returns:
    public String getCurrentElement() {
        return ;
    }

    
Set the string representing the value of the element which is being parsed.

Parameters:
currentElement
    public void setCurrentElement(String currentElement) {
        this. = currentElement;
    }

    
Gives the point which is being parsed.

Returns:
    public GPXPoint getCurrentPoint() {
        return ;
    }

    
Set the point which will be parsed.

Parameters:
currentPoint
    public void setCurrentPoint(GPXPoint currentPoint) {
        this. = currentPoint;
    }

    
Gives the XMLReader used to parse the document.
    public XMLReader getReader() {
        return ;
    }

    
Set the XMLReader used to parse the document.

Parameters:
reader
    public void setReader(XMLReader reader) {
        this. = reader;
    }

    
Gives the actual StringStack elementNames

Returns:
    public StringStack getElementNames() {
        return ;
    }

    
Set the actual StringStack elementNames

Parameters:
elementNames
    public void setElementNames(StringStack elementNames) {
        this. = elementNames;
    }

    
Indicates if we are in a specific element (waypoint, route or track).

Returns:
true if we are in a specific element, false else
    public boolean isSpecificElement() {
        return ;
    }

    
Set the indicator to know if we are in a specific element.

Parameters:
specificElement
    public void setSpecificElement(boolean specificElement) {
        this. = specificElement;
    }

    
Get the PreparedStatement of the waypoints table.

Returns:
        return ;
    }

    
Set the PreparedStatement of the waypoints table.

Parameters:
wptPreparedStmt
    public void setWptPreparedStmt(PreparedStatement wptPreparedStmt) {
        this. = wptPreparedStmt;
    }

    
Set the PreparedStatement of the route table.

Parameters:
rtePreparedStmt
    public void setRtePreparedStmt(PreparedStatement rtePreparedStmt) {
        this. = rtePreparedStmt;
    }

    
Gives the preparedstatement used to store route data

Returns:
        return ;
    }

    
Set the PreparedStatement of the route points table.

Parameters:
rtePreparedStmt
    public void setRteptPreparedStmt(PreparedStatement rteptPreparedStmt) {
        this. = rteptPreparedStmt;
    }

    
Gives the prepared statement used to store the route points.

Returns:
        return ;
    }

    
Gives the prepared statement used to store the track.

Returns:
        return ;
    }

    
Gives the prepared statement used to store the track points.

Returns:
        return ;
    }

    
Gives the prepared statement used to store the track segments.

Returns:
        return ;
    }

    
Set the prepared statement used to store the track.

Parameters:
trkPreparedStmt
    public void setTrkPreparedStmt(PreparedStatement trkPreparedStmt) {
        this. = trkPreparedStmt;
    }

    
Set the prepared statement used to store the track segments.

Parameters:
trkSegmentsPreparedStmt
    public void setTrkSegmentsPreparedStmt(PreparedStatement trkSegmentsPreparedStmt) {
        this. = trkSegmentsPreparedStmt;
    }

    
Set the prepared statement used to store the track points.

Parameters:
trkPointsPreparedStmt
    public void setTrkPointsPreparedStmt(PreparedStatement trkPointsPreparedStmt) {
        this. = trkPointsPreparedStmt;
    }

    
Gives the segment which is being parsed.

Returns:
    public GPXLine getCurrentSegment() {
        return ;
    }

    
Set the segment which will be parsed.

Parameters:
currentSegment
    public void setCurrentSegment(GPXLine currentSegment) {
        this. = currentSegment;
    }

    
Gives a geometryFactory to construct gpx geometries

Returns:
        return ;
    }

    
Gives the line which is being parsed.

Returns:
    public GPXLine getCurrentLine() {
        return ;
    }

    
Set the line which will be parsed.

Parameters:
currentLine
    public void setCurrentLine(GPXLine currentLine) {
        this. = currentLine;
    }
    
New to GrepCode? Check out our FAQ X