| 426 | | this.ovmap.setCenter(this.map.center, |
|---|
| 427 | | this.ovmap.getZoomForResolution(targetRes)); |
|---|
| | 433 | var center; |
|---|
| | 434 | var factor = 1; |
|---|
| | 435 | if (this.ovmap.getProjection() != this.map.getProjection()) { |
|---|
| | 436 | var sourceProjection = new OpenLayers.Projection( |
|---|
| | 437 | this.map.getProjection()); |
|---|
| | 438 | var targetProjection = new OpenLayers.Projection( |
|---|
| | 439 | this.ovmap.getProjection()); |
|---|
| | 440 | var sourceUnits = sourceProjection.proj.units; |
|---|
| | 441 | if (sourceUnits == null) { |
|---|
| | 442 | sourceUnits = 'degrees'; |
|---|
| | 443 | } |
|---|
| | 444 | var targetUnits = targetProjection.proj.units; |
|---|
| | 445 | if (targetUnits == null) { |
|---|
| | 446 | targetUnits = 'degrees'; |
|---|
| | 447 | } |
|---|
| | 448 | factor = OpenLayers.INCHES_PER_UNIT[targetUnits] / |
|---|
| | 449 | OpenLayers.INCHES_PER_UNIT[sourceUnits]; |
|---|
| | 450 | center = this.map.center.clone(); |
|---|
| | 451 | center.transform(new OpenLayers.Projection( |
|---|
| | 452 | this.map.getProjection()), |
|---|
| | 453 | new OpenLayers.Projection(this.ovmap.getProjection()) ); |
|---|
| | 454 | } else { |
|---|
| | 455 | center = this.map.center; |
|---|
| | 456 | } |
|---|
| | 457 | this.ovmap.setCenter(center, |
|---|
| | 458 | this.ovmap.getZoomForResolution(targetRes/factor)); |
|---|
| 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.units != 'degrees') { |
|---|
| 499 | | if(this.ovmap.getProjection() && (this.map.getProjection() != this.ovmap.getProjection())) { |
|---|
| 500 | | alert(OpenLayers.i18n("sameProjection")); |
|---|
| 501 | | } |
|---|
| | 527 | // If the projections differ we need to reproject |
|---|
| | 528 | var bounds; |
|---|
| | 529 | if (this.ovmap.getProjection() != this.map.getProjection()) { |
|---|
| | 530 | bounds = this.map.getExtent().transform(new OpenLayers.Projection( |
|---|
| | 531 | this.map.getProjection()), |
|---|
| | 532 | new OpenLayers.Projection(this.ovmap.getProjection()) ); |
|---|
| | 533 | } else { |
|---|
| | 534 | bounds = this.map.getExtent(); |
|---|