@panoramax/web-viewer 3.2.3-develop-83778bdd → 3.2.3-develop-04898f19
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/index.js +1 -1
- package/build/index.js.map +1 -1
- package/package.json +1 -1
- package/src/components/core/PhotoViewer.js +1 -1
- package/src/components/core/Viewer.js +1 -1
- package/tests/components/core/BasicMock.js +1 -0
- package/tests/components/core/PhotoViewer.test.js +37 -0
- package/tests/components/core/Viewer.test.js +60 -0
- package/tests/components/core/__snapshots__/PhotoViewer.test.js.snap +91 -0
- package/tests/components/core/__snapshots__/Viewer.test.js.snap +163 -0
package/build/index.js
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
* LICENSE file in the root directory of this source tree.
|
|
10
10
|
*
|
|
11
11
|
*/
|
|
12
|
-
!function(Qe,rt){"object"===typeof exports&&"object"===typeof module?module.exports=rt():"function"===typeof define&&define.amd?define("Panoramax",[],rt):"object"===typeof exports?exports.Panoramax=rt():Qe.Panoramax=rt()}(this,(()=>(()=>{var Qe={9039:(Qe,rt,Co)=>{"use strict";Co.d(rt,{A:()=>Basic});var El=Co(4542),Tl=Co(5254),kl=Co(4964),Ll=Co(8340),Dl=Co(5995),Rl=Co(7343),Ul=Co(8330);Co(1865),Co(3638);class Basic extends El.WF{constructor(){let Qe=arguments.length>0&&void 0!==arguments[0]&&arguments[0];super(),this.users=["geovisio"],this.mapstyle=this.getAttribute("mapstyle")||Ll.DEFAULT_TILES,this.lang=this.getAttribute("lang")||null,this.endpoint=this.getAttribute("endpoint")||null,this.picture=null,this.sequence=null,console.info(`\ud83d\udcf7 Panoramax ${this.getClassName()} - Version ${Ul.rE} (83778bd)\n\n\ud83c\udd98 Issues can be reported at ${Ul.Jk.O}`),this._t=(0,kl.getTranslations)(this.lang),Qe||(this.loader=(0,Dl.createWebComp)("pnx-loader",{_parent:this,"no-label":(0,Rl.isInIframe)()}),this._isInternetFast=null,(0,Rl.isInternetFast)().then((Qe=>this._isInternetFast=Qe)))}connectedCallback(){super.connectedCallback(),this.endpoint&&this._setupAPI()}_setupAPI(){if(this.loader=this.loader||(0,Dl.createWebComp)("pnx-loader",{_parent:this}),this.endpoint){try{this.mapstyle=JSON.parse(this.mapstyle)}catch(rt){}try{this.api=new Tl.A(this.endpoint,{users:this.users,fetch:this.fetchOptions,style:this.mapstyle}),this.api.onceReady().then((()=>{let Qe=this.api.getUnavailableFeatures(),rt=this.api.getAvailableFeatures();rt=0===Qe.length?"\u2705 All features available":"\u2705 Available features: "+rt.join(", "),Qe=0===Qe.length?"":"\ud83d\udeab Unavailable features: "+Qe.join(", "),console.info(`\ud83c\udf10 Connected to API "${this.api._metadata.name}" (${this.api._endpoint})\n\u2139\ufe0f API runs STAC ${this.api._metadata.stac_version} ${this.api._metadata.geovisio_version?"& GeoVisio "+this.api._metadata.geovisio_version:""}\n ${rt}\n ${Qe}\n`.trim())})).catch((Qe=>this.loader.dismiss(Qe,this._t.pnx.error_api)))}catch(rt){var Qe;null!==(Qe=this.loader)&&void 0!==Qe&&Qe.dismiss?this.loader.dismiss(rt,this._t.pnx.error_api):console.error(rt)}}else console.warn("No endpoint is defined")}onceReady(){throw new Error("You must override this method on sub-class")}onceAPIReady(){return this.api?this.api.onceReady():new Promise((Qe=>setTimeout(Qe,100))).then(this.onceAPIReady.bind(this))}createRenderRoot(){return this}attributeChangedCallback(Qe,rt,Co){if(super.attributeChangedCallback(Qe,rt,Co),"endpoint"===Qe&&(this.api&&this.api._endpoint===Co||this._setupAPI()),["picture","sequence"].includes(Qe)){let El,Tl,kl,Ll;"picture"===Qe?(El=this.sequence,kl=this.sequence,Tl=Co,Ll=rt):(El=Co,kl=rt,Tl=this.picture,Ll=this.picture),this.dispatchEvent(new CustomEvent("select",{bubbles:!0,composed:!0,detail:{seqId:El,picId:Tl,prevSeqId:kl,prevPicId:Ll}}))}}getClassName(){return"Basic"}select(){let Qe=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,rt=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;arguments.length>2&&void 0!==arguments[2]&&arguments[2]&&(this.picture=null,this.sequence=null),this.picture=rt,this.sequence=Qe}isWidthSmall(){return(null===this||void 0===this?void 0:this.offsetWidth)<576}isHeightSmall(){return(null===this||void 0===this?void 0:this.offsetHeight)<400}render(){return El.qy`<p>Should not be used directly, use Viewer/CoverageMap/Editor instead</p>`}getSubComponentsNames(){return["loader","api"]}addEventListener(Qe,rt,Co){let El=Qe.split(":").shift();if(El&&this.getSubComponentsNames().includes(El)){var Tl;const Ll=Qe.substring(El.length+1);var kl;if("map"===El)null!==(kl=this.map)&&void 0!==kl&&kl.on?null!==Co&&void 0!==Co&&Co.once?this.map.once(Ll,rt):this.map.on(Ll,rt):setTimeout((()=>{this.addEventListener(Qe,rt,Co)}),50);else null!==(Tl=this[El])&&void 0!==Tl&&Tl.addEventListener?this[El].addEventListener(Ll,rt,Co):setTimeout((()=>this.addEventListener(Qe,rt,Co)),50)}else super.addEventListener(Qe,rt,Co)}}Basic.properties={picture:{type:String,reflect:!0},sequence:{type:String,reflect:!0},fetchOptions:{type:Object,attribute:!1},users:{type:Array,reflect:!0},mapstyle:{type:String},lang:{type:String},endpoint:{type:String}}},153:(Qe,rt,Co)=>{"use strict";Co.d(rt,{A:()=>CoverageMap});var El=Co(9039),Tl=Co(5642),kl=Co(8340),Ll=Co(927),Dl=(Co(7776),Co(2118));class CoverageMap extends El.A{constructor(){super(),this._mapContainer=document.createElement("div"),this.onceAPIReady().then((()=>{this.loader.setAttribute("value",30),this._initParams=new Dl.Ay(Dl.Ay.GetComponentProperties(CoverageMap,this)),this._initMap()})),this.addEventListener("select",this._onSelect.bind(this))}getClassName(){return"CoverageMap"}onceReady(){return this.map&&this.map.waitForEnoughMapLoaded?this.map.waitForEnoughMapLoaded():new Promise((Qe=>setTimeout(Qe,100))).then(this.onceReady.bind(this))}render(){return[this.loader,this._mapContainer]}getSubComponentsNames(){const Qe=super.getSubComponentsNames();return Qe.push("map"),Qe}_initMap(){class MyMap extends Tl.A{_getLayerStyleProperties(Qe){return"pictures_symbols"===Qe?{layout:{visibility:"none"}}:super._getLayerStyleProperties(Qe)}}this.map=new MyMap(this,this._mapContainer,Object.assign({},this._initParams.getMapInit(),{hash:!0})),this.map.addControl(new Ll.NavigationControl({showCompass:!1})),this.loader.setAttribute("value",70),this.map.waitForEnoughMapLoaded().then((()=>{(0,Dl.mK)(this.map,this._initParams.getMapPostInit()),this.map.reloadLayersStyles(),this.loader.dismiss()})),this.map.on("picture-click",(Qe=>this.select(Qe.seqId,Qe.picId))),this.map.on("sequence-click",(Qe=>this.select(Qe.seqId)))}_onSelect(Qe){if(Qe.detail.picId||Qe.detail.seqId){const rt=Qe.detail.picId?"pictures":"sequences",Co=this.map.queryRenderedFeatures({layers:[...this.map._userLayers].map((Qe=>(0,kl.getUserLayerId)(Qe,rt))),filter:["==",["get","id"],Qe.detail.picId||Qe.detail.seqId]});Co.length>=0&&null!=Co[0]&&this.map._attachPreviewToPictures({features:Co},rt)}}}CoverageMap.properties={map:{type:Object},...El.A.properties},customElements.define("pnx-coverage-map",CoverageMap)},1752:(Qe,rt,Co)=>{"use strict";Co.d(rt,{A:()=>Editor});Co(7365);var El=Co(9039),Tl=Co(5642),kl=Co(9048),Ll=(Co(7534),Co(6810),Co(508)),Dl=Co(8340),Rl=Co(1545),Ul=(Co(4542),Co(5995));const Gl="sequence-headings";class Editor extends El.A{constructor(){super(),this.raster=null,this.background="streets",this.users=[],this._psvContainer=document.createElement("div"),this._mapContainer=document.createElement("div"),this.onceAPIReady().then((()=>{this.loader.setAttribute("value",30),this.sequence||this.loader.dismiss({},"No sequence is selected"),this.addEventListener("select",this._onSelect.bind(this)),this._initPSV(),this._initMap()}))}getClassName(){return"Editor"}onceReady(){var Qe,rt;return this.map&&this.psv&&null!==(Qe=(rt=this.map).loaded)&&void 0!==Qe&&Qe.call(rt)?Promise.resolve():new Promise((Qe=>setTimeout(Qe,100))).then(this.onceReady.bind(this))}render(){return[this.loader,this._psvContainer,this._mapContainer]}getSubComponentsNames(){return super.getSubComponentsNames().concat(["map","psv"])}_initPSV(){try{this.psv=new kl.Ay(this,this._psvContainer),this.psv._myVTour.datasource.nodeResolver=this._getNode.bind(this)}catch(Qe){let rt=Rl.IJ.isWebGLSupported?this._t.pnx.error_psv:this._t.pnx.error_webgl;this.loader.dismiss(Qe,rt)}}_initMap(){try{this.map=new Tl.A(this,this._mapContainer,{raster:this.raster,background:this.background,supplementaryStyle:this._createMapStyle(),zoom:15}),(0,Dl.linkMapAndPhoto)(this),this.loader.setAttribute("value",50),this._loadSequence(),this.map.once("load",(()=>{this.map.hasTwoBackgrounds()&&this._addMapBackgroundWidget(),this._bindPicturesEvents()}));const Qe=this.map._picMarker.setRotation.bind(this.map._picMarker);this.map._picMarker.setRotation=rt=>(rt=void 0===this._lastRelHeading?rt:rt+this._lastRelHeading-this.psv.getPictureRelativeHeading(),Qe(rt))}catch(Qe){this.loader.dismiss(Qe,this._t.pnx.error_psv)}}_createMapStyle(){return{sources:{geovisio_editor_sequences:{type:"geojson",data:{type:"FeatureCollection",features:[]}}},layers:[{id:"geovisio_editor_sequences",type:"line",source:"geovisio_editor_sequences",layout:{...Dl.VECTOR_STYLES.SEQUENCES.layout},paint:{...Dl.VECTOR_STYLES.SEQUENCES.paint}},{id:"geovisio_editor_pictures",type:"circle",source:"geovisio_editor_sequences",layout:{...Dl.VECTOR_STYLES.PICTURES.layout},paint:{...Dl.VECTOR_STYLES.PICTURES.paint}}]}}_bindPicturesEvents(){this.map.on("mousemove","geovisio_editor_pictures",(()=>{this.map.getCanvas().style.cursor="pointer"})),this.map.on("mouseleave","geovisio_editor_pictures",(()=>{this.map.getCanvas().style.cursor=""})),this.map.on("click","geovisio_editor_pictures",this.map._onPictureClick.bind(this.map))}_loadSequence(){return this.loader.setAttribute("value",60),this.api.getSequenceItems(this.sequence).then((Qe=>{if(this.loader.setAttribute("value",80),this.map.once("sourcedata",(()=>{this.map.setPaintProperty("geovisio_editor_sequences","line-color",this.map._getLayerColorStyle("sequences")),this.map.setPaintProperty("geovisio_editor_pictures","circle-color",this.map._getLayerColorStyle("pictures")),this.map.setLayoutProperty("geovisio_editor_sequences","visibility","visible"),this.map.setLayoutProperty("geovisio_editor_pictures","visibility","visible"),this.map.once("styledata",(()=>this.loader.dismiss()))})),this._sequenceData=Qe.features,this.map.getSource("geovisio_editor_sequences").setData({type:"FeatureCollection",features:[{type:"Feature",properties:{id:this.sequence},geometry:{type:"LineString",coordinates:Qe.features.map((Qe=>Qe.geometry.coordinates))}},...Qe.features.map((Qe=>(Qe.properties.id=Qe.id,Qe.properties.sequences=[this.sequence],Qe)))]}),this.picture){const rt=Qe.features.find((Qe=>Qe.id===this.picture));rt?(this.select(this.sequence,this.picture,!0),this.map.jumpTo({center:rt.geometry.coordinates,zoom:18})):console.log("Picture with ID",rt,"was not found")}else{const rt=[...Qe.features[0].geometry.coordinates,...Qe.features[0].geometry.coordinates];for(let Co=1;Co<Qe.features.length;Co++){const El=Qe.features[Co].geometry.coordinates;El[0]<rt[0]&&(rt[0]=El[0]),El[1]<rt[1]&&(rt[1]=El[1]),El[0]>rt[2]&&(rt[2]=El[0]),El[1]>rt[3]&&(rt[3]=El[1])}this.map.fitBounds(rt,{animate:!1})}})).catch((Qe=>this.loader.dismiss(Qe,this._t.pnx.error_api)))}_getNode(Qe){const rt=this._sequenceData.find((rt=>rt.properties.id===Qe)),Co=rt?(0,Ll.apiFeatureToPSVNode)(rt,this._t,this._isInternetFast):null;return Co&&delete Co.links,Co}_addMapBackgroundWidget(){const Qe=(0,Ul.createWebComp)("pnx-map-background",{_parent:this,size:"sm"});this._mapContainer.appendChild(Qe)}previewSequenceHeadingChange(Qe){const rt=void 0!==this.map.getLayer(Gl);if(this.map._picMarkerPreview.remove(),void 0===Qe)return delete this._lastRelHeading,rt&&this.map.setLayoutProperty(Gl,"visibility","none"),void(this.picture&&this.map._picMarker.setRotation(this.psv.getXY().x));this._lastRelHeading=Qe,rt||this.map.addLayer({id:Gl,type:"symbol",source:"geovisio_editor_sequences",layout:{"icon-image":"pnx-marker","icon-overlap":"always","icon-size":.8}});const Co=-this.psv.getPictureRelativeHeading();this.map.setLayoutProperty(Gl,"visibility","visible"),this.map.setLayoutProperty(Gl,"icon-rotate",["+",["get","view:azimuth"],Co,Qe]);const El=[["==",["geometry-type"],"Point"]];this.picture&&El.push(["!=",["get","id"],this.picture]),this.map.setFilter(Gl,["all",...El]),this.picture&&this.map._picMarker.setRotation(this.psv.getXY().x)}_onSelect(){void 0!==this._lastRelHeading&&this.previewSequenceHeadingChange(this._lastRelHeading)}}Editor.properties={raster:{type:Object},background:{type:String},...El.A.properties},customElements.define("pnx-editor",Editor)},3407:(Qe,rt,Co)=>{"use strict";Co.d(rt,{A:()=>PhotoViewer});Co(970);var El=Co(1545),Tl=Co(4451),kl=Co(9039),Ll=Co(9048),Dl=Co(5995),Rl=Co(2118);const Ul=Math.PI/6;class PhotoViewer extends kl.A{constructor(){super(),this.psv={},this["url-parameters"]=this.getAttribute("url-parameters")||!0,this.widgets=this.getAttribute("widgets")||"true",this.grid=(0,Dl.createWebComp)("pnx-cornered-grid"),this.psvContainer=document.createElement("div"),this.psvContainer.setAttribute("slot","bg"),this.grid.appendChild(this.psvContainer),this.popup=(0,Dl.createWebComp)("pnx-popup",{_parent:this,onclose:this._onPopupClose.bind(this)}),this["url-parameters"]&&"false"!==this["url-parameters"]&&(this.urlHandler=new Tl.A(this),this.onceReady().then((()=>{this.urlHandler.listenToChanges(),this.urlHandler._onParentChange()})))}_createInitParamsHandler(){var Qe,rt;this._initParams=new Rl.Ay(Rl.Ay.GetComponentProperties(PhotoViewer,this),Object.assign({},null===(Qe=this.urlHandler)||void 0===Qe?void 0:Qe.currentURLParams(),null===(rt=this.urlHandler)||void 0===rt?void 0:rt.currentURLParams(!0)),{})}_initWidgets(){"false"!==this._initParams.getParentInit().widgets&&(this.isWidthSmall()||this.grid.appendChild((0,Dl.createWebComp)("pnx-widget-zoom",{slot:"bottom-right",class:"pnx-print-hidden",_parent:this})),this.grid.appendChild((0,Dl.createWebComp)("pnx-widget-share",{slot:"bottom-right",class:"pnx-print-hidden",_parent:this})),this.legend=(0,Dl.createWebComp)("pnx-widget-legend",{slot:this.isWidthSmall()?"top":"top-left",_parent:this,focus:this._initParams.getParentPostInit().focus,picture:this._initParams.getParentPostInit().picture}),this.grid.appendChild(this.legend),this.grid.appendChild((0,Dl.createWebComp)("pnx-widget-player",{slot:"top",_parent:this,class:"pnx-only-psv pnx-print-hidden"})))}connectedCallback(){super.connectedCallback(),this._moveChildToGrid(),this.onceAPIReady().then((async()=>{this.loader.setAttribute("value",30),this._createInitParamsHandler();const Qe=this._initParams.getParentPostInit();this._initPSV(),this._initWidgets(),(0,Rl.ai)(this,Qe),this._handleKeyboardManagement(),Qe.picture?this.psv.addEventListener("picture-loaded",(()=>this.loader.dismiss()),{once:!0}):this.loader.dismiss()}))}getClassName(){return"PhotoViewer"}onceReady(){return this.oncePSVReady().then((()=>this._initParams.getParentPostInit().picture&&!this.psv.getPictureMetadata()?this.onceFirstPicLoaded():Promise.resolve()))}render(){return[this.loader,this.grid,this.popup,this.slot]}getSubComponentsNames(){return super.getSubComponentsNames().concat(["psv","grid","popup","urlHandler"])}oncePSVReady(){let Qe;return new Promise((rt=>{Qe=setInterval((()=>{"object"===typeof this.psv&&(this.psv.container?(clearInterval(Qe),rt()):this.psv.addEventListener&&this.psv.addEventListener("ready",(()=>{clearInterval(Qe),rt()}),{once:!0}))}),250)}))}onceFirstPicLoaded(){return this.oncePSVReady().then((()=>this.psv.getPictureMetadata()?Promise.resolve():new Promise((Qe=>{this.psv.addEventListener("picture-loaded",Qe,{once:!0})}))))}_initPSV(){try{this.psv=new Ll.Ay(this,this.psvContainer,{shouldGoFast:this._psvShouldGoFast.bind(this),keyboard:"always",keyboardActions:{...El.zY.keyboardActions,8:"ROTATE_UP",2:"ROTATE_DOWN",4:"ROTATE_LEFT",6:"ROTATE_RIGHT",PageUp:()=>this.psv.goToNextPicture(),9:()=>this.psv.goToNextPicture(),PageDown:()=>this.psv.goToPrevPicture(),3:()=>this.psv.goToPrevPicture(),5:()=>this.moveCenter(),"*":()=>this.moveCenter(),Home:()=>this._toggleFocus(),7:()=>this._toggleFocus(),End:()=>this.mini.toggleAttribute("collapsed"),1:()=>this.mini.toggleAttribute("collapsed")," ":()=>this.psv.toggleSequencePlaying(),0:()=>this.psv.toggleSequencePlaying()},...this._initParams.getPSVInit()}),this.oncePSVReady().then((()=>{this.loader.setAttribute("value",50),(0,Rl.Vy)(this.psv,this._initParams.getPSVPostInit())}))}catch(Qe){let rt=El.IJ.isWebGLSupported?this._t.pnx.error_psv:this._t.pnx.error_webgl;this.loader.dismiss(Qe,rt)}}_handleKeyboardManagement(){const keytonone=()=>this.psv.stopKeyboardControl(),keytopsv=()=>this.psv.startKeyboardControl();this.popup.addEventListener("open",(()=>keytonone())),this.popup.addEventListener("close",(()=>keytopsv()));for(let Qe of this.grid.childNodes)"bg"!==Qe.getAttribute("slot")&&(Qe.addEventListener("focusin",(()=>keytonone())),Qe.addEventListener("focusout",(()=>keytopsv())))}_psvShouldGoFast(){return this.psv._sequencePlaying&&this.psv.getTransitionDuration()<1e3}_moveChildToGrid(){for(let Co=0;Co<this.childNodes.length;Co++){var Qe;let El=this.childNodes[Co];var rt;if(null!==(Qe=El.getAttribute)&&void 0!==Qe&&Qe.call(El,"slot"))null!==(rt=El.tagName)&&void 0!==rt&&rt.toLowerCase().startsWith("pnx-")&&(El._parent=this,El._t=this._t),this.grid.appendChild(El)}}setPopup(Qe){let rt=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;Qe?this.popup.setAttribute("visible",""):this.popup.removeAttribute("visible"),this.popup.innerHTML="","string"===typeof rt?this.popup.innerHTML=rt:Array.isArray(rt)&&rt.forEach((Qe=>this.popup.appendChild(Qe)))}_onPopupClose(){this.dispatchEvent(new CustomEvent("focus-changed",{detail:{focus:this.map&&this.isMapWide()?"map":"pic"}}))}_showQualityScoreDoc(){this.setPopup(!0,[(0,Dl.createWebComp)("pnx-quality-score-doc",{_t:this._t})])}_showReportForm(){if(!this.psv.getPictureMetadata())throw new Error("No picture currently selected");this.setPopup(!0,[(0,Dl.createWebComp)("pnx-report-form",{_parent:this})]),this.dispatchEvent(new CustomEvent("focus-changed",{detail:{focus:"meta"}}))}_showPictureMetadata(){if(!this.psv.getPictureMetadata())throw new Error("No picture currently selected");this.setPopup(!0,[(0,Dl.createWebComp)("pnx-picture-metadata",{_parent:this})]),this.dispatchEvent(new CustomEvent("focus-changed",{detail:{focus:"meta"}}))}moveCenter(){this.psv.getPictureMetadata()&&this._psvAnimate({speed:Ll.LM,yaw:0,pitch:0,zoom:Ll.cS})}moveLeft(){this._moveToDirection("left")}moveRight(){this._moveToDirection("right")}moveUp(){this._moveToDirection("up")}moveDown(){this._moveToDirection("down")}_moveToDirection(Qe){let rt=this.psv.getPosition();switch(Qe){case"up":rt.pitch+=Ul;break;case"left":rt.yaw-=Ul;break;case"down":rt.pitch-=Ul;break;case"right":rt.yaw+=Ul}this._psvAnimate({speed:Ll.LM,...rt})}_psvAnimate(Qe){this._lastPsvAnim&&this._lastPsvAnim.cancel(),this._lastPsvAnim=this.psv.animate(Qe)}addEventListener(Qe,rt,Co){super.addEventListener(Qe,rt,Co)}}PhotoViewer.properties={psv:{type:Object},widgets:{type:String},"url-parameters":{type:String},...kl.A.properties},customElements.define("pnx-photo-viewer",PhotoViewer)},8743:(Qe,rt,Co)=>{"use strict";Co.d(rt,{$:()=>ql,A:()=>Viewer});Co(9616);var El=Co(8340),Tl=Co(3407),kl=Co(9039),Ll=Co(2771),Dl=Co(7343),Rl=Co(5995),Ul=Co(9683),Gl=Co(2e3),Zl=Co(9438),Wl=Co(2118);const ql=20,Ql=(Math.PI,100);class Viewer extends Tl.A{constructor(){super(),this.map=!0,this.geocoder=this.getAttribute("geocoder")||"nominatim",this.mini=(0,Rl.createWebComp)("pnx-mini",{slot:"bottom-left",_parent:this,onexpand:this._onMiniExpand.bind(this),collapsed:!!(0,Dl.isNullId)(this.picture)||void 0}),this.mini.addEventListener("expand",this._toggleFocus.bind(this)),this.grid.appendChild(this.mini),this.mapContainer=document.createElement("div")}_createInitParamsHandler(){var Qe,rt;this._initParams=new Wl.Ay(Wl.Ay.GetComponentProperties(Viewer,this),Object.assign({},null===(Qe=this.urlHandler)||void 0===Qe?void 0:Qe.currentURLParams(),null===(rt=this.urlHandler)||void 0===rt?void 0:rt.currentURLParams(!0)),{map:(0,El.getMapParamsFromLocalStorage)()})}_initWidgets(){var Qe,rt;"false"!==this._initParams.getParentInit().widgets&&(this.grid.appendChild((0,Rl.createWebComp)("pnx-widget-zoom",{slot:this.isWidthSmall()?"top-left":"bottom-right",class:this.isWidthSmall()?"pnx-only-map pnx-print-hidden":"pnx-print-hidden",_parent:this})),this.grid.appendChild((0,Rl.createWebComp)("pnx-widget-share",{slot:"bottom-right",class:"pnx-print-hidden",_parent:this})),this.legend=(0,Rl.createWebComp)("pnx-widget-legend",{slot:this.isWidthSmall()?"top":"top-left",_parent:this,focus:this._initParams.getParentPostInit().focus,picture:this._initParams.getParentPostInit().picture}),this.grid.appendChild(this.legend),this.grid.appendChild((0,Rl.createWebComp)("pnx-widget-player",{slot:"top",_parent:this,class:"pnx-only-psv pnx-print-hidden"})),this.grid.appendChild((0,Rl.createWebComp)("pnx-widget-geosearch",{slot:this.isWidthSmall()?"top-right":"top-left",_parent:this,class:"pnx-only-map pnx-print-hidden",geocoder:this._initParams.getParentPostInit().geocoder})),this.grid.appendChild((0,Rl.createWebComp)("pnx-widget-mapfilters",{slot:this.isWidthSmall()?"top-right":"top-left",_parent:this,"user-search":null!==this.api._endpoints.user_search&&null!==this.api._endpoints.user_tiles,"quality-score":(null===(Qe=this.map)||void 0===Qe||null===(rt=Qe._hasQualityScore)||void 0===rt?void 0:rt.call(Qe))||!1,class:"pnx-only-map pnx-print-hidden"})),this.grid.appendChild((0,Rl.createWebComp)("pnx-widget-maplayers",{slot:"top-right",_parent:this,class:"pnx-only-map pnx-print-hidden"})))}connectedCallback(){kl.A.prototype.connectedCallback.call(this),this._moveChildToGrid(),this.onceAPIReady().then((async()=>{this.loader.setAttribute("value",30),this._createInitParamsHandler();const Qe=this._initParams.getParentPostInit();this._initPSV(),await this._initMap(),this._initWidgets(),(0,Wl.iz)(this,Qe),this._handleKeyboardManagement(),Qe.picture?this.psv.addEventListener("picture-loaded",(()=>this.loader.dismiss()),{once:!0}):this.loader.dismiss()}))}getClassName(){return"Viewer"}getSubComponentsNames(){return super.getSubComponentsNames().concat(["mini","map"])}onceReady(){return Promise.all([this.oncePSVReady(),this.onceMapReady()]).then((()=>this._initParams.getParentPostInit().picture&&!this.psv.getPictureMetadata()?this.onceFirstPicLoaded():Promise.resolve()))}attributeChangedCallback(Qe,rt,Co){var El,Tl;(super.attributeChangedCallback(Qe,rt,Co),"picture"===Qe)&&(null===(El=this.legend)||void 0===El||null===(Tl=El.setAttribute)||void 0===Tl||Tl.call(El,"picture",Co),(0,Dl.isNullId)(rt)&&!(0,Dl.isNullId)(Co)&&this.mini.removeAttribute("collapsed"),(0,Dl.isNullId)(Co)&&this.map&&this.isMapWide()&&this.mini.classList.add("pnx-hidden"));"focus"===Qe&&this._setFocus(Co)}onceMapReady(){if(!this.map)return Promise.resolve();let Qe;return new Promise((rt=>{Qe=setInterval((()=>{var Co,El;"object"===typeof this.map&&(null!==(Co=(El=this.map).loaded)&&void 0!==Co&&Co.call(El)?(clearInterval(Qe),rt()):this.map.once&&this.map.once("render",(()=>{clearInterval(Qe),rt()})))}),250)}))}async _initMap(){await new Promise((Qe=>{this.map=new Ll.A(this,this.mapContainer,this._initParams.getMapInit()),(0,El.saveMapParamsToLocalStorage)(this.map),this.map.once("users-changed",(()=>{this.loader.setAttribute("value",75),Qe()}))})),(0,Wl.mK)(this.map,this._initParams.getMapPostInit()),(0,El.initMapKeyboardHandler)(this),(0,El.linkMapAndPhoto)(this)}_handleKeyboardManagement(){const keytomap=()=>{this.psv.stopKeyboardControl(),this.map.keyboard.enable()},keytopsv=()=>{var Qe,rt;this.psv.startKeyboardControl(),null===(Qe=this.map)||void 0===Qe||null===(rt=Qe.keyboard)||void 0===rt||rt.disable()},keytonone=()=>{var Qe,rt;this.psv.stopKeyboardControl(),null===(Qe=this.map)||void 0===Qe||null===(rt=Qe.keyboard)||void 0===rt||rt.disable()},keytofocused=()=>{this.map&&this.isMapWide()?keytomap():keytopsv()};this.addEventListener("focus-changed",(Qe=>{"map"===Qe.detail.focus?keytomap():keytopsv()})),this.popup.addEventListener("open",(()=>keytonone())),this.popup.addEventListener("close",(()=>keytofocused()));for(let Qe of this.grid.childNodes)"bg"!==Qe.getAttribute("slot")&&(Qe.addEventListener("focusin",(()=>keytonone())),Qe.addEventListener("focusout",(()=>keytofocused())))}moveCenter(){const Qe=this.psv.getPictureMetadata();Qe&&(this.map&&this.isMapWide()?this.map.flyTo({center:Qe.gps,zoom:20}):super.moveCenter())}_moveToDirection(Qe){if(this.map&&this.isMapWide()){let rt;switch(Qe){case"up":rt=[0,-100];break;case"left":rt=[-100,0];break;case"down":rt=[0,Ql];break;case"right":rt=[Ql,0]}this.map.panBy(rt)}else super._moveToDirection(Qe)}isMapWide(){return this.mapContainer.parentNode==this.grid}_setFocus(Qe){var rt,Co,El,Tl;let kl=arguments.length>1&&void 0!==arguments[1]&&arguments[1],Ll=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if("map"===Qe&&!this.map)throw new Error("Map is not enabled");if(!["map","pic"].includes(Qe))throw new Error("Invalid focus value (should be pic or map)");if(this.focus=Qe,(Ll||("map"!==Qe||!this.map||!this.isMapWide())&&("pic"!==Qe||this.map&&this.isMapWide()))&&("map"===Qe?(this.psvContainer.parentNode==this.grid&&(this.grid.removeChild(this.psvContainer),this.psvContainer.removeAttribute("slot")),this.mapContainer.parentNode==this.mini&&this.mini.removeChild(this.mapContainer),this.mapContainer.setAttribute("slot","bg"),this.grid.appendChild(this.mapContainer),this.mini.appendChild(this.psvContainer),this.mini.icon=(0,Rl.fa)(Ul.pt),(0,Dl.isNullId)(this.picture)?this.mini.classList.add("pnx-hidden"):this.mini.classList.remove("pnx-hidden"),this.map.getCanvas().focus()):(this.mapContainer.parentNode==this.grid&&(this.grid.removeChild(this.mapContainer),this.mapContainer.removeAttribute("slot")),this.psvContainer.parentNode==this.mini&&this.mini.removeChild(this.psvContainer),this.psvContainer.setAttribute("slot","bg"),this.grid.appendChild(this.psvContainer),this.mini.classList.remove("pnx-hidden"),this.mini.appendChild(this.mapContainer),this.mini.icon=(0,Rl.fa)(Gl.e5),this.psvContainer.focus()),null===this||void 0===this||null===(rt=this.map)||void 0===rt||null===(Co=rt.resize)||void 0===Co||Co.call(rt),this.psv.autoSize(),this.psv.forceRefresh(),null===(El=this.legend)||void 0===El||null===(Tl=El.setAttribute)||void 0===Tl||Tl.call(El,"focus",this.focus),!kl)){const rt=new CustomEvent("focus-changed",{detail:{focus:Qe}});this.dispatchEvent(rt)}}_toggleFocus(){this._setFocus(this.isMapWide()?"pic":"map")}_onMiniExpand(){this.map.resize(),this.psv.autoSize()}_onMapFiltersChange(){var Qe;const rt=(0,Zl.qi)("#pnx-map-filters-menu"),Co=null===rt||void 0===rt?void 0:rt.shadowRoot.getElementById("pnx-filter-date-from"),El=null===rt||void 0===rt?void 0:rt.shadowRoot.getElementById("pnx-filter-date-end"),Tl=null===rt||void 0===rt?void 0:rt.shadowRoot.getElementById("pnx-filter-type-flat"),kl=null===rt||void 0===rt?void 0:rt.shadowRoot.getElementById("pnx-filter-type-360"),Ll=(0,Zl.qi)("#pnx-map-theme");let Dl="";null===kl||void 0===kl||!kl.checked||null!==Tl&&void 0!==Tl&&Tl.checked||(Dl="equirectangular"),null!==kl&&void 0!==kl&&kl.checked||null===Tl||void 0===Tl||!Tl.checked||(Dl="flat");let Rl=[];if(null!==(Qe=this.map)&&void 0!==Qe&&Qe._hasQualityScore()){const Qe=null===rt||void 0===rt?void 0:rt.shadowRoot.getElementById("pnx-filter-qualityscore");Rl=((null===Qe||void 0===Qe?void 0:Qe.grade)||"").split(",").map((Qe=>parseInt(Qe))).filter((Qe=>!isNaN(Qe))),5==Rl.length&&(Rl=[])}const Ul={minDate:null===Co||void 0===Co?void 0:Co.value,maxDate:null===El||void 0===El?void 0:El.value,pic_type:Dl,theme:null===Ll||void 0===Ll?void 0:Ll.value,qualityscore:Rl};this.map.setFilters(Ul)}}Viewer.properties={map:{type:Object},focus:{type:String,reflect:!0},geocoder:{type:String},...Tl.A.properties},customElements.define("pnx-viewer",Viewer)},3921:(Qe,rt,Co)=>{"use strict";Co.r(rt),Co.d(rt,{Basic:()=>El.A,CoverageMap:()=>Tl.A,Editor:()=>kl.A,PhotoViewer:()=>Dl.A,Viewer:()=>Ll.A});var El=Co(9039),Tl=Co(153),kl=Co(1752),Ll=Co(8743),Dl=Co(3407)},9341:(Qe,rt,Co)=>{"use strict";Co.r(rt),Co.d(rt,{core:()=>El,layout:()=>Tl,menus:()=>kl,ui:()=>Ll});var El=Co(3921),Tl=Co(456),kl=Co(8794),Ll=Co(9472)},7422:(Qe,rt,Co)=>{"use strict";Co.d(rt,{A:()=>CorneredGrid});var El=Co(4542);class CorneredGrid extends El.WF{render(){return El.qy`
|
|
12
|
+
!function(Qe,rt){"object"===typeof exports&&"object"===typeof module?module.exports=rt():"function"===typeof define&&define.amd?define("Panoramax",[],rt):"object"===typeof exports?exports.Panoramax=rt():Qe.Panoramax=rt()}(this,(()=>(()=>{var Qe={9039:(Qe,rt,Co)=>{"use strict";Co.d(rt,{A:()=>Basic});var El=Co(4542),Tl=Co(5254),kl=Co(4964),Ll=Co(8340),Dl=Co(5995),Rl=Co(7343),Ul=Co(8330);Co(1865),Co(3638);class Basic extends El.WF{constructor(){let Qe=arguments.length>0&&void 0!==arguments[0]&&arguments[0];super(),this.users=["geovisio"],this.mapstyle=this.getAttribute("mapstyle")||Ll.DEFAULT_TILES,this.lang=this.getAttribute("lang")||null,this.endpoint=this.getAttribute("endpoint")||null,this.picture=null,this.sequence=null,console.info(`\ud83d\udcf7 Panoramax ${this.getClassName()} - Version ${Ul.rE} (04898f1)\n\n\ud83c\udd98 Issues can be reported at ${Ul.Jk.O}`),this._t=(0,kl.getTranslations)(this.lang),Qe||(this.loader=(0,Dl.createWebComp)("pnx-loader",{_parent:this,"no-label":(0,Rl.isInIframe)()}),this._isInternetFast=null,(0,Rl.isInternetFast)().then((Qe=>this._isInternetFast=Qe)))}connectedCallback(){super.connectedCallback(),this.endpoint&&this._setupAPI()}_setupAPI(){if(this.loader=this.loader||(0,Dl.createWebComp)("pnx-loader",{_parent:this}),this.endpoint){try{this.mapstyle=JSON.parse(this.mapstyle)}catch(rt){}try{this.api=new Tl.A(this.endpoint,{users:this.users,fetch:this.fetchOptions,style:this.mapstyle}),this.api.onceReady().then((()=>{let Qe=this.api.getUnavailableFeatures(),rt=this.api.getAvailableFeatures();rt=0===Qe.length?"\u2705 All features available":"\u2705 Available features: "+rt.join(", "),Qe=0===Qe.length?"":"\ud83d\udeab Unavailable features: "+Qe.join(", "),console.info(`\ud83c\udf10 Connected to API "${this.api._metadata.name}" (${this.api._endpoint})\n\u2139\ufe0f API runs STAC ${this.api._metadata.stac_version} ${this.api._metadata.geovisio_version?"& GeoVisio "+this.api._metadata.geovisio_version:""}\n ${rt}\n ${Qe}\n`.trim())})).catch((Qe=>this.loader.dismiss(Qe,this._t.pnx.error_api)))}catch(rt){var Qe;null!==(Qe=this.loader)&&void 0!==Qe&&Qe.dismiss?this.loader.dismiss(rt,this._t.pnx.error_api):console.error(rt)}}else console.warn("No endpoint is defined")}onceReady(){throw new Error("You must override this method on sub-class")}onceAPIReady(){return this.api?this.api.onceReady():new Promise((Qe=>setTimeout(Qe,100))).then(this.onceAPIReady.bind(this))}createRenderRoot(){return this}attributeChangedCallback(Qe,rt,Co){if(super.attributeChangedCallback(Qe,rt,Co),"endpoint"===Qe&&(this.api&&this.api._endpoint===Co||this._setupAPI()),["picture","sequence"].includes(Qe)){let El,Tl,kl,Ll;"picture"===Qe?(El=this.sequence,kl=this.sequence,Tl=Co,Ll=rt):(El=Co,kl=rt,Tl=this.picture,Ll=this.picture),this.dispatchEvent(new CustomEvent("select",{bubbles:!0,composed:!0,detail:{seqId:El,picId:Tl,prevSeqId:kl,prevPicId:Ll}}))}}getClassName(){return"Basic"}select(){let Qe=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,rt=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;arguments.length>2&&void 0!==arguments[2]&&arguments[2]&&(this.picture=null,this.sequence=null),this.picture=rt,this.sequence=Qe}isWidthSmall(){return(null===this||void 0===this?void 0:this.offsetWidth)<576}isHeightSmall(){return(null===this||void 0===this?void 0:this.offsetHeight)<400}render(){return El.qy`<p>Should not be used directly, use Viewer/CoverageMap/Editor instead</p>`}getSubComponentsNames(){return["loader","api"]}addEventListener(Qe,rt,Co){let El=Qe.split(":").shift();if(El&&this.getSubComponentsNames().includes(El)){var Tl;const Ll=Qe.substring(El.length+1);var kl;if("map"===El)null!==(kl=this.map)&&void 0!==kl&&kl.on?null!==Co&&void 0!==Co&&Co.once?this.map.once(Ll,rt):this.map.on(Ll,rt):setTimeout((()=>{this.addEventListener(Qe,rt,Co)}),50);else null!==(Tl=this[El])&&void 0!==Tl&&Tl.addEventListener?this[El].addEventListener(Ll,rt,Co):setTimeout((()=>this.addEventListener(Qe,rt,Co)),50)}else super.addEventListener(Qe,rt,Co)}}Basic.properties={picture:{type:String,reflect:!0},sequence:{type:String,reflect:!0},fetchOptions:{type:Object,attribute:!1},users:{type:Array,reflect:!0},mapstyle:{type:String},lang:{type:String},endpoint:{type:String}}},153:(Qe,rt,Co)=>{"use strict";Co.d(rt,{A:()=>CoverageMap});var El=Co(9039),Tl=Co(5642),kl=Co(8340),Ll=Co(927),Dl=(Co(7776),Co(2118));class CoverageMap extends El.A{constructor(){super(),this._mapContainer=document.createElement("div"),this.onceAPIReady().then((()=>{this.loader.setAttribute("value",30),this._initParams=new Dl.Ay(Dl.Ay.GetComponentProperties(CoverageMap,this)),this._initMap()})),this.addEventListener("select",this._onSelect.bind(this))}getClassName(){return"CoverageMap"}onceReady(){return this.map&&this.map.waitForEnoughMapLoaded?this.map.waitForEnoughMapLoaded():new Promise((Qe=>setTimeout(Qe,100))).then(this.onceReady.bind(this))}render(){return[this.loader,this._mapContainer]}getSubComponentsNames(){const Qe=super.getSubComponentsNames();return Qe.push("map"),Qe}_initMap(){class MyMap extends Tl.A{_getLayerStyleProperties(Qe){return"pictures_symbols"===Qe?{layout:{visibility:"none"}}:super._getLayerStyleProperties(Qe)}}this.map=new MyMap(this,this._mapContainer,Object.assign({},this._initParams.getMapInit(),{hash:!0})),this.map.addControl(new Ll.NavigationControl({showCompass:!1})),this.loader.setAttribute("value",70),this.map.waitForEnoughMapLoaded().then((()=>{(0,Dl.mK)(this.map,this._initParams.getMapPostInit()),this.map.reloadLayersStyles(),this.loader.dismiss()})),this.map.on("picture-click",(Qe=>this.select(Qe.seqId,Qe.picId))),this.map.on("sequence-click",(Qe=>this.select(Qe.seqId)))}_onSelect(Qe){if(Qe.detail.picId||Qe.detail.seqId){const rt=Qe.detail.picId?"pictures":"sequences",Co=this.map.queryRenderedFeatures({layers:[...this.map._userLayers].map((Qe=>(0,kl.getUserLayerId)(Qe,rt))),filter:["==",["get","id"],Qe.detail.picId||Qe.detail.seqId]});Co.length>=0&&null!=Co[0]&&this.map._attachPreviewToPictures({features:Co},rt)}}}CoverageMap.properties={map:{type:Object},...El.A.properties},customElements.define("pnx-coverage-map",CoverageMap)},1752:(Qe,rt,Co)=>{"use strict";Co.d(rt,{A:()=>Editor});Co(7365);var El=Co(9039),Tl=Co(5642),kl=Co(9048),Ll=(Co(7534),Co(6810),Co(508)),Dl=Co(8340),Rl=Co(1545),Ul=(Co(4542),Co(5995));const Gl="sequence-headings";class Editor extends El.A{constructor(){super(),this.raster=null,this.background="streets",this.users=[],this._psvContainer=document.createElement("div"),this._mapContainer=document.createElement("div"),this.onceAPIReady().then((()=>{this.loader.setAttribute("value",30),this.sequence||this.loader.dismiss({},"No sequence is selected"),this.addEventListener("select",this._onSelect.bind(this)),this._initPSV(),this._initMap()}))}getClassName(){return"Editor"}onceReady(){var Qe,rt;return this.map&&this.psv&&null!==(Qe=(rt=this.map).loaded)&&void 0!==Qe&&Qe.call(rt)?Promise.resolve():new Promise((Qe=>setTimeout(Qe,100))).then(this.onceReady.bind(this))}render(){return[this.loader,this._psvContainer,this._mapContainer]}getSubComponentsNames(){return super.getSubComponentsNames().concat(["map","psv"])}_initPSV(){try{this.psv=new kl.Ay(this,this._psvContainer),this.psv._myVTour.datasource.nodeResolver=this._getNode.bind(this)}catch(Qe){let rt=Rl.IJ.isWebGLSupported?this._t.pnx.error_psv:this._t.pnx.error_webgl;this.loader.dismiss(Qe,rt)}}_initMap(){try{this.map=new Tl.A(this,this._mapContainer,{raster:this.raster,background:this.background,supplementaryStyle:this._createMapStyle(),zoom:15}),(0,Dl.linkMapAndPhoto)(this),this.loader.setAttribute("value",50),this._loadSequence(),this.map.once("load",(()=>{this.map.hasTwoBackgrounds()&&this._addMapBackgroundWidget(),this._bindPicturesEvents()}));const Qe=this.map._picMarker.setRotation.bind(this.map._picMarker);this.map._picMarker.setRotation=rt=>(rt=void 0===this._lastRelHeading?rt:rt+this._lastRelHeading-this.psv.getPictureRelativeHeading(),Qe(rt))}catch(Qe){this.loader.dismiss(Qe,this._t.pnx.error_psv)}}_createMapStyle(){return{sources:{geovisio_editor_sequences:{type:"geojson",data:{type:"FeatureCollection",features:[]}}},layers:[{id:"geovisio_editor_sequences",type:"line",source:"geovisio_editor_sequences",layout:{...Dl.VECTOR_STYLES.SEQUENCES.layout},paint:{...Dl.VECTOR_STYLES.SEQUENCES.paint}},{id:"geovisio_editor_pictures",type:"circle",source:"geovisio_editor_sequences",layout:{...Dl.VECTOR_STYLES.PICTURES.layout},paint:{...Dl.VECTOR_STYLES.PICTURES.paint}}]}}_bindPicturesEvents(){this.map.on("mousemove","geovisio_editor_pictures",(()=>{this.map.getCanvas().style.cursor="pointer"})),this.map.on("mouseleave","geovisio_editor_pictures",(()=>{this.map.getCanvas().style.cursor=""})),this.map.on("click","geovisio_editor_pictures",this.map._onPictureClick.bind(this.map))}_loadSequence(){return this.loader.setAttribute("value",60),this.api.getSequenceItems(this.sequence).then((Qe=>{if(this.loader.setAttribute("value",80),this.map.once("sourcedata",(()=>{this.map.setPaintProperty("geovisio_editor_sequences","line-color",this.map._getLayerColorStyle("sequences")),this.map.setPaintProperty("geovisio_editor_pictures","circle-color",this.map._getLayerColorStyle("pictures")),this.map.setLayoutProperty("geovisio_editor_sequences","visibility","visible"),this.map.setLayoutProperty("geovisio_editor_pictures","visibility","visible"),this.map.once("styledata",(()=>this.loader.dismiss()))})),this._sequenceData=Qe.features,this.map.getSource("geovisio_editor_sequences").setData({type:"FeatureCollection",features:[{type:"Feature",properties:{id:this.sequence},geometry:{type:"LineString",coordinates:Qe.features.map((Qe=>Qe.geometry.coordinates))}},...Qe.features.map((Qe=>(Qe.properties.id=Qe.id,Qe.properties.sequences=[this.sequence],Qe)))]}),this.picture){const rt=Qe.features.find((Qe=>Qe.id===this.picture));rt?(this.select(this.sequence,this.picture,!0),this.map.jumpTo({center:rt.geometry.coordinates,zoom:18})):console.log("Picture with ID",rt,"was not found")}else{const rt=[...Qe.features[0].geometry.coordinates,...Qe.features[0].geometry.coordinates];for(let Co=1;Co<Qe.features.length;Co++){const El=Qe.features[Co].geometry.coordinates;El[0]<rt[0]&&(rt[0]=El[0]),El[1]<rt[1]&&(rt[1]=El[1]),El[0]>rt[2]&&(rt[2]=El[0]),El[1]>rt[3]&&(rt[3]=El[1])}this.map.fitBounds(rt,{animate:!1})}})).catch((Qe=>this.loader.dismiss(Qe,this._t.pnx.error_api)))}_getNode(Qe){const rt=this._sequenceData.find((rt=>rt.properties.id===Qe)),Co=rt?(0,Ll.apiFeatureToPSVNode)(rt,this._t,this._isInternetFast):null;return Co&&delete Co.links,Co}_addMapBackgroundWidget(){const Qe=(0,Ul.createWebComp)("pnx-map-background",{_parent:this,size:"sm"});this._mapContainer.appendChild(Qe)}previewSequenceHeadingChange(Qe){const rt=void 0!==this.map.getLayer(Gl);if(this.map._picMarkerPreview.remove(),void 0===Qe)return delete this._lastRelHeading,rt&&this.map.setLayoutProperty(Gl,"visibility","none"),void(this.picture&&this.map._picMarker.setRotation(this.psv.getXY().x));this._lastRelHeading=Qe,rt||this.map.addLayer({id:Gl,type:"symbol",source:"geovisio_editor_sequences",layout:{"icon-image":"pnx-marker","icon-overlap":"always","icon-size":.8}});const Co=-this.psv.getPictureRelativeHeading();this.map.setLayoutProperty(Gl,"visibility","visible"),this.map.setLayoutProperty(Gl,"icon-rotate",["+",["get","view:azimuth"],Co,Qe]);const El=[["==",["geometry-type"],"Point"]];this.picture&&El.push(["!=",["get","id"],this.picture]),this.map.setFilter(Gl,["all",...El]),this.picture&&this.map._picMarker.setRotation(this.psv.getXY().x)}_onSelect(){void 0!==this._lastRelHeading&&this.previewSequenceHeadingChange(this._lastRelHeading)}}Editor.properties={raster:{type:Object},background:{type:String},...El.A.properties},customElements.define("pnx-editor",Editor)},3407:(Qe,rt,Co)=>{"use strict";Co.d(rt,{A:()=>PhotoViewer});Co(970);var El=Co(1545),Tl=Co(4451),kl=Co(9039),Ll=Co(9048),Dl=Co(5995),Rl=Co(2118);const Ul=Math.PI/6;class PhotoViewer extends kl.A{constructor(){super(),this.psv={},this["url-parameters"]=this.getAttribute("url-parameters")||!0,this.widgets=this.getAttribute("widgets")||"true",this.grid=(0,Dl.createWebComp)("pnx-cornered-grid"),this.psvContainer=document.createElement("div"),this.psvContainer.setAttribute("slot","bg"),this.grid.appendChild(this.psvContainer),this.popup=(0,Dl.createWebComp)("pnx-popup",{_parent:this,onclose:this._onPopupClose.bind(this)}),this["url-parameters"]&&"false"!==this["url-parameters"]&&(this.urlHandler=new Tl.A(this),this.onceReady().then((()=>{this.urlHandler.listenToChanges(),this.urlHandler._onParentChange()})))}_createInitParamsHandler(){var Qe,rt;this._initParams=new Rl.Ay(Rl.Ay.GetComponentProperties(PhotoViewer,this),Object.assign({},null===(Qe=this.urlHandler)||void 0===Qe?void 0:Qe.currentURLParams(),null===(rt=this.urlHandler)||void 0===rt?void 0:rt.currentURLParams(!0)),{})}_initWidgets(){"false"!==this._initParams.getParentPostInit().widgets&&(this.isWidthSmall()||this.grid.appendChild((0,Dl.createWebComp)("pnx-widget-zoom",{slot:"bottom-right",class:"pnx-print-hidden",_parent:this})),this.grid.appendChild((0,Dl.createWebComp)("pnx-widget-share",{slot:"bottom-right",class:"pnx-print-hidden",_parent:this})),this.legend=(0,Dl.createWebComp)("pnx-widget-legend",{slot:this.isWidthSmall()?"top":"top-left",_parent:this,focus:this._initParams.getParentPostInit().focus,picture:this._initParams.getParentPostInit().picture}),this.grid.appendChild(this.legend),this.grid.appendChild((0,Dl.createWebComp)("pnx-widget-player",{slot:"top",_parent:this,class:"pnx-only-psv pnx-print-hidden"})))}connectedCallback(){super.connectedCallback(),this._moveChildToGrid(),this.onceAPIReady().then((async()=>{this.loader.setAttribute("value",30),this._createInitParamsHandler();const Qe=this._initParams.getParentPostInit();this._initPSV(),this._initWidgets(),(0,Rl.ai)(this,Qe),this._handleKeyboardManagement(),Qe.picture?this.psv.addEventListener("picture-loaded",(()=>this.loader.dismiss()),{once:!0}):this.loader.dismiss()}))}getClassName(){return"PhotoViewer"}onceReady(){return this.oncePSVReady().then((()=>this._initParams.getParentPostInit().picture&&!this.psv.getPictureMetadata()?this.onceFirstPicLoaded():Promise.resolve()))}render(){return[this.loader,this.grid,this.popup,this.slot]}getSubComponentsNames(){return super.getSubComponentsNames().concat(["psv","grid","popup","urlHandler"])}oncePSVReady(){let Qe;return new Promise((rt=>{Qe=setInterval((()=>{"object"===typeof this.psv&&(this.psv.container?(clearInterval(Qe),rt()):this.psv.addEventListener&&this.psv.addEventListener("ready",(()=>{clearInterval(Qe),rt()}),{once:!0}))}),250)}))}onceFirstPicLoaded(){return this.oncePSVReady().then((()=>this.psv.getPictureMetadata()?Promise.resolve():new Promise((Qe=>{this.psv.addEventListener("picture-loaded",Qe,{once:!0})}))))}_initPSV(){try{this.psv=new Ll.Ay(this,this.psvContainer,{shouldGoFast:this._psvShouldGoFast.bind(this),keyboard:"always",keyboardActions:{...El.zY.keyboardActions,8:"ROTATE_UP",2:"ROTATE_DOWN",4:"ROTATE_LEFT",6:"ROTATE_RIGHT",PageUp:()=>this.psv.goToNextPicture(),9:()=>this.psv.goToNextPicture(),PageDown:()=>this.psv.goToPrevPicture(),3:()=>this.psv.goToPrevPicture(),5:()=>this.moveCenter(),"*":()=>this.moveCenter(),Home:()=>this._toggleFocus(),7:()=>this._toggleFocus(),End:()=>this.mini.toggleAttribute("collapsed"),1:()=>this.mini.toggleAttribute("collapsed")," ":()=>this.psv.toggleSequencePlaying(),0:()=>this.psv.toggleSequencePlaying()},...this._initParams.getPSVInit()}),this.oncePSVReady().then((()=>{this.loader.setAttribute("value",50),(0,Rl.Vy)(this.psv,this._initParams.getPSVPostInit())}))}catch(Qe){let rt=El.IJ.isWebGLSupported?this._t.pnx.error_psv:this._t.pnx.error_webgl;this.loader.dismiss(Qe,rt)}}_handleKeyboardManagement(){const keytonone=()=>this.psv.stopKeyboardControl(),keytopsv=()=>this.psv.startKeyboardControl();this.popup.addEventListener("open",(()=>keytonone())),this.popup.addEventListener("close",(()=>keytopsv()));for(let Qe of this.grid.childNodes)"bg"!==Qe.getAttribute("slot")&&(Qe.addEventListener("focusin",(()=>keytonone())),Qe.addEventListener("focusout",(()=>keytopsv())))}_psvShouldGoFast(){return this.psv._sequencePlaying&&this.psv.getTransitionDuration()<1e3}_moveChildToGrid(){for(let Co=0;Co<this.childNodes.length;Co++){var Qe;let El=this.childNodes[Co];var rt;if(null!==(Qe=El.getAttribute)&&void 0!==Qe&&Qe.call(El,"slot"))null!==(rt=El.tagName)&&void 0!==rt&&rt.toLowerCase().startsWith("pnx-")&&(El._parent=this,El._t=this._t),this.grid.appendChild(El)}}setPopup(Qe){let rt=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;Qe?this.popup.setAttribute("visible",""):this.popup.removeAttribute("visible"),this.popup.innerHTML="","string"===typeof rt?this.popup.innerHTML=rt:Array.isArray(rt)&&rt.forEach((Qe=>this.popup.appendChild(Qe)))}_onPopupClose(){this.dispatchEvent(new CustomEvent("focus-changed",{detail:{focus:this.map&&this.isMapWide()?"map":"pic"}}))}_showQualityScoreDoc(){this.setPopup(!0,[(0,Dl.createWebComp)("pnx-quality-score-doc",{_t:this._t})])}_showReportForm(){if(!this.psv.getPictureMetadata())throw new Error("No picture currently selected");this.setPopup(!0,[(0,Dl.createWebComp)("pnx-report-form",{_parent:this})]),this.dispatchEvent(new CustomEvent("focus-changed",{detail:{focus:"meta"}}))}_showPictureMetadata(){if(!this.psv.getPictureMetadata())throw new Error("No picture currently selected");this.setPopup(!0,[(0,Dl.createWebComp)("pnx-picture-metadata",{_parent:this})]),this.dispatchEvent(new CustomEvent("focus-changed",{detail:{focus:"meta"}}))}moveCenter(){this.psv.getPictureMetadata()&&this._psvAnimate({speed:Ll.LM,yaw:0,pitch:0,zoom:Ll.cS})}moveLeft(){this._moveToDirection("left")}moveRight(){this._moveToDirection("right")}moveUp(){this._moveToDirection("up")}moveDown(){this._moveToDirection("down")}_moveToDirection(Qe){let rt=this.psv.getPosition();switch(Qe){case"up":rt.pitch+=Ul;break;case"left":rt.yaw-=Ul;break;case"down":rt.pitch-=Ul;break;case"right":rt.yaw+=Ul}this._psvAnimate({speed:Ll.LM,...rt})}_psvAnimate(Qe){this._lastPsvAnim&&this._lastPsvAnim.cancel(),this._lastPsvAnim=this.psv.animate(Qe)}addEventListener(Qe,rt,Co){super.addEventListener(Qe,rt,Co)}}PhotoViewer.properties={psv:{type:Object},widgets:{type:String},"url-parameters":{type:String},...kl.A.properties},customElements.define("pnx-photo-viewer",PhotoViewer)},8743:(Qe,rt,Co)=>{"use strict";Co.d(rt,{$:()=>ql,A:()=>Viewer});Co(9616);var El=Co(8340),Tl=Co(3407),kl=Co(9039),Ll=Co(2771),Dl=Co(7343),Rl=Co(5995),Ul=Co(9683),Gl=Co(2e3),Zl=Co(9438),Wl=Co(2118);const ql=20,Ql=(Math.PI,100);class Viewer extends Tl.A{constructor(){super(),this.map=!0,this.geocoder=this.getAttribute("geocoder")||"nominatim",this.mini=(0,Rl.createWebComp)("pnx-mini",{slot:"bottom-left",_parent:this,onexpand:this._onMiniExpand.bind(this),collapsed:!!(0,Dl.isNullId)(this.picture)||void 0}),this.mini.addEventListener("expand",this._toggleFocus.bind(this)),this.grid.appendChild(this.mini),this.mapContainer=document.createElement("div")}_createInitParamsHandler(){var Qe,rt;this._initParams=new Wl.Ay(Wl.Ay.GetComponentProperties(Viewer,this),Object.assign({},null===(Qe=this.urlHandler)||void 0===Qe?void 0:Qe.currentURLParams(),null===(rt=this.urlHandler)||void 0===rt?void 0:rt.currentURLParams(!0)),{map:(0,El.getMapParamsFromLocalStorage)()})}_initWidgets(){var Qe,rt;"false"!==this._initParams.getParentPostInit().widgets&&(this.grid.appendChild((0,Rl.createWebComp)("pnx-widget-zoom",{slot:this.isWidthSmall()?"top-left":"bottom-right",class:this.isWidthSmall()?"pnx-only-map pnx-print-hidden":"pnx-print-hidden",_parent:this})),this.grid.appendChild((0,Rl.createWebComp)("pnx-widget-share",{slot:"bottom-right",class:"pnx-print-hidden",_parent:this})),this.legend=(0,Rl.createWebComp)("pnx-widget-legend",{slot:this.isWidthSmall()?"top":"top-left",_parent:this,focus:this._initParams.getParentPostInit().focus,picture:this._initParams.getParentPostInit().picture}),this.grid.appendChild(this.legend),this.grid.appendChild((0,Rl.createWebComp)("pnx-widget-player",{slot:"top",_parent:this,class:"pnx-only-psv pnx-print-hidden"})),this.grid.appendChild((0,Rl.createWebComp)("pnx-widget-geosearch",{slot:this.isWidthSmall()?"top-right":"top-left",_parent:this,class:"pnx-only-map pnx-print-hidden",geocoder:this._initParams.getParentPostInit().geocoder})),this.grid.appendChild((0,Rl.createWebComp)("pnx-widget-mapfilters",{slot:this.isWidthSmall()?"top-right":"top-left",_parent:this,"user-search":null!==this.api._endpoints.user_search&&null!==this.api._endpoints.user_tiles,"quality-score":(null===(Qe=this.map)||void 0===Qe||null===(rt=Qe._hasQualityScore)||void 0===rt?void 0:rt.call(Qe))||!1,class:"pnx-only-map pnx-print-hidden"})),this.grid.appendChild((0,Rl.createWebComp)("pnx-widget-maplayers",{slot:"top-right",_parent:this,class:"pnx-only-map pnx-print-hidden"})))}connectedCallback(){kl.A.prototype.connectedCallback.call(this),this._moveChildToGrid(),this.onceAPIReady().then((async()=>{this.loader.setAttribute("value",30),this._createInitParamsHandler();const Qe=this._initParams.getParentPostInit();this._initPSV(),await this._initMap(),this._initWidgets(),(0,Wl.iz)(this,Qe),this._handleKeyboardManagement(),Qe.picture?this.psv.addEventListener("picture-loaded",(()=>this.loader.dismiss()),{once:!0}):this.loader.dismiss()}))}getClassName(){return"Viewer"}getSubComponentsNames(){return super.getSubComponentsNames().concat(["mini","map"])}onceReady(){return Promise.all([this.oncePSVReady(),this.onceMapReady()]).then((()=>this._initParams.getParentPostInit().picture&&!this.psv.getPictureMetadata()?this.onceFirstPicLoaded():Promise.resolve()))}attributeChangedCallback(Qe,rt,Co){var El,Tl;(super.attributeChangedCallback(Qe,rt,Co),"picture"===Qe)&&(null===(El=this.legend)||void 0===El||null===(Tl=El.setAttribute)||void 0===Tl||Tl.call(El,"picture",Co),(0,Dl.isNullId)(rt)&&!(0,Dl.isNullId)(Co)&&this.mini.removeAttribute("collapsed"),(0,Dl.isNullId)(Co)&&this.map&&this.isMapWide()&&this.mini.classList.add("pnx-hidden"));"focus"===Qe&&this._setFocus(Co)}onceMapReady(){if(!this.map)return Promise.resolve();let Qe;return new Promise((rt=>{Qe=setInterval((()=>{var Co,El;"object"===typeof this.map&&(null!==(Co=(El=this.map).loaded)&&void 0!==Co&&Co.call(El)?(clearInterval(Qe),rt()):this.map.once&&this.map.once("render",(()=>{clearInterval(Qe),rt()})))}),250)}))}async _initMap(){await new Promise((Qe=>{this.map=new Ll.A(this,this.mapContainer,this._initParams.getMapInit()),(0,El.saveMapParamsToLocalStorage)(this.map),this.map.once("users-changed",(()=>{this.loader.setAttribute("value",75),Qe()}))})),(0,Wl.mK)(this.map,this._initParams.getMapPostInit()),(0,El.initMapKeyboardHandler)(this),(0,El.linkMapAndPhoto)(this)}_handleKeyboardManagement(){const keytomap=()=>{this.psv.stopKeyboardControl(),this.map.keyboard.enable()},keytopsv=()=>{var Qe,rt;this.psv.startKeyboardControl(),null===(Qe=this.map)||void 0===Qe||null===(rt=Qe.keyboard)||void 0===rt||rt.disable()},keytonone=()=>{var Qe,rt;this.psv.stopKeyboardControl(),null===(Qe=this.map)||void 0===Qe||null===(rt=Qe.keyboard)||void 0===rt||rt.disable()},keytofocused=()=>{this.map&&this.isMapWide()?keytomap():keytopsv()};this.addEventListener("focus-changed",(Qe=>{"map"===Qe.detail.focus?keytomap():keytopsv()})),this.popup.addEventListener("open",(()=>keytonone())),this.popup.addEventListener("close",(()=>keytofocused()));for(let Qe of this.grid.childNodes)"bg"!==Qe.getAttribute("slot")&&(Qe.addEventListener("focusin",(()=>keytonone())),Qe.addEventListener("focusout",(()=>keytofocused())))}moveCenter(){const Qe=this.psv.getPictureMetadata();Qe&&(this.map&&this.isMapWide()?this.map.flyTo({center:Qe.gps,zoom:20}):super.moveCenter())}_moveToDirection(Qe){if(this.map&&this.isMapWide()){let rt;switch(Qe){case"up":rt=[0,-100];break;case"left":rt=[-100,0];break;case"down":rt=[0,Ql];break;case"right":rt=[Ql,0]}this.map.panBy(rt)}else super._moveToDirection(Qe)}isMapWide(){return this.mapContainer.parentNode==this.grid}_setFocus(Qe){var rt,Co,El,Tl;let kl=arguments.length>1&&void 0!==arguments[1]&&arguments[1],Ll=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if("map"===Qe&&!this.map)throw new Error("Map is not enabled");if(!["map","pic"].includes(Qe))throw new Error("Invalid focus value (should be pic or map)");if(this.focus=Qe,(Ll||("map"!==Qe||!this.map||!this.isMapWide())&&("pic"!==Qe||this.map&&this.isMapWide()))&&("map"===Qe?(this.psvContainer.parentNode==this.grid&&(this.grid.removeChild(this.psvContainer),this.psvContainer.removeAttribute("slot")),this.mapContainer.parentNode==this.mini&&this.mini.removeChild(this.mapContainer),this.mapContainer.setAttribute("slot","bg"),this.grid.appendChild(this.mapContainer),this.mini.appendChild(this.psvContainer),this.mini.icon=(0,Rl.fa)(Ul.pt),(0,Dl.isNullId)(this.picture)?this.mini.classList.add("pnx-hidden"):this.mini.classList.remove("pnx-hidden"),this.map.getCanvas().focus()):(this.mapContainer.parentNode==this.grid&&(this.grid.removeChild(this.mapContainer),this.mapContainer.removeAttribute("slot")),this.psvContainer.parentNode==this.mini&&this.mini.removeChild(this.psvContainer),this.psvContainer.setAttribute("slot","bg"),this.grid.appendChild(this.psvContainer),this.mini.classList.remove("pnx-hidden"),this.mini.appendChild(this.mapContainer),this.mini.icon=(0,Rl.fa)(Gl.e5),this.psvContainer.focus()),null===this||void 0===this||null===(rt=this.map)||void 0===rt||null===(Co=rt.resize)||void 0===Co||Co.call(rt),this.psv.autoSize(),this.psv.forceRefresh(),null===(El=this.legend)||void 0===El||null===(Tl=El.setAttribute)||void 0===Tl||Tl.call(El,"focus",this.focus),!kl)){const rt=new CustomEvent("focus-changed",{detail:{focus:Qe}});this.dispatchEvent(rt)}}_toggleFocus(){this._setFocus(this.isMapWide()?"pic":"map")}_onMiniExpand(){this.map.resize(),this.psv.autoSize()}_onMapFiltersChange(){var Qe;const rt=(0,Zl.qi)("#pnx-map-filters-menu"),Co=null===rt||void 0===rt?void 0:rt.shadowRoot.getElementById("pnx-filter-date-from"),El=null===rt||void 0===rt?void 0:rt.shadowRoot.getElementById("pnx-filter-date-end"),Tl=null===rt||void 0===rt?void 0:rt.shadowRoot.getElementById("pnx-filter-type-flat"),kl=null===rt||void 0===rt?void 0:rt.shadowRoot.getElementById("pnx-filter-type-360"),Ll=(0,Zl.qi)("#pnx-map-theme");let Dl="";null===kl||void 0===kl||!kl.checked||null!==Tl&&void 0!==Tl&&Tl.checked||(Dl="equirectangular"),null!==kl&&void 0!==kl&&kl.checked||null===Tl||void 0===Tl||!Tl.checked||(Dl="flat");let Rl=[];if(null!==(Qe=this.map)&&void 0!==Qe&&Qe._hasQualityScore()){const Qe=null===rt||void 0===rt?void 0:rt.shadowRoot.getElementById("pnx-filter-qualityscore");Rl=((null===Qe||void 0===Qe?void 0:Qe.grade)||"").split(",").map((Qe=>parseInt(Qe))).filter((Qe=>!isNaN(Qe))),5==Rl.length&&(Rl=[])}const Ul={minDate:null===Co||void 0===Co?void 0:Co.value,maxDate:null===El||void 0===El?void 0:El.value,pic_type:Dl,theme:null===Ll||void 0===Ll?void 0:Ll.value,qualityscore:Rl};this.map.setFilters(Ul)}}Viewer.properties={map:{type:Object},focus:{type:String,reflect:!0},geocoder:{type:String},...Tl.A.properties},customElements.define("pnx-viewer",Viewer)},3921:(Qe,rt,Co)=>{"use strict";Co.r(rt),Co.d(rt,{Basic:()=>El.A,CoverageMap:()=>Tl.A,Editor:()=>kl.A,PhotoViewer:()=>Dl.A,Viewer:()=>Ll.A});var El=Co(9039),Tl=Co(153),kl=Co(1752),Ll=Co(8743),Dl=Co(3407)},9341:(Qe,rt,Co)=>{"use strict";Co.r(rt),Co.d(rt,{core:()=>El,layout:()=>Tl,menus:()=>kl,ui:()=>Ll});var El=Co(3921),Tl=Co(456),kl=Co(8794),Ll=Co(9472)},7422:(Qe,rt,Co)=>{"use strict";Co.d(rt,{A:()=>CorneredGrid});var El=Co(4542);class CorneredGrid extends El.WF{render(){return El.qy`
|
|
13
13
|
<div class="bg">
|
|
14
14
|
<slot name="bg"></slot>
|
|
15
15
|
</div>
|