Skip to content

Instantly share code, notes, and snippets.

@wboykinm
Created April 24, 2013 13:33
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wboykinm/5452155 to your computer and use it in GitHub Desktop.
Save wboykinm/5452155 to your computer and use it in GitHub Desktop.
Sketch OSMBuildings - http://osmbuildings.org/sketch/
(function (j) {
function O(o, q) {
var A = o[0] - q[0],
g = o[1] - q[1];
return A * A + g * g
}
function Na(o) {
for (var q = 0, A = 0, g = 0, i = o.length - 3; g < i; g += 2) {
q += o[g];
A += o[g + 1]
}
o = (o.length - 2) * 2;
return [q / o << 0, A / o << 0]
}
function Oa(o) {
var q = o.length / 2,
A = new Pa(q),
g = 0,
i = q - 1,
n, t, r, G, K = [],
P = [],
N = [];
for (A[g] = A[i] = 1; i;) {
t = 0;
for (n = g + 1; n < i; n++) {
r = o[n * 2];
var Y = o[n * 2 + 1],
Q = o[g * 2],
M = o[g * 2 + 1],
ga = o[i * 2],
$ = o[i * 2 + 1],
x = ga - Q,
u = $ - M,
D = void 0;
if (x !== 0 || u !== 0) {
D = ((r - Q) * x + (Y - M) * u) / (x * x + u * u);
if (D > 1) {
Q = ga;
M = $
} else if (D > 0) {
Q += x * D;
M += u * D
}
}
x = r - Q;
u = Y - M;
r = x *
x + u * u;
if (r > t) {
G = n;
t = r
}
}
if (t > 2) {
A[G] = 1;
K.push(g);
P.push(G);
K.push(G);
P.push(i)
}
g = K.pop();
i = P.pop()
}
for (n = 0; n < q; n++) A[n] && N.push(o[n * 2], o[n * 2 + 1]);
return N
}
var Qa = Qa || Array,
Pa = Pa || Array,
ba = Math,
Ta = ba.exp,
Ua = ba.log,
Va = ba.sin,
Wa = ba.cos,
Ea = ba.tan,
Xa = ba.atan,
la = ba.min,
Fa = ba.max,
xa = j.document,
X = function () {
function o(g, i, n) {
if (n < 0) n += 1;
if (n > 1) n -= 1;
if (n < 1 / 6) return g + (i - g) * 6 * n;
if (n < 0.5) return i;
if (n < 2 / 3) return g + (i - g) * (2 / 3 - n) * 6;
return g
}
function q(g, i, n, t) {
this.r = g;
this.g = i;
this.b = n;
this.a = arguments.length <
4 ? 1 : t
}
var A = q.prototype;
A.toString = function () {
return "rgba(" + [this.r << 0, this.g << 0, this.b << 0, this.a.toFixed(2)].join(",") + ")"
};
A.adjustLightness = function (g) {
var i = X.toHSLA(this);
i.l *= g;
i.l = Math.min(1, Math.max(0, i.l));
var n, t;
if (i.s === 0) g = n = t = i.l;
else {
t = i.l < 0.5 ? i.l * (1 + i.s) : i.l + i.s - i.l * i.s;
var r = 2 * i.l - t;
g = o(r, t, i.h + 1 / 3);
n = o(r, t, i.h);
t = o(r, t, i.h - 1 / 3)
}
return new X(g * 255 << 0, n * 255 << 0, t * 255 << 0, i.a)
};
A.adjustAlpha = function (g) {
return new X(this.r, this.g, this.b, this.a * g)
};
q.parse = function (g) {
g += "";
if (~g.indexOf("#")) {
g =
g.match(/^#?(\w{2})(\w{2})(\w{2})(\w{2})?$/);
return new X(parseInt(g[1], 16), parseInt(g[2], 16), parseInt(g[3], 16), g[4] ? parseInt(g[4], 16) / 255 : 1)
}
if (g = g.match(/rgba?\((\d+)\D+(\d+)\D+(\d+)(\D+([\d.]+))?\)/)) return new X(parseInt(g[1], 10), parseInt(g[2], 10), parseInt(g[3], 10), g[4] ? parseFloat(g[5], 10) : 1)
};
q.toHSLA = function (g) {
var i = g.r / 255,
n = g.g / 255,
t = g.b / 255,
r = Math.max(i, n, t),
G = Math.min(i, n, t),
K, P = (r + G) / 2,
N;
if (r === G) K = G = 0;
else {
N = r - G;
G = P > 0.5 ? N / (2 - r - G) : N / (r + G);
switch (r) {
case i:
K = (n - t) / N + (n < t ? 6 : 0);
break;
case n:
K =
(t - i) / N + 2;
break;
case t:
K = (i - n) / N + 4;
break
}
K /= 6
}
return {
h: K,
s: G,
l: P,
a: g.a
}
};
return q
}(),
Ya = function () {
var o = Math,
q = o.sin,
A = o.cos,
g = o.tan,
i = o.asin,
n = o.atan2,
t = o.PI,
r = 180 / t,
G = 357.5291 / r,
K = 0.98560028 / r,
P = 1.9148 / r,
N = 0.02 / r,
Y = 3.0E-4 / r,
Q = 102.9372 / r,
M = 23.45 / r,
ga = 280.16 / r,
$ = 360.9856235 / r;
return function (x, u, D) {
D = -D / r;
u = u / r;
x = x.valueOf() / 864E5 - 0.5 + 2440588;
var R = G + K * (x - 2451545),
I = P * q(R) + N * q(2 * R) + Y * q(3 * R);
I = R + Q + I + t;
R = i(q(I) * q(M));
I = n(q(I) * A(M), A(I));
D = ga + $ * (x - 2451545) - D - I;
return {
altitude: i(q(u) * q(R) + A(u) * A(R) *
A(D)),
azimuth: n(q(D), A(D) * q(u) - g(R) * A(u)) - t / 2
}
}
}(),
ma = Math.PI,
Ra = ma / 2,
Za = ma / 4,
$a = 180 / ma,
ab = 256,
Ga = 14,
na = "latitude",
oa = "longitude",
U = 0,
S = 1,
V = 2,
ca = 3,
ya = 4,
ha = 5,
da = 6;
j.OSMBuildings = function (o) {
function q(a, c) {
var b = {};
a /= pa;
c /= pa;
b[na] = c <= 0 ? 90 : c >= 1 ? -90 : $a * (2 * Xa(Ta(ma * (1 - 2 * c))) - Ra);
b[oa] = (a === 1 ? 1 : (a % 1 + 1) % 1) * 360 - 180;
return b
}
function A(a, c) {
return a.replace(/\{ *([\w_]+) *\}/g, function (b, d) {
return c[d]
})
}
function g(a, c) {
var b = new XMLHttpRequest;
b.onreadystatechange = function () {
if (b.readyState === 4)!b.status ||
b.status < 200 || b.status > 299 || b.responseText && c(JSON.parse(b.responseText))
};
b.open("GET", a);
b.send(null);
return b
}
function i() {
if (!(!Ha || T < Ga)) {
var a = q(I - D, aa - R),
c = q(I + x + D, aa + u + R);
za && za.abort();
za = g(A(Ha, {
w: a[oa],
n: a[na],
e: c[oa],
s: c[na],
z: T
}), n)
}
}
function n(a) {
var c, b, d, e = [],
f, h = f = 0;
ja = Ga;
P(T);
za = null;
if (!(!a || a.meta.z !== T)) {
d = a.meta;
b = a.data;
if (E && B && E.z === d.z) {
f = E.x - d.x;
h = E.y - d.y;
a = 0;
for (c = B.length; a < c; a++) e[a] = B[a][V][0] + f + "," + (B[a][V][1] + h)
}
E = d;
B = [];
a = 0;
for (c = b.length; a < c; a++) {
d = [];
if (!(b[a][S] >
qa)) {
f = Oa(b[a][V]);
if (!(f.length < 8)) {
d[V] = f;
d[ya] = Na(f);
d[U] = la(b[a][U], qa);
d[S] = b[a][S];
f = d[V][0] + "," + d[V][1];
d[ha] = !(e && ~e.indexOf(f));
d[ca] = [];
d[da] = [];
B.push(d)
}
}
}
N()
}
}
function t(a, c) {
var b = [],
d, e, f, h, k, m, l, y, v, F = Ia - T;
d = 0;
for (e = a.length; d < e; d++) {
k = a[d];
y = k[S] >> F;
if (!(y > qa)) {
m = k[V];
v = new Qa(m.length);
f = 0;
for (h = m.length - 1; f < h; f += 2) {
l = m[f + 1];
var w = la(1, Fa(0, 0.5 - Ua(Ea(Za + Ra * m[f] / 180)) / ma / 2));
l = {
x: (l / 360 + 0.5) * pa << 0,
y: w * pa << 0
};
v[f] = l.x;
v[f + 1] = l.y
}
v = Oa(v);
if (!(v.length < 8)) {
h = [];
h[V] = v;
h[ya] = Na(v);
h[U] =
la(k[U] >> F, qa);
h[S] = y;
h[ha] = c;
h[ca] = k[ca];
h[da] = [];
for (f = 0; f < 3; f++) if (h[ca][f]) h[da][f] = h[ca][f].adjustAlpha(Z) + "";
b.push(h)
}
}
}
return b
}
function r(a, c) {
if (typeof a === "object") K(a, !c);
else {
var b = xa.documentElement,
d = xa.createElement("script");
j.jsonpCallback = function (e) {
delete j.jsonpCallback;
b.removeChild(d);
K(e, !c)
};
b.insertBefore(d, b.lastChild).src = a.replace(/\{callback\}/, "jsonpCallback")
}
}
function G(a, c, b) {
if (b === undefined) b = [];
var d, e, f, h = a[0] ? a : a.features,
k, m, l, y, v, F = c ? 1 : 0,
w = c ? 0 : 1;
if (h) {
d = 0;
for (a = h.length; d < a; d++) G(h[d], c, b);
return b
}
if (a.type === "Feature") {
k = a.geometry;
d = a.properties
}
if (k.type === "Polygon") m = [k.coordinates];
if (k.type === "MultiPolygon") m = k.coordinates;
if (m) {
c = d.height;
if (d.color || d.wallColor) y = X.parse(d.color || d.wallColor);
if (d.roofColor) v = X.parse(d.roofColor);
d = 0;
for (a = m.length; d < a; d++) {
h = m[d][0];
l = [];
e = k = 0;
for (f = h.length; e < f; e++) {
l.push(h[e][F], h[e][w]);
k += c || h[e][2] || 0
}
if (k) {
e = [];
f = V;
var p = void 0,
s = void 0,
z = void 0,
C = void 0,
H = 0,
J = void 0,
ra = void 0;
J = 0;
for (ra = l.length -
3; J < ra; J += 2) {
p = l[J];
s = l[J + 1];
z = l[J + 2];
C = l[J + 3];
H += p * C - z * s
}
if ((H / 2 > 0 ? "CW" : "CCW") === "CW") l = l;
else {
p = [];
for (s = l.length - 2; s >= 0; s -= 2) p.push(l[s], l[s + 1]);
l = p
}
e[f] = l;
e[U] = k / h.length << 0;
e[ca] = [y || null, y ? y.adjustLightness(0.8) : null, v ? v : y ? y.adjustLightness(1.2) : ia];
b.push(e)
}
}
}
return b
}
function K(a, c) {
if (a) {
sa = G(a, c);
ja = 0;
P(T);
E = {
n: 90,
w: -180,
s: -90,
e: 180,
x: 0,
y: 0,
z: T
};
B = t(sa, true);
N()
} else {
sa = null;
Q()
}
}
function P(a) {
var c, b, d;
T = a;
pa = ab << T;
a = T;
c = ja;
b = Ia;
a = la(Fa(a, c), b);
Z = 1 - la(Fa(0 + (a - c) / (b - c) * 0.4, 0), 0.4);
Ja = ea.adjustAlpha(Z) +
"";
Ka = Aa.adjustAlpha(Z) + "";
ta = ia.adjustAlpha(Z) + "";
if (B) {
a = 0;
for (c = B.length; a < c; a++) {
d = B[a];
d[da] = [];
for (b = 0; b < 3; b++) if (d[ca][b]) d[da][b] = d[ca][b].adjustAlpha(Z) + ""
}
}
}
function N() {
clearInterval(La);
fa = 0;
Ba.render();
La = setInterval(function () {
fa += 0.1;
if (fa > 1) {
clearInterval(La);
fa = 1;
for (var a = 0, c = B.length; a < c; a++) B[a][ha] = 0
}
Ca.render();
Q()
}, 33)
}
function Y() {
Ca.render();
Ba.render();
Q()
}
function Q() {
W.clearRect(0, 0, x, u);
if (!(!E || !B || T < ja || ua)) {
var a, c, b, d, e, f, h, k, m, l = I - E.x,
y = aa - E.y,
v = Ba.getMaxHeight(),
F = [va + l, wa + y],
w, p, s, z, C, H;
B.sort(function (J, ra) {
return O(ra[ya], F) / ra[U] - O(J[ya], F) / J[U]
});
a = 0;
for (c = B.length; a < c; a++) {
e = B[a];
if (!(e[U] <= v)) {
p = false;
f = e[V];
w = [];
b = 0;
for (d = f.length - 1; b < d; b += 2) {
w[b] = k = f[b] - l;
w[b + 1] = m = f[b + 1] - y;
p || (p = k > 0 && k < x && m > 0 && m < u)
}
if (p) {
b = e[ha] ? e[U] * fa : e[U];
f = ka / (ka - b);
if (e[S]) {
b = e[ha] ? e[S] * fa : e[S];
h = ka / (ka - b)
}
k = [];
W.strokeStyle = "#666666";
b = 0;
for (d = w.length - 3; b < d; b += 2) {
m = w[b];
s = w[b + 1];
p = w[b + 2];
z = w[b + 3];
C = $(m, s, f);
H = $(p, z, f);
if (e[S]) {
s = $(m, s, h);
z = $(p, z, h);
m = s.x;
s = s.y;
p = z.x;
z = z.y
}
if ((p -
m) * (C.y - s) > (C.x - m) * (z - s)) {
W.fillStyle = m < p && s < z || m > p && s > z ? e[da][1] || Ka : e[da][0] || Ja;
ga([p, z, m, s, C.x, C.y, H.x, H.y], true)
}
k[b] = C.x;
k[b + 1] = C.y
}
W.fillStyle = e[da][2] || ta;
W.strokeStyle = "#333333";
ga(k, true)
}
}
}
}
}
function M(a, c, b, d, e) {
e.lineWidth = 2;
var f = b - a,
h = d - c,
k = Sa(f * f + h * h),
m = Sa(k),
l = Da(),
y = Da(),
v = Da() * m;
m = Da() * m;
e.bezierCurveTo(a + f * l + h / k * v, c + h * l - f / k * v, a + f * y - h / k * m, c + h * y + f / k * m, b, d)
}
function ga(a, c) {
if (a.length) {
W.beginPath();
W.moveTo(a[0], a[1]);
for (var b = 2, d = a.length; b < d; b += 2) M(a[b - 2], a[b - 1], a[b], a[b + 1],
W);
W.closePath();
c && W.stroke();
W.fill()
}
}
function $(a, c, b) {
return {
x: (a - va) * b + va << 0,
y: (c - wa) * b + wa << 0
}
}
var x = 0,
u = 0,
D = 0,
R = 0,
I = 0,
aa = 0,
T, pa, za, W, Ha, ea = new X(200, 190, 180),
Aa = ea.adjustLightness(0.8),
ia = ea.adjustLightness(1.2),
Ja = ea + "",
Ka = Aa + "",
ta = ia + "",
sa, E, B, fa = 1,
La, Z = 1,
ja = Ga,
Ia = 20,
qa, va, wa, ka, ua, Ma = {
container: null,
items: [],
init: function (a) {
var c = this.container = xa.createElement("DIV");
c.style.pointerEvents = "none";
c.style.position = "absolute";
c.style.left = 0;
c.style.top = 0;
Ca.init(this.create());
Ba.init(this.create());
W = this.create();
a.appendChild(c);
return c
},
create: function () {
var a = xa.createElement("CANVAS");
a.style.webkitTransform = "translate3d(0,0,0)";
a.style.imageRendering = "optimizeSpeed";
a.style.position = "absolute";
a.style.left = 0;
a.style.top = 0;
var c = a.getContext("2d");
c.lineCap = "round";
c.lineJoin = "round";
c.lineWidth = 1;
try {
c.mozImageSmoothingEnabled = false
} catch (b) {}
this.items.push(a);
this.container.appendChild(a);
return c
},
setSize: function (a, c) {
for (var b = this.items, d = 0, e = b.length; d < e; d++) {
b[d].width = a;
b[d].height =
c
}
}
}, Sa = Math.sqrt,
Da = Math.random,
Ca = {
context: null,
color: new X(0, 0, 0),
colorStr: this.color + "",
date: null,
alpha: 1,
length: 0,
directionX: 0,
directionY: 0,
init: function (a) {
this.context = a;
this.setDate((new Date).setHours(10))
},
render: function () {
var a = this.context,
c, b, d;
a.clearRect(0, 0, x, u);
if (!(!E || !B || T < ja || ua)) {
c = q(I + D, aa + R);
c = Ya(this.date, c.latitude, c.longitude);
if (!(c.altitude <= 0)) {
b = 1 / Ea(c.altitude);
d = 0.4 / b;
this.directionX = Wa(c.azimuth) * b;
this.directionY = Va(c.azimuth) * b;
this.color.a = d;
c = this.color + "";
var e,
f, h, k, m, l, y = I - E.x,
v = aa - E.y,
F, w, p, s, z, C, H, J;
a.beginPath();
b = 0;
for (d = B.length; b < d; b++) {
h = B[b];
w = false;
k = h[V];
F = [];
e = 0;
for (f = k.length - 1; e < f; e += 2) {
F[e] = m = k[e] - y;
F[e + 1] = l = k[e + 1] - v;
w || (w = m > 0 && m < x && l > 0 && l < u)
}
if (w) {
k = h[ha] ? h[U] * fa : h[U];
if (h[S]) k = h[ha] ? h[S] * fa : h[S];
m = null;
e = 0;
for (f = F.length - 3; e < f; e += 2) {
l = F[e];
p = F[e + 1];
w = F[e + 2];
s = F[e + 3];
H = this.project(l, p, k);
J = this.project(w, s, k);
if (h[S]) {
p = this.project(l, p, k);
s = this.project(w, s, k);
l = p.x;
p = p.y;
w = s.x;
s = s.y
}
if ((w - l) * (H.y - p) > (H.x - l) * (s - p)) {
if (m === 1) {
M(z, C, l, p,
a);
z = l;
C = p
}
m = 0;
if (!e) {
a.moveTo(l, p);
z = l;
C = p
}
M(z, C, w, s, a);
z = w;
C = s
} else {
if (m === 0) {
M(z, C, H.x, H.y, a);
z = H.x;
C = H.y
}
m = 1;
if (!e) {
a.moveTo(H.x, H.y);
z = H.x;
C = H.y
}
M(z, C, J.x, J.y, a);
z = J.x;
C = J.y
}
}
}
}
a.fillStyle = c;
a.fill()
}
}
},
project: function (a, c, b) {
return {
x: a + this.directionX * b,
y: c + this.directionY * b
}
},
setDate: function (a) {
this.date = a;
this.render()
}
}, Ba = {
context: null,
maxHeight: 8,
init: function (a) {
this.context = a
},
render: function () {
var a = this.context;
a.clearRect(0, 0, x, u);
if (!(!E || !B || T < ja || ua)) {
var c, b, d, e, f, h, k, m = I - E.x,
l = aa - E.y,
y, v, F, w;
a.fillStyle = ta;
a.strokeStyle = "#666666";
c = 0;
for (b = B.length; c < b; c++) {
d = B[c];
v = false;
f = d[V];
y = [];
d = 0;
for (e = f.length - 1; d < e; d += 2) {
y[d] = h = f[d] - m;
y[d + 1] = k = f[d + 1] - l;
v || (v = h > 0 && h < x && k > 0 && k < u)
}
if (v) {
a.beginPath();
d = 0;
for (e = y.length - 3; d < e; d += 2) {
v = y[d];
f = y[d + 1];
d ? M(F, w, v, f, a) : a.moveTo(v, f);
F = v;
w = f
}
a.closePath();
a.stroke();
a.fill()
}
}
}
},
getMaxHeight: function () {
return this.maxHeight
}
};
this.setStyle = function (a) {
a = (a = a) || {};
if (a.color || a.wallColor) {
ea = X.parse(a.color || a.wallColor);
Ja = ea.adjustAlpha(Z) +
"";
Aa = ea.adjustLightness(0.8);
Ka = Aa.adjustAlpha(Z) + "";
ia = ea.adjustLightness(1.2);
ta = ia.adjustAlpha(Z) + ""
}
if (a.roofColor) {
ia = X.parse(a.roofColor);
ta = ia.adjustAlpha(Z) + ""
}
Y();
return this
};
this.geoJSON = function (a, c) {
r(a, c);
return this
};
this.setCamOffset = function (a, c) {
va = D + a;
wa = u + c
};
this.setMaxZoom = function (a) {
Ia = a
};
this.setDate = function (a) {
Ca.setDate(a);
return this
};
this.appendTo = function (a) {
return Ma.init(a)
};
this.loadData = i;
this.onMoveEnd = function () {
var a = q(I, aa),
c = q(I + x, aa + u);
Y();
if (E && (a[na] > E.n ||
a[oa] < E.w || c[na] < E.s || c[oa] > E.e)) i()
};
this.onZoomEnd = function (a) {
ua = false;
P(a.zoom);
if (sa) {
B = t(sa);
Y()
} else {
Q();
i()
}
};
this.onZoomStart = function () {
ua = true;
Y()
};
this.setOrigin = function (a, c) {
I = a;
aa = c
};
this.setSize = function (a, c) {
x = a;
u = c;
D = x / 2 << 0;
R = u / 2 << 0;
va = D;
wa = u;
ka = x / 1.5 / Ea(45) << 0;
Ma.setSize(x, u);
qa = ka - 50
};
this.setZoom = P;
this.render = Q;
this.screenshot = function (a) {
a.push(function (c) {
Y();
for (var b = Ma.items, d = 0, e = b.length; d < e; d++) c.drawImage(b[d], 0, 0);
a.next()
})
};
Ha = o
};
j.OSMBuildings.VERSION = "0.1.8a";
j.OSMBuildings.ATTRIBUTION =
'&copy; <a href="http://osmbuildings.org">OSM Buildings</a>'
})(this);
L.BuildingsLayer = L.Class.extend({
map: null,
osmb: null,
container: null,
blockMoveEvent: null,
lastX: 0,
lastY: 0,
initialize: function (j) {
L.Util.setOptions(this, j)
},
onMove: function () {
var j = L.DomUtil.getPosition(this.map._mapPane);
this.osmb.setCamOffset(this.lastX - j.x, this.lastY - j.y);
this.osmb.render()
},
onMoveEnd: function () {
if (this.blockMoveEvent) this.blockMoveEvent = false;
else {
var j = L.DomUtil.getPosition(this.map._mapPane),
O = this.map.getPixelOrigin();
this.lastX = j.x;
this.lastY = j.y;
this.container.style.left = -j.x +
"px";
this.container.style.top = -j.y + "px";
this.osmb.setCamOffset(0, 0);
this.osmb.setSize(this.map._size.x, this.map._size.y);
this.osmb.setOrigin(O.x - j.x, O.y - j.y);
this.osmb.onMoveEnd()
}
},
onZoomStart: function () {
this.osmb.onZoomStart()
},
onZoomEnd: function () {
var j = L.DomUtil.getPosition(this.map._mapPane),
O = this.map.getPixelOrigin();
this.osmb.setOrigin(O.x - j.x, O.y - j.y);
this.osmb.onZoomEnd({
zoom: this.map._zoom
});
this.blockMoveEvent = true
},
addTo: function (j) {
j.addLayer(this);
return this
},
onAdd: function (j) {
this.map =
j;
j = this.map._panes.overlayPane;
if (this.osmb) j.appendChild(this.container);
else {
this.osmb = new OSMBuildings(this.options.url);
this.container = this.osmb.appendTo(j);
this.osmb.maxZoom = this.map._layersMaxZoom
}
j = L.DomUtil.getPosition(this.map._mapPane);
var O = this.map.getPixelOrigin();
this.osmb.setSize(this.map._size.x, this.map._size.y);
this.osmb.setOrigin(O.x - j.x, O.y - j.y);
this.osmb.setZoom(this.map._zoom);
this.container.style.left = -j.x + "px";
this.container.style.top = -j.y + "px";
this.map.on({
move: this.onMove,
moveend: this.onMoveEnd,
zoomstart: this.onZoomStart,
zoomend: this.onZoomEnd
}, this);
this.map.attributionControl.addAttribution(OSMBuildings.ATTRIBUTION);
this.osmb.loadData();
this.osmb.render()
},
onRemove: function (j) {
j.attributionControl.removeAttribution(OSMBuildings.ATTRIBUTION);
j.off({
move: this.onMove,
moveend: this.onMoveEnd,
zoomstart: this.onZoomStart,
zoomend: this.onZoomEnd
}, this);
this.container.parentNode.removeChild(this.container)
},
geoJSON: function (j, O) {
return this.osmb.geoJSON(j, O)
},
setStyle: function (j) {
return this.osmb.setStyle(j)
},
setDate: function (j) {
return this.osmb.setDate(j)
},
screenshot: function (j) {
return this.osmb.screenshot(j)
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment