| | 131 | /** Calculates using px-> lonlat translation functions on tl and br |
|---|
| | 132 | * corners of viewport |
|---|
| | 133 | * |
|---|
| | 134 | * @returns A Bounds object which represents the lon/lat bounds of the |
|---|
| | 135 | * current viewPort. |
|---|
| | 136 | * @type OpenLayers.Bounds |
|---|
| | 137 | */ |
|---|
| | 138 | getExtent: function () { |
|---|
| | 139 | |
|---|
| | 140 | var extent = null; |
|---|
| | 141 | |
|---|
| | 142 | if ((this.markers != null) || (this.markers.length > 0)) { |
|---|
| | 143 | var i=0; |
|---|
| | 144 | var tl = new OpenLayers.LonLat(180, -90); |
|---|
| | 145 | var br = new OpenLayers.LonLat(-180, 90); |
|---|
| | 146 | while(this.markers.length > i) { |
|---|
| | 147 | if (this.markers[i].lonlat.lon<tl.lon) tl.lon = this.markers[i].lonlat.lon; |
|---|
| | 148 | if (this.markers[i].lonlat.lon>br.lon) br.lon = this.markers[i].lonlat.lon; |
|---|
| | 149 | if (this.markers[i].lonlat.lat>tl.lat) tl.lat = this.markers[i].lonlat.lat; |
|---|
| | 150 | if (this.markers[i].lonlat.lat<br.lat) br.lat = this.markers[i].lonlat.lat; |
|---|
| | 151 | i++; |
|---|
| | 152 | } |
|---|
| | 153 | |
|---|
| | 154 | extent = new OpenLayers.Bounds(tl.lon, br.lat, br.lon, tl.lat); |
|---|
| | 155 | } |
|---|
| | 156 | return extent; |
|---|
| | 157 | }, |
|---|
| | 158 | |
|---|