| 426 | | this.ovmap.setCenter(this.map.center, |
|---|
| 427 | | this.ovmap.getZoomForResolution(targetRes)); |
|---|
| | 439 | var center; |
|---|
| | 440 | if (this.ovmap.getProjection() != this.map.getProjection()) { |
|---|
| | 441 | center = this.map.center.clone(); |
|---|
| | 442 | center.transform(this.map.getProjectionObject(), |
|---|
| | 443 | this.ovmap.getProjectionObject() ); |
|---|
| | 444 | } else { |
|---|
| | 445 | center = this.map.center; |
|---|
| | 446 | } |
|---|
| | 447 | this.ovmap.setCenter(center, this.ovmap.getZoomForResolution( |
|---|
| | 448 | targetRes * this.resolutionFactor)); |
|---|
| | 510 | if (this.ovmap.getProjection() != this.map.getProjection()) { |
|---|
| | 511 | var sourceUnits = this.map.getProjectionObject().getUnits() || |
|---|
| | 512 | this.map.units || this.map.baseLayer.units; |
|---|
| | 513 | var targetUnits = this.ovmap.getProjectionObject().getUnits() || |
|---|
| | 514 | this.ovmap.units || this.ovmap.baseLayer.units; |
|---|
| | 515 | this.resolutionFactor = sourceUnits && targetUnits ? |
|---|
| | 516 | OpenLayers.INCHES_PER_UNIT[sourceUnits] / |
|---|
| | 517 | OpenLayers.INCHES_PER_UNIT[targetUnits] : 1; |
|---|
| | 518 | } |
|---|
| 496 | | // The base layer for overview map needs to be in the same projection |
|---|
| 497 | | // as the base layer for the main map. This should be made more robust. |
|---|
| 498 | | if(this.map.getUnits() != 'degrees') { |
|---|
| 499 | | if(this.ovmap.getProjection() && (this.map.getProjection() != this.ovmap.getProjection())) { |
|---|
| 500 | | OpenLayers.Console.userError(OpenLayers.i18n("sameProjection")); |
|---|
| 501 | | } |
|---|
| 502 | | } |
|---|
| 503 | | var pxBounds = this.getRectBoundsFromMapBounds(this.map.getExtent()); |
|---|
| | 526 | // If the projections differ we need to reproject |
|---|
| | 527 | var bounds; |
|---|
| | 528 | if (this.ovmap.getProjection() != this.map.getProjection()) { |
|---|
| | 529 | bounds = this.map.getExtent().transform( |
|---|
| | 530 | this.map.getProjectionObject(), |
|---|
| | 531 | this.ovmap.getProjectionObject() ); |
|---|
| | 532 | } else { |
|---|
| | 533 | bounds = this.map.getExtent(); |
|---|
| | 534 | } |
|---|
| | 535 | var pxBounds = this.getRectBoundsFromMapBounds(bounds); |
|---|