From 52ab1578c716ccca85a5eb211bb36c00b54dce9a Mon Sep 17 00:00:00 2001 From: Richard Fairhurst Date: Sun, 7 Nov 2010 17:27:49 +0000 Subject: [PATCH] this should speed up redraw - need to add registerPOI support for vector background layers though --- net/systemeD/halcyon/MapPaint.as | 16 ++++++++-------- net/systemeD/halcyon/VectorLayer.as | 9 +++++---- net/systemeD/halcyon/connection/Connection.as | 8 ++++---- 3 files changed, 17 insertions(+), 16 deletions(-) diff --git a/net/systemeD/halcyon/MapPaint.as b/net/systemeD/halcyon/MapPaint.as index 79d78150..b2e36971 100644 --- a/net/systemeD/halcyon/MapPaint.as +++ b/net/systemeD/halcyon/MapPaint.as @@ -112,7 +112,7 @@ package net.systemeD.halcyon { } public function updateEntityUIs(o:Object, redraw:Boolean, remove:Boolean):void { - var way:Way, node:Node; + var way:Way, poi:Node; for each (way in o.waysInside) { if (!wayuis[way.id]) { createWayUI(way); } @@ -129,17 +129,17 @@ package net.systemeD.halcyon { } } - for each (node in o.nodesInside) { - if (!nodeuis[node.id]) { createNodeUI(node); } - else if (redraw) { nodeuis[node.id].redraw(); } + for each (poi in o.poisInside) { + if (!nodeuis[poi.id]) { createNodeUI(poi); } + else if (redraw) { nodeuis[poi.id].redraw(); } } if (remove) { - for each (node in o.nodesOutside) { - if (nodeuis[node.id] && !nodeuis[node.id].purgable) { - if (redraw) { nodeuis[node.id].redraw(); } + for each (poi in o.poisOutside) { + if (nodeuis[poi.id] && !nodeuis[poi.id].purgable) { + if (redraw) { nodeuis[poi.id].redraw(); } } else { - deleteNodeUI(node); + deleteNodeUI(poi); } } } diff --git a/net/systemeD/halcyon/VectorLayer.as b/net/systemeD/halcyon/VectorLayer.as index b4f6a5ca..e97a1cf6 100644 --- a/net/systemeD/halcyon/VectorLayer.as +++ b/net/systemeD/halcyon/VectorLayer.as @@ -52,14 +52,15 @@ package net.systemeD.halcyon { public function getObjectsByBbox(left:Number, right:Number, top:Number, bottom:Number):Object { // ** FIXME: this is just copied-and-pasted from Connection.as, which really isn't very // good practice. Is there a more elegant way of doing it? - var o:Object = { nodesInside: [], nodesOutside: [], waysInside: [], waysOutside: [] }; + var o:Object = { poisInside: [], poisOutside: [], waysInside: [], waysOutside: [] }; for each (var way:Way in ways) { if (way.within(left,right,top,bottom)) { o.waysInside.push(way); } else { o.waysOutside.push(way); } } - for each (var node:Node in nodes) { - if (node.within(left,right,top,bottom)) { o.nodesInside.push(node); } - else { o.nodesOutside.push(node); } + // ** FIXME: this needs to do POIs, not nodes (i.e. we need registerPOI for vector layers too) + for each (var poi:Node in nodes) { + if (poi.within(left,right,top,bottom)) { o.poisInside.push(poi); } + else { o.poisOutside.push(poi); } } return o; } diff --git a/net/systemeD/halcyon/connection/Connection.as b/net/systemeD/halcyon/connection/Connection.as index e4e2c6c4..799985fd 100755 --- a/net/systemeD/halcyon/connection/Connection.as +++ b/net/systemeD/halcyon/connection/Connection.as @@ -289,14 +289,14 @@ package net.systemeD.halcyon.connection { } public function getObjectsByBbox(left:Number, right:Number, top:Number, bottom:Number):Object { - var o:Object = { nodesInside: [], nodesOutside: [], waysInside: [], waysOutside: [] }; + var o:Object = { poisInside: [], poisOutside: [], waysInside: [], waysOutside: [] }; for each (var way:Way in ways) { if (way.within(left,right,top,bottom)) { o.waysInside.push(way); } else { o.waysOutside.push(way); } } - for each (var node:Node in nodes) { - if (node.within(left,right,top,bottom)) { o.nodesInside.push(node); } - else { o.nodesOutside.push(node); } + for each (var poi:Node in pois) { + if (poi.within(left,right,top,bottom)) { o.poisInside.push(poi); } + else { o.poisOutside.push(poi); } } return o; } -- 2.31.1