|
@@ 38-40 (lines=3) @@
|
| 35 |
|
this.direction.x*a,y:b.y+this.direction.y*a}},render:function(){var b=this.context,a,c,d;b.clearRect(0,0,B,v);if(!(!this.enabled||x<G||Q||(a=ja(W+p,fa+n),a=Ha(this.date,a.latitude,a.longitude),0>=a.altitude))){c=1/ka(a.altitude);d=5>c?0.75:1/c*5;this.direction.x=Fa(a.azimuth)*c;this.direction.y=Ea(a.azimuth)*c;var f,e,g,h;a=F.items;b.canvas.style.opacity=d/(2*C);b.shadowColor=this.blurColor;b.shadowBlur=C/2*this.blurSize;b.fillStyle=this.color;b.beginPath();d=0;for(c=a.length;d<c;d++)if(f=a[d],h= |
| 36 |
|
f.footprint,V(h)){e=1>f.scale?f.height*f.scale:f.height;g=0;f.minHeight&&(g=1>f.scale?f.minHeight*f.scale:f.minHeight);switch(f.shape){case "cylinder":w.shadow(b,f.center,f.radius,f.radius,e,g);break;case "cone":w.shadow(b,f.center,f.radius,0,e,g);break;case "dome":w.shadow(b,f.center,f.radius,f.radius/2,e,g);break;case "sphere":w.shadow(b,f.center,f.radius,f.radius,e,g);break;case "pyramid":R.shadow(b,h,f.center,e,g);break;default:Z.shadow(b,h,f.holes,e,g)}switch(f.roofShape){case "cone":w.shadow(b, |
| 37 |
|
f.center,f.radius,0,e+f.roofHeight,e);break;case "dome":w.shadow(b,f.center,f.radius,f.radius/2,e+f.roofHeight,e);break;case "pyramid":R.shadow(b,h,f.center,e+f.roofHeight,e)}}b.closePath();b.fill();b.shadowBlur=null;b.globalCompositeOperation="destination-out";b.beginPath();d=0;for(c=a.length;d<c;d++)if(f=a[d],h=f.footprint,V(h)&&!f.minHeight)switch(f.shape){case "cylinder":case "cone":case "dome":w.shadowMask(b,f.center,f.radius);break;default:Z.shadowMask(b,h,f.holes)}b.fillStyle="#00ff00";b.fill(); |
| 38 |
|
b.globalCompositeOperation="source-over"}}},Y={_idMapping:[null],reset:function(){this._idMapping=[null]},render:function(){if(!this._timer){var b=this;this._timer=setTimeout(function(){b._timer=null;b._render()},500)}},_render:function(){var b=this.context;b.clearRect(0,0,B,v);if(!(x<G||Q)){var a,c,d,f={x:M+p,y:N+n},e,g,h=F.items;h.sort(function(a,b){return a.minHeight-b.minHeight||S(b.center,f)-S(a.center,f)||b.height-a.height});for(var k=0,m=h.length;k<m;k++)if(a=h[k],g=a.hitColor)if(e=a.footprint, |
| 39 |
|
V(e)){c=a.height;d=0;a.minHeight&&(d=a.minHeight);switch(a.shape){case "cylinder":w.hitArea(b,a.center,a.radius,a.radius,c,d,g);break;case "cone":w.hitArea(b,a.center,a.radius,0,c,d,g);break;case "dome":w.hitArea(b,a.center,a.radius,a.radius/2,c,d,g);break;case "sphere":w.hitArea(b,a.center,a.radius,a.radius,c,d,g);break;case "pyramid":R.hitArea(b,e,a.center,c,d,g);break;default:Z.hitArea(b,e,a.holes,c,d,g)}switch(a.roofShape){case "cone":w.hitArea(b,a.center,a.radius,0,c+a.roofHeight,c,g);break; |
| 40 |
|
case "dome":w.hitArea(b,a.center,a.radius,a.radius/2,c+a.roofHeight,c,g);break;case "pyramid":R.hitArea(b,e,a.center,c+a.roofHeight,c,g)}}B&&v&&(this._imageData=this.context.getImageData(0,0,B,v).data)}},getIdFromXY:function(b,a){var c=this._imageData;if(c){var d=4*((a|0)*B+(b|0));return this._idMapping[c[d]|c[d+1]<<8|c[d+2]<<16]}},idToColor:function(b){var a=this._idMapping.indexOf(b);-1===a&&(this._idMapping.push(b),a=this._idMapping.length-1);return"rgb("+[a&255,a>>8&255,a>>16&255].join()+")"}}, |
| 41 |
|
$,A={container:document.createElement("DIV"),items:[],init:function(){this.container.style.pointerEvents="none";this.container.style.position="absolute";this.container.style.left=0;this.container.style.top=0;z.context=this.createContext(this.container);ia.context=this.createContext(this.container);r.context=this.createContext(this.container);Y.context=this.createContext()},render:function(b){Ga(function(){b||(z.render(),ia.render(),Y.render());r.render()})},createContext:function(b){var a=document.createElement("CANVAS"); |
| 42 |
|
a.style.transform="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;c.imageSmoothingEnabled=!1;this.items.push(a);b&&b.appendChild(a);return c},appendTo:function(b){b.appendChild(this.container)},remove:function(){this.container.parentNode.removeChild(this.container)},setSize:function(b,a){for(var c=0,d=this.items.length;c<d;c++)this.items[c].width=b,this.items[c].height= |
| 43 |
|
a},setPosition:function(b,a){this.container.style.left=b+"px";this.container.style.top=a+"px"}};A.init();u=function(b){this.offset={x:0,y:0};b&&b.addLayer(this)};t=u.prototype=L.Layer?new L.Layer:{};t.addTo=function(b){b.addLayer(this);return this};t.onAdd=function(b){this.map=b;A.appendTo(b._panes.overlayPane);var a=this.getOffset(),c=b.getPixelOrigin();la({width:b._size.x,height:b._size.y});var d=c.y-a.y;p=c.x-a.x;n=d;ma(b._zoom);A.setPosition(-a.x,-a.y);b.on({move:this.onMove,moveend:this.onMoveEnd, |
|
@@ 31-33 (lines=3) @@
|
| 28 |
|
e[1].y2),b.arc(f.x,f.y,d,h,g),b.arc(a.x,a.y,c,g,h)):(b.moveTo(a.x+c,a.y),b.arc(a.x,a.y,c,0,2*E));b.closePath();b.fill()},_circle:function(b,a,c){b.beginPath();b.arc(a.x,a.y,c,0,2*E);b.stroke();b.fill()},_tangents:function(b,a,c,d){var f=b.x-c.x,e=b.y-c.y,g=a-d,h=f*f+e*e;if(!(h<=g*g)){var h=pa(h),f=-f/h,e=-e/h,g=g/h,h=[],k,m,l;k=pa(K(0,1-g*g));for(var n=1;-1<=n;n-=2)m=f*g-n*k*e,l=e*g+n*k*f,h.push({x1:b.x+a*m<<0,y1:b.y+a*l<<0,x2:c.x+d*m<<0,y2:c.y+d*l<<0});return h}}},R={draw:function(b,a,c,d,f,e,g){var h= |
| 29 |
|
q/(q-f);c=r.project({x:c.x-p,y:c.y-n},q/(q-d));d={x:0,y:0};for(var k={x:0,y:0},m=0,l=a.length-3;m<l;m+=2)d.x=a[m]-p,d.y=a[m+1]-n,k.x=a[m+2]-p,k.y=a[m+3]-n,f&&(d=r.project(d,h),k=r.project(k,h)),(k.x-d.x)*(c.y-d.y)>(c.x-d.x)*(k.y-d.y)&&(b.fillStyle=d.x<k.x&&d.y<k.y||d.x>k.x&&d.y>k.y?g:e,b.beginPath(),this._triangle(b,d,k,c),b.closePath(),b.fill())},_triangle:function(b,a,c,d){b.moveTo(a.x,a.y);b.lineTo(c.x,c.y);b.lineTo(d.x,d.y)},_ring:function(b,a){b.moveTo(a[0]-p,a[1]-n);for(var c=2,d=a.length-1;c< |
| 30 |
|
d;c+=2)b.lineTo(a[c]-p,a[c+1]-n)},shadow:function(b,a,c,d,f){var e={x:0,y:0},g={x:0,y:0};c=z.project({x:c.x-p,y:c.y-n},d);d=0;for(var h=a.length-3;d<h;d+=2)e.x=a[d]-p,e.y=a[d+1]-n,g.x=a[d+2]-p,g.y=a[d+3]-n,f&&(e=z.project(e,f),g=z.project(g,f)),(g.x-e.x)*(c.y-e.y)>(c.x-e.x)*(g.y-e.y)&&this._triangle(b,e,g,c)},shadowMask:function(b,a){this._ring(b,a)},hitArea:function(b,a,c,d,f,e){var g=q/(q-f);c=r.project({x:c.x-p,y:c.y-n},q/(q-d));d={x:0,y:0};var h={x:0,y:0};b.fillStyle=e;b.beginPath();e=0;for(var k= |
| 31 |
|
a.length-3;e<k;e+=2)d.x=a[e]-p,d.y=a[e+1]-n,h.x=a[e+2]-p,h.y=a[e+3]-n,f&&(d=r.project(d,g),h=r.project(h,g)),(h.x-d.x)*(c.y-d.y)>(c.x-d.x)*(h.y-d.y)&&this._triangle(b,d,h,c);b.closePath();b.fill()}},r={project:function(b,a){return{x:(b.x-M)*a+M<<0,y:(b.y-N)*a+N<<0}},render:function(){var b=this.context;b.clearRect(0,0,B,v);if(!(x<G||Q)){var a,c,d,f={x:M+p,y:N+n},e,g,h,k,m=F.items;m.sort(function(a,b){return a.minHeight-b.minHeight||S(b.center,f)-S(a.center,f)||b.height-a.height});for(var l=0,q=m.length;l< |
| 32 |
|
q;l++)if(a=m[l],!ia.isSimple(a)&&(e=a.footprint,V(e))){c=1>a.scale?a.height*a.scale:a.height;d=0;a.minHeight&&(d=1>a.scale?a.minHeight*a.scale:a.minHeight);g=a.wallColor||ha;h=a.altColor||aa;k=a.roofColor||X;b.strokeStyle=h;switch(a.shape){case "cylinder":w.draw(b,a.center,a.radius,a.radius,c,d,g,h,k);break;case "cone":w.draw(b,a.center,a.radius,0,c,d,g,h);break;case "dome":w.draw(b,a.center,a.radius,a.radius/2,c,d,g,h);break;case "sphere":w.draw(b,a.center,a.radius,a.radius,c,d,g,h,k);break;case "pyramid":R.draw(b, |
| 33 |
|
e,a.center,c,d,g,h);break;default:Z.draw(b,e,a.holes,c,d,g,h,k)}switch(a.roofShape){case "cone":w.draw(b,a.center,a.radius,0,c+a.roofHeight,c,k,""+I.parse(k).lightness(0.9));break;case "dome":w.draw(b,a.center,a.radius,a.radius/2,c+a.roofHeight,c,k,""+I.parse(k).lightness(0.9));break;case "pyramid":R.draw(b,e,a.center,c+a.roofHeight,c,k,I.parse(k).lightness(0.9))}}}}},ia={maxZoom:G+2,maxHeight:5,isSimple:function(b){return x<=this.maxZoom&&b.height+b.roofHeight<this.maxHeight},render:function(){var b= |
| 34 |
|
this.context;b.clearRect(0,0,B,v);if(!(x<G||Q||x>this.maxZoom))for(var a,c,d=F.items,f=0,e=d.length;f<e;f++)if(a=d[f],!(a.height>=this.maxHeight)&&(c=a.footprint,V(c)))switch(b.strokeStyle=a.altColor||aa,b.fillStyle=a.roofColor||X,a.shape){case "cylinder":case "cone":case "dome":case "sphere":w.simplified(b,a.center,a.radius);break;default:Z.simplified(b,c,a.holes)}}},z={enabled:!0,color:"#666666",blurColor:"#000000",blurSize:15,date:new Date,direction:{x:0,y:0},project:function(b,a){return{x:b.x+ |
| 35 |
|
this.direction.x*a,y:b.y+this.direction.y*a}},render:function(){var b=this.context,a,c,d;b.clearRect(0,0,B,v);if(!(!this.enabled||x<G||Q||(a=ja(W+p,fa+n),a=Ha(this.date,a.latitude,a.longitude),0>=a.altitude))){c=1/ka(a.altitude);d=5>c?0.75:1/c*5;this.direction.x=Fa(a.azimuth)*c;this.direction.y=Ea(a.azimuth)*c;var f,e,g,h;a=F.items;b.canvas.style.opacity=d/(2*C);b.shadowColor=this.blurColor;b.shadowBlur=C/2*this.blurSize;b.fillStyle=this.color;b.beginPath();d=0;for(c=a.length;d<c;d++)if(f=a[d],h= |
| 36 |
|
f.footprint,V(h)){e=1>f.scale?f.height*f.scale:f.height;g=0;f.minHeight&&(g=1>f.scale?f.minHeight*f.scale:f.minHeight);switch(f.shape){case "cylinder":w.shadow(b,f.center,f.radius,f.radius,e,g);break;case "cone":w.shadow(b,f.center,f.radius,0,e,g);break;case "dome":w.shadow(b,f.center,f.radius,f.radius/2,e,g);break;case "sphere":w.shadow(b,f.center,f.radius,f.radius,e,g);break;case "pyramid":R.shadow(b,h,f.center,e,g);break;default:Z.shadow(b,h,f.holes,e,g)}switch(f.roofShape){case "cone":w.shadow(b, |