X-Git-Url: http://gitweb.fperrin.net/?a=blobdiff_plain;f=tim%2Fprune%2Fload%2Fxml%2FGpxHandler.java;h=4208014e44c1e9e8c9df262c0caa3083f3bd76f3;hb=649c5da6ee1bbc590699e11a92316ece2ea8512d;hp=8ab3e17978b878dca0221d8c80c9156fa9b5d1d4;hpb=112bb0c9b46894adca9a33ed8c99ea712b253185;p=GpsPrune.git diff --git a/tim/prune/load/xml/GpxHandler.java b/tim/prune/load/xml/GpxHandler.java index 8ab3e17..4208014 100644 --- a/tim/prune/load/xml/GpxHandler.java +++ b/tim/prune/load/xml/GpxHandler.java @@ -6,6 +6,7 @@ import org.xml.sax.Attributes; import org.xml.sax.SAXException; import tim.prune.data.Field; +import tim.prune.load.TrackNameList; /** @@ -13,19 +14,21 @@ import tim.prune.data.Field; */ public class GpxHandler extends XmlHandler { + private boolean _insidePoint = false; private boolean _insideWaypoint = false; - private boolean _insideName = false; - private boolean _insideElevation = false; - private boolean _insideTime = false; -// private boolean _insideType = false; private boolean _startSegment = true; - private String _name = null, _latitude = null, _longitude = null; - private String _elevation = null; - private String _time = null; -// private String _type = null; + private boolean _isTrackPoint = false; + private int _trackNum = -1; + private GpxTag _name = new GpxTag(), _trackName = new GpxTag(); + private String _latitude = null, _longitude = null; + private GpxTag _elevation = new GpxTag(), _time = new GpxTag(); + private GpxTag _type = new GpxTag(), _description = new GpxTag(); + private GpxTag _link = new GpxTag(); + private GpxTag _currentTag = null; private ArrayList _pointList = new ArrayList(); + private ArrayList _linkList = new ArrayList(); + private TrackNameList _trackNameList = new TrackNameList(); - // FIXME: Read waypoint type too /** * Receive the start of a tag @@ -35,40 +38,52 @@ public class GpxHandler extends XmlHandler Attributes attributes) throws SAXException { // Read the parameters for waypoints and track points - if (qName.equalsIgnoreCase("wpt") || qName.equalsIgnoreCase("trkpt")) + String tag = qName.toLowerCase(); + if (tag.equals("wpt") || tag.equals("trkpt") || tag.equals("rtept")) { - _insideWaypoint = qName.equalsIgnoreCase("wpt"); - int numAttributes = attributes.getLength(); + _insidePoint = true; + _insideWaypoint = tag.equals("wpt"); + _isTrackPoint = tag.equals("trkpt"); + final int numAttributes = attributes.getLength(); for (int i=0; i