1
2
3
<label class="radio" for="bild-switch_2">
<input id="bild-switch_2" class="bild-switch_1a" type="radio" name="bilder" value="Bild2" onchange="checkedRadioBtn('Haus.png', [750, 547], [-20, -10, 55, 20])" />Haus
</label>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
function checkedRadioBtn(url, size, extProj){
var resultExt, r2 = 0, ext = 1;
if(extProj[0] < 0){
ext = extProj[0] * (-1);
//Dreisatz
resultExt = (((extProj[2] + ext)*size[1])/size[0])+extProj[1];
}else{
resultExt = (((extProj[2] - extProj[0])*size[1]) / size[0])-extProj[1];
}
resultExt.toFixed(2);
var newSizeProjection = new ol.proj.Projection({
code: 'metrics',
units: 'm',
extent: [extProj[0], extProj[1], extProj[2], resultExt] //Xmin, Ymin, Xmax, Ymax
});
//remove
map.removeLayer(baseLayer);
//get layers and remove marker
var allLayers = map.getLayers().getArray()[0];
map.removeLayer(allLayers);
for(var i = 0; i<icons.length; i++){
map.removeLayer(icons[i]);
}
var extent = newSizeProjection.getExtent();
var center = ol.extent.getCenter(extent);
var newV = new ol.View2D({
projection: newSizeProjection,
center: center,
zoom: 2
});
map.updateSize();
map.addLayer(newL);
map.getView().getView2D().setProjection(newSizeProjection);
map.getView().getView2D().setCenter(center);
$("#extentResult").text('Extent: ' +newSizeProjection.getExtent()[0].toFixed(2)+", "+newSizeProjection.getExtent()[1].toFixed(2)+", "+newSizeProjection.getExtent()[2].toFixed(2)+", "+newSizeProjection.getExtent()[3].toFixed(2));
1
2
3
4
5
6
7
8
9
map.on('click', function(evt){
var coordinate = evt.coordinate;
$("#result").text('You clicked here: x:' + coordinate[0].toFixed(2) + " m - y:" + coordinate[1].toFixed(2) + " m");
overlay.setPosition(coordinate);
content.innerHTML = '<p>You clicked here:</p></br><code>x: ' + coordinate[0].toFixed(2) + ' m </br> y: ' + coordinate[1].toFixed(2) + ' m</code>';
container.style.display = 'block';
});
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
map.on('click', function(evt){
coordinate = evt.coordinate;
if(document.getElementById('bild-switch_2').checked == true){
coordinate[0] = 45- coordinate[0];
coordinate[1] = coordinate[1];
overlay.setPosition(coordinate);
}else{
overlay.setPosition(coordinate);
}
$("#result").show();
$("#result").text('You clicked here: x:' + coordinate[0].toFixed(2) + " m - y:" + coordinate[1].toFixed(2) + " m");
content.innerHTML = '<p>You clicked here:</p></br><code>x: ' + coordinate[0].toFixed(2) + ' m </br> y: ' + coordinate[1].toFixed(2) + ' m</code>';
container.style.display = 'block';
});
1
2
3
4
5
6
7
8
9
10
11
12
map.on('click', function(evt){
coordinate = evt.coordinate;
overlay.setPosition(coordinate);
var v= (document.getElementById('bild-switch_2').checked)? 45 - coordinate[0] : coordinate[0];
content.innerHTML = '<p>You clicked here:</p></br><code>x: ' +v.toFixed(2) +' m</code></br><code>y: '+ coordinate[1].toFixed(2) + ' m</code>';
container.style.display = 'block';
});