+ /**
+ * Process a Gx track including timestamps
+ */
+ private void processGxTrack()
+ {
+ if (_whenList.size() > 0 && _whenList.size() == _whereList.size())
+ {
+ // Add each of the unnamed track points to list
+ boolean firstPoint = true;
+ final int numPoints = _whenList.size();
+ for (int p=0; p < numPoints; p++)
+ {
+ String when = _whenList.get(p);
+ String where = _whereList.get(p);
+ if (where != null)
+ {
+ String[] coords = where.split(" ");
+ if (coords.length == 3)
+ {
+ String[] pointArray = new String[7];
+ pointArray[0] = coords[0];
+ pointArray[1] = coords[1];
+ pointArray[2] = coords[2];
+ // leave name and description empty
+ if (firstPoint) {pointArray[5] = "1";} // start of segment flag
+ firstPoint = false;
+ pointArray[6] = when; // timestamp
+ _pointList.add(pointArray);
+ }
+ }
+ _linkList.add(null);
+ }
+ }
+ _whenList.clear();
+ _whereList.clear();
+ }
+
+ /**
+ * Extract an image link from the point description
+ * @param inDesc description tag contents
+ * @return image link if found or null
+ */
+ private static String getImgLink(String inDesc)
+ {
+ if (inDesc == null || inDesc.equals("")) {return null;}
+ // Pull out <img tag from description (if any)
+ int spos = inDesc.indexOf("<img");
+ int epos = inDesc.indexOf('>', spos + 10);
+ if (spos < 0 || epos < 0) return null;
+ String imgtag = inDesc.substring(spos + 4, epos);
+ // Find the src attribute from img tag
+ int quotepos = imgtag.toLowerCase().indexOf("src=");
+ if (quotepos < 0) return null;
+ // source may be quoted with single or double quotes
+ char quotechar = imgtag.charAt(quotepos + 4);
+ int equotepos = imgtag.indexOf(quotechar, quotepos + 7);
+ if (equotepos < 0) return null;
+ return imgtag.substring(quotepos + 5, equotepos);
+ }