map for fewo rhein
This commit is contained in:
parent
0b647adc03
commit
3a2f301c04
@ -4,9 +4,10 @@ $(document).ready(function() {
|
||||
$('#menu div').removeClass('aktmenuitem');
|
||||
$(this).addClass('aktmenulink');
|
||||
$(this).parent().addClass('aktmenuitem');
|
||||
$('#content').load('http://mojotrollz.eu/web/rhein/index.php?page='+$(this).attr('page'),function(){
|
||||
if($(this).attr('page') == 'anreise'){
|
||||
initialize_map();}
|
||||
page = $(this).attr('page');
|
||||
$('#content').load('http://mojotrollz.eu/web/rhein/index.php?page='+page,function(){
|
||||
if(page === 'anreise'){
|
||||
drawmap();}
|
||||
});
|
||||
});
|
||||
});
|
||||
@ -4,9 +4,10 @@ class default_page extends SYSTEM\PAGE\Page {
|
||||
public static function js(){
|
||||
return '<script type="text/javascript" src="'.\SYSTEM\WEBPATH(new PLIB(),'jquery/jquery-1.9.1.min.js').'"></script>'.
|
||||
'<script type="text/javascript" src="'.\SYSTEM\WEBPATH(new PLIB(),'bootstrap/js/bootstrap.min.js').'"></script>'.
|
||||
'<script type="text/javascript" src="http://www.openlayers.org/api/OpenLayers.js"></script>'.
|
||||
'<script type="text/javascript" src="http://www.openstreetmap.org/openlayers/OpenStreetMap.js"></script>'.
|
||||
'<script type="text/javascript" src="'.\SYSTEM\WEBPATH(new PPAGE(),'default_page/default_page.js').'"></script>'.
|
||||
'<script src="http://maps.google.com/maps?file=api&v=2&key=ABQIAAAAd8T2YK0lOCLFeMqrYc2O1RStBS1POjc6f-MQn8XSSGdYfsrKkhTtJNQeylV0F6_0O9FqT3xkIAJKpA" type="text/javascript"></script>'.
|
||||
'<script type="text/javascript" src="'.\SYSTEM\WEBPATH(new PPAGE(),'default_page/google.js').'"></script>';
|
||||
'<script type="text/javascript" src="'.\SYSTEM\WEBPATH(new PPAGE(),'default_page/map.js').'"></script>';
|
||||
}
|
||||
public static function css(){
|
||||
return '<link rel="stylesheet" href="'.\SYSTEM\WEBPATH(new PLIB(),'bootstrap/css/bootstrap.min.css').'" type="text/css" />'.
|
||||
|
||||
@ -1,18 +0,0 @@
|
||||
function initialize_map()
|
||||
{
|
||||
if (GBrowserIsCompatible())
|
||||
{
|
||||
var map = new GMap2(document.getElementById("map_canvas"),{ size: new GSize(575,450) });
|
||||
map.enableScrollWheelZoom();
|
||||
map.setCenter(new GLatLng(49.727620, 8.611300), 14);
|
||||
map.addControl(new GSmallMapControl());
|
||||
map.addControl(new GMapTypeControl());
|
||||
|
||||
var latlng = new GLatLng(49.732810, 8.608990);
|
||||
map.addOverlay(new GMarker(latlng,{draggable: true}));
|
||||
map.openInfoWindowHtml(latlng,"<h3>Ferienwohnung Rhein</h3>Lange Hart 30");
|
||||
|
||||
//var latlng2 = new GLatLng(49.725631, 8.609151);
|
||||
//map.addOverlay(new GMarker(latlng2,{draggable: true}));
|
||||
}
|
||||
}
|
||||
123
rhein/page/default_page/map.js
Normal file
123
rhein/page/default_page/map.js
Normal file
@ -0,0 +1,123 @@
|
||||
/*function initialize_map()
|
||||
{
|
||||
if (GBrowserIsCompatible())
|
||||
{
|
||||
var map = new GMap2(document.getElementById("map_canvas"),{ size: new GSize(575,450) });
|
||||
map.enableScrollWheelZoom();
|
||||
map.setCenter(new GLatLng(49.727620, 8.611300), 14);
|
||||
map.addControl(new GSmallMapControl());
|
||||
map.addControl(new GMapTypeControl());
|
||||
|
||||
var latlng = new GLatLng(49.732810, 8.608990);
|
||||
map.addOverlay(new GMarker(latlng,{draggable: true}));
|
||||
map.openInfoWindowHtml(latlng,"<h3></h3>");
|
||||
|
||||
//var latlng2 = new GLatLng(49.725631, 8.609151);
|
||||
//map.addOverlay(new GMarker(latlng2,{draggable: true}));
|
||||
}
|
||||
}*/
|
||||
|
||||
var map;
|
||||
var layer_mapnik;
|
||||
var layer_tah;
|
||||
var layer_markers;
|
||||
|
||||
function drawmap() {
|
||||
// Popup und Popuptext mit evtl. Grafik
|
||||
var popuptext="<font color=\"black\"><b>Ferienwohnung Rhein<br>Lange Hart 30<br>64673 Zwingenberg</b><p><img src=\"http://mojotrollz.eu/web/rhein/api.php?call=files&cat=page&id=house_overview.jpg\" width=\"120\" height=\"100\"></p></font>";
|
||||
|
||||
OpenLayers.Lang.setCode('de');
|
||||
|
||||
// Position und Zoomstufe der Karte
|
||||
var lon = 8.60884488;
|
||||
var lat = 49.73296614;
|
||||
var zoom = 17;
|
||||
|
||||
map = new OpenLayers.Map('map', {
|
||||
projection: new OpenLayers.Projection("EPSG:900913"),
|
||||
displayProjection: new OpenLayers.Projection("EPSG:4326"),
|
||||
controls: [
|
||||
new OpenLayers.Control.Navigation(),
|
||||
//new OpenLayers.Control.LayerSwitcher(),
|
||||
new OpenLayers.Control.PanZoomBar()],
|
||||
//maxExtent:
|
||||
// new OpenLayers.Bounds(-20037508.34,-20037508.34,
|
||||
// 20037508.34, 20037508.34),
|
||||
numZoomLevels: 18,
|
||||
maxResolution: 156543,
|
||||
units: 'meters'
|
||||
});
|
||||
|
||||
layer_mapnik = new OpenLayers.Layer.OSM.Mapnik("Mapnik");
|
||||
layer_markers = new OpenLayers.Layer.Markers("Address", { projection: new OpenLayers.Projection("EPSG:4326"),
|
||||
visibility: true, displayInLayerSwitcher: false });
|
||||
|
||||
map.addLayers([layer_mapnik, layer_markers]);
|
||||
jumpTo(lon, lat, zoom);
|
||||
|
||||
// Position des Markers
|
||||
addMarker(layer_markers, 8.60884488, 49.73296614, popuptext);
|
||||
|
||||
}
|
||||
function jumpTo(lon, lat, zoom) {
|
||||
var x = Lon2Merc(lon);
|
||||
var y = Lat2Merc(lat);
|
||||
map.setCenter(new OpenLayers.LonLat(x, y), zoom);
|
||||
return false;
|
||||
}
|
||||
function Lon2Merc(lon) {
|
||||
return 20037508.34 * lon / 180;
|
||||
}
|
||||
|
||||
function Lat2Merc(lat) {
|
||||
var PI = 3.14159265358979323846;
|
||||
lat = Math.log(Math.tan( (90 + lat) * PI / 360)) / (PI / 180);
|
||||
return 20037508.34 * lat / 180;
|
||||
}
|
||||
|
||||
function addMarker(layer, lon, lat, popupContentHTML) {
|
||||
|
||||
var ll = new OpenLayers.LonLat(Lon2Merc(lon), Lat2Merc(lat));
|
||||
var feature = new OpenLayers.Feature(layer, ll);
|
||||
feature.closeBox = true;
|
||||
feature.popupClass = OpenLayers.Class(OpenLayers.Popup.FramedCloud, {minSize: new OpenLayers.Size(300, 180) } );
|
||||
feature.data.popupContentHTML = popupContentHTML;
|
||||
feature.data.overflow = "hidden";
|
||||
|
||||
var marker = new OpenLayers.Marker(ll);
|
||||
marker.feature = feature;
|
||||
|
||||
var markerClick = function(evt) {
|
||||
if (this.popup == null) {
|
||||
this.popup = this.createPopup(this.closeBox);
|
||||
map.addPopup(this.popup);
|
||||
this.popup.show();
|
||||
} else {
|
||||
this.popup.toggle();
|
||||
}
|
||||
OpenLayers.Event.stop(evt);
|
||||
};
|
||||
marker.events.register("mousedown", feature, markerClick);
|
||||
|
||||
layer.addMarker(marker);
|
||||
map.addPopup(feature.createPopup(feature.closeBox));
|
||||
}
|
||||
|
||||
function getCycleTileURL(bounds) {
|
||||
var res = this.map.getResolution();
|
||||
var x = Math.round((bounds.left - this.maxExtent.left) / (res * this.tileSize.w));
|
||||
var y = Math.round((this.maxExtent.top - bounds.top) / (res * this.tileSize.h));
|
||||
var z = this.map.getZoom();
|
||||
var limit = Math.pow(2, z);
|
||||
|
||||
if (y < 0 || y >= limit)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
else
|
||||
{
|
||||
x = ((x % limit) + limit) % limit;
|
||||
|
||||
return this.url + z + "/" + x + "/" + y + "." + this.type;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user