mirror of
https://github.com/FoggedLens/iD.git
synced 2026-03-21 02:23:30 +00:00
Remove unused files
This commit is contained in:
@@ -1,8 +0,0 @@
|
||||
iD.DrawWay = {
|
||||
enter: function(map) {
|
||||
console.log('entering');
|
||||
return 'foo';
|
||||
},
|
||||
exit: function(map) {
|
||||
}
|
||||
};
|
||||
@@ -1,33 +0,0 @@
|
||||
// ----------------------------------------------------------------------
|
||||
// edit.NoSelection class
|
||||
|
||||
iD.controller.edit.NoSelection = function() {};
|
||||
iD.controller.edit.NoSelection.prototype = {
|
||||
|
||||
constructor: function() {
|
||||
// summary: In 'Edit object' mode but nothing selected.
|
||||
},
|
||||
|
||||
enterState: function() {
|
||||
// this.controller.stepper.hide();
|
||||
},
|
||||
|
||||
processMouseEvent: function(event, entityUI) {
|
||||
if (!entityUI) { return this; }
|
||||
var entity = entityUI.entity;
|
||||
if (event.type === 'click') {
|
||||
this.inherited(arguments);
|
||||
if (entity.entityType === 'node') {
|
||||
var ways = entity.entity.parentWays();
|
||||
if (!ways.length) {
|
||||
return new iD.controller.edit.SelectedPOINode(entity);
|
||||
} else {
|
||||
return new iD.controller.edit.SelectedWayNode(entity,ways[0]);
|
||||
}
|
||||
} else if (entity.entityType === 'way') {
|
||||
return new iD.controller.edit.SelectedWay(entityUI.entity, event);
|
||||
}
|
||||
}
|
||||
return this;
|
||||
}
|
||||
};
|
||||
@@ -1,43 +0,0 @@
|
||||
// ----------------------------------------------------------------------
|
||||
// edit.SelectedPOINode class
|
||||
|
||||
iD.controller.edit.SelectedPOINode = function() {};
|
||||
iD.controller.edit.SelectedPOINode.prototype = {
|
||||
|
||||
node: null,
|
||||
nodeUI: null,
|
||||
|
||||
constructor: function(node) {
|
||||
// summary: In 'Edit object' mode and a POI node is selected.
|
||||
this.node = node;
|
||||
},
|
||||
|
||||
enterState: function() {
|
||||
var map = this.controller.map;
|
||||
this.nodeUI = map.getUI(this.node);
|
||||
this.nodeUI.setStateClass('selected')
|
||||
.redraw();
|
||||
this.openEditorTooltip(this.node);
|
||||
return this;
|
||||
},
|
||||
|
||||
exitState: function() {
|
||||
this.nodeUI.resetStateClass('selected')
|
||||
.redraw();
|
||||
this.closeEditorTooltip();
|
||||
return this;
|
||||
},
|
||||
|
||||
processMouseEvent: function(event, entityUI) {
|
||||
if (event.type !== 'click') return this;
|
||||
var entity = entityUI ? entityUI.entity : null;
|
||||
var entityType = entity ? entity.entityType : null;
|
||||
switch (entityType) {
|
||||
case null: return new iD.controller.edit.NoSelection();
|
||||
case 'node': return new iD.controller.edit.SelectedPOINode(entityUI.entity);
|
||||
case 'way': return new iD.controller.edit.SelectedWay(entityUI.entity, event);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
};
|
||||
@@ -1,57 +0,0 @@
|
||||
// ----------------------------------------------------------------------
|
||||
// edit.SelectedWay class
|
||||
|
||||
iD.controller.edit.SelectedWay = function() {};
|
||||
iD.controller.edit.SelectedWay.prototype = {
|
||||
|
||||
way: null,
|
||||
wayUI: null,
|
||||
entryevent: null,
|
||||
|
||||
constructor:function(way, event) {
|
||||
// summary: In 'Edit object' mode and a way is selected.
|
||||
this.way = way;
|
||||
this.entryevent = event;
|
||||
},
|
||||
enterState:function() {
|
||||
this.wayUI = this.controller.map.getUI(this.way);
|
||||
this.wayUI.setStateClass('selected');
|
||||
this.wayUI.setStateClass('shownodes');
|
||||
if (this.entryevent) {
|
||||
this.openEditorTooltip(this.entryevent.clientX, this.entryevent.clientY, this.way);
|
||||
}
|
||||
this.wayUI.redraw();
|
||||
},
|
||||
exitState:function() {
|
||||
this.wayUI.resetStateClass('selected');
|
||||
this.wayUI.resetStateClass('shownodes');
|
||||
this.wayUI.redraw();
|
||||
this.closeEditorTooltip();
|
||||
},
|
||||
|
||||
processMouseEvent:function(event, entityUI) {
|
||||
var entity = entityUI ? entityUI.entity : null;
|
||||
var entityType = entity ? entity.entityType : null;
|
||||
|
||||
if (event.type === 'click') {
|
||||
switch (entityType) {
|
||||
case null:
|
||||
return new iD.controller.edit.NoSelection();
|
||||
case 'node':
|
||||
var ways = entity.entity.parentWays();
|
||||
if (entity.entity.hasParent(this.way)) {
|
||||
return new iD.controller.edit.SelectedWayNode(entity, this.way);
|
||||
} else if (!ways.length) {
|
||||
return new iD.controller.edit.SelectedPOINode(entity);
|
||||
} else {
|
||||
return new iD.controller.edit.SelectedWayNode(entity, ways[0]);
|
||||
}
|
||||
break;
|
||||
case 'way':
|
||||
return new iD.controller.edit.SelectedWay(entityUI.entity, event);
|
||||
}
|
||||
} else { }
|
||||
return this;
|
||||
}
|
||||
|
||||
};
|
||||
@@ -1,52 +0,0 @@
|
||||
// ----------------------------------------------------------------------
|
||||
// SelectedWayNode class
|
||||
iD.controller.edit.SelectedWayNode = function() {};
|
||||
iD.controller.edit.SelectedWayNode.prototype = {
|
||||
|
||||
node: null,
|
||||
way: null,
|
||||
|
||||
constructor:function(node, way) {
|
||||
// summary: In 'Edit object' mode and a node in a way is selected.
|
||||
this.node = node;
|
||||
this.way = way;
|
||||
},
|
||||
enterState:function() {
|
||||
var map=this.controller.map;
|
||||
map.getUI(this.way).setStateClass('shownodes').redraw();
|
||||
map.getUI(this.node).setStateClass('selected' ).redraw();
|
||||
this.openEditorTooltip(map.lon2screen(this.node.lon),
|
||||
map.lat2screen(this.node.lat), this.node);
|
||||
},
|
||||
exitState:function() {
|
||||
var map=this.controller.map;
|
||||
map.getUI(this.way).resetStateClass('shownodes').redraw();
|
||||
map.getUI(this.node).resetStateClass('selected' ).redraw();
|
||||
this.closeEditorTooltip();
|
||||
},
|
||||
|
||||
processMouseEvent:function(event,entityUI) {
|
||||
if (event.type !== 'click') return this;
|
||||
var entity = entityUI ? entityUI.entity : null;
|
||||
var entityType = entity ? entity.entityType : null;
|
||||
|
||||
switch (entityType) {
|
||||
case null:
|
||||
return new iD.controller.edit.NoSelection();
|
||||
case 'node':
|
||||
var ways = entity.entity.parentWays();
|
||||
if (entity.entity.hasParent(this.way)) {
|
||||
return new iD.controller.edit.SelectedWayNode(entity,this.way);
|
||||
} else if (!ways.length) {
|
||||
return new iD.controller.edit.SelectedPOINode(entity);
|
||||
} else {
|
||||
return new iD.controller.edit.SelectedWayNode(entity,ways[0]);
|
||||
}
|
||||
break;
|
||||
case 'way':
|
||||
return new iD.controller.edit.SelectedWay(entityUI.entity, event);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
};
|
||||
@@ -1 +0,0 @@
|
||||
iD.controller.edit = {};
|
||||
@@ -1,188 +0,0 @@
|
||||
// iD/controller/shape/DrawWay.js
|
||||
|
||||
/*
|
||||
Add road or shape -> DrawWay
|
||||
|
||||
The user is drawing a way.
|
||||
|
||||
Goes to:
|
||||
-> click empty area: adds point, continues
|
||||
-> click way: adds junction, continues
|
||||
-> click node: adds to way, continues
|
||||
-> double-click, or click this way: goes to Edit/SelectedWay
|
||||
|
||||
*/
|
||||
|
||||
|
||||
define(['dojo/_base/declare', 'dojo/_base/lang', 'dojox/gfx/shape'],
|
||||
function(declare, lang, shape){
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
// DrawWay class
|
||||
|
||||
declare("iD.controller.shape.DrawWay", null, {
|
||||
|
||||
way: null,
|
||||
wayUI: null,
|
||||
editEnd: false,
|
||||
|
||||
constructor: function(way) {
|
||||
this.way = way;
|
||||
},
|
||||
|
||||
enterState: function() {
|
||||
this.wayUI = this.controller.map.getUI(this.way);
|
||||
this.wayUI.setStateClass('selected')
|
||||
.setStateClass('shownodes')
|
||||
.redraw();
|
||||
this.controller.stepper.step(1);
|
||||
},
|
||||
|
||||
exitState: function() {
|
||||
this.controller.map.clearElastic();
|
||||
this.wayUI
|
||||
.resetStateClass('selected')
|
||||
.resetStateClass('shownodes')
|
||||
.redraw();
|
||||
},
|
||||
|
||||
processMouseEvent: function(event, entityUI) {
|
||||
var entity = entityUI ? entityUI.entity : null;
|
||||
var entityType = entity ? entity.entityType : null;
|
||||
var map = this.controller.map;
|
||||
var ways, undo, action;
|
||||
|
||||
if (event.type === 'mouseover' &&
|
||||
entityType === 'way' &&
|
||||
entityUI !== this.wayUI) {
|
||||
|
||||
// Mouse over way, show hover highlight
|
||||
entityUI.setStateClass('shownodeshover')
|
||||
.redraw();
|
||||
this.wayUI.redraw();
|
||||
this.updateElastic(event);
|
||||
return this;
|
||||
|
||||
} else if (event.type=='mouseout' && entityType=='way' &&
|
||||
entityUI !== this.wayUI) {
|
||||
// Mouse left way, remove hover highlight
|
||||
// Find what object we're moving into
|
||||
var into = shape.byId((event.hasOwnProperty('toElement') ? event.toElement : event.relatedTarget).__gfxObject__);
|
||||
// If it's a nodeUI that belongs to a hovering way, don't deselect
|
||||
if (into &&
|
||||
into.hasOwnProperty('source') &&
|
||||
into.source.hasStateClass('hoverway') &&
|
||||
into.source.entity.entity.hasParent(entity)) {
|
||||
return this;
|
||||
}
|
||||
entityUI.resetStateClass('shownodeshover');
|
||||
entityUI.redraw();
|
||||
this.wayUI.redraw();
|
||||
this.updateElastic(event);
|
||||
return this;
|
||||
|
||||
} else if (event.type=='mouseout' && entityType=='node') {
|
||||
// Mouse left node, remove hover highlight from parent way too
|
||||
ways = entity.entity.parentWays();
|
||||
for (var i in ways) {
|
||||
var ui = this.controller.map.getUI(ways[i]);
|
||||
if (ui && ui.hasStateClass('shownodeshover')) {
|
||||
ui.resetStateClass('shownodeshover');
|
||||
ui.redraw();
|
||||
}
|
||||
}
|
||||
this.updateElastic(event);
|
||||
this.wayUI.redraw();
|
||||
return this;
|
||||
|
||||
} else if (event.type=='mousemove') {
|
||||
// Mouse moved, update elastic
|
||||
this.updateElastic(event);
|
||||
return this;
|
||||
|
||||
} else if (event.type=='mousedown') {
|
||||
switch (entityType) {
|
||||
case 'node':
|
||||
// Click on node
|
||||
if (entity === this.getDrawingNode()) {
|
||||
// Double-click, so complete drawing
|
||||
this.controller.stepper.step(2);
|
||||
return new iD.controller.edit.SelectedWay(this.way, null);
|
||||
} else if (entity === this.getStartNode()) {
|
||||
// Start of this way, so complete drawing
|
||||
this.appendNode(entity, this.undoAdder() );
|
||||
this.controller.stepper.step(2);
|
||||
return new iD.controller.edit.SelectedWay(this.way, null);
|
||||
} else {
|
||||
// Add to way
|
||||
this.appendNode(entity, this.undoAdder() );
|
||||
return this;
|
||||
}
|
||||
break;
|
||||
|
||||
case 'way':
|
||||
// Click on way, add new junction node to way
|
||||
ways = [entity]; // ** needs to find all the ways under the mouse
|
||||
undo = new iD.actions.CompositeUndoableAction();
|
||||
var node=this.appendNewNode(event, undo);
|
||||
_.each(ways, function(w) {
|
||||
w.doInsertNodeAtClosestPosition(node, true, _.bind(undo.push, this));
|
||||
});
|
||||
action = this.undoAdder();
|
||||
action(undo);
|
||||
return this;
|
||||
}
|
||||
|
||||
} else if (event.type=='click') {
|
||||
// Click on empty space, add new node to way
|
||||
undo = new iD.actions.CompositeUndoableAction();
|
||||
this.appendNewNode(event, undo);
|
||||
action = this.undoAdder(); action(undo);
|
||||
return this;
|
||||
}
|
||||
|
||||
return this;
|
||||
},
|
||||
|
||||
updateElastic:function(event) {
|
||||
var map = this.controller.map;
|
||||
map.drawElastic(
|
||||
map.lon2coord(this.getDrawingNode().lon),
|
||||
map.lat2coord(this.getDrawingNode().lat),
|
||||
map.mouseX(event), map.mouseY(event)
|
||||
);
|
||||
},
|
||||
|
||||
getDrawingNode:function() {
|
||||
return this.editEnd ?
|
||||
this.way.nodes[this.way.nodes.length - 1] : this.way.nodes[0];
|
||||
},
|
||||
|
||||
getStartNode:function() {
|
||||
return this.editEnd ?
|
||||
this.way.nodes[0] : this.way.nodes[this.way.nodes.length - 1];
|
||||
},
|
||||
|
||||
appendNode:function(node, performAction) {
|
||||
if (this.editEnd) {
|
||||
this.way.doAppendNode(node, performAction);
|
||||
this.controller.map.refreshUI(this.way);
|
||||
} else {
|
||||
this.way.doPrependNode(node, performAction);
|
||||
}
|
||||
},
|
||||
|
||||
appendNewNode:function(event, undo) {
|
||||
var map = this.controller.map;
|
||||
var push = _.bind(undo.push, undo);
|
||||
var node = this.getConnection().doCreateNode({},
|
||||
map.coord2lat(map.mouseY(event)),
|
||||
map.coord2lon(map.mouseX(event)), push);
|
||||
this.appendNode(node, push);
|
||||
return node;
|
||||
}
|
||||
});
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
// End of module
|
||||
});
|
||||
@@ -1,98 +0,0 @@
|
||||
// iD/controller/shape/NoSelection.js
|
||||
|
||||
/*
|
||||
Add road or shape -> NoSelection
|
||||
|
||||
The user has clicked 'Add road or shape', but hasn't yet started drawing.
|
||||
|
||||
Goes to:
|
||||
-> click empty area: goes to shape/DrawWay
|
||||
-> click way: goes to shape/SelectedWay
|
||||
-> click way-node: goes to shape/SelectedWayNode
|
||||
-> click POI: ** not done yet, needs to ask "convert to shape"?
|
||||
|
||||
*/
|
||||
|
||||
define(['dojo/_base/declare',
|
||||
'iD/actions/UndoableAction',
|
||||
'iD/controller/shape/DrawWay',
|
||||
'iD/controller/shape/SelectedWay',
|
||||
'iD/controller/shape/SelectedPOINode'
|
||||
], function(declare) {
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
// ControllerState base class
|
||||
|
||||
declare("iD.controller.shape.NoSelection", null, {
|
||||
|
||||
constructor: function(intent) {
|
||||
// summary: In 'Draw shape' mode but nothing is selected.
|
||||
this.intent = intent;
|
||||
},
|
||||
|
||||
exitState: function() {
|
||||
this.controller.map.div.className = '';
|
||||
},
|
||||
|
||||
enterState: function() {
|
||||
this.controller.map.div.className = 'state-drawing';
|
||||
if (this.intent === 'way') {
|
||||
this.controller.stepper.show().step(0);
|
||||
} else if (this.intent === 'node') {
|
||||
this.controller.stepper.show().message('Click on the map to add a place');
|
||||
}
|
||||
},
|
||||
|
||||
processMouseEvent: function(event, entityUI) {
|
||||
var entity = entityUI ? entityUI.entity : null;
|
||||
var entityType = entity ? entity.type : null;
|
||||
var map = this.controller.map;
|
||||
var connection = map.connection;
|
||||
|
||||
if (event.type === 'click') {
|
||||
if (entityType === 'node') {
|
||||
// Click to select a node
|
||||
var ways = entity.parentWays();
|
||||
if (!ways.length) { return new iD.controller.shape.SelectedPOINode(entity); }
|
||||
// else { return new iD.controller.shape.SelectedWayNode(entity,ways[0]); }
|
||||
// ** FIXME: ^^^ the above should start a new branching way, not select the node
|
||||
return this;
|
||||
} else if (entityType === 'way') {
|
||||
if (this.intent === 'way') {
|
||||
// Click to select a way
|
||||
return new iD.controller.shape.SelectedWay(entityUI.entity);
|
||||
}
|
||||
} else {
|
||||
if (this.intent === 'way') {
|
||||
// Click to start a new way
|
||||
var undo = new iD.actions.CompositeUndoableAction();
|
||||
var startNode = connection.doCreateNode({},
|
||||
map.coord2lat(map.mouseY(event)),
|
||||
map.coord2lon(map.mouseX(event)), _.bind(undo.push, undo) );
|
||||
var way = connection.doCreateWay({}, [startNode], _.bind(undo.push, undo) );
|
||||
this.controller.undoStack.addAction(undo);
|
||||
this.controller.map.createUI(way);
|
||||
return new iD.controller.shape.DrawWay(way);
|
||||
} else if (this.intent === 'node') {
|
||||
var action = new iD.actions.CreatePOIAction(connection, {},
|
||||
map.coord2lat(map.mouseY(event)),
|
||||
map.coord2lon(map.mouseX(event)));
|
||||
if (action.run()) {
|
||||
this.controller.undoStack.add(action);
|
||||
var node = action.getNode();
|
||||
this.controller.map.createUI(node);
|
||||
var state = new iD.controller.edit.SelectedPOINode(node);
|
||||
state.controller = this.controller;
|
||||
state.enterState();
|
||||
return state;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return this;
|
||||
}
|
||||
});
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
// End of module
|
||||
});
|
||||
@@ -1,35 +0,0 @@
|
||||
// iD/controller/shape/SelectedPOINode.js
|
||||
|
||||
/*
|
||||
Add road or shape -> SelectedPOINode
|
||||
|
||||
The user has clicked 'Add road or shape', then a POI node to be converted to a way.
|
||||
|
||||
*/
|
||||
|
||||
define(['dojo/_base/declare',
|
||||
'iD/actions/UndoableAction'
|
||||
], function(declare){
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
// SelectedPOINode class
|
||||
|
||||
declare("iD.controller.shape.SelectedPOINode", null, {
|
||||
|
||||
constructor:function() {
|
||||
// summary: In 'Draw shape' mode and a POI node is selected, to be converted into a way.
|
||||
// Not yet implemented.
|
||||
},
|
||||
|
||||
processMouseEvent:function(event,entityUI) {
|
||||
var entity=entityUI ? entityUI.entity : null;
|
||||
var entityType=entity ? entity.entityType : null;
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
// End of module
|
||||
});
|
||||
@@ -1,93 +0,0 @@
|
||||
// iD/controller/shape/SelectedWay.js
|
||||
|
||||
// ## Add road or shape -> SelectedWay
|
||||
//
|
||||
// The user has clicked 'Add road or shape',
|
||||
// then clicks an existing way that their new way will be connected
|
||||
// to.
|
||||
|
||||
define(['dojo/_base/declare',
|
||||
'iD/actions/UndoableAction'
|
||||
], function(declare) {
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
// SelectedWayNode class
|
||||
|
||||
declare("iD.controller.shape.SelectedWay", null, {
|
||||
|
||||
way: null,
|
||||
wayUI: null,
|
||||
|
||||
constructor: function(way) {
|
||||
// summary: In 'Draw shape' mode, and a way is selected as the starting point of the new way.
|
||||
this.way = way;
|
||||
},
|
||||
|
||||
enterState: function() {
|
||||
this.wayUI = this.controller.map.getUI(this.way);
|
||||
this.wayUI.setStateClass('selected')
|
||||
.setStateClass('shownodes')
|
||||
.redraw();
|
||||
this.controller.stepper.message("Click the point on the way where you want to start your new way");
|
||||
return this;
|
||||
},
|
||||
|
||||
exitState: function() {
|
||||
this.wayUI.resetStateClass('selected')
|
||||
.resetStateClass('shownodes')
|
||||
.redraw();
|
||||
return this;
|
||||
},
|
||||
|
||||
processMouseEvent: function(event, entityUI) {
|
||||
var entity = entityUI ? entityUI.entity : null;
|
||||
var entityType = entity ? entity.type : null;
|
||||
var way;
|
||||
|
||||
if (event.type === 'click') {
|
||||
switch (entityType) {
|
||||
case null:
|
||||
return new iD.controller.shape.NoSelection();
|
||||
case 'node':
|
||||
var ways = entity.entity.parentWays();
|
||||
if (entity.entity.hasParent(this.way)) {
|
||||
// start a branching way from an existing point
|
||||
way = this.getConnection().doCreateWay({}, [entity], _.bind(this.undoAdder, this));
|
||||
this.controller.map.createUI(way);
|
||||
return new iD.controller.shape.DrawWay(way);
|
||||
} else if (ways.length===0) {
|
||||
// convert POI into way
|
||||
return this;
|
||||
} else {
|
||||
// select another way
|
||||
return new iD.controller.shape.SelectedWay(entity.getParents()[0]);
|
||||
}
|
||||
break;
|
||||
case 'way':
|
||||
if (entity === this.way) {
|
||||
// start a branching way from a new point
|
||||
var map = this.controller.map;
|
||||
var undo = new iD.actions.CompositeUndoableAction();
|
||||
var startNode = this.getConnection().doCreateNode({},
|
||||
map.coord2lat(map.mouseY(event)),
|
||||
map.coord2lon(map.mouseX(event)), _.bind(undo.push, undo));
|
||||
entity.doInsertNodeAtClosestPosition(startNode, true, _.bind(undo.push, undo));
|
||||
way = this.getConnection().doCreateWay({}, [startNode], _.bind(undo.push, undo) );
|
||||
this.controller.undoStack.addAction(undo);
|
||||
this.controller.map.createUI(way);
|
||||
return new iD.controller.shape.DrawWay(way);
|
||||
} else {
|
||||
// select another way
|
||||
return new iD.controller.shape.SelectedWay(entity);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
// End of module
|
||||
});
|
||||
Reference in New Issue
Block a user