| 32 | | this._addButton("pan", "panning-hand-off.png", "panning-hand-on.png", new OpenLayers.Pixel(100,47), sz); |
|---|
| | 33 | this._addButton("pan", "panning-hand-off.png", "panning-hand-on.png", new OpenLayers.Pixel(12,328), sz); |
|---|
| | 34 | this._addButton("measure", "measuring-stick-off.png", "measuring-stick-on.png", new OpenLayers.Pixel(12,356), sz); |
|---|
| | 35 | this.switchModeTo("pan"); |
|---|
| | 36 | this.map.events.register("zoomend", this, function() { this.switchModeTo("pan"); }); |
|---|
| | 112 | var distance = ""; |
|---|
| | 113 | if (this.measureStart) { |
|---|
| | 114 | measureEnd = this.map.getLonLatFromScreenPx(this.mouseDragStart); |
|---|
| | 115 | distance = OpenLayers.Util.distVincenty(this.measureStart, measureEnd); |
|---|
| | 116 | distance = Math.round(distance * 100) / 100; |
|---|
| | 117 | distance = distance + "km"; |
|---|
| | 118 | this.measureStartBox = this.measureBox; |
|---|
| | 119 | } |
|---|
| | 120 | this.measureStart = this.map.getLonLatFromScreenPx(this.mouseDragStart);; |
|---|
| | 121 | this.measureBox = OpenLayers.Util.createDiv(null, |
|---|
| | 122 | this.mouseDragStart.add( |
|---|
| | 123 | -2-parseInt(this.map.layerContainerDiv.style.left), |
|---|
| | 124 | -2-parseInt(this.map.layerContainerDiv.style.top)), |
|---|
| | 125 | null, |
|---|
| | 126 | null, |
|---|
| | 127 | "absolute"); |
|---|
| | 128 | this.measureBox.style.width="4px"; |
|---|
| | 129 | this.measureBox.style.height="4px"; |
|---|
| | 130 | this.measureBox.style.backgroundColor="red"; |
|---|
| | 131 | this.measureBox.style.zIndex = this.map.Z_INDEX_BASE["Popup"] - 1; |
|---|
| | 132 | this.map.layerContainerDiv.appendChild(this.measureBox); |
|---|
| | 133 | if (distance) { |
|---|
| | 134 | this.measureBoxDistance = OpenLayers.Util.createDiv(null, |
|---|
| | 135 | this.mouseDragStart.add( |
|---|
| | 136 | -2-parseInt(this.map.layerContainerDiv.style.left), |
|---|
| | 137 | 2-parseInt(this.map.layerContainerDiv.style.top)), |
|---|
| | 138 | null, |
|---|
| | 139 | null, |
|---|
| | 140 | "absolute"); |
|---|
| | 141 | |
|---|
| | 142 | this.measureBoxDistance.innerHTML = distance; |
|---|
| | 143 | this.measureBoxDistance.style.zIndex = this.map.Z_INDEX_BASE["Popup"] - 1; |
|---|
| | 144 | this.map.layerContainerDiv.appendChild(this.measureBoxDistance); |
|---|
| | 145 | this.measureDivs.append(this.measureBoxDistance); |
|---|
| | 146 | } |
|---|
| | 147 | this.measureBox.style.zIndex = this.map.Z_INDEX_BASE["Popup"] - 1; |
|---|
| | 148 | this.map.layerContainerDiv.appendChild(this.measureBox); |
|---|
| | 149 | this.measureDivs.append(this.measureBox); |
|---|