Only download map data for currently visible layers
authorAndy Allan <andy@gravitystorm.co.uk>
Wed, 6 Jul 2011 10:58:16 +0000 (11:58 +0100)
committerAndy Allan <andy@gravitystorm.co.uk>
Wed, 6 Jul 2011 10:58:16 +0000 (11:58 +0100)
net/systemeD/halcyon/Map.as

index 8a45b07..e214800 100644 (file)
@@ -218,13 +218,15 @@ package net.systemeD.halcyon {
             }
                }
 
-        /** Download map data. Data is downloaded for the connection and the vector layers, where supported.
+        /** Download map data. Data is downloaded for the currently visible layers
         * The bounding box for the download is taken from the current map edges.
         */
                public function download():void {
                        this.dispatchEvent(new MapEvent(MapEvent.DOWNLOAD, {minlon:edge_l, maxlon:edge_r, maxlat:edge_t, minlat:edge_b} ));
                        for (var i:uint=0; i<paintContainer.numChildren; i++)
-                               getLayerAt(i).connection.loadBbox(edge_l,edge_r,edge_t,edge_b);
+                               if(getLayerAt(i).visible == true) {
+                    getLayerAt(i).connection.loadBbox(edge_l,edge_r,edge_t,edge_b);
+                }
                }
 
         // Handle mouse events on ways/nodes