import flash.events.MouseEvent;
import flash.text.AntiAliasType;
import flash.text.GridFitType;
- import net.systemeD.halcyon.Globals;
import net.systemeD.halcyon.styleparser.StyleList;
import net.systemeD.halcyon.connection.*;
scalefactor=MASTERSCALE/Math.pow(2,13-scale);
baselon =startlon -(mapwidth /2)/scalefactor;
basey =lat2latp(startlat)+(mapheight/2)/scalefactor;
- addDebug("Baselon "+baselon+", basey "+basey);
updateCoords(0,0);
this.dispatchEvent(new Event(MapEvent.INITIALISED));
download();
if (connection.waycount>1000) {
connection.purgeOutside(edge_l,edge_r,edge_t,edge_b);
}
- addDebug("Calling download with "+edge_l+"-"+edge_r+", "+edge_t+"-"+edge_b);
connection.loadBbox(edge_l,edge_r,edge_t,edge_b);
// Do the same for vector layers
}
private function changeScale(newscale:uint):void {
- addDebug("new scale "+newscale);
scale=newscale;
this.dispatchEvent(new MapEvent(MapEvent.SCALE, {scale:scale}));
scalefactor=MASTERSCALE/Math.pow(2,13-scale);
download();
}
- private function reportPosition():void {
- addDebug("lon "+coord2lon(mouseX)+", lat "+coord2lat(mouseY));
- }
-
private function toggleReportPosition():void {
showingLatLon = !showingLatLon;
this.dispatchEvent(new MapEvent(MapEvent.TOGGLE_LATLON, {latlon: showingLatLon}));
// and mask)
/*
public function export():void {
- addDebug("size is "+this.width+","+this.height);
+ trace("size is "+this.width+","+this.height);
var jpgSource:BitmapData = new BitmapData(800,800); // (this.width, this.height);
jpgSource.draw(this);
var jpgEncoder:JPGEncoder = new JPGEncoder(85);
}
}
- /** What to do if an error with the network connection happens. */
- public function connectionError(err:Object=null): void {
- addDebug("got error");
- }
-
// ------------------------------------------------------------------------------------------
// Debugging
import net.systemeD.halcyon.WayUI;
import net.systemeD.halcyon.connection.*;
import net.systemeD.halcyon.styleparser.RuleSet;
- import net.systemeD.halcyon.Globals;
/** Manages the drawing of map entities, allocating their sprites etc. */
public class MapPaint extends Sprite {
import flash.geom.Point;
import net.systemeD.halcyon.styleparser.*;
import net.systemeD.halcyon.connection.*;
- import net.systemeD.halcyon.Globals;
public class MarkerUI extends EntityUI {
import flash.geom.Point;
import net.systemeD.halcyon.styleparser.*;
import net.systemeD.halcyon.connection.*;
- import net.systemeD.halcyon.Globals;
/** The graphical representation of a Node (including POIs and nodes that are part of Ways). */
public class NodeUI extends EntityUI {
import net.systemeD.halcyon.MapPaint;
import net.systemeD.halcyon.connection.*;
import net.systemeD.halcyon.connection.actions.*;
- import net.systemeD.halcyon.Globals;
import net.systemeD.halcyon.styleparser.RuleSet;
/** The VectorLayer class is used for the concept of Vector Background Layers.
import flash.events.EventDispatcher;
import flash.events.Event;
- import net.systemeD.halcyon.Globals;
import net.systemeD.halcyon.connection.actions.*;
import net.systemeD.halcyon.AttentionEvent;
import net.systemeD.halcyon.MapEvent;
import flash.system.Security;
import net.systemeD.halcyon.ExtendedURLLoader;
- import net.systemeD.halcyon.Globals;
/**
* Read-only connection from local OSM-XML format (.osm) files.
}
private function loadFile(box:Array):void {
- Globals.vars.root.addDebug("called loadFile for "+box);
bboxes[box]=LOADING;
var mapRequest:URLRequest = new URLRequest(Connection.apiBaseURL+"/"+box[0]+"_"+box[1]+"_"+box[2]+"_"+box[3]+".osm");
import flash.net.*;
import org.iotashan.oauth.*;
- import net.systemeD.halcyon.Globals;
-
/**
* XMLBaseConnection is the common code between connecting to an OSM server
* (i.e. XMLConnection) and connecting to a standalone .osm file (i.e. OSMConnection)
package net.systemeD.halcyon.connection.actions {
import net.systemeD.halcyon.connection.*;
- import net.systemeD.halcyon.Globals;
public class AddNodeToWayAction extends UndoableEntityAction {
private var node:Node;
package net.systemeD.halcyon.connection.actions {
import net.systemeD.halcyon.connection.*;
- import net.systemeD.halcyon.Globals;
public class UnjoinNodeAction extends CompositeUndoableAction {
import net.systemeD.halcyon.connection.Entity;
import net.systemeD.halcyon.connection.*;
- import net.systemeD.halcyon.Globals;
/** A complete stylesheet, as loaded from a MapCSS file. It contains all selectors, declarations,
and embedded images. </p><p>
}
private function httpStatusHandler( event:HTTPStatusEvent ):void { }
- private function securityErrorHandler( event:SecurityErrorEvent ):void { Globals.vars.root.addDebug("securityerrorevent"); }
- private function ioErrorHandler( event:IOErrorEvent ):void { Globals.vars.root.addDebug("ioerrorevent"); }
+ private function securityErrorHandler( event:SecurityErrorEvent ):void { trace("securityerrorevent"); }
+ private function ioErrorHandler( event:IOErrorEvent ):void { trace("ioerrorevent"); }
// ------------------------------------------------------------------------------------------------
// Parse CSS
// Unknown pattern
} else if ((o=UNKNOWN.exec(css))) {
css=css.replace(UNKNOWN,'');
- Globals.vars.root.addDebug("unknown: "+o[1]);
+ trace("unknown: "+o[1]);
// ** do some debugging with o[1]
} else {
- Globals.vars.root.addDebug("choked on "+css);
+ trace("choked on "+css);
return;
}
}
package net.systemeD.halcyon.styleparser {
import net.systemeD.halcyon.connection.Entity;
- import net.systemeD.halcyon.Globals;
public class StyleChooser {
import mx.core.*;
import mx.collections.ArrayCollection;
import mx.managers.PopUpManager;
- import net.systemeD.halcyon.Globals;
public function setDimming(v:Boolean):void {
Application.application.theMap.setDimming(dim.selected);
}
if (bg.attribution_url) {
// load the attribution
- trace("requesting "+bg.attribution_url);
var urlloader:URLLoader = new URLLoader();
var thisbg2:Object = bg; // scope it for the closure
urlloader.addEventListener(Event.COMPLETE, function(e:Event):void { onAttributionLoad(e,thisbg2); });
}
public function onAttributionLoad(e:Event,bg: Object):void {
- trace ("onAttributionLoad");
// if we ever need to cope with non-Microsoft attribution, then this should look at bg.scheme
default xml namespace = Namespace("http://schemas.microsoft.com/search/local/ws/rest/v1");
var xml:XML = new XML(e.target.data);
import net.systemeD.halcyon.connection.*;
import net.systemeD.potlatch2.collections.Imagery;
import net.systemeD.potlatch2.EditController;
- import net.systemeD.halcyon.Globals;
import net.systemeD.potlatch2.save.SaveManager;
import flash.ui.Keyboard;
import mx.controls.Alert;
import net.systemeD.potlatch2.EditController;
import net.systemeD.halcyon.connection.*;
import net.systemeD.halcyon.MapEvent;
- import net.systemeD.halcyon.Globals;
/** The state of realigning the background imagery by holding down a key and moving the mouse. This moves the background, but
* doesn't move the map, thereby adjusting the offset between the background and the map. */
/** Prevent map panning while background is being dragged. */
override public function enterState():void {
controller.map.draggable=false;
- Globals.vars.root.addDebug("**** -> "+this);
}
/** Re-allow map panning. */
override public function exitState(newState:ControllerState):void {
controller.map.draggable=true;
- Globals.vars.root.addDebug("**** <- "+this);
}
/** "DragBackground" */
import net.systemeD.potlatch2.EditController;
import net.systemeD.halcyon.connection.*;
import net.systemeD.halcyon.connection.actions.*;
- import net.systemeD.halcyon.Globals;
/** The state of moving a selection around with the mouse. */
public class DragSelection extends ControllerState {
for each (var entity:Entity in selection) {
controller.map.setHighlight(entity, { selected: true });
}
- Globals.vars.root.addDebug("**** -> "+this);
}
/** Un-highlight the dragged selection. */
for each (var entity:Entity in selection) {
controller.map.setHighlight(entity, { selected: false });
}
- Globals.vars.root.addDebug("**** <- "+this);
}
/** "DragSelection" */
override public function toString():String {
import flash.events.*;
import net.systemeD.potlatch2.EditController;
import net.systemeD.halcyon.connection.*;
- import net.systemeD.halcyon.Globals;
import net.systemeD.halcyon.WayUI;
public class DragWayNode extends ControllerState {
controller.map.setHighlight(draggingNode, { selected: true } );
controller.map.protectWay(parentWay);
controller.map.limitWayDrawing(parentWay, NaN, draggingIndex);
- Globals.vars.root.addDebug("**** -> "+this);
}
override public function exitState(newState:ControllerState):void {
controller.map.unprotectWay(parentWay);
controller.map.limitWayDrawing(parentWay);
controller.map.setHighlightOnNodes(parentWay, { selectedway: false } );
controller.map.setHighlight(draggingNode, { selected: false } );
- Globals.vars.root.addDebug("**** <- "+this);
}
override public function toString():String {
return "DragWayNode";
import net.systemeD.halcyon.connection.*;
import net.systemeD.halcyon.connection.actions.*;
import net.systemeD.halcyon.Elastic;
- import net.systemeD.halcyon.Globals;
import net.systemeD.halcyon.MapPaint;
public class DrawWay extends SelectedWay {
var start:Point = new Point(node.lon, node.latp);
elastic = new Elastic(controller.map, start, start);
controller.setCursor(controller.pen);
- Globals.vars.root.addDebug("**** -> "+this);
}
override public function exitState(newState:ControllerState):void {
Way(firstSelected).removeEventListener(Connection.WAY_NODE_REMOVED, fixElastic);
controller.setCursor(null);
elastic.removeSprites();
elastic = null;
- Globals.vars.root.addDebug("**** <- "+this);
}
override public function toString():String {
return "DrawWay";
import net.systemeD.halcyon.connection.actions.*;
import net.systemeD.halcyon.Map;
import net.systemeD.halcyon.MapPaint;
- import net.systemeD.halcyon.Globals;
public class NoSelection extends ControllerState {
override public function enterState():void {
controller.map.mouseUpHandler();
- Globals.vars.root.addDebug("**** -> "+this);
}
override public function exitState(newState:ControllerState):void {
- Globals.vars.root.addDebug("**** <- "+this);
}
override public function toString():String {
return "NoSelection";
import net.systemeD.potlatch2.EditController;
import net.systemeD.halcyon.connection.*;
import net.systemeD.halcyon.VectorLayer;
- import net.systemeD.halcyon.Globals;
public class SelectedMarker extends ControllerState {
protected var initMarker:Marker;
override public function enterState():void {
selectMarker(initMarker);
controller.map.setPurgable(selection,false);
- Globals.vars.root.addDebug("**** -> "+this);
}
override public function exitState(newState:ControllerState):void {
controller.map.setPurgable(selection,true);
clearSelection(newState);
- Globals.vars.root.addDebug("**** <- "+this);
}
override public function toString():String {
import flash.events.*;
import net.systemeD.halcyon.AttentionEvent;
- import net.systemeD.halcyon.Globals;
import net.systemeD.halcyon.connection.*;
import net.systemeD.halcyon.connection.actions.MergeWaysAction;
}
controller.updateSelectionUI();
controller.map.setPurgable(selection,false);
- Globals.vars.root.addDebug("**** -> "+this+" "+selection);
}
override public function exitState(newState:ControllerState):void {
}
selection = [];
if (!newState.isSelectionState()) { controller.updateSelectionUI(); }
- Globals.vars.root.addDebug("**** <- "+this);
}
override public function toString():String {
import flash.ui.Keyboard;
import net.systemeD.potlatch2.EditController;
import net.systemeD.halcyon.connection.*;
- import net.systemeD.halcyon.Globals;
public class SelectedPOINode extends ControllerState {
protected var initNode:Node;
override public function enterState():void {
selectNode(initNode);
controller.map.setPurgable(selection,false);
- Globals.vars.root.addDebug("**** -> "+this);
}
override public function exitState(newState:ControllerState):void {
if(firstSelected.hasTags()) {
}
controller.map.setPurgable(selection,true);
clearSelection(newState);
- Globals.vars.root.addDebug("**** <- "+this);
}
override public function toString():String {
import net.systemeD.halcyon.connection.*;
import net.systemeD.halcyon.Map;
import net.systemeD.potlatch2.tools.Parallelise;
- import net.systemeD.halcyon.Globals;
/** The state midway during the use of the "parallelise tool", where a parallel way has been created but is stuck to the
* mouse cursor, allowing the user to choose how far from the original way it should go. This transforms it in the process. */
controller.map.paint.createWayUI(firstSelected as Way);
startlon =controller.map.coord2lon(controller.map.mouseX);
startlatp=controller.map.coord2latp(controller.map.mouseY);
- Globals.vars.root.addDebug("**** -> "+this);
}
/** Unselects. */
override public function exitState(newState:ControllerState):void {
clearSelection(newState);
- Globals.vars.root.addDebug("**** <- "+this);
}
override public function toString():String {
import flash.geom.Point;
import flash.ui.Keyboard;
- import net.systemeD.halcyon.Globals;
import net.systemeD.halcyon.WayUI;
import net.systemeD.halcyon.connection.*;
import net.systemeD.potlatch2.tools.Quadrilateralise;
initWay.addEventListener(Connection.WAY_REORDERED, updateSelectionUI, false, 0, true);
}
controller.map.setPurgable(selection,false);
- Globals.vars.root.addDebug("**** -> "+this+" "+firstSelected.id);
}
/** Officially leave the state, remembering the current way's tags for future repeats. */
// TODO: tweak this so that repeat tags aren't remembered if you only select a way in order to branch off it. (a la PL1)
controller.map.setPurgable(selection,true);
firstSelected.removeEventListener(Connection.WAY_REORDERED, updateSelectionUI);
clearSelection(newState);
- Globals.vars.root.addDebug("**** <- "+this);
}
/** @return "SelectedWay" */
import flash.ui.Keyboard;
import net.systemeD.halcyon.AttentionEvent;
- import net.systemeD.halcyon.Globals;
import net.systemeD.halcyon.WayUI;
import net.systemeD.halcyon.connection.*;
import net.systemeD.halcyon.connection.actions.*;
override public function enterState():void {
selectNode(parentWay,initIndex);
controller.map.setPurgable(selection,false);
- Globals.vars.root.addDebug("**** -> "+this);
}
override public function exitState(newState:ControllerState):void {
if (firstSelected.hasTags()) {
}
controller.map.setPurgable(selection,true);
clearSelection(newState);
- Globals.vars.root.addDebug("**** <- "+this);
}
override public function toString():String {
package net.systemeD.potlatch2.utils {
import net.systemeD.halcyon.MapPaint;
- import net.systemeD.halcyon.Globals;
import net.systemeD.halcyon.connection.Node;
import net.systemeD.halcyon.connection.Way;
import net.systemeD.potlatch2.tools.Simplify;
import flash.events.*;
import flash.net.*;
- import net.systemeD.halcyon.Globals;
-
public class Importer {
protected var container:Object; // destination object for way/node/relations data
protected var simplify:Boolean;
public function Importer(container:*, paint:MapPaint, filenames:Array, callback:Function, simplify:Boolean) {
- Globals.vars.root.addDebug("starting importer");
- Globals.vars.root.addDebug("container is "+container);
- Globals.vars.root.addDebug("paint is "+paint);
this.container = container;
this.paint = paint;
this.filenames=filenames;
var sp:uint=0;
for each (var fn:String in filenames) {
var thissp:uint=sp; // scope within this block for the URLLoader 'complete' closure
- Globals.vars.root.addDebug("requesting file "+fn);
+ trace("requesting file "+fn);
var request:DebugURLRequest = new DebugURLRequest(fn);
var loader:URLLoader = new URLLoader();
loader.dataFormat=URLLoaderDataFormat.BINARY;
}
protected function fileLoaded(e:Event,filenum:uint):void {
- Globals.vars.root.addDebug("loaded file "+filenum);
+ trace("loaded file "+filenum);
files[filenum]=e.target.data;
filesloaded++;
if (filesloaded==filenames.length) {
package net.systemeD.potlatch2.utils {
import net.systemeD.halcyon.MapPaint;
- import net.systemeD.halcyon.Globals;
import net.systemeD.halcyon.connection.Node;
import net.systemeD.halcyon.connection.Way;
import net.systemeD.halcyon.connection.Relation;
package net.systemeD.potlatch2.utils {
import net.systemeD.halcyon.MapPaint;
- import net.systemeD.halcyon.Globals;
import net.systemeD.halcyon.connection.*;
import net.systemeD.potlatch2.tools.Simplify;
import org.vanrijkom.shp.*;
import org.vanrijkom.dbf.*;
import net.systemeD.halcyon.MapPaint;
- import net.systemeD.halcyon.Globals;
import net.systemeD.halcyon.connection.Node;
import net.systemeD.halcyon.connection.Way;
import net.systemeD.potlatch2.tools.Simplify;