Merge pull request #2628 from fredj/scale-line
Take the 'us' and 'nautical' units into account in scale line control
This commit is contained in:
@@ -27,7 +27,9 @@
|
|||||||
<div id="map" class="map"></div>
|
<div id="map" class="map"></div>
|
||||||
<select id="units">
|
<select id="units">
|
||||||
<option value="degrees">degrees</option>
|
<option value="degrees">degrees</option>
|
||||||
<option value="imperial">imperial</option>
|
<option value="imperial">imperial inch</option>
|
||||||
|
<option value="us">us inch</option>
|
||||||
|
<option value="nautical">nautical mile</option>
|
||||||
<option value="metric">metric</option>
|
<option value="metric">metric</option>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -213,7 +213,9 @@ ol.control.ScaleLine.prototype.updateElement_ = function() {
|
|||||||
var units = this.getUnits();
|
var units = this.getUnits();
|
||||||
if (projectionUnits == ol.proj.Units.DEGREES &&
|
if (projectionUnits == ol.proj.Units.DEGREES &&
|
||||||
(units == ol.control.ScaleLineUnits.METRIC ||
|
(units == ol.control.ScaleLineUnits.METRIC ||
|
||||||
units == ol.control.ScaleLineUnits.IMPERIAL)) {
|
units == ol.control.ScaleLineUnits.IMPERIAL ||
|
||||||
|
units == ol.control.ScaleLineUnits.US ||
|
||||||
|
units == ol.control.ScaleLineUnits.NAUTICAL)) {
|
||||||
|
|
||||||
// Convert pointResolution from degrees to meters
|
// Convert pointResolution from degrees to meters
|
||||||
this.toEPSG4326_ = null;
|
this.toEPSG4326_ = null;
|
||||||
@@ -244,7 +246,9 @@ ol.control.ScaleLine.prototype.updateElement_ = function() {
|
|||||||
|
|
||||||
goog.asserts.assert(
|
goog.asserts.assert(
|
||||||
((units == ol.control.ScaleLineUnits.METRIC ||
|
((units == ol.control.ScaleLineUnits.METRIC ||
|
||||||
units == ol.control.ScaleLineUnits.IMPERIAL) &&
|
units == ol.control.ScaleLineUnits.IMPERIAL ||
|
||||||
|
units == ol.control.ScaleLineUnits.US ||
|
||||||
|
units == ol.control.ScaleLineUnits.NAUTICAL) &&
|
||||||
projectionUnits == ol.proj.Units.METERS) ||
|
projectionUnits == ol.proj.Units.METERS) ||
|
||||||
(units == ol.control.ScaleLineUnits.DEGREES &&
|
(units == ol.control.ScaleLineUnits.DEGREES &&
|
||||||
projectionUnits == ol.proj.Units.DEGREES));
|
projectionUnits == ol.proj.Units.DEGREES));
|
||||||
|
|||||||
Reference in New Issue
Block a user