mirror of
https://github.com/FoggedLens/iD.git
synced 2026-03-07 11:51:35 +00:00
Unify calling connection connection
This commit is contained in:
@@ -5,8 +5,6 @@
|
||||
<title>iD</title>
|
||||
<!-- load Dojo -->
|
||||
<link rel="stylesheet" href="http://ajax.googleapis.com/ajax/libs/dojo/1.8/dijit/themes/claro/claro.css">
|
||||
<link rel="stylesheet" href="http://ajax.googleapis.com/ajax/libs/dojo/1.8/dojox/layout/resources/FloatingPane.css">
|
||||
<link rel="stylesheet" href="http://ajax.googleapis.com/ajax/libs/dojo/1.8/dojox/layout/resources/ResizeHandle.css">
|
||||
<link rel="stylesheet" href="css/app.css">
|
||||
<script src="http://ajax.googleapis.com/ajax/libs/dojo/1.8/dojo/dojo.js" data-dojo-config="async: true, parseOnLoad: true, baseUrl: 'js/iD/'"></script>
|
||||
</head>
|
||||
@@ -24,7 +22,6 @@
|
||||
<script>
|
||||
|
||||
require(["dojo/dom-geometry","dojo/dom-class","dojo/on","dojo/dom","dojo/Evented",
|
||||
"dojox/layout/FloatingPane",
|
||||
"iD/actions/UndoStack",
|
||||
"iD/actions/CreatePOIAction",
|
||||
"iD/actions/AddNodeToWayAction",
|
||||
@@ -37,7 +34,7 @@ require(["dojo/dom-geometry","dojo/dom-class","dojo/on","dojo/dom","dojo/Evented
|
||||
"dojo/domReady!"], function(domGeom,domClass,on,dom,Evented){
|
||||
|
||||
var ruleset = new iD.styleparser.RuleSet();
|
||||
var conn = new iD.Connection("http://www.overpass-api.de/api/xapi?");
|
||||
var connection = new iD.Connection("http://www.overpass-api.de/api/xapi?");
|
||||
|
||||
// Load styles
|
||||
ruleset.registerCallback(styleLoaded);
|
||||
@@ -49,7 +46,7 @@ require(["dojo/dom-geometry","dojo/dom-class","dojo/on","dojo/dom","dojo/Evented
|
||||
lon: -1.49,
|
||||
zoom: 17,
|
||||
div: "map",
|
||||
connection: conn,
|
||||
connection: connection,
|
||||
width: dom.byId('map').offsetWidth,
|
||||
height: dom.byId('map').offsetHeight
|
||||
});
|
||||
|
||||
@@ -179,7 +179,7 @@ iD.Connection = function(apiURL) {
|
||||
}).object().value();
|
||||
}
|
||||
|
||||
function getNodes(obj,conn) {
|
||||
function getNodes(obj) {
|
||||
return _(obj.childNodes).chain()
|
||||
.filter(filterNodeName('nd'))
|
||||
.map(function(item) {
|
||||
@@ -187,7 +187,7 @@ iD.Connection = function(apiURL) {
|
||||
}).value();
|
||||
}
|
||||
|
||||
function getMembers(obj,conn) {
|
||||
function getMembers(obj) {
|
||||
return _(obj.childNodes).chain()
|
||||
.filter(filterNodeName('member'))
|
||||
.map(function(item) {
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
if (typeof iD === 'undefined') iD = {};
|
||||
|
||||
iD.Node = function(conn, id, lat, lon, tags, loaded) {
|
||||
iD.Node = function(connection, id, lat, lon, tags, loaded) {
|
||||
// summary: An OSM node.
|
||||
this.entityType = 'node';
|
||||
this.connection = conn;
|
||||
this.connection = connection;
|
||||
this.id = id;
|
||||
this._id = iD.Util.id();
|
||||
this.entity = new iD.Entity();
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
if (typeof iD === 'undefined') iD = {};
|
||||
|
||||
iD.Relation = function(conn, id, members, tags, loaded) {
|
||||
iD.Relation = function(connection, id, members, tags, loaded) {
|
||||
this.entityType = 'relation';
|
||||
this.connection = conn;
|
||||
this.connection = connection;
|
||||
this.id = id;
|
||||
this._id = iD.Util.id();
|
||||
this.members = members;
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
if (typeof iD === 'undefined') iD = {};
|
||||
|
||||
iD.Way = function(conn, id, nodes, tags, loaded) {
|
||||
iD.Way = function(connection, id, nodes, tags, loaded) {
|
||||
// summary: An OSM way.
|
||||
this.connection = conn;
|
||||
this.connection = connection;
|
||||
this.entityType = 'way';
|
||||
this.id = id;
|
||||
this._id = iD.Util.id();
|
||||
|
||||
@@ -30,7 +30,7 @@ declare("iD.renderer.EntityUI", null, {
|
||||
},
|
||||
getConnection:function() {
|
||||
// summary: Get the Connection from where the map draws its data.
|
||||
return this.map.conn; // iD.Connection
|
||||
return this.map.connection; // iD.Connection
|
||||
},
|
||||
targetGroup:function(groupType,sublayer) {
|
||||
// summary: Find a gfx.Group to render on.
|
||||
|
||||
@@ -25,7 +25,7 @@ declare("iD.renderer.Map", null, {
|
||||
surface: null, // <div>.surface containing the rendering
|
||||
container: null, // root-level group within the surface
|
||||
backdrop: null, // coloured backdrop (MapCSS canvas element)
|
||||
conn: null, // data store
|
||||
connection: null, // data store
|
||||
controller: null, // UI controller
|
||||
nodeuis: {}, // graphic representations of data
|
||||
wayuis: {}, // |
|
||||
@@ -80,7 +80,7 @@ declare("iD.renderer.Map", null, {
|
||||
}).setFill(new dojo.Color([255,255,245,1]));
|
||||
this.tilegroup = this.surface.createGroup();
|
||||
this.container = this.surface.createGroup();
|
||||
this.conn = obj.connection;
|
||||
this.connection = obj.connection;
|
||||
this.zoom = obj.zoom ? obj.zoom : 17;
|
||||
this.baselon = obj.lon;
|
||||
this.baselat = obj.lat;
|
||||
@@ -225,7 +225,7 @@ declare("iD.renderer.Map", null, {
|
||||
download: function() {
|
||||
// summary: Ask the connection to download data for the current viewport.
|
||||
$('#progress').show().addClass('spinner');
|
||||
this.conn.loadFromAPI(this.extent, _.bind(this.updateUIs, this));
|
||||
this.connection.loadFromAPI(this.extent, _.bind(this.updateUIs, this));
|
||||
},
|
||||
|
||||
updateUIs: function(redraw, remove) {
|
||||
@@ -236,7 +236,7 @@ declare("iD.renderer.Map", null, {
|
||||
|
||||
var m = this;
|
||||
var way, poi;
|
||||
var o = this.conn.getObjectsByBbox(this.extent);
|
||||
var o = this.connection.getObjectsByBbox(this.extent);
|
||||
|
||||
_(o.waysInside).chain()
|
||||
.filter(function(w) { return w.loaded; })
|
||||
|
||||
Reference in New Issue
Block a user