text: OpenLayers.Layer.PointGrid=OpenLayers.Class(OpenLayers.Layer.Vector,{dx:null,dy:null,ratio:1.5,maxFeatures:250,rotation:0,origin:null,gridBounds:null,initialize:function(e){e=e||{},OpenLayers.Layer.Vector.prototype.initialize.apply(this,[e.name,e])},setMap:function(e){OpenLayers.Layer.Vector.prototype.setMap.apply(this,arguments),e.events.register("moveend",this,this.onMoveEnd)},removeMap:function(e){e.events.unregister("moveend",this,this.onMoveEnd),OpenLayers.Layer.Vector.prototype.removeMap.apply(this,arguments)},setRatio:function(e){this.ratio=e,this.updateGrid(!0)},setMaxFeatures:function(e){this.maxFeatures=e,this.updateGrid(!0)},setSpacing:function(e,t){this.dx=e,this.dy=t||e,this.updateGrid(!0)},setOrigin:function(e){this.origin=e,this.updateGrid(!0)},getOrigin:function(){return this.origin||(this.origin=this.map.getExtent().getCenterLonLat()),this.origin},setRotation:function(e){this.rotation=e,this.updateGrid(!0)},onMoveEnd:function(){this.updateGrid()},getViewBounds:function(){var e=this.map.getExtent();if(this.rotation){var t=this.getOrigin(),i=new OpenLayers.Geometry.Point(t.lon,t.lat),n=e.toGeometry();n.rotate(-this.rotation,i),e=n.getBounds()}return e},updateGrid:function(e){if(e||this.invalidBounds()){var t=this.getViewBounds(),i=this.getOrigin(),n=new OpenLayers.Geometry.Point(i.lon,i.lat),r=t.getWidth(),o=t.getHeight(),s=r/o,a=Math.sqrt(this.dx*this.dy*this.maxFeatures/s),l=a*s,c=Math.min(r*this.ratio,l),u=Math.min(o*this.ratio,a),h=t.getCenterLonLat();this.gridBounds=new OpenLayers.Bounds(h.lon-c/2,h.lat-u/2,h.lon+c/2,h.lat+u/2);for(var d,p,f,m=Math.floor(u/this.dy),g=Math.floor(c/this.dx),y=i.lon+this.dx*Math.ceil((this.gridBounds.left-i.lon)/this.dx),v=i.lat+this.dy*Math.ceil((this.gridBounds.bottom-i.lat)/this.dy),b=Array(m*g),x=0;g>x;++x){d=y+x*this.dx;for(var C=0;m>C;++C)p=v+C*this.dy,f=new OpenLayers.Geometry.Point(d,p),this.rotation&&f.rotate(this.rotation,n),b[x*m+C]=new OpenLayers.Feature.Vector(f)}this.destroyFeatures(this.features,{silent:!0}),this.addFeatures(b,{silent:!0})}},invalidBounds:function(){return!this.gridBounds||!this.gridBounds.containsBounds(this.getViewBounds())},CLASS_NAME:"OpenLayers.Layer.PointGrid"});