О немО себе[code]/maps/
[code] | SparseTileLayer.js
kMaps
4D
  SparseTileLayer.js
  auto_registrator_cc.c
  ed_line.c
  array-speed.php
  ed_line.cc.c
  codeZ.php
  time.php
  auto_registrator.c
 
var SparseTileLayerOverlay_tear=0;


var 
SparseTileLayerOverlay = function (){
    if(!
SparseTileLayerOverlay_tear)
    {
        
this.tear();
        return new 
SparseTileLayerOverlay();
    }else
    {
        
this.loop=0;
        
this.isActive=0;
    }
}

SparseTileLayerOverlay.prototype.tear = function ()
{
 
SparseTileLayerOverlay_tear=1;
 
SparseTileLayerOverlay.prototype=new google.maps.OverlayView;

SparseTileLayerOverlay.prototype.setUrl=function(xy,z){return [];}

SparseTileLayerOverlay.prototype.loaded=function(e)
{
    
e=window.event window.event.srcElement e.currentTarget;

    
e.loaded=1;
    
e.failed=0;

    
e.style.display="";
}

SparseTileLayerOverlay.prototype.failed=function(e)
{
    
e=window.event window.event.srcElement e.currentTarget;

    
e.loaded=0;
    
e.failed=1;

    
e.style.display="none";
}

SparseTileLayerOverlay.prototype.idle=function(){
    
this.redraw();
}

SparseTileLayerOverlay.prototype.draw=function(){
    
this.redraw();
}

SparseTileLayerOverlay.prototype.show=function(){
    
this.isActive=1;
    if(
this.L)this.L.style.display='block';
}

SparseTileLayerOverlay.prototype.hide=function(){
    
this.isActive=0;
    if(
this.L)this.L.style.display='none';
}

SparseTileLayerOverlay.prototype.pushTo=function(e,a)
{
    if (
window.XMLHttpRequest)
    {
        
e.style.display="none";
        
e.loaded=0;
        
e.failed=0;
        
e.onload =this.loaded;
        
e.onerror=this.failed;
        
e.src=a;
    }
    
    else
    {
        
e.style.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+a+"',sizingMethod='scale')";
        
e.style.display="";
        
e.src=a;
    }  
}

SparseTileLayerOverlay.prototype.redraw=function()
{
    try{
    var 
a,b,c,d,e,f,g,h,i,j,k,l,o,p,q,r,s,t,u,v,w,x,y,z,iil;

    var 
X$=0,Y$=0,X_=0,Y_=0,X0=0,X1=0,Y0=0,Y1=0;

    var 
offset=268435456;

    var 
radius=offset/Math.PI;

    function 
LToX(x){return Math.round(offset+radius*x*Math.PI/180);}
    function 
LToY(y){return Math.round(offset-radius*Math.log((1+Math.sin(y*Math.PI/180))/(1-Math.sin(y*Math.PI/180)))/2);}
    function 
XToL(x){return ((Math.round(x)-offset)/radius)*180/Math.PI;}
    function 
YToL(y){return (Math.PI/2-2*Math.atan(Math.exp((Math.round(y)-offset)/radius)))*180/Math.PI;}
    function 
LLToXY(w,z){return {x:LToX(w.x)>>(21-z),y:LToY(w.y)>>(21-z)};}
    function 
XYToLL(w,z){return {x:XToL(w.x<<(21-z)),y:YToL(w.y<<(21-z))};}

    
w=this.getMap();
    
u=this.getPanes();
    if(!
|| !u.overlayLayer)return;
    
v=this.getProjection();

    if (!
w) return;
    if (!
u) return;
    if (!
v) return;

    
l=w.getDiv();

    
q=w.getBounds();
    
c=w.getCenter();
    
z=w.getZoom();

    
w=8;

    
q={x:LToX(c.lng())>>(21-z),y:LToY(c.lat())>>(21-z)};

    
c=v.fromLatLngToDivPixel(c);

    
X0=q.x-((l.offsetWidth +1)>>1);
    
X1=q.x+((l.offsetWidth +1)>>1);

    
Y0=q.y-((l.offsetHeight+1)>>1);
    
Y1=q.y+((l.offsetHeight+1)>>1);

    
X$=q.x-c.x;
    
Y$=q.y-c.y;

    
X_=1+((X1-X0)>>w)+1;
    
Y_=1+((Y1-Y0)>>w)+1;

    
X0=X0>>w;
    
X1=X0+X_;

    
Y0=Y0>>w;
    
Y1=Y0+Y_;

    if ((
z!=this.Z) || (X$!=this.X$) || (Y$!=this.Y$) || (X_!=this.X_) || (Y_!=this.Y_))
    {
        
l=this.L;
        if (
l)
        {
            for (
i=l.childNodes.length-1;i+1;i--)
            {
                
o=l.childNodes[i];

                
l.removeChild(o);
            }

            
u.overlayLayer.removeChild(l);

            
l=null;
        }

        
l=document.createElement("DIV");
        
l.style.display=this.isActive?"block":"none";

        if (
l)
        {
            
u.overlayLayer.appendChild(l);

            
l.style.position="absolute";

            for (
i=0;X_*Y_-i;i++)
            {
                
o=document.createElement("DIV");

                
l.appendChild(o);

                
o.style.position="absolute";
                
o.style.width=(1<<w);
                
o.style.height=(1<<w);
            }
        }

        
this.X$=X$;
        
this.Y$=Y$;

        
this.X_=X_;
        
this.Y_=Y_;

        
this.X0=0;
        
this.Y0=0;

        
this.X1=0;
        
this.Y1=0;

        
this.L=l;
        
this.Z=z;
    }

    if ((
z!=this.Z)+(X0<this.X0)+(Y0<this.Y0)+(X1>this.X1)+(Y1>this.Y1))
    {
        
//Post(X0+":"+X1+" "+Y0+":"+Y1);

        
l=this.L;

        
i=(0%X_)*Y_+(0%Y_);

        var 
knownset;
        var 
keep=0;
        
        for (
i=l.childNodes.length-1;i+1;i--){
            
e=l.childNodes[i];
            
e.used=0;
            if(
e.tileX>=X0 && e.tileX<X1 &&
               
e.tileY>=Y0 && e.tileY<Y1 )
            {
               
e.used=1;
               
keep++;
            }
        }
        
        
//Post("keeped:"+keep+" of "+l.childNodes.length);

        

        
for (y=Y0;Y1-y;y++)
        for (
x=X0;X1-x;x++)        
        {
            
a=this.setUrl({x:x,y:y},z);
            if (
typeof(a)!="object"a=[a];

            
i=((x+X_)%X_)*Y_+((y+Y_)%Y_);

            
o=0;
            
            for (
iil=l.childNodes.length-1;iil+1;iil--){
                
o=l.childNodes[i];
                if(
o.tileX==&& o.tileY==y)break;
                else 
o=0;
            }
            if(
o)
            {
                
o.used=1;
                continue;
            }
            
            for (
iil=l.childNodes.length-1;iil+1;iil--){
             
o=l.childNodes[i];
             if(!
o.used)break;else o=0;
            }
            if(!
o)
            {
                
//Post("not pass on "+iil+"::"+x+","+y);
                
break;
            }
            if(
o.tileX==&& o.tileY==y)break;
            
            
o.used=1;
            
o.tileX=x;
            
o.tileY=y;

            if (
a.length!=o.childNodes.length)
            {
                for (
i=o.childNodes.length-1;i+1;i--){
                    
e=o.childNodes[i];               
                    
o.removeChild(e);
                }
                for (
i=0;a[i];i++)
                {
                    
e=document.createElement(window.XMLHttpRequest "IMG" "DIV");
                    
o.appendChild(e);
                }
            }

            
//o.style.position="absolute";
            
            
            

            //if (a.length!=o.childNodes.length)
            
for (i=0;a[i];i++)
            {
                
e=o.childNodes[i];//document.createElement(window.XMLHttpRequest ? "IMG" : "DIV");

                //o.appendChild(e);
                
               //e.title=x+":"+y;

                
e.style.position="absolute";

                
e.style.left  =0+"px";
                
e.style.top   =0+"px";

                
e.style.width =(1<<w);
                
e.style.height=(1<<w);
                
this.pushTo(e,a[i]);
            }            
        }
        
        for (
i=l.childNodes.length-1;i+1;i--){
            
o=l.childNodes[i];
               
o.style.left  =((o.tileX<<w)-X$)+"px";
            
o.style.top   =((o.tileY<<w)-Y$)+"px";

            
o.style.width =(1<<w)+"px";
            
o.style.height=(1<<w)+"px";
        }

        
this.X0=X0;
        
this.Y0=Y0;

        
this.X1=X1;
        
this.Y1=Y1;

        
this.L=l;
        
this.Z=z;
    }

    
this.loop++;
    }catch(
e){
        
    }
}

}


[CODE]/SparseTileLayer.js

– Идиот! – весело сказал Кащей.
Мышцы радостно запели, настраиваясь на сражение.
– Делать котлеты – это мое призвание!
Дмитрий Мансуров