var lastFov = -1; var lastPan = -1; var lastZoom = -1; var radar = null; var activeNodeLatLng; var map; $(document).ready(function () { $(".ReportLink").attr('href', url); if (skinid() == 47 || skinid() == 102) { $(".report-link").addClass("report-link-top"); } //if (isMarzipanoAllowed() == 'True' && isPanoPublished() == 'True') { if (isMarzipanoAllowed() == 'True' ) { if (returnQueryString("skin") != undefined && returnQueryString("skin") > 0) { hideInfoWindow(); } if (skinid() == 52) { $('#' + infoPopupWindowId).modal('show'); } if (skinid() == 77) { $('#span_userName').html(''); $('#span_contactNo').html(''); } if (skinid() == 92) { $('#divpanocopyright').show(); } if (skinid() == 98) {//for inviso change compass to top right $('.compass').addClass("compass_left"); $('.report-link').addClass("report-link-right"); } var MarziSkinDetail = $.parseJSON($('#hdMarzipanoSkinDetail').val()); //var subscriptiontype=MarzipanoSkinDetail.data.marzipanoSkinCompanyInfo.subscriptiontype; //var showInfoButton = MarzipanoSkinDetail.data.marzipanoSkinCompanyInfo.showInfoButton; ////============= info button will not be visible for online users =========== //if (showInfoButton == true && subscriptiontype != 2 && subscriptiontype != 3 && subscriptiontype != 4 && subscriptiontype != 5) { // $('#aInfoWindow').show(); //} ////========== freemium plan infowindow ========== //if (subscriptiontype == 2) { // $('#' + infoPopupWindowId).modal('show'); // //$('#aInfoWindow').hide(); //} ////=============================================== setinfo_popUpPosition(); var showCompass = MarzipanoSkinDetail.data.marzipanoSkinCompanyInfo.showCompass; if (showCompass == true && $('#hdn_panNorth').val() != '0') { if (returnQueryString("control") == undefined || returnQueryString("control") == "") { $('.compass').css("visibility", "visible"); } } if (returnQueryString("control") == "hide") {//if the querystring contains control=hide, then don't show the bottom icons and report link $("#divBottomIcons").hide(); $('.report-link').hide(); $('.watermark1').hide(); } var showMapButton = MarzipanoSkinDetail.data.marzipanoSkinCompanyInfo.showMapButton; if (showMapButton == true) { isMapAllowed = true; $('#infoMap').show(); //if (skinid() != 74) { // $('#marzimapdiv').css("visibility", "visible"); // //$('.compass').css("visibility", "visible"); //} //$("#viewMap").trigger("click"); } else { isMapAllowed = false; } var isVrDisplayQrString = returnQueryString("isVrDisplay"); if (isVrDisplayQrString != undefined && isVrDisplayQrString != '') { displayVrView(); isVRView = true; } else { loadDetail(); } if (mql.matches == false) { $('#fullscreenTogglesTour2').show(); } else { $('#fullscreenTogglesTour2').hide(); } //////if ($('#hdn_arrHotSpotLines').val() != "") { ////// arrHotSpot = JSON.parse($('#hdn_arrHotSpotLines').val()); ////// window.setTimeout(function () { ////// $.each(arrHotSpot, function (ind, dat) { ////// dat.isLineDraw = false; ////// hotSpotCount += 1; ////// dat.isAddedArray = true; ////// //addNewLineHotSpot(scene, { position: { yaw: dat.point1Yaw, pitch: dat.point1Pitch, fov: dat.point1Fov } }, dat.lineHeight, dat.lineBackColor, dat.lineID, dat.isAddedArray); ////// if (ind == 0) { ////// HspotIndex = parseInt(dat.point1.split('_')[1]); ////// addLineSpotOnPosition({ yaw: dat.point1Yaw, pitch: dat.point1Pitch, fov: dat.point1Fov }); ////// HspotIndex = parseInt(dat.point2.split('_')[1]); ////// addLineSpotOnPosition({ yaw: dat.point2Yaw, pitch: dat.point2Pitch, fov: dat.point2Fov }); ////// var point3 = { ////// yaw: dat.point3Yaw, ////// pitch: dat.point3Pitch, ////// fov: dat.point3Fov, ////// }; ////// hotSpotCount += 1; ////// addNewLinePoint(point3, HspotIndex, lineId, 2); ////// } ////// else { ////// if (dat.point1 != arrHotSpot[ind - 1].point2) { ////// HspotIndex = parseInt(dat.point1.split('_')[1]); ////// addLineSpotOnPosition({ yaw: dat.point1Yaw, pitch: dat.point1Pitch, fov: dat.point1Fov }); ////// } ////// hotSpotCount += 1; ////// HspotIndex = parseInt(dat.point2.split('_')[1]); ////// addLineSpotOnPosition({ yaw: dat.point2Yaw, pitch: dat.point2Pitch, fov: dat.point2Fov }); ////// var point3 = { ////// yaw: dat.point3Yaw, ////// pitch: dat.point3Pitch, ////// fov: dat.point3Fov, ////// }; ////// addNewLinePoint(point3, HspotIndex, lineId, 2); ////// } ////// //arrHotSpot[ind].point1 = point1.id; ////// //arrHotSpot[ind].point2 = point2.id; ////// //arrHotSpot[ind].lineId = lineId; ////// }) ////// drawLine(); ////// }, 100) //////} //////if ($('#hdn_HotSpotCollection').val() != "") { ////// jsonHotSpot = JSON.parse($('#hdn_HotSpotCollection').val()); ////// $.each(jsonHotSpot, function (ind, dat) { ////// hotspoturl = jsonHotSpot[ind].hotspoturl; ////// dat.hotspotpan = dat.hotspotpan; ////// dat.hotspottilt = dat.hotspottilt; ////// dat.marzipanoHotspot = AddCustomHotSpot(jsonHotSpot[ind].hotspoturltarget, hotspoturl, dat.hotspotname, dat.hotspotpan, dat.hotspottilt, dat.hotspotimagename) ////// }) //////} if (referUrl().toLowerCase().indexOf("dynamicdroneview.aspx") == -1 && referUrl().toLowerCase().indexOf("previewtour.aspx") == -1 && (returnQueryString("control") == undefined || returnQueryString("control") == "")) { if (culture().toLowerCase() == 'sv-se') { $('#imgProcessing').attr('src', 'images/pano-drag-icon-sweden.gif'); } else { $('#imgProcessing').attr('src', 'images/pano-drag-icon-English.gif'); } } else { //======== hide hand if redirect from DynamicDroneView.aspx or previewtour.aspx $('#divProcessing').hide(); } window.setTimeout(function () { $('#divProcessing').hide(); }, 5000); } $("#infoMap").click(function () { //if ($('#marzimapdiv').css('visibility') == "hidden") { // $('#marzimapdiv').css("visibility", "visible"); //} //else if ($('#marzimapdiv').css('visibility') == "visible") { // $('#marzimapdiv').css("visibility", "hidden"); //} //else { $('#marzimapPopUp').modal("show"); //} }); //$("#marzimapPopUp").on("shown.bs.modal", function () { // google.maps.event.trigger(marzipanomap, "resize"); // var latlng = new google.maps.LatLng(panolatitude(), panolongitude()); // marzipanomap.setCenter(latlng); //}); var searchurl = location.search; if (searchurl.indexOf("parantorgcompanyid") > 0 && searchurl.indexOf("companyId") > 0) { $("#btnBackToOculusMap").show(); } $("#btnBackToOculusMap").click(function () { var querystring = getQuerystring("panoguid"); if (querystring != "") { querystring = "?" + querystring.substring(0, querystring.length - 1); querystring = querystring.replace("long", "lng"); } window.location.href = "oculus.aspx" + querystring; }); }); function loadDetail(layerId, showLinesVr) { if (showLinesVr == undefined) { if ($('#hdn_arrHotSpotLines').val() != "") { arrHotSpot = JSON.parse($('#hdn_arrHotSpotLines').val()); window.setTimeout(function () { $.each(arrHotSpot, function (ind, dat) { dat.isLineDraw = false; hotSpotCount += 1; dat.isAddedArray = true; //addNewLineHotSpot(scene, { position: { yaw: dat.point1Yaw, pitch: dat.point1Pitch, fov: dat.point1Fov } }, dat.lineHeight, dat.lineBackColor, dat.lineID, dat.isAddedArray); if (ind == 0) { HspotIndex = parseInt(dat.point1.split('_')[1]); addLineSpotOnPosition({ yaw: dat.point1Yaw, pitch: dat.point1Pitch, fov: dat.point1Fov }, layerId); HspotIndex = parseInt(dat.point2.split('_')[1]); addLineSpotOnPosition({ yaw: dat.point2Yaw, pitch: dat.point2Pitch, fov: dat.point2Fov }, layerId); var point3 = { yaw: dat.point3Yaw, pitch: dat.point3Pitch, fov: dat.point3Fov, }; hotSpotCount += 1; addNewLinePoint(point3, HspotIndex, lineId, 2, layerId); } else { if (dat.point1 != arrHotSpot[ind - 1].point2) { HspotIndex = parseInt(dat.point1.split('_')[1]); addLineSpotOnPosition({ yaw: dat.point1Yaw, pitch: dat.point1Pitch, fov: dat.point1Fov }, layerId); } hotSpotCount += 1; HspotIndex = parseInt(dat.point2.split('_')[1]); addLineSpotOnPosition({ yaw: dat.point2Yaw, pitch: dat.point2Pitch, fov: dat.point2Fov }, layerId); var point3 = { yaw: dat.point3Yaw, pitch: dat.point3Pitch, fov: dat.point3Fov, }; addNewLinePoint(point3, HspotIndex, lineId, 2, layerId); } //arrHotSpot[ind].point1 = point1.id; //arrHotSpot[ind].point2 = point2.id; //arrHotSpot[ind].lineId = lineId; }) drawLine(); }, 100) } } //Added for adding companylogo start var obj = []; if ($('#hdn_HotSpotCollection').val() != "") { obj = JSON.parse($('#hdn_HotSpotCollection').val()); } //obj.push(JSON.parse('{"hotspotname":"","hotspotpan":-88.50988001699294,"hotspottilt":90.00007601981207,"hotspotfov":1.22172944444444,"hotspotimagename":"companylogo","hotspoturl":"","autogenerate":false,"hotspotid":"","poisId":0,"hotspoturltarget":"","hotspotcategoryname":"","hotspotcategorydisplayname":"","marzipanoHotspot":{"HspotIndex":2,"position":{"yaw":-1.5454106034713053,"pitch":1.5714298987586233,"fov":2.09439333333333},"imagePath":"companylogo","title":"","wrapperId":"hotspoticonwrapper_2","hotspotId":"hotspotId_2","hotspotTitleId":"hotspotId_2_title"}}')); $('#hdn_HotSpotCollection').val(JSON.stringify(obj)); //Added for adding companylogo end if ($('#hdn_HotSpotCollection').val() != "") { jsonHotSpot = JSON.parse($('#hdn_HotSpotCollection').val()); $.each(jsonHotSpot, function (ind, dat) { hotspoturl = jsonHotSpot[ind].hotspoturl; dat.hotspotpan = dat.hotspotpan; dat.hotspottilt = dat.hotspottilt; dat.marzipanoHotspot = AddCustomHotSpot(jsonHotSpot[ind].hotspoturltarget, hotspoturl, dat.hotspotname, dat.hotspotpan, dat.hotspottilt, dat.hotspotimagename, layerId, dat.destinationpanoguid) }) } window.setTimeout(function () { //if (toureSkinType == 2) { $('.out').css('border', '5px solid ' + MarzipanoSkinDetail.data.marzipanoSkinCompanyInfo.animationcolor + ''); $('.in-2').css('background-color', '' + MarzipanoSkinDetail.data.marzipanoSkinCompanyInfo.animationcolor + ''); //} }, 200) } var HspotIndex = 1; function AddCustomHotSpot(target, hotspoturl, hotspottitle, hotspotpan, hotspottilt, hotspotimagename, layerId, destinationpanoguid) { if (isMarzipanoAllowed() == 'True') { //if (jsonHotSpot.length > 0) { // HspotIndex = parseInt(jsonHotSpot[jsonHotSpot.length - 1].marzipanoHotspot.HspotIndex) + 1; //} var position; if (hotspotpan != "" && hotspotpan != undefined && hotspotpan != null) { position = { yaw: (hotspotpan * (22 / 7)) / 180, pitch: (hotspottilt * (22 / 7)) / 180, fov: view.fov() }; } else { position = { yaw: view.yaw(), pitch: view.pitch(), fov: view.fov() }; } var marzipanoHotspot = { HspotIndex: HspotIndex, position: position, imagePath: hotspotimagename, title: hotspottitle, destinationpanoguid: destinationpanoguid }; marzipanoHotspot = addNewHotSpot(target, hotspoturl, scene, marzipanoHotspot, undefined, layerId); return marzipanoHotspot; } } //function updateRadar() { // if ((!activeNodeLatLng) || (!pano) || (!map)) return; // var d2r = Math.PI / 180; // var r2d = 180 / Math.PI; // var fov = pano.getFov(); // var pan = pano.getPanNorth(); // var zoom = map.getZoom(); // var gps = pano.getNodeLatLng(""); // if ((gps.length >= 2) && ((gps[0] != 0) || (gps[1] != 0))) { // if (zoom < 6) zoom = 6; // avoid large radar beams on world map // if ((fov == lastFov) && (pan == lastPan) && (zoom == lastZoom) && (gps[0] == activeNodeLatLng.lat()) && (gps[1] == activeNodeLatLng.lng())) return; // nothing to do // lastPan = pan; // lastFov = fov; // lastZoom = zoom; // activeNodeLatLng = new google.maps.LatLng(gps[0], gps[1]); // var rLat = 4.0 * r2d / Math.pow(2, zoom); // beam size // var rLng = rLat / Math.cos(activeNodeLatLng.lat() * d2r); // // generate radar fan for fov // var radar_poly = new Array(); // radar_poly.push(activeNodeLatLng); // var segments = 5; // for (i = -segments; i <= segments; i++) { // var angle = (fov / (2 * segments)) * i; // var x = -rLng * Math.sin((pan + angle) * d2r) + activeNodeLatLng.lng(); // var y = rLat * Math.cos((pan + angle) * d2r) + activeNodeLatLng.lat(); // radar_poly.push(new google.maps.LatLng(y, x)); // } // // clear old radar // if (radar) { // radar.setMap(null); // radar = null; // } // // show radar // radar = new google.maps.Polygon({ // paths: radar_poly, // strokeColor: "#000000", // strokeOpacity: 0.8, // strokeWeight: 1, // fillColor: "#000000", // fillOpacity: 0.35 // }); // radar.setMap(map); // } else { // // clear radar // if (radar) { // activeNodeLatLng = new google.maps.LatLng(0, 0); // radar.setMap(null); // radar = null; // } // } //} function initMap() { var gps = pano.getNodeLatLng(""); if ((gps.length >= 2) && ((gps[0] != 0) || (gps[1] != 0))) { activeNodeLatLng = new google.maps.LatLng(gps[0], gps[1]); } else { activeNodeLatLng = new google.maps.LatLng(0, 0); } var mapOptions = { zoom: 14, center: activeNodeLatLng, mapTypeId: google.maps.MapTypeId.HYBRID }; map = new google.maps.Map(document.getElementById('mapdiv'), mapOptions); var ids = pano.getNodeIds(); var marker; var markerLocation; var bounds = new google.maps.LatLngBounds(); for (var i = 0; i < ids.length; i++) { var id = ids[i]; var gps = pano.getNodeLatLng(id); if ((gps.length >= 2) && ((gps[0] != 0) || (gps[1] != 0))) { markerLocation = new google.maps.LatLng(gps[0], gps[1]); marker = new google.maps.Marker({ position: markerLocation, map: map }); marker.setTitle(pano.getNodeTitle(id)); marker.setAnimation(google.maps.Animation.DROP); marker.setClickable(true); marker.ggId = id; bounds.extend(markerLocation); google.maps.event.addListener(marker, 'click', function () { pano.openNext("{" + this.ggId + "}"); activeNodeLatLng = this.position; lastFov = -1; // force radar update }); } } //if (!bounds.isEmpty()) { // map.fitBounds(bounds); //} setInterval(function () { updateRadar(); }, 50); } function OpenReportProblem() { var win = window.open(url, '_blank'); if (win) { //Browser has allowed it to be opened win.focus(); } else { //Browser has blocked it location.href = url; } } function getPanoramaDetail(guid, tourid) { $('#hdn_PanoramaGuid').val(''); if (guid != "") { $('#hdn_PanoramaGuid').val(guid); $('#hdn_arrHotSpotLines').val(''); $('#hdn_HotSpotCollection').val(''); $('.info-hotspot-icon-wrapper').remove(); if (tourid == undefined) { tourid = 0; } var url = "api/tourpreview/getPanoramaDetail?panoguid=" + guid + "&tourid=" + tourid + ""; var res = MakeSyncWebCall(url, "{}", "get"); if (res != "") { var response = JSON.parse(res); if (tourid !== undefined && tourid !== 0) { toureSkinType = 2; } viewtype = response.opanoramaresponse.data.panorama.viewtype; $('#hdn_startYaw').val(response.hdn_startYaw); $('#hdn_startPitch').val(response.hdn_startPitch); $('#hdn_startFov').val(response.hdn_startFov); $('#hdn_minFov').val(response.hdn_minFov); $('#hdn_maxFov').val(response.hdn_maxFov); if (response.opanoramaresponse.data.panorama.hotspots.length > 0) { var arr = []; $.each(response.opanoramaresponse.data.panorama.hotspots, function (ind, item) { if (item.hotspotimagename.toLowerCase().indexOf('hs_hviewhide') == -1) { var obj = new Object; obj.hotspotname = item.name; obj.hotspotpan = -1 * item.pan; obj.hotspottilt = -1 * item.tilt; obj.hotspotfov = 0; obj.hotspotimagename = item.hotspotimagename; obj.hotspoturl = item.hotspotimagename.toLowerCase().indexOf('comment') > 0 ? item.hotspotcomments : item.href; obj.hotspoturltarget = item.target; obj.autogenerate = false; obj.hotspotid = item.hotspotid; obj.hotspotcategoryvalue = item.hotspotcategoryvalue; obj.hotspotcategoryname = item.hotspotcategoryname; obj.destinationpanoguid = item.destinationpanoguid; arr.push(obj); } }) $('#hdn_HotSpotCollection').val(JSON.stringify(arr)); } if (response.lsthotspotLine.length > 0) { $('#hdn_arrHotSpotLines').val(JSON.stringify(response.lsthotspotLine)); } $('#hdmarzipanoimgUrl').val(response.hdmarzipanoimgUrl); $('#hdMarzipanoSkinDetail').val(response.MarzipanoSkinDetail); $('#hdnPreviewSingleImageUrl').val(response.hdnPreviewSingleImageUrl); updateScene(); HspotIndex = 0; loadDetail(); } } } function updateScene() { var startYaw = $('#hdn_startYaw').val(), startPitch = $('#hdn_startPitch').val(), startFov = $('#hdn_startFov').val(); if (toureSkinType == 2 && startFov == "0") { startFov = $('#hdn_maxFov').val(); } var initialView = { yaw: startYaw, pitch: startPitch, fov: startFov }; imagesPath = $('#hdmarzipanoimgUrl').val();//.toLowerCase();// GetMarzipanoImageBasePath() + "/" + $.trim(MarzipanoSkinDetail.data.marzipanoPanoImagesList[0].countrycode) + "/" + $.trim(MarzipanoSkinDetail.data.marzipanoPanoImagesList[0].panobankguid) + "/" + MarzipanoSkinDetail.data.marzipanoPanoImagesList[0].marzipanoImageName + "_{f}.jpg";//"panoimages/test" + "_" + "{f}.jpg"; var previewImagesPath = $('#hdmarzipanoimgUrl').val().replace('{f}', 'preview'); source = Marzipano.ImageUrlSource.fromString( imagesPath, { cubeMapPreviewUrl: previewImagesPath, cubeMapPreviewFaceOrder: 'fdrblu' } ); if (imagesPath.toLowerCase().indexOf("{f}.jpg") == -1) // single image { MarzipanoSkinDetail.data.marzipanoSkinCompanyInfo.hasSingleImage = true; if ($('#hdnPreviewSingleImageUrl').val() != "") { source = new Marzipano.ImageUrlSource(function (tile) { if (tile.z === 0) { return { url: $('#hdnPreviewSingleImageUrl').val() }; } else { return { url: imagesPath }; } }); } } else { MarzipanoSkinDetail.data.marzipanoSkinCompanyInfo.hasSingleImage = false; } view = new Marzipano.RectilinearView(initialView, limiter); scene = viewer.createScene({ source: source, geometry: geometry, view: view, pinFirstLevel: true }); scene.switchTo(); scene.layer().setEffects({ opacity: 0 }); startAutorotate(); } //function returnQueryString(findKey) { // var querystring = ""; // var url = window.location.search; // url = url.substring(1, url.length); // var urlarray = url.split('&'); // if (urlarray.length > 0) { // for (var i = 0; i < urlarray.length; i++) { // var key = urlarray[i].split('=')[0]; // if (key.toLowerCase() == findKey.toLowerCase()) { // querystring = urlarray[i].split('=')[1]; // } // } // } // return querystring; //}