vendor/pdir/panorama-bundle/src/Resources/views/mod_pano_map_view.twig line 1

Open in your IDE?
  1. <div class="map-container">
  2.   <script>
  3.     var catalogUri = '{{ catalogUri }}';
  4.     var zoom = {{ city.zoom }};
  5.     var cityid = '{{ city.id }}';
  6.     var iCatalogPageId = '{{ iCatalogPageId }}';
  7.     var sCatalogUri = '{{ sCatalogUri }}';
  8.     var year = '{{ actYear }}';
  9.     var timePeriod = '{{ timePeriod }}';
  10.     var cat = '{{ cat }}';
  11.     var lat = '{{ city.latitude }}';
  12.     var lng = '{{ city.longitude }}';
  13.     var overlayImageUri = '{{ overlayImage }}';
  14.     var overlayLat1 = '{{ cityMap.overlay_latitude }}';
  15.     var overlayLng1 = '{{ cityMap.overlay_longitude }}';
  16.     var overlayLat2 = '{{ cityMap.overlay_bottom_latitude }}';
  17.     var overlayLng2 = '{{ cityMap.overlay_bottom_longitude }}';
  18.     var overlayZoom = parseInt('{{ cityMap.overlay_zoom }}');
  19.     var actOverlayObject = null;
  20.     var controlPanel = parseInt('{{ iControlPanel }}');
  21.     var webp = true;
  22.     function initialize() {
  23.       const newark = new google.maps.LatLng(lat, lng);
  24.       const myOptions = {
  25.         zoom: zoom,
  26.         maxZoom: 20,
  27.         minZoom: 13,
  28.         center: newark,
  29.         mapTypeId: google.maps.MapTypeId.ROADMAP,
  30.         mapTypeControl: false,
  31.         streetViewControl: false,
  32.         panControlOptions: {
  33.           position: google.maps.ControlPosition.TOP_RIGHT
  34.         },
  35.         zoomControlOptions: {
  36.           style: google.maps.ZoomControlStyle.LARGE,
  37.           position: google.maps.ControlPosition.TOP_LEFT
  38.         }
  39.       };
  40.       map = new google.maps.Map(document.getElementById("map_canvas"), myOptions);
  41.       // deactivate restaurants ...
  42.       const styles = [
  43.         // {
  44.         //   elementType: "geometry",
  45.         //   stylers: [
  46.         //     {
  47.         //       color: "#212121"
  48.         //     }
  49.         //   ]
  50.         // },
  51.         // {
  52.         //   elementType: "labels.icon",
  53.         //   stylers: [
  54.         //     {
  55.         //       visibility: "off"
  56.         //     }
  57.         //   ]
  58.         // },
  59.         {
  60.           featureType: "poi",
  61.           stylers: [
  62.             {
  63.               visibility: "off"
  64.             }
  65.           ]
  66.         }
  67.       ];
  68.       map.setOptions({styles: styles});
  69.       overlayImageUri = '{{ overlayImage }}'; // 'files/design/meissen.jpg';
  70.       // cityid 1
  71.       // if (typeof overlayImageUri != 'undefined' && overlayImageUri != '' && overlayImageUri != 'files/pano_data/Staedte/Frauenstein/Stadtplaene/FS_Burg_Schloss_2014.png') {
  72.       if(cityid === '1') {
  73.         var tilePath = '{{ url }}/' + overlayImageUri.substring(0, overlayImageUri.length - 4),
  74.           tileExt = '.png';
  75.         /*if (typeof webp !== 'undefined') {
  76.             tilePath = tilePath + '_webp';
  77.             tileExt = '.webp'
  78.         }*/
  79.         var mapBounds = new google.maps.LatLngBounds(
  80.           new google.maps.LatLng(overlayLat2, overlayLng2),
  81.           new google.maps.LatLng(overlayLat1, overlayLng1));
  82.         var mapMinZoom = 13;
  83.         var mapMaxZoom = 20;
  84.         var imageMapType = new google.maps.ImageMapType({
  85.           getTileUrl: function (coord, zoom) {
  86.             var proj = map.getProjection();
  87.             var z2 = Math.pow(2, zoom);
  88.             var tileXSize = 256 / z2;
  89.             var tileYSize = 256 / z2;
  90.             var tileBounds = new google.maps.LatLngBounds(
  91.               proj.fromPointToLatLng(new google.maps.Point(coord.x * tileXSize, (coord.y + 1) * tileYSize)),
  92.               proj.fromPointToLatLng(new google.maps.Point((coord.x + 1) * tileXSize, coord.y * tileYSize))
  93.             );
  94.             var y = coord.y;
  95.             var x = coord.x >= 0 ? coord.x : z2 + coord.x
  96.             if (mapBounds.intersects(tileBounds) && (mapMinZoom <= zoom) && (zoom <= mapMaxZoom))
  97.               return tilePath + '/' + zoom + "/" + x + "/" + y + tileExt;
  98.             else
  99.               return tilePath + "/none.png";
  100.           }
  101.         });
  102.         map.overlayMapTypes.push(imageMapType);
  103.         actOverlayObject = imageMapType;
  104.       } else {
  105.         /* fallback frauenstein */
  106.         var imageBounds = new google.maps.LatLngBounds(
  107.           new google.maps.LatLng(overlayLat2, overlayLng2),
  108.           new google.maps.LatLng(overlayLat1, overlayLng1));
  109.         var overlayMap = new google.maps.GroundOverlay(
  110.           overlayImageUri,
  111.           imageBounds
  112.         );
  113.         overlayMap.setMap(map);
  114.         actOverlayObject = overlayMap;
  115.       }
  116.       /* for debug
  117.                           map.addListener('zoom_changed', function() {
  118.                               console.log('Zoom: ' + map.getZoom());
  119.                           });
  120.       */
  121.       if (controlPanel == 1) {
  122.         // @todo needed map.controls[google.maps.ControlPosition.TOP_LEFT].push(renderMapControlPanel());
  123.       }
  124.       ;
  125.       google.maps.event.addListenerOnce(map, 'idle', function () {
  126.         google.maps.event.trigger(map, 'resize');
  127.       });
  128.       markerClusterOptions = {
  129.         gridSize: 30,
  130.         maxZoom: 17,
  131.         styles: [
  132.           {
  133.             height: 56,
  134.             width: 55,
  135.             url: "/typo3conf/ext/arstempano_design/Resources/Public/v2/images/map/m2.png"
  136.           }
  137.         ]
  138.       };
  139.       markerCluster = new MarkerClusterer(map, [], markerClusterOptions);
  140.       // init Sidebar and MapController
  141.       Sidebar.init();
  142.     }
  143.     document.addEventListener("DOMContentLoaded", function () {
  144.       google.maps.event.addDomListener(window, 'load', initialize);
  145.     });
  146.   </script>
  147.   <div id="map_canvas" style="height:100%;weight:100%;"></div>
  148. </div>