@arcgis/map-components 5.2.0-next.31 → 5.2.0-next.32
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/dist/cdn/KIQMUMR7.js +2 -0
- package/dist/cdn/index.js +1 -1
- package/dist/components/arcgis-utility-network-trace-location/customElement.js +108 -97
- package/dist/docs/api.json +1 -1
- package/dist/docs/docs.json +1 -1
- package/dist/docs/web-types.json +1 -1
- package/package.json +4 -4
- package/dist/cdn/7ED4UQDB.js +0 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@arcgis/map-components",
|
|
3
|
-
"version": "5.2.0-next.
|
|
3
|
+
"version": "5.2.0-next.32",
|
|
4
4
|
"description": "ArcGIS Map Components",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"2D",
|
|
@@ -46,9 +46,9 @@
|
|
|
46
46
|
"lit": "^3.3.0",
|
|
47
47
|
"lodash-es": "^4.18.1",
|
|
48
48
|
"tslib": "^2.8.1",
|
|
49
|
-
"@arcgis/
|
|
50
|
-
"@arcgis/
|
|
51
|
-
"@arcgis/toolkit": "5.2.0-next.
|
|
49
|
+
"@arcgis/lumina": "5.2.0-next.32",
|
|
50
|
+
"@arcgis/common-components": "5.2.0-next.32",
|
|
51
|
+
"@arcgis/toolkit": "5.2.0-next.32"
|
|
52
52
|
},
|
|
53
53
|
"peerDependencies": {
|
|
54
54
|
"@arcgis/core": "^5.2.0-next",
|
package/dist/cdn/7ED4UQDB.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import a from"./MZWO5JYA.js";import{a as x}from"./KPOSO4HB.js";import"./VJ2SMYNX.js";import"./IDZCPNFC.js";import"./DU6OKLV4.js";import{O as v,U as I,a as S,b as f,p as c,r as g,x as b}from"./KLXEJCTT.js";import"./H6RQVSYM.js";export default $arcgis.t(([P,w,d,A,$,G,k,_,{c:T,f:C}])=>{var F=S`calcite-block{--calcite-block-content-space: 0;--calcite-block-border-color: transparent;margin:0}.add-location-button{--calcite-button-border-color: var(--calcite-color-border-1);--calcite-button-icon-color: var(--calcite-color-text-1);--calcite-button-text-color: var(--calcite-color-text-1)}.button-container{justify-content:center;display:grid}.clear-button{--calcite-button-border-color: transparent}`,L=class extends v{constructor(){super(...arguments),this.messages=x({blocking:!0}),this.isSelectWaiting=!1,this.traceLocationType="starting-point",this.spatialTolerance=.05,this.autoDestroyDisabled=!1,this.arcgisTraceLocationChange=b(),this.arcgisTraceLocationSelectEnd=b(),this.arcgisTraceLocationSelectStart=b()}static{this.properties={isSelectWaiting:16,beforeTraceLocationSelectStart:0,afterHitTest:0,view:0,traceLocationType:1,traceLocations:0,filterLayers:0,sketchViewModel:0,spatialTolerance:9,autoDestroyDisabled:5,utilityNetwork:0}}static{this.styles=F}async destroy(){this._resetCursor(),await this.manager.destroy()}async load(){d.isLoaded()||await d.load()}_createPolyline(t,e){return new A({hasZ:!1,hasM:!0,paths:t,spatialReference:new $({wkid:e})})}_calculatePercentAlong(t,e){let r=t.spatialReference,n=this._createPolyline(t.paths,r.wkid),o=e.x-.5,i=e.x+.5,s=e.y-.5,a=e.y+.5,l=[[[o,s],[i,a]]],h=this._createPolyline(l,e.spatialReference.wkid),u=d.execute(h,r);if(!u)return c("error",this,"Unable to project flag geometry to source geometry spatial reference."),-1;let p=P.execute(n,u);if(p.length>0){let m=w.execute(n,{unit:"feet"}),y;return p[0].paths[0][0][0]===n.paths[0][0][0]?y=w.execute(p[0],{unit:"feet"}):p.length>1?y=w.execute(p[1],{unit:"feet"}):y=0,y/m}return c("warn",this,"Unable to cut the source geometry with the flag geometry."),-1}get _edgeSourceLayerIds(){let t=this.utilityNetwork?.dataElement?.domainNetworks;return t?t.flatMap(e=>e.edgeSources).map(e=>e.layerId).filter(Boolean):[]}async _handleAddButtonClick(){let{view:t,sketchViewModel:e}=this;if(!(t&&e)){c("error",this,"Cannot add trace location."),e||c("error",this,g("sketchViewModel")),t||c("error",this,g("view"));return}if(this.beforeTraceLocationSelectStart){this.isSelectWaiting=!0;try{await this.beforeTraceLocationSelectStart()}finally{this.isSelectWaiting=!1}}await this._startSketch(t,e)}async _startSketch(t,e){this.arcgisTraceLocationSelectStart.emit({cancelSelect:()=>e.cancel()}).defaultPrevented||(this._clickHandler?.remove(),this._clickHandler=e.on("create",r=>this._handleSketchComplete(r,t,e)),"acquireCursor"in t&&t.acquireCursor("crosshair"),e.snappingOptions.enabled=!0,e.create("point"))}_handleSketchComplete(t,e,r){if(t.state==="complete"&&t.graphic){r.layer.remove(t.graphic),this._performHitTest(t,e,r);return}t.state==="cancel"&&(this._resetCursor(),this.arcgisTraceLocationSelectEnd.emit())}async _performHitTest(t,e,r){let{utilityNetwork:n}=this;if(!n){c("error",this,g("utilityNetwork")),this._resetCursor(),this.arcgisTraceLocationSelectEnd.emit();return}let o=t.graphic?.geometry,i=e.toScreen(o);if(!i){c("warn",this,"No screen point available for hit test."),this._startSketch(e,r);return}let s=(await e.hitTest(i,{include:this.filterLayers})).results.filter(a=>a.type==="graphic"&&a?.layer&&a.graphic);if(s.length===0){c("info",this,"No usable hit test results found."),this._startSketch(e,r);return}this._resetCursor(),await this._processHitTestResults(s,o,e)?this.arcgisTraceLocationSelectEnd.emit():this._startSketch(e,r)}_resetCursor(){let{view:t,sketchViewModel:e}=this;if(!t){c("error",this,g("view"));return}e&&(e.snappingOptions.enabled=!1),this._clickHandler?.remove(),this._clickHandler=void 0,"acquireCursor"in t&&t.acquireCursor("default")}async _processHitTestResults(t,e,r){if(t.length===0)return c("error",this,"There are no hit test results to process."),!1;let n=t[0],o=t.map(a=>{let l=a,h=l.graphic;return h.origin=l.layer,h.sourceLayer=l.layer,h}),i=n.graphic;if(this.afterHitTest)try{i=await this.afterHitTest(o)}catch{i=null}if(!i)return c("error",this,"No graphic available from hit test results."),this.arcgisTraceLocationSelectEnd.emit(),!0;let s=await this._ensureNecessaryAttributes(i);return s?await this._generateTraceLocation(s,e,r):(c("error",this,"Unable to ensure necessary attributes on the selected graphic."),this.arcgisTraceLocationSelectEnd.emit(),!0)}async _ensureNecessaryAttributes(t){let e=(T(t.layer),t.layer),r=e.geometryType===null,n=e.fieldsIndex?.get("assetgroup")??!1,o=e.fieldsIndex?.get("assetgroup")?.name??"assetgroup",i=e.fieldsIndex?.get("assettype")??!1,s=e.fieldsIndex?.get("assettype")?.name??"assettype",a=t.getGlobalId(),l=t.getObjectId(),h=n?!!t.getAttribute(o):!0,u=i?!!t.getAttribute(s):!0,p=!!t.geometry;if(a&&l&&h&&u&&(p||r))return t;let m=e.createQuery();return m.objectIds=[l],(await e.queryFeatures(m))?.features[0]||null}async _generateTraceLocation(t,e,r){let{traceLocations:n}=this,o=t.getGlobalId()??"",i=t.geometry?.type,s=await this._generateFlagInfo(t,e);if(!s)return c("error",this,"Unable to generate flag info for trace location."),!1;let a=n?.filter(h=>h.spatialProperties.mapGraphic?.getGlobalId()===o)??[];if(a.length>0){if(i!=="polyline")return c("warn",this,"A flag with the same globalId already exists."),!1;if(a.some(h=>Math.abs(h.traceLocation.percentAlong-s.traceLocation.percentAlong)<=this.spatialTolerance))return c("warn",this,"A flag with the same globalId already exists within tolerance."),!1}let l=this._addFlagGraphic(t,e,r);return l?(s.spatialProperties.flagGraphic=l,n?.add(s),!0):(c("warn",this,"Unable to add flag graphic."),!1)}async _generateFlagInfo(t,e){let{traceLocationType:r,utilityNetwork:n}=this,o=t.getGlobalId()??"",i=t.geometry?.type,s=await this._generateItemTitle(t);if(i==="point"||i==="polygon"){let a=n?.getTerminalConfiguration(t),l=a?a.terminals[0].id:1;return{traceLocation:new k({type:r,isFilterBarrier:!1,globalId:o,terminalId:l}),flagProperties:{title:s,expanded:!1,terminalConfiguration:a??void 0,selectedTerminals:a?new Set([l]):void 0},spatialProperties:{mapPoint:e,mapGraphic:t}}}else if(i==="polyline"){let a=this._calculatePercentAlong(t.geometry,e);return a<0?(c("warn",this,"Unable to calculate percent along for polyline flag."),null):{traceLocation:new k({type:r,isFilterBarrier:!1,globalId:o,percentAlong:a}),flagProperties:{title:s,expanded:!1,terminalConfiguration:void 0,selectedTerminals:void 0},spatialProperties:{mapPoint:e,mapGraphic:t}}}else if(!i){let a=C(t.layer)?t.layer.parent:t.layer,l=a&&this._edgeSourceLayerIds.includes(a.layerId),h=n?.getTerminalConfiguration(t),u=h?h.terminals[0].id:l?-1:1,p=l?.5:-1;return{traceLocation:new k({type:r,isFilterBarrier:!1,globalId:o,terminalId:u,percentAlong:p}),flagProperties:{title:s,expanded:!1,terminalConfiguration:h??void 0,selectedTerminals:h?new Set([u]):void 0},spatialProperties:{mapPoint:e,mapGraphic:t}}}return null}async _generateItemTitle(t){let{messages:e}=this,r=(T(t.layer),t.layer);return("getFeatureTitle"in r?await r.getFeatureTitle(t):null)||t?.getObjectId()?.toString()||e.labels.unknown}_addFlagGraphic(t,e,r){let n=t.geometry?t.geometry.type==="point"?t.geometry:e:null,o=this._createFlagSymbol(),i=new G({geometry:n,symbol:o,attributes:t.attributes});return r.graphics.add(i),i}_createFlagSymbol(){let{traceLocationType:t}=this,e=[244,21,21,.6],r=[21,244,21,.6];return t==="stopping-point"?new _({color:e,style:"x",size:12,outline:{color:e,width:2}}):t==="barrier"?new _({color:e,style:"square",size:12,outline:{color:e,width:0}}):new _({color:r,style:"circle",size:12,outline:{color:r,width:0}})}_handleClearButtonClick(){let{view:t,traceLocations:e}=this;e?.forEach(r=>{r.spatialProperties.flagGraphic&&t&&t.graphics.remove(r.spatialProperties.flagGraphic)}),e?.removeAll()}renderAddLocationBlock(){let{traceLocationType:t,messages:e,traceLocations:r,view:n}=this,o=t==="starting-point"?e.types.startingPoint:t==="barrier"?e.types.barrier:e.types.stoppingPoint,i=o.heading,s=o.description,a=o.buttonText;return f`<calcite-block .heading=${i} .label=${i} expanded .description=${s}>${r?.length?f`<calcite-button class="clear-button" slot=actions-end appearance=transparent .label=${e.buttons.clear} @click=${()=>this._handleClearButtonClick()}>${e.buttons.clear}</calcite-button><arcgis-utility-network-trace-location-list .traceLocations=${r} .traceLocationType=${t} .view=${n}></arcgis-utility-network-trace-location-list>`:null}<div class="button-container"><calcite-button .loading=${this.isSelectWaiting} class="add-location-button" icon-start=select appearance=outline .label=${a} @click=${()=>this._handleAddButtonClick()}>${a}</calcite-button></div></calcite-block>`}render(){return f`<div class="root">${this.renderAddLocationBlock()}</div>`}};I("arcgis-utility-network-trace-location",L);return L},"geometry/operators/cutOperator","geometry/operators/lengthOperator","geometry/operators/projectOperator","geometry/Polyline","geometry/SpatialReference","Graphic","rest/networks/support/TraceLocation","symbols/SimpleMarkerSymbol",a)
|