From 3b255c1fe9f2a37fbbeacf4d7559e9de105fa75d Mon Sep 17 00:00:00 2001 From: Tom MacWright Date: Tue, 13 Nov 2012 21:59:19 -0500 Subject: [PATCH] Remove unused files --- js/iD/controller/DrawWay.js | 8 - js/iD/controller/edit/NoSelection.js | 33 ---- js/iD/controller/edit/SelectedPOINode.js | 43 ----- js/iD/controller/edit/SelectedWay.js | 57 ------- js/iD/controller/edit/SelectedWayNode.js | 52 ------ js/iD/controller/edit/edit.js | 1 - js/iD/controller/shape/DrawWay.js | 188 ---------------------- js/iD/controller/shape/NoSelection.js | 98 ----------- js/iD/controller/shape/SelectedPOINode.js | 35 ---- js/iD/controller/shape/SelectedWay.js | 93 ----------- 10 files changed, 608 deletions(-) delete mode 100644 js/iD/controller/DrawWay.js delete mode 100755 js/iD/controller/edit/NoSelection.js delete mode 100755 js/iD/controller/edit/SelectedPOINode.js delete mode 100755 js/iD/controller/edit/SelectedWay.js delete mode 100755 js/iD/controller/edit/SelectedWayNode.js delete mode 100644 js/iD/controller/edit/edit.js delete mode 100644 js/iD/controller/shape/DrawWay.js delete mode 100644 js/iD/controller/shape/NoSelection.js delete mode 100644 js/iD/controller/shape/SelectedPOINode.js delete mode 100644 js/iD/controller/shape/SelectedWay.js diff --git a/js/iD/controller/DrawWay.js b/js/iD/controller/DrawWay.js deleted file mode 100644 index b07364d93..000000000 --- a/js/iD/controller/DrawWay.js +++ /dev/null @@ -1,8 +0,0 @@ -iD.DrawWay = { - enter: function(map) { - console.log('entering'); - return 'foo'; - }, - exit: function(map) { - } -}; diff --git a/js/iD/controller/edit/NoSelection.js b/js/iD/controller/edit/NoSelection.js deleted file mode 100755 index fadd88cb8..000000000 --- a/js/iD/controller/edit/NoSelection.js +++ /dev/null @@ -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; - } -}; diff --git a/js/iD/controller/edit/SelectedPOINode.js b/js/iD/controller/edit/SelectedPOINode.js deleted file mode 100755 index 2330f9e2d..000000000 --- a/js/iD/controller/edit/SelectedPOINode.js +++ /dev/null @@ -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; - } - -}; diff --git a/js/iD/controller/edit/SelectedWay.js b/js/iD/controller/edit/SelectedWay.js deleted file mode 100755 index 884da4eb5..000000000 --- a/js/iD/controller/edit/SelectedWay.js +++ /dev/null @@ -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; - } - -}; diff --git a/js/iD/controller/edit/SelectedWayNode.js b/js/iD/controller/edit/SelectedWayNode.js deleted file mode 100755 index efe347151..000000000 --- a/js/iD/controller/edit/SelectedWayNode.js +++ /dev/null @@ -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; - } - -}; diff --git a/js/iD/controller/edit/edit.js b/js/iD/controller/edit/edit.js deleted file mode 100644 index a6e693128..000000000 --- a/js/iD/controller/edit/edit.js +++ /dev/null @@ -1 +0,0 @@ -iD.controller.edit = {}; diff --git a/js/iD/controller/shape/DrawWay.js b/js/iD/controller/shape/DrawWay.js deleted file mode 100644 index 92cb2b051..000000000 --- a/js/iD/controller/shape/DrawWay.js +++ /dev/null @@ -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 -}); diff --git a/js/iD/controller/shape/NoSelection.js b/js/iD/controller/shape/NoSelection.js deleted file mode 100644 index b9b45e8fa..000000000 --- a/js/iD/controller/shape/NoSelection.js +++ /dev/null @@ -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 -}); diff --git a/js/iD/controller/shape/SelectedPOINode.js b/js/iD/controller/shape/SelectedPOINode.js deleted file mode 100644 index 554a503d5..000000000 --- a/js/iD/controller/shape/SelectedPOINode.js +++ /dev/null @@ -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 -}); diff --git a/js/iD/controller/shape/SelectedWay.js b/js/iD/controller/shape/SelectedWay.js deleted file mode 100644 index 2fb26371a..000000000 --- a/js/iD/controller/shape/SelectedWay.js +++ /dev/null @@ -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 -});