1 line
14 KiB
JavaScript
1 line
14 KiB
JavaScript
System.register(["jimu-core","jimu-arcgis","jimu-ui","calcite-components","esri/widgets/Search","esri/layers/FeatureLayer","esri/Graphic","esri/core/promiseUtils.js","esri/widgets/Search/SearchSource","esri/geometry/Point","esri/geometry/Polyline","esri/geometry/Polygon","esri/geometry/geometryEngine"],(function(e,t){var r={},n={},i={},a={},o={},c={},s={},l={},u={},d={},p={},f={},m={};return{setters:[function(e){r.React=e.React,r.ReactDOM=e.ReactDOM},function(e){n.JimuMapViewComponent=e.JimuMapViewComponent},function(e){i.WidgetPlaceholder=e.WidgetPlaceholder},function(e){a.CalciteAccordion=e.CalciteAccordion,a.CalciteAccordionItem=e.CalciteAccordionItem,a.CalciteAction=e.CalciteAction,a.CalciteLink=e.CalciteLink,a.CalciteList=e.CalciteList,a.CalciteListItem=e.CalciteListItem},function(e){o.default=e.default},function(e){c.default=e.default},function(e){s.default=e.default},function(e){l.default=e.default},function(e){u.default=e.default},function(e){d.default=e.default},function(e){p.default=e.default},function(e){f.default=e.default},function(e){m.default=e.default}],execute:function(){e((()=>{var e={158:(e,t,r)=>{"use strict";r.d(t,{Z:()=>c});var n=r(81),i=r.n(n),a=r(645),o=r.n(a)()(i());o.push([e.id,".esri-icon-visible::before{cursor:pointer;padding:0 8px 0 3px}.container{background-color:transparent}\n",""]);const c=o},645:e=>{"use strict";e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var r="",n=void 0!==t[5];return t[4]&&(r+="@supports (".concat(t[4],") {")),t[2]&&(r+="@media ".concat(t[2]," {")),n&&(r+="@layer".concat(t[5].length>0?" ".concat(t[5]):""," {")),r+=e(t),n&&(r+="}"),t[2]&&(r+="}"),t[4]&&(r+="}"),r})).join("")},t.i=function(e,r,n,i,a){"string"==typeof e&&(e=[[null,e,void 0]]);var o={};if(n)for(var c=0;c<this.length;c++){var s=this[c][0];null!=s&&(o[s]=!0)}for(var l=0;l<e.length;l++){var u=[].concat(e[l]);n&&o[u[0]]||(void 0!==a&&(void 0===u[5]||(u[1]="@layer".concat(u[5].length>0?" ".concat(u[5]):""," {").concat(u[1],"}")),u[5]=a),r&&(u[2]?(u[1]="@media ".concat(u[2]," {").concat(u[1],"}"),u[2]=r):u[2]=r),i&&(u[4]?(u[1]="@supports (".concat(u[4],") {").concat(u[1],"}"),u[4]=i):u[4]="".concat(i)),t.push(u))}},t}},81:e=>{"use strict";e.exports=function(e){return e[1]}},379:e=>{"use strict";var t=[];function r(e){for(var r=-1,n=0;n<t.length;n++)if(t[n].identifier===e){r=n;break}return r}function n(e,n){for(var a={},o=[],c=0;c<e.length;c++){var s=e[c],l=n.base?s[0]+n.base:s[0],u=a[l]||0,d="".concat(l," ").concat(u);a[l]=u+1;var p=r(d),f={css:s[1],media:s[2],sourceMap:s[3],supports:s[4],layer:s[5]};if(-1!==p)t[p].references++,t[p].updater(f);else{var m=i(f,n);n.byIndex=c,t.splice(c,0,{identifier:d,updater:m,references:1})}o.push(d)}return o}function i(e,t){var r=t.domAPI(t);return r.update(e),function(t){if(t){if(t.css===e.css&&t.media===e.media&&t.sourceMap===e.sourceMap&&t.supports===e.supports&&t.layer===e.layer)return;r.update(e=t)}else r.remove()}}e.exports=function(e,i){var a=n(e=e||[],i=i||{});return function(e){e=e||[];for(var o=0;o<a.length;o++){var c=r(a[o]);t[c].references--}for(var s=n(e,i),l=0;l<a.length;l++){var u=r(a[l]);0===t[u].references&&(t[u].updater(),t.splice(u,1))}a=s}}},569:e=>{"use strict";var t={};e.exports=function(e,r){var n=function(e){if(void 0===t[e]){var r=document.querySelector(e);if(window.HTMLIFrameElement&&r instanceof window.HTMLIFrameElement)try{r=r.contentDocument.head}catch(e){r=null}t[e]=r}return t[e]}(e);if(!n)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");n.appendChild(r)}},216:e=>{"use strict";e.exports=function(e){var t=document.createElement("style");return e.setAttributes(t,e.attributes),e.insert(t,e.options),t}},565:(e,t,r)=>{"use strict";e.exports=function(e){var t=r.nc;t&&e.setAttribute("nonce",t)}},795:e=>{"use strict";e.exports=function(e){if("undefined"==typeof document)return{update:function(){},remove:function(){}};var t=e.insertStyleElement(e);return{update:function(r){!function(e,t,r){var n="";r.supports&&(n+="@supports (".concat(r.supports,") {")),r.media&&(n+="@media ".concat(r.media," {"));var i=void 0!==r.layer;i&&(n+="@layer".concat(r.layer.length>0?" ".concat(r.layer):""," {")),n+=r.css,i&&(n+="}"),r.media&&(n+="}"),r.supports&&(n+="}");var a=r.sourceMap;a&&"undefined"!=typeof btoa&&(n+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(a))))," */")),t.styleTagTransform(n,e,t.options)}(t,e,r)},remove:function(){!function(e){if(null===e.parentNode)return!1;e.parentNode.removeChild(e)}(t)}}}},589:e=>{"use strict";e.exports=function(e,t){if(t.styleSheet)t.styleSheet.cssText=e;else{for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(e))}}},513:e=>{e.exports='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"><path d="M10 4H6c-1.1 0-2 .9-2 2v4c0 1.1.9 2 2 2h4c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zM22 12h4c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2h-4c-1.1 0-2 .9-2 2v4c0 1.1.9 2 2 2zm0-6h4v4h-4V6zM10 20H6c-1.1 0-2 .9-2 2v4c0 1.1.9 2 2 2h4c1.1 0 2-.9 2-2v-4c0-1.1-.9-2-2-2zm0 6H6v-4h4v4zM26 20h-4c-1.1 0-2 .9-2 2v4c0 1.1.9 2 2 2h4c1.1 0 2-.9 2-2v-4c0-1.1-.9-2-2-2z"></path><path d="M28 16h-2c-2.671 0-5.182-1.04-7.071-2.929S16 8.671 16 6V4c0-2.2-1.8-4-4-4H4C1.8 0 0 1.8 0 4v8c0 2.2 1.8 4 4 4h2c2.671 0 5.182 1.04 7.071 2.929S16 23.329 16 26v2c0 2.2 1.8 4 4 4h8c2.2 0 4-1.8 4-4v-8c0-2.2-1.8-4-4-4zm2 12c0 .53-.209 1.031-.589 1.411S28.53 30 28 30h-8c-.53 0-1.031-.209-1.411-.589S18 28.53 18 28v-2c0-6.627-5.373-12-12-12H4c-.53 0-1.031-.209-1.411-.589S2 12.53 2 12V4c0-.53.209-1.031.589-1.411S3.47 2 4 2h8c.53 0 1.031.209 1.411.589S14 3.47 14 4v2c0 6.627 5.373 12 12 12h2c.53 0 1.031.209 1.411.589S30 19.47 30 20v8z"></path></svg>'},145:e=>{"use strict";e.exports=a},129:e=>{"use strict";e.exports=s},651:e=>{"use strict";e.exports=l},294:e=>{"use strict";e.exports=d},763:e=>{"use strict";e.exports=f},920:e=>{"use strict";e.exports=p},942:e=>{"use strict";e.exports=m},818:e=>{"use strict";e.exports=c},720:e=>{"use strict";e.exports=o},19:e=>{"use strict";e.exports=u},826:e=>{"use strict";e.exports=n},891:e=>{"use strict";e.exports=r},726:e=>{"use strict";e.exports=i}},t={};function v(r){var n=t[r];if(void 0!==n)return n.exports;var i=t[r]={id:r,exports:{}};return e[r](i,i.exports,v),i.exports}v.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return v.d(t,{a:t}),t},v.d=(e,t)=>{for(var r in t)v.o(t,r)&&!v.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},v.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),v.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},v.p="",v.nc=void 0;var y={};return v.p=window.jimuConfig.baseUrl,(()=>{"use strict";v.r(y),v.d(y,{__set_webpack_public_path__:()=>_,default:()=>F});var e=v(891),t=v(826),r=v(726),n=v(145),i=v(720),a=v(818),o=v(129),c=v(651),s=v(19),l=v(294),u=v(920),d=v(763),p=v(942),f=v(513),m=v.n(f);var g=v(379),h=v.n(g),b=v(795),w=v.n(b),x=v(569),C=v.n(x),R=v(565),S=v.n(R),A=v(216),M=v.n(A),I=v(589),E=v.n(I),j=v(158),k={};k.styleTagTransform=E(),k.setAttributes=S(),k.insert=C().bind(null,"head"),k.domAPI=w(),k.insertStyleElement=M(),h()(j.Z,k),j.Z&&j.Z.locals&&j.Z.locals;var P=function(e,t,r,n){return new(r||(r=Promise))((function(i,a){function o(e){try{s(n.next(e))}catch(e){a(e)}}function c(e){try{s(n.throw(e))}catch(e){a(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,c)}s((n=n.apply(e,t||[])).next())}))};const{useState:T,useRef:L}=e.React,O=new a.default({url:"https://gis.geosphere.at/maps/rest/services/datenindex/raster_10000/MapServer/0",title:"Datenindex 1:10.000",opacity:.3}),F=a=>{var f;const[v,y]=T(null),[g,h]=T(null),b=L(null);b.current=v;const w=L(null);w.current=g;const x=e=>{if(b.current){const t=b.current.allLayerViews.filter((t=>{const r=e.match(/^https:\/\/.+\/MapServer/g);let n;return r.length>0&&(n=r[0]),t.layer.url&&t.layer.url===n}));if(t.length>0)return t.at(0).layer}},C=e=>{var t,r;const n=e.target,i=n.getAttribute("text"),a=n.getAttribute("icon");if(i){const e=null===(r=null===(t=b.current)||void 0===t?void 0:t.map)||void 0===r?void 0:r.findLayerById(i);"view-hide"===a?(n.setAttribute("icon","view-visible"),e&&(e.visible=!0)):(n.setAttribute("icon","view-hide"),e&&(e.visible=!1))}},R=e=>P(void 0,void 0,void 0,(function*(){var t;const r=e.target.getAttribute("text"),n=yield fetch(r+"?f=json"),i=yield n.json(),a=x(r).spatialReference,o=null===(t=i.feature)||void 0===t?void 0:t.geometry;o.x&&o.y?b.current.goTo(new l.default({x:o.x,y:o.y,spatialReference:a})):o.paths?b.current.goTo(new u.default({paths:o.paths,spatialReference:a})):o.rings&&b.current.goTo(new d.default({rings:o.rings,spatialReference:a}))})),S=(e,t)=>e.filter((e=>t(e))).map((e=>"group"===e.type&&e.layers?Object.assign(Object.assign({},e),{layers:S(e.layers,t)}):e)),A=e=>e.map((e=>e.layers?{id:e.id,type:e.type,title:e.title,visible:e.visible,layers:A(e.layers.toArray())}:{id:e.id,type:e.type,title:e.title,visible:e.visible})),M=e=>`?term=${encodeURI(e)}`,I="https://kataster.bev.gv.at/api/all4map",E=new s.default({placeholder:a.intl.formatMessage({id:"placeholderText",defaultMessage:"Orts- oder Adresssuche"}),getSuggestions:e=>P(void 0,void 0,void 0,(function*(){const t=yield fetch(I+M(e.suggestTerm)),r=yield t.json();if(r.data&&r.data.features.length>0)return r.data.features.map((t=>({key:"bev",text:t.properties.name,sourceIndex:e.sourceIndex})))})),getResults:e=>P(void 0,void 0,void 0,(function*(){const t=yield fetch(I+M(e.suggestResult.text)),r=yield t.json();if(r.data&&r.data.features.length>0)return r.data.features.map((e=>{if("Point"===e.geometry.type){const t=new o.default({geometry:new l.default({x:e.geometry.coordinates[0],y:e.geometry.coordinates[1],spatialReference:{wkid:4326}})}),r=p.default.geodesicBuffer(t.geometry,1e3,"meters");return{extent:null,feature:t,target:new o.default({geometry:r.extent}),name:e.properties.name}}{const t=e.geometry.coordinates,r=new o.default({geometry:new d.default({rings:t,spatialReference:{wkid:4326}})});return{extent:r.geometry.extent,feature:r,target:r,name:e.properties.name}}}))}))}),j=e=>{const{north:t,east:r}=e.match(/N(?<north>\d+)E(?<east>\d+)/).groups,n=parseInt(t),i=parseInt(r);return`cellcode = '${e}' OR `+[[1,-1],[1,0],[1,1],[0,-1],[0,1],[-1,-1],[-1,0],[-1,1]].map((e=>`cellcode = '10kmN${n+e[0]}E${i+e[1]}'`)).join(" OR ")};return e.React.createElement("div",{className:"widget-search-widget h-100"},a.useMapWidgetIds&&0===a.useMapWidgetIds.length&&e.React.createElement(r.WidgetPlaceholder,{icon:m(),widgetId:a.id,message:"Please select a map widget."}),e.React.createElement(t.JimuMapViewComponent,{useMapWidgetId:null===(f=a.useMapWidgetIds)||void 0===f?void 0:f[0],onActiveViewChange:t=>{const r=t.view;if(r){y(r),r.map.layers.push(O);const t=new i.default({view:r,popupEnabled:!1,sources:[E],includeDefaultSources:!1});r.ui.add(t,"top-left"),t.on("select-result",(e=>{let t;r.closePopup(),t=e.result.extent?new o.default({geometry:e.result.extent,symbol:{type:"simple-fill",color:[51,51,204,.5],style:"solid",outline:{color:"white",width:1}}}):new o.default({geometry:e.result.feature.geometry,symbol:{type:"simple-marker",style:"circle",color:[51,51,204,.5],size:"8px",outline:{color:"white",width:1}}}),h(t),r.graphics.removeAll(),r.graphics.add(t),O.queryFeatures({geometry:t.geometry,spatialRelationship:"intersects",returnGeometry:!1,outFields:["fid","cellcode"]}).then((t=>{if(0!==t.features.length)if(e.result.extent){const e=t.features.map((e=>e.attributes.fid));a(e,!1)}else{const e=t.features[0].attributes.cellcode,r=j(e);O.queryFeatures({where:r,returnGeometry:!1,outFields:["fid"]}).then((e=>{const t=e.features.map((e=>e.attributes.fid));a(t,!1)}))}}))}));const a=(t,i)=>{const a={},o=O.relationships.map((e=>O.queryRelatedFeatures({outFields:["url"],relationshipId:e.id,objectIds:t}).then((e=>{Object.keys(e).forEach((t=>{if(!e[t])return;const r=/^https:\/\/.+\/MapServer\/\d+/g,n=e[t].features;let i;if(n.length>0){const e=n[0].attributes.url.match(r);e.length>0&&(i=e[0])}const o=n.map((e=>e.attributes.url));a[i]?a[i]=a[i].concat(o):a[i]=o}))}))));return c.default.eachAlways(o).then((()=>{const t={},o=[];Object.keys(a).forEach((r=>{const i=[...new Set(a[r])],c=x(r);let s,l;c&&(s=c.id,o.push(c),c.sublayers.forEach((e=>{e.url===r&&(l=e)})));const u=e.React.createElement(n.CalciteAccordionItem,{heading:l.title},e.React.createElement(n.CalciteAction,{slot:"actions-end",icon:l.visible?"view-visible":"view-hide",text:l.id,appearance:"transparent",onClick:()=>{l.visible=!l.visible}}),e.React.createElement(n.CalciteList,null,i.map((t=>{const r=t.match(/\d+$/g);let i;return r.length>0&&(i=r[0]),e.React.createElement(n.CalciteListItem,{onCalciteListItemSelect:()=>{}},e.React.createElement(n.CalciteAction,{slot:"actions-start",icon:"magnifying-glass",text:t,appearance:"transparent",onClick:R}),e.React.createElement(n.CalciteLink,{href:t,target:"_blank",slot:"content"},`Feature ${i}`))}))));t[s]?t[s].push(u):t[s]=[u]}));const c=A(r.map.layers.toArray());let s=S(c,(e=>"map-image"!==e.type||-1!==o.findIndex((t=>t.id===e.id))));s=S(s,(e=>("group"!==e.type||0!==e.layers.length&&!e.layers.every((e=>"imagery"===e.type||"imagery-tile"===e.type)))&&"feature"!==e.type&&"imagery"!==e.type&&"imagery-tile"!==e.type));const l=r=>"group"===r.type?e.React.createElement(n.CalciteAccordionItem,{heading:r.title},e.React.createElement(n.CalciteAction,{slot:"actions-end",icon:r.visible?"view-visible":"view-hide",text:r.id,appearance:"transparent",onClick:C}),r.layers&&r.layers.map((e=>l(e)))):"map-image"===r.type?e.React.createElement(n.CalciteAccordionItem,{heading:r.title},e.React.createElement(n.CalciteAction,{slot:"actions-end",icon:r.visible?"view-visible":"view-hide",text:r.id,appearance:"transparent",onClick:C}),t[r.id]):void 0,u=e.React.createElement(n.CalciteAccordion,{appearance:"transparent",iconPosition:"start",scale:"s"},s.map((e=>l(e)))),d=document.createElement("div");if(e.ReactDOM.render(u,d),i)return d;r.openPopup({title:"Relevante Daten",content:d,location:w.current.geometry})}))},s={title:"Relevante Daten",content:e=>P(void 0,void 0,void 0,(function*(){const t=e.graphic.attributes.cellcode,r=j(t),n=yield O.queryFeatures({where:r,returnGeometry:!1,outFields:["fid"]}).then((e=>e.features.map((e=>e.attributes.fid))));return a(n,!0)})),returnGeometry:!1,outFields:[]};O.popupTemplate=s}}}))};function _(e){v.p=e}})(),y})())}}})); |