== Rendering (Halcyon) ==
-** Entities need some sort of .purgable attribute (like EntityUIs) - currently you can select an item, then pan off-screen, and the entity is deleted at next purge, causing an exception whenever P2 tries to access it (e.g. via the selection)
* halcyon_viewer needs updating for new tileurl stuff
* Shields
* More line decoration (cliffs etc.), and implied values for 'dashes' if not supplied
if (paint.wayuis[way.id]) paint.wayuis[way.id].setHighlightOnNodes(settings);
}
+ /* Protect Entities and EntityUIs against purging. This prevents the currently selected items
+ from being purged even though they're off-screen. */
+
public function setPurgable(entities:Array, purgable:Boolean):void {
for each (var entity:Entity in entities) {
+ entity.locked=!purgable;
if ( entity is Way ) {
var way:Way=entity as Way;
if (paint.wayuis[way.id]) { paint.wayuis[way.id].purgable=purgable; }
for (var i:uint=0; i<way.length; i++) {
- if (paint.nodeuis[way.getNode(i).id]) {
- paint.nodeuis[way.getNode(i).id].purgable=purgable;
- }
+ var node:Node=way.getNode(i)
+ node.locked=!purgable;
+ if (paint.nodeuis[node.id]) { paint.nodeuis[node.id].purgable=purgable; }
}
} else if ( entity is Node && paint.nodeuis[entity.id]) {
paint.nodeuis[entity.id].purgable=purgable;
public function purgeOutside(left:Number, right:Number, top:Number, bottom:Number):void {
for each (var way:Way in ways) {
- if (!way.within(left,right,top,bottom) && !way.isDirty) {
+ if (!way.within(left,right,top,bottom) && !way.isDirty && !way.locked && !way.hasLockedNodes()) {
killWayWithNodes(way.id);
}
}
for each (var poi:Node in pois) {
- if (!poi.within(left,right,top,bottom) && !poi.isDirty) {
+ if (!poi.within(left,right,top,bottom) && !poi.isDirty && !poi.locked) {
killNode(poi.id);
}
}
private var modified:Boolean = false;
private var _loaded:Boolean = true;
private var parents:Dictionary = new Dictionary();
- private var locked:Boolean = false;
+ public var locked:Boolean = false; // lock against purging when off-screen
public var deleted:Boolean = false;
public function Entity(id:Number, version:uint, tags:Object, loaded:Boolean, uid:Number, timestamp:String) {
public function hasOnceOnly(node:Node):Boolean {
return nodes.indexOf(node)==nodes.lastIndexOf(node);
}
+
+ public function hasLockedNodes():Boolean {
+ for each (var node:Node in nodes) {
+ if (node.locked) { return true; }
+ }
+ return false;
+ }
public function removeNode(node:Node, performAction:Function):void {
performAction(new RemoveNodeFromWayAction(this, node, nodes));