Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unify a number of inconsistent files to 4 space soft tab #18

Open
wants to merge 15 commits into
base: master
Choose a base branch
from
Open
190 changes: 95 additions & 95 deletions halcyon_viewer.as
Original file line number Diff line number Diff line change
@@ -1,99 +1,99 @@
package {

import net.systemeD.halcyon.*;
import net.systemeD.halcyon.connection.*;
import flash.system.Security;
import flash.net.*;
import flash.events.*;
import flash.events.MouseEvent;
import flash.display.*;
import flash.text.Font;
import flash.text.TextField;
import flash.external.*;
// import bustin.dev.Inspector;

public class halcyon_viewer extends Sprite {

public var theMap:Map;

function halcyon_viewer():void {
stage.align = StageAlign.TOP_LEFT;
stage.scaleMode = StageScaleMode.NO_SCALE;
this.loaderInfo.addEventListener(Event.COMPLETE, startInit);
}
private function startInit(e:Event):void {
var loader:Loader = new Loader();
loader.contentLoaderInfo.addEventListener(Event.COMPLETE, startApp);
loader.load(new URLRequest("FontLibrary.swf"));
}

private function startApp(event:Event):void {
// Initialise font
var FontLibrary:Class = event.target.applicationDomain.getDefinition("FontLibrary") as Class;
Font.registerFont(FontLibrary.DejaVu);

// Get parameters
var params:Object={}; var k:String;
for (k in this.loaderInfo.parameters) params[k]=this.loaderInfo.parameters[k];
Globals.vars.flashvars = loaderInfo.parameters; // ** FIXME - not sure we should use flashvars anywhere in Halcyon/P2

// Initialise map
theMap = new Map();
import net.systemeD.halcyon.*;
import net.systemeD.halcyon.connection.*;
import flash.system.Security;
import flash.net.*;
import flash.events.*;
import flash.events.MouseEvent;
import flash.display.*;
import flash.text.Font;
import flash.text.TextField;
import flash.external.*;
// import bustin.dev.Inspector;

public class halcyon_viewer extends Sprite {

public var theMap:Map;

function halcyon_viewer():void {
stage.align = StageAlign.TOP_LEFT;
stage.scaleMode = StageScaleMode.NO_SCALE;
this.loaderInfo.addEventListener(Event.COMPLETE, startInit);
}
private function startInit(e:Event):void {
var loader:Loader = new Loader();
loader.contentLoaderInfo.addEventListener(Event.COMPLETE, startApp);
loader.load(new URLRequest("FontLibrary.swf"));
}

private function startApp(event:Event):void {
// Initialise font
var FontLibrary:Class = event.target.applicationDomain.getDefinition("FontLibrary") as Class;
Font.registerFont(FontLibrary.DejaVu);

// Get parameters
var params:Object={}; var k:String;
for (k in this.loaderInfo.parameters) params[k]=this.loaderInfo.parameters[k];
Globals.vars.flashvars = loaderInfo.parameters; // ** FIXME - not sure we should use flashvars anywhere in Halcyon/P2

// Initialise map
theMap = new Map();
theMap.updateSize(stage.stageWidth, stage.stageHeight);
addChild(theMap);

// Add connection
// ** FIXME - should get the stylesheet from parameters
var conn:Connection = new XMLConnection("Main", params['api'], params['policy'], params);
theMap.addLayer(conn, params['style'], false, true);
theMap.init(params['lat'], params['lon'], params['zoom']);

Globals.vars.root=theMap; // ** FIXME - should no longer be necessary
Globals.vars.nocache = loaderInfo.parameters['nocache'] == 'true';

stage.addEventListener(MouseEvent.MOUSE_UP, theMap.mouseUpHandler);
stage.addEventListener(MouseEvent.MOUSE_MOVE, theMap.mouseMoveHandler);
stage.addEventListener(MouseEvent.MOUSE_DOWN, theMap.mouseDownHandler);
// Inspector.getInstance().init(stage);

// Zoom buttons
var z1:Sprite=new Sprite();
z1.graphics.beginFill(0x0000FF); z1.graphics.drawRoundRect(0,0,20,20,5); z1.graphics.endFill();
z1.graphics.lineStyle(2,0xFFFFFF);
z1.graphics.moveTo(5,10); z1.graphics.lineTo(15,10);
z1.graphics.moveTo(10,5); z1.graphics.lineTo(10,15);
z1.x=5; z1.y=5; z1.buttonMode=true;
z1.addEventListener(MouseEvent.CLICK, zoomInHandler, false, 1);
addChild(z1);

var z2:Sprite=new Sprite();
z2.graphics.beginFill(0x0000FF); z2.graphics.drawRoundRect(0,0,20,20,5); z2.graphics.endFill();
z2.graphics.lineStyle(2,0xFFFFFF);
z2.graphics.moveTo(5,10); z2.graphics.lineTo(15,10);
z2.x=5; z2.y=30; z2.buttonMode=true;
z2.addEventListener(MouseEvent.CLICK, zoomOutHandler, false, 1);
addChild(z2);

if (this.loaderInfo.parameters.hasOwnProperty('responder')) {
var controller:JSController = new JSController(theMap, loaderInfo.parameters['responder']);
controller.setActive();
}

ExternalInterface.addCallback('refreshCSS', onRefreshCSS);
ExternalInterface.addCallback('jumpTo', onJumpTo);
}

private function onRefreshCSS(str:String):void {
theMap.editableLayer.setStyle(str);
}
private function onJumpTo(lat:Number,lon:Number):void {
theMap.init(lat,lon);
}

private function zoomInHandler(e:MouseEvent):void { e.stopPropagation(); theMap.zoomIn(); }
private function zoomOutHandler(e:MouseEvent):void { e.stopPropagation(); theMap.zoomOut(); }


}
addChild(theMap);

// Add connection
// ** FIXME - should get the stylesheet from parameters
var conn:Connection = new XMLConnection("Main", params['api'], params['policy'], params);
theMap.addLayer(conn, params['style'], false, true);
theMap.init(params['lat'], params['lon'], params['zoom']);

Globals.vars.root=theMap; // ** FIXME - should no longer be necessary
Globals.vars.nocache = loaderInfo.parameters['nocache'] == 'true';

stage.addEventListener(MouseEvent.MOUSE_UP, theMap.mouseUpHandler);
stage.addEventListener(MouseEvent.MOUSE_MOVE, theMap.mouseMoveHandler);
stage.addEventListener(MouseEvent.MOUSE_DOWN, theMap.mouseDownHandler);
// Inspector.getInstance().init(stage);

// Zoom buttons
var z1:Sprite=new Sprite();
z1.graphics.beginFill(0x0000FF); z1.graphics.drawRoundRect(0,0,20,20,5); z1.graphics.endFill();
z1.graphics.lineStyle(2,0xFFFFFF);
z1.graphics.moveTo(5,10); z1.graphics.lineTo(15,10);
z1.graphics.moveTo(10,5); z1.graphics.lineTo(10,15);
z1.x=5; z1.y=5; z1.buttonMode=true;
z1.addEventListener(MouseEvent.CLICK, zoomInHandler, false, 1);
addChild(z1);

var z2:Sprite=new Sprite();
z2.graphics.beginFill(0x0000FF); z2.graphics.drawRoundRect(0,0,20,20,5); z2.graphics.endFill();
z2.graphics.lineStyle(2,0xFFFFFF);
z2.graphics.moveTo(5,10); z2.graphics.lineTo(15,10);
z2.x=5; z2.y=30; z2.buttonMode=true;
z2.addEventListener(MouseEvent.CLICK, zoomOutHandler, false, 1);
addChild(z2);

if (this.loaderInfo.parameters.hasOwnProperty('responder')) {
var controller:JSController = new JSController(theMap, loaderInfo.parameters['responder']);
controller.setActive();
}

ExternalInterface.addCallback('refreshCSS', onRefreshCSS);
ExternalInterface.addCallback('jumpTo', onJumpTo);
}

private function onRefreshCSS(str:String):void {
theMap.editableLayer.setStyle(str);
}
private function onJumpTo(lat:Number,lon:Number):void {
theMap.init(lat,lon);
}

private function zoomInHandler(e:MouseEvent):void { e.stopPropagation(); theMap.zoomIn(); }
private function zoomOutHandler(e:MouseEvent):void { e.stopPropagation(); theMap.zoomOut(); }


}
}
20 changes: 10 additions & 10 deletions net/systemeD/halcyon/AttentionEvent.as
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
package net.systemeD.halcyon {

import flash.events.Event;
import net.systemeD.halcyon.connection.Entity;
import net.systemeD.halcyon.connection.Entity;

public class AttentionEvent extends Event {

public static const ATTENTION:String = "attention";
public static const ALERT:String = "alert";
public static const ATTENTION:String = "attention";
public static const ALERT:String = "alert";

public var entity:Entity;
public var message:String;
public var priority:uint;
public var entity:Entity;
public var message:String;
public var priority:uint;

public var params:Object;
public var params:Object;

public function AttentionEvent(eventname:String, entity:Entity, message:String="", priority:uint=0) {
super(eventname);
this.entity =entity;
this.message =message;
this.priority=priority;
this.entity =entity;
this.message =message;
this.priority=priority;
}
}
}
6 changes: 3 additions & 3 deletions net/systemeD/halcyon/Elastic.as
Original file line number Diff line number Diff line change
Expand Up @@ -84,11 +84,11 @@ package net.systemeD.halcyon {
var a:Number, xc:Number, yc:Number;
var curx:Number, cury:Number;
var dx:Number, dy:Number, segleft:Number=0;
var i:int=0;
var i:int=0;

var p0:Point = start;
var p1:Point = end;
g.moveTo(map.lon2coord(p0.x), map.latp2coord(p0.y));
g.moveTo(map.lon2coord(p0.x), map.latp2coord(p0.y));
while (i < 1 || segleft>0) {
if (dashleft<=0) { // should be ==0
if (dc.length==0) { dc=dashes.slice(0); }
Expand All @@ -107,7 +107,7 @@ package net.systemeD.halcyon {

if (segleft<=dashleft) {
// the path segment is shorter than the dash
curx+=dx; cury+=dy;
curx+=dx; cury+=dy;
moveLine(g,curx,cury,draw);
dashleft-=segleft; segleft=0;
} else {
Expand Down
Loading