paint.wayuis[oldWay.id].redraw();
delete ways[oldWay.id];
map.paint.createWayUI(newWay);
+ } else {
+ // ** should be able to pull nodes through
+ trace ("Pulling nodes through isn't supported yet");
}
return newWay;
}
private function loadFiles(url:String,type:String,simplify:Boolean):void {
var names:Array=url.split('/'); var name:String=names[names.length-1];
- var vectorlayer:VectorLayer=new VectorLayer(name,map,"potlatch.css");
+ var stylesheet:String="potlatch.css";
+ if (type=='gpx') { stylesheet="gpx.css"; }
+ var vectorlayer:VectorLayer=new VectorLayer(name,map,stylesheet);
vectorlayer.url=url;
map.addVectorLayer(vectorlayer);
if ( paint && paint.isBackground ) {
if ( event.type == MouseEvent.MOUSE_DOWN && ((event.shiftKey && event.ctrlKey) || event.altKey) ) {
// pull data out of vector background layer
- if (entity is Way) { return new SelectedWay(paint.findSource().pullThrough(entity,controller.connection)); }
+ var newEntity:Entity=paint.findSource().pullThrough(entity,controller.connection);
+ if (entity is Way) { return new SelectedWay(newEntity); }
+ else if (entity is Node) { return new SelectedPOINode(newEntity); }
}
return (this is NoSelection) ? this : new NoSelection();
}
package net.systemeD.potlatch2.controller {
import flash.events.*;
import flash.geom.*;
+ import flash.display.DisplayObject;
import flash.ui.Keyboard;
import net.systemeD.potlatch2.EditController;
import net.systemeD.halcyon.connection.*;
import net.systemeD.halcyon.Elastic;
import net.systemeD.halcyon.Globals;
+ import net.systemeD.halcyon.MapPaint;
public class DrawWay extends SelectedWay {
private var elastic:Elastic;
override public function processMouseEvent(event:MouseEvent, entity:Entity):ControllerState {
var mouse:Point;
var node:Node;
+ var paint:MapPaint = getMapPaint(DisplayObject(event.target));
+ var isBackground:Boolean = paint && paint.isBackground;
+
if (entity == null && hoverEntity) { entity=hoverEntity; }
var focus:Entity = getTopLevelFocusEntity(entity);
if ( event.type == MouseEvent.MOUSE_UP ) {
- if ( entity == null ) {
+ if ( entity == null || isBackground ) {
node = createAndAddNode(event);
resetElastic(node);
lastClick=node;
controller.map.coord2lon(event.localX),
controller.map.coord2latp(event.localY));
elastic.end = mouse;
- } else if ( event.type == MouseEvent.ROLL_OVER ) {
+ } else if ( event.type == MouseEvent.ROLL_OVER && !isBackground ) {
if (focus!=selectedWay) {
hoverEntity=focus;
controller.map.setHighlightOnNodes(focus as Way, { hoverway: true });
} else {
controller.setCursor(controller.pen_plus);
}
- } else if ( event.type == MouseEvent.MOUSE_OUT ) {
+ } else if ( event.type == MouseEvent.MOUSE_OUT && !isBackground ) {
if (entity!=selectedWay) {
hoverEntity=null;
controller.map.setHighlightOnNodes(focus as Way, { hoverway: false });
}
}
for each (var wpt:XML in file.child("wpt")) {
- // ** could potentially get the children and add them as gpx:tags
- container.createNode({}, wpt.lat, wpt.lon);
+ var tags:Object={};
+ for each (var tag:XML in wpt.children()) {
+ tags[tag.name()]=tag.toString();
+ }
+ container.createNode(tags, wpt.@lat, wpt.@lon);
}
}
}
import flash.events.*;
/* still to do:
- - don't join to GPS track when you click on it
- - light-blue colour
- empty layer on reload
- cope with tracks with timestamps */
private var map:Map;
private var apiBaseURL:String;
- private static const STYLESHEET:String="wireframe.css";
+ private static const STYLESHEET:String="gpx.css";
public function TrackLoader(map:Map, url:String) {
this.map=map;
--- /dev/null
+/*
+
+ Wireframe stylesheet for GPS tracks
+
+*/
+
+way { z-index: 2; width: 1; color: cyan; }
+node :poi { z-index: 2;
+ icon-image: circle; icon-width: 4; color: orange;
+ casing-color: red; casing-width: 1;
+ text-offset: 10; font-family: DejaVu; text: name; font-size: 9; text_color: red; }
+
<name>OpenCycleMap</name>
<url>opencyclemap.css</url>
</stylesheet>
+ <stylesheet>
+ <name>GPS</name>
+ <url>gpx.css</url>
+ </stylesheet>
</stylesheets>