[OpenLayers-Commits] r12361 - sandbox/camptocamp/gpx/openlayers/lib/OpenLayers/Format

commits-20090109 at openlayers.org commits-20090109 at openlayers.org
Wed Sep 14 03:06:27 EDT 2011


Author: pgiraud
Date: 2011-09-14 00:06:27 -0700 (Wed, 14 Sep 2011)
New Revision: 12361

Modified:
   sandbox/camptocamp/gpx/openlayers/lib/OpenLayers/Format/GPX.js
Log:
Small fixes, thanks to marcjansen

Modified: sandbox/camptocamp/gpx/openlayers/lib/OpenLayers/Format/GPX.js
===================================================================
--- sandbox/camptocamp/gpx/openlayers/lib/OpenLayers/Format/GPX.js	2011-09-13 12:08:41 UTC (rev 12360)
+++ sandbox/camptocamp/gpx/openlayers/lib/OpenLayers/Format/GPX.js	2011-09-14 07:06:27 UTC (rev 12361)
@@ -21,21 +21,14 @@
  */
 OpenLayers.Format.GPX = OpenLayers.Class(OpenLayers.Format.XML, {
     
-    /** 
-     * APIProperty: waypointsDesc
-     * {String} Default description of the waypoints in the case where the
-     *     feature has no "description" attribute.
-     *     Default is "No description available".
-     */
-    waypointsDesc: "No description available",
 
     /** 
-     * APIProperty: tracksDesc
-     * {String} Default description of the tracks in the case where the
-     *     feature has no "description" attribute.
+     * APIProperty: defaultDesc
+     * {String} Default description for the waypoints/tracks in the case
+     *     where the feature has no "description" attribute.
      *     Default is "No description available".
      */
-    tracksDesc: "No description available",
+    defaultDesc: "No description available",
 
    /**
     * APIProperty: extractWaypoints
@@ -291,17 +284,22 @@
      * geometry - {OpenLayers.Geometry}
      */
     buildTrkSegNode: function(geometry) {
+        var node,
+            i,
+            len,
+            point,
+            nodes;
         if (geometry.CLASS_NAME == "OpenLayers.Geometry.LineString" ||
             geometry.CLASS_NAME == "OpenLayers.Geometry.LinearRing") {
-            var node = this.createElementNS(this.gpxns, "trkseg");
-            for (var i = 0, len=geometry.components.length; i < len; i++) {
-                var point = geometry.components[i];
+            node = this.createElementNS(this.gpxns, "trkseg");
+            for (i = 0, len=geometry.components.length; i < len; i++) {
+                point = geometry.components[i];
                 node.appendChild(this.buildTrkPtNode(point));
             }
             return node;
         } else {
-            var nodes = [];
-            for (var i = 0, len = geometry.components.length; i < len; i++) {
+            nodes = [];
+            for (i = 0, len = geometry.components.length; i < len; i++) {
                 nodes.push(this.buildTrkSegNode(geometry.components[i]));
             }
             return nodes;
@@ -354,7 +352,7 @@
     appendAttributesNode: function(node, feature) {
         var name = this.createElementNS(this.gpxns, 'name');
         name.appendChild(this.createTextNode(
-            feature.attributes.name || feature.attributes.id));
+            feature.attributes.name || feature.id));
         node.appendChild(name);
         var desc = this.createElementNS(this.gpxns, 'desc');
         desc.appendChild(this.createTextNode(



More information about the Commits mailing list