@arcgis/core 4.30.3 → 4.30.5
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/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/{88e8547079b299572bfe.js → 618f825d56d4981594c5.js} +1 -1
- package/assets/esri/core/workers/chunks/{ed9c88afccc5041d899a.js → f927c28f2fa78ec68235.js} +1 -1
- package/assets/esri/themes/base/widgets/_Grid.scss +0 -1
- package/assets/esri/themes/dark/main.css +1 -1
- package/assets/esri/themes/light/main.css +1 -1
- package/assets/esri/themes/light/view.css +1 -1
- package/interfaces.d.ts +4 -4
- package/kernel.js +1 -1
- package/package.json +1 -1
- package/portal/support/layersLoader.js +1 -1
- package/rest/networks/support/SynthesizeAssociationGeometriesParameters.js +1 -1
- package/rest/networks/support/TraceParameters.js +1 -1
- package/rest/networks/support/ValidateNetworkTopologyParameters.js +1 -1
- package/rest/print.js +1 -1
- package/rest/symbolService.js +1 -1
- package/support/revision.js +1 -1
- package/widgets/FeatureTable/support/tableUtils.js +1 -1
- package/widgets/UtilityNetworkAssociations/UtilityNetworkAssociationsViewModel.js +1 -1
package/interfaces.d.ts
CHANGED
|
@@ -53955,11 +53955,11 @@ declare namespace __esri {
|
|
|
53955
53955
|
*/
|
|
53956
53956
|
moment: Date;
|
|
53957
53957
|
/**
|
|
53958
|
-
* The spatial reference
|
|
53958
|
+
* The spatial reference of the returned geometry.
|
|
53959
53959
|
*
|
|
53960
53960
|
* [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-rest-networks-support-SynthesizeAssociationGeometriesParameters.html#outSpatialReference)
|
|
53961
53961
|
*/
|
|
53962
|
-
outSpatialReference:
|
|
53962
|
+
outSpatialReference: any;
|
|
53963
53963
|
/**
|
|
53964
53964
|
* Indicates whether to synthesize and return structural attachment associations.
|
|
53965
53965
|
*
|
|
@@ -54019,11 +54019,11 @@ declare namespace __esri {
|
|
|
54019
54019
|
*/
|
|
54020
54020
|
moment?: DateProperties;
|
|
54021
54021
|
/**
|
|
54022
|
-
* The spatial reference
|
|
54022
|
+
* The spatial reference of the returned geometry.
|
|
54023
54023
|
*
|
|
54024
54024
|
* [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-rest-networks-support-SynthesizeAssociationGeometriesParameters.html#outSpatialReference)
|
|
54025
54025
|
*/
|
|
54026
|
-
outSpatialReference?:
|
|
54026
|
+
outSpatialReference?: any;
|
|
54027
54027
|
/**
|
|
54028
54028
|
* Indicates whether to synthesize and return structural attachment associations.
|
|
54029
54029
|
*
|
package/kernel.js
CHANGED
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.30/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import has from"./core/has.js";import{addQueryParameter as o}from"./core/urlUtils.js";import{buildDate as s,commitHash as e}from"./support/revision.js";Symbol.dispose??=Symbol("Symbol.dispose"),Symbol.asyncDispose??=Symbol("Symbol.asyncDispose");const r="4.30";let t,i=r;i="4.30.
|
|
5
|
+
import has from"./core/has.js";import{addQueryParameter as o}from"./core/urlUtils.js";import{buildDate as s,commitHash as e}from"./support/revision.js";Symbol.dispose??=Symbol("Symbol.dispose"),Symbol.asyncDispose??=Symbol("Symbol.asyncDispose");const r="4.30";let t,i=r;i="4.30.5";function n(o){t=o}function m(s){const e=t?.findCredential(s);return e?.token?o(s,"token",e.token):s}has("host-webworker");export{m as addTokenParameter,s as buildDate,i as fullVersion,t as id,e as revision,n as setId,r as version};
|
package/package.json
CHANGED
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.30/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import e from"../../core/Error.js";import{parse as t}from"../../layers/support/arcgisLayerUrl.js";import{fetchFeatureService as r}from"../../layers/support/fetchService.js";import{LayerLoadContext as a}from"../../layers/support/LayerLoadContext.js";import{populateGroupLayer as o}from"../../layers/support/layersCreator.js";import{layerLookupMap as n}from"../../layers/support/lazyLayerLoader.js";import s from"../Portal.js";import{createForItemRead as
|
|
5
|
+
import e from"../../core/Error.js";import{parse as t}from"../../layers/support/arcgisLayerUrl.js";import{fetchFeatureService as r}from"../../layers/support/fetchService.js";import{LayerLoadContext as a}from"../../layers/support/LayerLoadContext.js";import{populateGroupLayer as o}from"../../layers/support/layersCreator.js";import{layerLookupMap as n}from"../../layers/support/lazyLayerLoader.js";import s from"../Portal.js";import{createForItemRead as i}from"./jsonContext.js";import{getFirstLayerOrTable as l,preprocessFSItemData as c,populateSceneServiceItemData as u,getNumLayersAndTables as p,createSublayerData as y,instanceTypeToLayerType as f,getSublayersByLayerType as m,layerTypeToLayerModuleType as d}from"./loadUtils.js";import{hasTypeKeyword as w}from"./portalItemUtils.js";import{loadStyleRenderer as h}from"../../renderers/support/styleUtils.js";import{fetchArcGISServiceJSON as I}from"../../support/requestPresets.js";async function g(e,t){const r=e.instance.portalItem;if(r?.id)return await r.load(t),b(e),e.validateItem&&e.validateItem(r),L(e,t)}function b(t){const r=t.instance.portalItem;if(!r?.type||!t.supportedTypes.includes(r.type))throw new e("portal:invalid-layer-item-type","Invalid layer item type '${type}', expected '${expectedType}'",{type:r?.type,expectedType:t.supportedTypes.join(", ")})}async function L(e,t){const r=e.instance,o=r.portalItem;if(!o)return;const{url:n,title:s}=o,l=i(o,"portal-item");if("group"===r.type)return S(r,l,e);n&&"media"!==r.type&&r.read({url:n},l);const c=new a,u=await M(e,c,t);return u&&r.read(u,l),r.resourceReferences={portalItem:o,paths:l.readResourcePaths??[]},"subtype-group"!==r.type&&r.read({title:s},l),h(r,l)}async function S(t,r,a){const o=t.portalItem;if(!t.sourceIsPortalItem)return;const{title:n,type:s}=o;if("Group Layer"===s){if(!w(o,"Map"))throw new e("portal:invalid-layer-item-typekeyword","'Group Layer' item without 'Map' type keyword is not supported");return T(t)}return t.read({title:n},r),v(t,a)}async function T(e){const t=e.portalItem,r=await t.fetchData("json");if(!r)return;const a=i(t,"web-map");e.read(r,a),await o(e,r,{context:a}),e.resourceReferences={portalItem:t,paths:a.readResourcePaths??[]}}async function v(t,r){let o;const{portalItem:n}=t;if(!n)return;const s=n.type,i=r.layerModuleTypeMap;switch(s){case"Feature Service":case"Feature Collection":o=i.FeatureLayer;break;case"Stream Service":o=i.StreamLayer;break;case"Scene Service":o=i.SceneLayer;break;default:throw new e("portal:unsupported-item-type-as-group",`The item type '${s}' is not supported as a 'IGroupLayer'`)}const y=new a;let[f,m]=await Promise.all([o(),M(r,y)]),d=()=>f;if("Feature Service"===s){const e=l(m)?.customParameters;m=n.url?await c(m,n.url,y):{},d=await E(m,i)||d;const r=await k(n.url,{customParameters:e,loadContext:y});return await F(t,d,m,r)}return"Scene Service"===s&&n.url&&(m=await u(n,m,y)),p(m)>0?await F(t,d,m):await j(t,d)}async function j(e,t){const{portalItem:r}=e;if(!r?.url)return;const a=await I(r.url);a&&F(e,t,{layers:a.layers?.map(y),tables:a.tables?.map(y)})}async function F(e,t,r,a){let o=r.layers||[];const s=r.tables||[];if("Feature Collection"===e.portalItem?.type?(o.forEach(((e,t)=>{e.id=t,"Table"===e?.layerDefinition?.type&&s.push(e)})),o=o.filter((e=>"Table"!==e?.layerDefinition?.type))):(o.reverse(),s.reverse()),o.forEach((o=>{const n=a?.(o);if(n||!a){const a=P(e,t(o),r,o,n);e.add(a)}})),s.length){const t=await n.FeatureLayer();s.forEach((o=>{const n=a?.(o);if(n||!a){const a=P(e,t,r,o,n);e.tables.add(a)}}))}}function P(e,t,r,a,o){const n=e.portalItem,i={portalItem:n.clone(),layerId:a.id};null!=a.url&&(i.url=a.url);const l=new t(i);if("sourceJSON"in l&&(l.sourceJSON=o),"subtype-group"!==l.type&&"catalog"!==l.type&&(l.sublayerTitleMode="service-name"),"Feature Collection"===n.type){const e={origin:"portal-item",portal:n.portal||s.getDefault()};l.read(a,e);const t=r.showLegend;null!=t&&l.read({showLegend:t},e)}return l}async function M(e,t,r){if(!1===e.supportsData)return;const a=e.instance,o=a.portalItem;if(!o)return;let n=null;try{n=await o.fetchData("json",r)}catch(s){}if(D(a)){let e=null;const r=await x(o,n,t);if((n?.layers||n?.tables)&&r>0){if(null==a.layerId){const e=f(a.type),t=e?m(n,e)[0]:l(n);t&&(a.layerId=t.id)}e=C(n,a),"OrientedImageryLayer"===e?.layerType&&"oriented-imagery"===a.type&&a.supportedSourceTypes.add("Feature Layer"),e&&null!=n.showLegend&&(e.showLegend=n.showLegend)}return r>1&&"sublayerTitleMode"in a&&"service-name"!==a.sublayerTitleMode&&(a.sublayerTitleMode="item-title-and-service-name"),e}return n}async function x(e,r,a){if(r?.layers&&r?.tables)return p(r);const o=t(e.url);if(!o)return 1;const n=await a.fetchServiceMetadata(o.url.path,{customParameters:l(r)?.customParameters}).catch((()=>null));return(r?.layers?.length??n?.layers?.length??0)+(r?.tables?.length??n?.tables?.length??0)}function C(e,t){const{layerId:r}=t,a=e.layers?.find((e=>e.id===r))||e.tables?.find((e=>e.id===r));return a&&G(a,t)?a:null}function D(e){return"stream"!==e.type&&"layerId"in e}function G(e,t){const r="layerType"in e&&e.layerType,{type:a}=t;return!("feature"===a&&r&&"ArcGISFeatureLayer"!==e.layerType||"catalog"===a&&!r||"oriented-imagery"===a&&!r||"subtype-group"===a&&!r)}async function k(e,t){const{layersJSON:a}=await r(e,t);if(!a)return null;const o=[...a.layers,...a.tables];return e=>o.find((t=>t.id===e.id))}async function E(e,t){const{layers:r}=e;if(!r?.length)return;const a=new Set,o=[];for(const{layerType:i}of r){const e=i??"ArcGISFeatureLayer";if(a.has(e))continue;a.add(e);const r=t[d(e)];o.push(r())}const n=await Promise.all(o),s=new Map;return Array.from(a).forEach(((e,t)=>{s.set(e,n[t])})),({layerType:e})=>{const t=e??"ArcGISFeatureLayer";return s.get(t)}}export{g as load};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.30/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as t}from"../../../chunks/tslib.es6.js";import{JSONSupport as o}from"../../../core/JSONSupport.js";import{property as e}from"../../../core/accessorSupport/decorators/property.js";import{ensureClass as r}from"../../../core/accessorSupport/ensureType.js";import"../../../core/RandomLCG.js";import"../../../core/has.js";import{subclass as s}from"../../../core/accessorSupport/decorators/subclass.js";import i from"../../../geometry/Extent.js";import
|
|
5
|
+
import{_ as t}from"../../../chunks/tslib.es6.js";import{JSONSupport as o}from"../../../core/JSONSupport.js";import{property as e}from"../../../core/accessorSupport/decorators/property.js";import{ensureClass as r}from"../../../core/accessorSupport/ensureType.js";import"../../../core/RandomLCG.js";import"../../../core/has.js";import{subclass as s}from"../../../core/accessorSupport/decorators/subclass.js";import{writer as i}from"../../../core/accessorSupport/decorators/writer.js";import n from"../../../geometry/Extent.js";import a from"../../../geometry/SpatialReference.js";var c;let p=c=class extends o{static from(t){return r(c,t)}constructor(t){super(t),this.returnAttachmentAssociations=!1,this.returnConnectivityAssociations=!1,this.returnContainmentAssociations=!1,this.extent=null,this.maxGeometryCount=null,this.outSpatialReference=null,this.gdbVersion=null,this.moment=null}writeOutSR(t,o,e){if(null!=t){const{wkid:r}=t;o[e]=JSON.stringify({wkid:r})}}};t([e({type:Boolean,json:{read:{source:"attachmentAssociations"},write:{target:"attachmentAssociations"}}})],p.prototype,"returnAttachmentAssociations",void 0),t([e({type:Boolean,json:{read:{source:"connectivityAssociations"},write:{target:"connectivityAssociations"}}})],p.prototype,"returnConnectivityAssociations",void 0),t([e({type:Boolean,json:{read:{source:"containmentAssociations"},write:{target:"containmentAssociations"}}})],p.prototype,"returnContainmentAssociations",void 0),t([e({type:n,json:{write:!0}})],p.prototype,"extent",void 0),t([e({type:Number,json:{write:!0}})],p.prototype,"maxGeometryCount",void 0),t([e({type:a,json:{write:{allowNull:!0,target:"outSR"}}})],p.prototype,"outSpatialReference",void 0),t([i("outSpatialReference")],p.prototype,"writeOutSR",null),t([e({type:String,json:{write:!0}})],p.prototype,"gdbVersion",void 0),t([e({type:Date,json:{type:Number,write:{writer:(t,o)=>{o.moment=t?.getTime()}}}})],p.prototype,"moment",void 0),p=c=t([s("esri.rest.networks.support.SynthesizeAssociationGeometriesParameters")],p);const m=p;export{m as default};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.30/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as t}from"../../../chunks/tslib.es6.js";import{JSONSupport as o}from"../../../core/JSONSupport.js";import{property as r}from"../../../core/accessorSupport/decorators/property.js";import{ensureClass as e}from"../../../core/accessorSupport/ensureType.js";import"../../../core/RandomLCG.js";import"../../../core/has.js";import{subclass as s}from"../../../core/accessorSupport/decorators/subclass.js";import i from"../../../geometry/SpatialReference.js";import{traceTypeKebabDict as
|
|
5
|
+
import{_ as t}from"../../../chunks/tslib.es6.js";import{JSONSupport as o}from"../../../core/JSONSupport.js";import{property as r}from"../../../core/accessorSupport/decorators/property.js";import{ensureClass as e}from"../../../core/accessorSupport/ensureType.js";import"../../../core/RandomLCG.js";import"../../../core/has.js";import{subclass as s}from"../../../core/accessorSupport/decorators/subclass.js";import{writer as i}from"../../../core/accessorSupport/decorators/writer.js";import p from"../../../geometry/SpatialReference.js";import{traceTypeKebabDict as a}from"../../../networks/support/typeUtils.js";import n from"../../../networks/support/UNTraceConfiguration.js";import c from"./TraceLocation.js";var l;let u=l=class extends o{static from(t){return e(l,t)}constructor(t){super(t),this.namedTraceConfigurationGlobalId=null,this.gdbVersion=null,this.traceLocations=[],this.moment=null,this.outSpatialReference=null,this.traceConfiguration=null,this.resultTypes=null,this.traceType=null}writeOutSR(t,o,r){if(null!=t){const{wkid:e}=t;o[r]=JSON.stringify({wkid:e})}}};t([r({type:String,json:{read:{source:"traceConfigurationGlobalId"},write:{target:"traceConfigurationGlobalId"}}})],u.prototype,"namedTraceConfigurationGlobalId",void 0),t([r({type:String,json:{write:!0}})],u.prototype,"gdbVersion",void 0),t([r({type:[c],json:{write:!0}})],u.prototype,"traceLocations",void 0),t([r({type:Date,json:{type:Number,write:{writer:(t,o)=>{o.moment=t?t.getTime():null}}}})],u.prototype,"moment",void 0),t([r({type:p,json:{write:{allowNull:!0,target:"outSR"}}})],u.prototype,"outSpatialReference",void 0),t([i("outSpatialReference")],u.prototype,"writeOutSR",null),t([r({type:n,json:{write:!0}})],u.prototype,"traceConfiguration",void 0),t([r({type:[Object],json:{write:!0}})],u.prototype,"resultTypes",void 0),t([r({type:a.apiValues,json:{type:a.jsonValues,read:a.read,write:a.write}})],u.prototype,"traceType",void 0),u=l=t([s("esri.rest.networks.support.TraceParameters")],u);const m=u;export{m as default};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.30/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as t}from"../../../chunks/tslib.es6.js";import"../../../geometry.js";import{JSONSupport as o}from"../../../core/JSONSupport.js";import{property as e}from"../../../core/accessorSupport/decorators/property.js";import{ensureClass as r}from"../../../core/accessorSupport/ensureType.js";import"../../../core/RandomLCG.js";import"../../../core/has.js";import{subclass as s}from"../../../core/accessorSupport/decorators/subclass.js";import{writer as
|
|
5
|
+
import{_ as t}from"../../../chunks/tslib.es6.js";import"../../../geometry.js";import{JSONSupport as o}from"../../../core/JSONSupport.js";import{property as e}from"../../../core/accessorSupport/decorators/property.js";import{ensureClass as r}from"../../../core/accessorSupport/ensureType.js";import"../../../core/RandomLCG.js";import"../../../core/has.js";import{subclass as s}from"../../../core/accessorSupport/decorators/subclass.js";import{writer as i}from"../../../core/accessorSupport/decorators/writer.js";import{validationTypeKebabDict as p}from"../../../networks/support/typeUtils.js";import a from"../../../geometry/Extent.js";import n from"../../../geometry/SpatialReference.js";var l;let c=l=class extends o{static from(t){return r(l,t)}constructor(t){super(t),this.gdbVersion=null,this.sessionID=null,this.validationType=null,this.validateArea=null,this.validationSet=null,this.outSpatialReference=null}writeOutSR(t,o,e){if(null!=t){const{wkid:r}=t;o[e]=JSON.stringify({wkid:r})}}};t([e({type:String,json:{write:!0}})],c.prototype,"gdbVersion",void 0),t([e({type:String,json:{write:!0}})],c.prototype,"sessionID",void 0),t([e({type:p.apiValues,json:{type:p.jsonValues,read:p.read,write:p.write}})],c.prototype,"validationType",void 0),t([e({type:a,json:{write:!0}})],c.prototype,"validateArea",void 0),t([e({type:[Object],json:{write:!0}})],c.prototype,"validationSet",void 0),t([e({type:n,json:{write:{allowNull:!0,target:"outSR"}}})],c.prototype,"outSpatialReference",void 0),t([i("outSpatialReference")],c.prototype,"writeOutSR",null),c=l=t([s("esri.rest.networks.support.ValidateNetworkTopologyParameters")],c);const u=c;export{u as default};
|
package/rest/print.js
CHANGED
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.30/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{id as e}from"../kernel.js";import t from"../request.js";import{JSONMap as a}from"../core/jsonMap.js";import{createScreenPoint as i,pt2px as r,px2pt as n}from"../core/screenUtils.js";import{normalize as o,dataComponents as s}from"../core/urlUtils.js";import l from"../geometry/Polygon.js";import{collectLabelingFields as c}from"../layers/support/fieldUtils.js";import{getFloorFilterClause as u}from"../layers/support/floorFilterUtils.js";import{getSizeRangeAtScale as y}from"../renderers/visualVariables/support/visualVariableUtils.js";import{asValidOptions as p,getToken as f}from"./utils.js";import{execute as m}from"./geoprocessor/execute.js";import{submitJob as d}from"./geoprocessor/submitJob.js";import{toJSON as g}from"./support/fileFormat.js";import{toJSON as h}from"./support/layoutTemplate.js";import{getVisibleLayerViews as b,isScreenshotRequired as w,isBingMapsLayer as S,isCSVLayer as x,isBlendLayer as I,getSelectionSymbol as v,getContextBoundingBox as D,createPolygonLayer as L,createPolylineLayer as T,createPointLayer as O,createMultipointLayer as E}from"./support/printTaskUtils.js";import P from"./support/PrintTemplate.js";import{toJSON as M}from"./support/reportTemplate.js";const F={Feet:"ft",Kilometers:"km",Meters:"m",Miles:"mi"},V=new a({esriFeet:"Feet",esriKilometers:"Kilometers",esriMeters:"Meters",esriMiles:"Miles"}),N=new a({esriExecutionTypeSynchronous:"sync",esriExecutionTypeAsynchronous:"async"}),U=new Map;async function J(e,t,a){const i=await R(e,a),r=await A(t,i);if("sync"===await j(e,a)){const{results:t}=await m(e,r,void 0,a);return t?.[0]?.value}const n=await d(e,r,void 0,a);await n.waitForJobCompletion({interval:t.updateDelay});const{value:o}=await n.fetchResultData("Output_File",null,a);return o}async function R(e,a){const i=C(e),r=U.get(i)??{gpServerUrl:i,legendLayerNameMap:{},legendLayers:[]};return r.gpMetadata??=(await t(i,p({f:"json"},a))).data,r.cimVersion=r.gpMetadata.cimVersion,U.set(i,r),r}async function j(e,t){return de(await R(e,t))}async function k(e,t){return(await R(e,t)).gpMetadata.tasks}async function A(t,a){a=a||{is11xService:!1,legendLayerNameMap:{},legendLayers:[]};const i=t.template||new P;null==i.showLabels&&(i.showLabels=!0);const r=i.exportOptions;let n;const o=h(i.layout);if(r){if(n={dpi:r.dpi},"map_only"===o.toLowerCase()||""===o){const e=r.width,t=r.height;n.outputSize=null!=e&&null!=t?[e,t]:void 0}}const s=i.layoutOptions;let l;if(s){let e,t;"Miles"===s.scalebarUnit||"Kilometers"===s.scalebarUnit?(e="Kilometers",t="Miles"):"Meters"!==s.scalebarUnit&&"Feet"!==s.scalebarUnit||(e="Meters",t="Feet"),l={titleText:s.titleText,authorText:s.authorText,copyrightText:s.copyrightText,customTextElements:s.customTextElements,elementOverrides:s.elementOverrides,scaleBarOptions:{metricUnit:V.toJSON(e),metricLabel:e?F[e]:void 0,nonMetricUnit:V.toJSON(t),nonMetricLabel:t?F[t]:void 0}}}let c=null;s?.legendLayers&&(c=s.legendLayers.map((e=>{const t=e.layerId;a.legendLayerNameMap[t]=e.title;const i={id:t};return e.subLayerIds&&(i.subLayerIds=e.subLayerIds),i})));const u=await _(t,i,a);if(u.operationalLayers){const e=new RegExp("[\\u4E00-\\u9FFF\\u0E00-\\u0E7F\\u0900-\\u097F\\u3040-\\u309F\\u30A0-\\u30FF\\u31F0-\\u31FF]"),t=/[\u0600-\u06FF]/,a=a=>{const i=a.text,r=a.font,n=r?.family?.toLowerCase();i&&r&&("arial"===n||"arial unicode ms"===n)&&(r.family=e.test(i)?"Arial Unicode MS":"Arial","normal"!==r.style&&t.test(i)&&(r.family="Arial Unicode MS"))};for(const i of u.operationalLayers)if(i.featureCollection?.layers)for(const e of i.featureCollection.layers){if(e.layerDefinition?.drawingInfo?.renderer?.symbol){const t=e.layerDefinition.drawingInfo.renderer;"esriTS"===t.symbol.type&&a(t.symbol)}if(e.featureSet?.features)for(const t of e.featureSet.features)t.symbol&&"esriTS"===t.symbol.type&&a(t.symbol)}}t.outSpatialReference&&(u.mapOptions.spatialReference=t.outSpatialReference.toJSON()),Object.assign(u,{exportOptions:n,layoutOptions:l||{}}),Object.assign(u.layoutOptions,{legendOptions:{operationalLayers:null!=c?c:a.legendLayers.slice()}}),a.legendLayers.length=0,U.set(a.gpServerUrl,a);const y={Web_Map_as_JSON:JSON.stringify(u),Format:g(i.format),Layout_Template:o,Layout_Item_ID:void 0,Report_Template:M(i.report),Report_Item_ID:void 0};if(i.layoutItem){delete y.Layout_Template;const t=i.layoutItem;await t.load(),"public"!==t.access&&e&&await e.getCredential(a.gpServerUrl),y.Layout_Item_ID=JSON.stringify({id:t.id})}if(i.reportItem){delete y.Report_Template;const t=i.reportItem;await t.load(),"public"!==t.access&&e&&await e.getCredential(a.gpServerUrl),y.Report_Item_ID=JSON.stringify({id:t.id})}return t.extraParameters&&Object.assign(y,t.extraParameters),y}async function _(e,t,a){const i=e.view;let r=i.spatialReference;const n={operationalLayers:await z(i,t,a)};t.includeTables&&(n.tables=await re(i));let o=e.extent||a.ssExtent||i.extent;if(r?.isWrappable&&(o=o.clone()._normalize(!0),r=o.spatialReference),n.mapOptions={extent:o&&o.toJSON(),spatialReference:r&&r.toJSON(),showAttribution:t.attributionVisible},a.ssExtent=null,i.background&&(n.background=i.background.toJSON()),i.rotation&&(n.mapOptions.rotation=-i.rotation),t.scalePreserved&&(n.mapOptions.scale=t.outScale||i.scale),null!=i.timeExtent){const e=null!=i.timeExtent.start?i.timeExtent.start.getTime():null,t=null!=i.timeExtent.end?i.timeExtent.end.getTime():null;n.mapOptions.time=[e,t]}return t.reportOptions&&(n.reportOptions=t.reportOptions),n}function C(e){let t=e;const a=t.lastIndexOf("/GPServer/");return a>0&&(t=t.slice(0,a+9)),t}async function z(e,t,a){const i=[],r={layerView:null,printTemplate:t,view:e};let n=0;t.scalePreserved&&(n=t.outScale||e.scale);const o=b(e,n);for(const s of o){const e=s.layer;if(!e.loaded||"layers"in e)continue;let t;r.layerView=s,t=w(s)?await ae(e,r,a):S(e)?$(e):x(e)?await K(e,r,a):"catalog-footprint"===e?.type?await q(e,r,a):"feature"===e?.type?await B(e,r,a):"geojson"===e?.type?await G(e,r,a):"graphics"===e?.type?await H(e,r,a):"imagery"===e?.type?Q(e,a):"imagery-tile"===e?.type?await X(e,r,a):"kml"===e?.type?await Y(e,r,a):"map-image"===e?.type?Z(e,r,a):"map-notes"===e?.type?await ee(r,a):"open-street-map"===e?.type?te():"stream"===e?.type?await ie(e,r,a):"tile"===e?.type?ne(e,a):"vector-tile"===e?.type?await oe(e,r,a):"web-tile"===e?.type?se(e):"wms"===e?.type?le(e,a):"wmts"===e?.type?ce(e):await ae(e,r,a),t&&(Array.isArray(t)?i.push(...t):(t.id=e.id,t.title=a.legendLayerNameMap[e.id]||e.title,t.opacity=s.fullOpacity,t.minScale=e.minScale||0,t.maxScale=e.maxScale||0,I(e)&&e.blendMode&&"normal"!==e.blendMode&&(t.blendMode=e.blendMode),i.push(t)))}if(n)for(const s of i)s.minScale=0,s.maxScale=0;if(e.graphics?.length){const r=await W(null,e.graphics,t,a);r&&i.push(r)}return i}function $(e){return{culture:e.culture,key:e.key,type:"BingMaps"+("aerial"===e.style?"Aerial":"hybrid"===e.style?"Hybrid":"Road")}}async function q(e,{layerView:t,printTemplate:a},i){if(parseFloat(i.cimVersion)<3.1){return W(e,await fe(t),a,i)}const r=e.parent,n={id:(o=me(r,"web-map")).id,url:o.url,layerType:o.layerType,customParameters:o.customParameters,dynamicGroupLayer:{visibility:!1},footprintLayer:o.footprintLayer,layerDefinition:o.layerDefinition};var o;return ue(n,r),n}async function K(e,t,a){e.legendEnabled&&a.legendLayers.push({id:e.id});const i=t.layerView,r=t.printTemplate;if(!(i.filter||e.portalItem&&"public"!==e.portalItem.access)){const t=me(e,"web-map");return t.type="CSV",delete t.popupInfo,delete t.layerType,t.showLabels=r.showLabels&&e.labelsVisible,t}return W(e,await fe(i),r,a)}async function W(e,t,a,i){let r;const n=L(),o=T(),s=O(),u=E(),y=O();if(y.layerDefinition.name="textLayer",delete y.layerDefinition.drawingInfo,e){if("esri.layers.FeatureLayer"===e.declaredClass||"esri.layers.StreamLayer"===e.declaredClass?n.layerDefinition.name=o.layerDefinition.name=s.layerDefinition.name=u.layerDefinition.name=i.legendLayerNameMap[e.id]||e.get("arcgisProps.title")||e.title:"esri.layers.GraphicsLayer"===e.declaredClass&&(t=e.graphics.items),e.renderer){const t=e.renderer.toJSON(),a=n.layerDefinition.drawingInfo;a&&(a.renderer=t);const i=o.layerDefinition.drawingInfo;i&&(i.renderer=t);const r=s.layerDefinition.drawingInfo;r&&(r.renderer=t);const l=u.layerDefinition.drawingInfo;l&&(l.renderer=t)}if(a.showLabels&&e.labelsVisible&&"function"==typeof e.write){const t=me(e,"web-map"),a=t.layerDefinition?.drawingInfo?.labelingInfo;if(a){r=!0;const e=n.layerDefinition.drawingInfo;e&&(e.labelingInfo=a);const t=o.layerDefinition.drawingInfo;t&&(t.labelingInfo=a);const i=s.layerDefinition.drawingInfo;i&&(i.labelingInfo=a);const l=u.layerDefinition.drawingInfo;l&&(l.labelingInfo=a)}}}let p;e?.renderer||r||(delete n.layerDefinition.drawingInfo,delete o.layerDefinition.drawingInfo,delete s.layerDefinition.drawingInfo,delete u.layerDefinition.drawingInfo);const f=e?.fieldsIndex,m=e?.renderer;if(f){const t=new Set;r&&await c(t,e),m&&"function"==typeof m.collectRequiredFields&&await m.collectRequiredFields(t,f),p=Array.from(t);const a=f.fields.map((e=>e.toJSON()));n.layerDefinition.fields=a,o.layerDefinition.fields=a,s.layerDefinition.fields=a,u.layerDefinition.fields=a}const d=t?.length;let g;for(let c=0;c<d;c++){const e=t[c]||t.at(c);if(!1!==e.visible&&e.geometry){if(g=e.toJSON(),g.hasOwnProperty("popupTemplate")&&delete g.popupTemplate,g.geometry?.z&&delete g.geometry.z,g.symbol&&(g.symbol.angle||delete g.symbol.angle,ge(g.symbol)?g.symbol=await ye(g.symbol,i):g.symbol.text&&delete g.attributes),(!a||!a.forceFeatureAttributes)&&p?.length){const e={};for(const t of p)g.attributes?.hasOwnProperty(t)&&(e[t]=g.attributes[t]);g.attributes=e}"polygon"===e.geometry.type?n.featureSet.features.push(g):"polyline"===e.geometry.type?o.featureSet.features.push(g):"point"===e.geometry.type?g.symbol?.text?y.featureSet.features.push(g):s.featureSet.features.push(g):"multipoint"===e.geometry.type?u.featureSet.features.push(g):"extent"===e.geometry.type&&(g.geometry=l.fromExtent(e.geometry).toJSON(),n.featureSet.features.push(g))}}const h=[n,o,u,s,y].filter((e=>e.featureSet.features.length>0));for(const l of h){const e=l.featureSet.features.every((e=>e.symbol));if(e&&(!a||!a.forceFeatureAttributes))for(const t of l.featureSet.features)delete t.attributes;e&&delete l.layerDefinition.drawingInfo,l.layerDefinition.drawingInfo?.renderer&&await pe(l.layerDefinition.drawingInfo.renderer,i)}return h.length?{featureCollection:{layers:h},showLabels:r}:null}async function B(e,t,a){let i;const r=e.renderer,n=parseFloat(a.cimVersion);if("binning"===e.featureReduction?.type||"cluster"===e.featureReduction?.type&&n<2.9||"pie-chart"===r?.type||"dot-density"===r?.type&&n<2.6)return ae(e,t,a);e.legendEnabled&&a.legendLayers.push({id:e.id});const o=t.layerView,{printTemplate:s,view:l}=t,c="feature-layer"!==e.source?.type&&"ogc-feature"!==e.source?.type;if(o.filter||c||!r||"field"in r&&null!=r.field&&!e.getField(r.field)){const t=await fe(o);i=await W(e,t,s,a)}else{if(i={id:(p=me(e)).id,title:p.title,url:p.url,layerType:p.layerType,customParameters:p.customParameters,layerDefinition:p.layerDefinition,charts:s.includeCharts?p.charts:void 0},i.showLabels=s.showLabels&&e.labelsVisible,ue(i,e),i.layerDefinition?.drawingInfo?.renderer&&(delete i.layerDefinition.minScale,delete i.layerDefinition.maxScale,await pe(i.layerDefinition.drawingInfo.renderer,a),"visualVariables"in r&&r.visualVariables&&r.visualVariables[0])){const e=r.visualVariables[0];if("size"===e.type&&e.maxSize&&"number"!=typeof e.maxSize&&e.minSize&&"number"!=typeof e.minSize){const t=y(e,l.scale);i.layerDefinition.drawingInfo.renderer.visualVariables[0].minSize=t.minSize,i.layerDefinition.drawingInfo.renderer.visualVariables[0].maxSize=t.maxSize}}const t=u(o);if(t&&(i.layerDefinition||(i.layerDefinition={}),i.layerDefinition.definitionExpression=i.layerDefinition.definitionExpression?`(${i.layerDefinition.definitionExpression}) AND (${t})`:t),o.hasHighlight?.()&&"getHighlightIds"in o){const t=o;i.selectionObjectIds=t.getHighlightIds(),i.selectionSymbol=v(e.geometryType,t.highlightOptions??l.highlightOptions)}}var p;return i}async function G(e,t,a){if("binning"===e.featureReduction?.type||"cluster"===e.featureReduction?.type)return ae(e,t,a);e.legendEnabled&&a.legendLayers.push({id:e.id});return W(e,await fe(t.layerView),t.printTemplate,a)}async function H(e,{printTemplate:t},a){return W(e,null,t,a)}function Q(e,t){e.legendEnabled&&t.legendLayers.push({id:e.id});const a={layerType:(i=me(e)).layerType,customParameters:i.customParameters};var i;return a.bandIds=e.bandIds,a.compressionQuality=e.compressionQuality,a.format=e.format,a.interpolation=e.interpolation,(e.mosaicRule||e.definitionExpression)&&(a.mosaicRule=e.exportImageServiceParameters.mosaicRule.toJSON()),e.rasterFunction&&(a.renderingRule=e.rasterFunction.toJSON()),e.renderer&&(a.layerDefinition??={},a.layerDefinition.drawingInfo??={},a.layerDefinition.drawingInfo.renderer=e.renderer.toJSON()),ue(a,e),a}async function X(e,t,a){if("flow"===e.renderer?.type)return ae(e,t,a);e.legendEnabled&&a.legendLayers.push({id:e.id});const i={bandIds:(r=me(e)).bandIds,customParameters:r.customParameters,interpolation:r.interpolation,layerDefinition:r.layerDefinition};var r;return i.layerType="ArcGISImageServiceLayer",ue(i,e),i}async function Y(e,t,a){const i=t.printTemplate;if(!e.portalItem||"public"===e.portalItem.access){const t=me(e,"web-map");return t.type="kml",delete t.layerType,t.url=o(e.url),t}const r=[],n=t.layerView;n.allVisibleMapImages.forEach(((t,a)=>{const i={id:`${e.id}_image${a}`,type:"image",title:e.id,minScale:e.minScale||0,maxScale:e.maxScale||0,opacity:n.fullOpacity,extent:t.extent};"data:image/png;base64,"===t.href.substr(0,22)?i.imageData=t.href.substr(22):i.url=t.href,r.push(i)}));const s=[...n.allVisiblePoints.items,...n.allVisiblePolylines.items,...n.allVisiblePolygons.items],l={id:e.id,...await W(null,s,i,a)};return r.push(l),r}function Z(e,{view:t},a){let i;const r={id:e.id,subLayerIds:[]};let n=[];const o=t.scale,s=e=>{const t=0===o,a=0===e.minScale||o<=e.minScale,i=0===e.maxScale||o>=e.maxScale;if(e.visible&&(t||a&&i))if(e.sublayers)e.sublayers.forEach(s);else{const t=e.toExportImageJSON(),a={id:e.id,name:e.title,layerDefinition:{drawingInfo:t.drawingInfo,definitionExpression:t.definitionExpression,source:t.source}};n.unshift(a),r.subLayerIds.push(e.id)}};var l;return e.sublayers&&e.sublayers.forEach(s),n.length&&(n=n.map((({id:e,name:t,layerDefinition:a})=>({id:e,name:t,layerDefinition:a}))),i={layerType:(l=me(e)).layerType,customParameters:l.customParameters},i.layers=n,i.visibleLayers=e.capabilities?.exportMap?.supportsDynamicLayers?void 0:r.subLayerIds,ue(i,e),e.legendEnabled&&a.legendLayers.push(r)),i}async function ee({layerView:e,printTemplate:t},a){const i=[],r=e.layer;if(null!=r.featureCollections)for(const n of r.featureCollections){const e=await W(n,n.source,t,a);e&&i.push(...e.featureCollection.layers)}else if(null!=r.sublayers)for(const n of r.sublayers){const e=await W(null,n.graphics,t,a);e&&i.push(...e.featureCollection.layers)}return{featureCollection:{layers:i}}}function te(){return{type:"OpenStreetMap"}}async function ae(e,{printTemplate:t,view:a},r){const n={type:"image"},o={format:"png",ignoreBackground:!0,ignorePadding:!0,layers:[e]};0!==a.rotation&&(o.rotation=0);const l=r.ssExtent||a.state.extent.clone();let c=96,u=!0,y=!0;if(t.exportOptions){const e=t.exportOptions;null!=e.dpi&&e.dpi>0&&(c=e.dpi),null!=e.width&&e.width>0&&(u=e.width%2==a.width%2),null!=e.height&&e.height>0&&(y=e.height%2==a.height%2)}if("map-only"===t.layout&&t.scalePreserved&&(!t.outScale||t.outScale===a.scale)&&96===c&&(!u||!y)&&a.state.extent.equals(a.extent)&&(o.area={x:0,y:0,width:a.width,height:a.height},u||(o.area.width-=1),y||(o.area.height-=1),!r.ssExtent)){const e=a.toMap(i(o.area.width,o.area.height));l.ymin=e.y,l.xmax=e.x,r.ssExtent=l}n.extent=l.clone()._normalize(!0).toJSON();const p=await a.takeScreenshot(o);return n.imageData=s(p.dataUrl)?.data,n}async function ie(e,{layerView:t,printTemplate:a},i){e.legendEnabled&&i.legendLayers.push({id:e.id});return W(e,await fe(t),a,i)}async function re(e){const t=[],a=[];for(const r of e.map.allTables)"feature"!==r.type||r.loaded||a.push(r.load());a.length&&await Promise.allSettled(a);for(const r of e.map.allTables)if("feature"===r.type&&r.loaded&&r.isTable&&"feature-layer"===r.source?.type){const e={id:(i=me(r)).id,title:i.title,customParameters:i.customParameters,layerDefinition:{definitionExpression:i.layerDefinition?.definitionExpression},url:i.url};ue(e,r),t.push(e)}var i;return t.length?t:void 0}function ne(e,t){e.legendEnabled&&t.legendLayers.push({id:e.id});const a={layerType:(i=me(e)).layerType,customParameters:i.customParameters};var i;return ue(a,e),a}async function oe(e,t,a){if(e.serviceUrl&&e.styleUrl){const t=f(e.styleUrl,e.apiKey),i=f(e.serviceUrl,e.apiKey);if(!t&&!i||"2.1.0"!==a.cimVersion){const a={type:"VectorTileLayer"};return a.styleUrl=o(e.styleUrl),a.token=t,i!==t&&(a.additionalTokens=[{url:e.serviceUrl,token:i}]),a}}return ae(e,t,a)}function se(e){const t=e.urlTemplate?.replace(/\${/g,"{"),a={type:"WebTiledLayer",urlTemplate:t,credits:e.copyright};return e.subDomains&&e.subDomains.length>0&&(a.subDomains=e.subDomains),a}function le(e,t){let a;const i=[],r=e=>{e.visible&&(e.sublayers?e.sublayers.forEach(r):e.name&&i.unshift(e.name))};return e.sublayers&&e.sublayers.forEach(r),i.length&&(e.legendEnabled&&t.legendLayers.push({id:e.id,subLayerIds:i}),a={type:"wms",customLayerParameters:e.customLayerParameters,customParameters:e.customParameters,transparentBackground:e.imageTransparency,visibleLayers:i,url:o(e.url),version:e.version}),a}function ce(e){const t=e.activeLayer;return{type:"wmts",customLayerParameters:e.customLayerParameters,customParameters:e.customParameters,format:t.imageFormat,layer:t.id,style:t.styleId,tileMatrixSet:t.tileMatrixSetId,url:o(e.url)}}function ue(e,t){t.url&&(e.url=o(e.url||t.url),e.token=f(e.url,t.apiKey))}async function ye(e,a){a.canvas||(a.canvas=document.createElement("canvas"));const i=1024;a.canvas.width=i,a.canvas.height=i;const o=a.canvas.getContext("2d");let s,l;if(e.path){const t=new Path2D(e.path);t.closePath(),o.fillStyle=Array.isArray(e.color)?`rgba(${e.color[0]},${e.color[1]},${e.color[2]},${e.color[3]/255})`:"rgb(0,0,0)",o.fill(t);const a=D(o);if(!a)return null;o.clearRect(0,0,i,i);const n=r(e.size)/Math.max(a.width,a.height);o.scale(n,n);const c=i/n,u=c/2-a.width/2-a.x,y=c/2-a.height/2-a.y;if(o.translate(u,y),Array.isArray(e.color)&&o.fill(t),e.outline?.width&&Array.isArray(e.outline.color)){const i=e.outline;o.lineWidth=r(i.width)/n,o.lineJoin="round",o.strokeStyle=`rgba(${i.color[0]},${i.color[1]},${i.color[2]},${i.color[3]/255})`,o.stroke(t),a.width+=o.lineWidth,a.height+=o.lineWidth}a.width*=n,a.height*=n;const p=o.getImageData(i/2-a.width/2,i/2-a.height/2,Math.ceil(a.width),Math.ceil(a.height));s=p.width,l=p.height,o.canvas.width=s,o.canvas.height=l,o.putImageData(p,0,0)}else{const a="image/svg+xml"===e.contentType?"data:image/svg+xml;base64,"+e.imageData:e.url,i=(await t(a,{responseType:"image"})).data;s=r(e.width),l=r(e.height),o.canvas.width=s,o.canvas.height=l,o.drawImage(i,0,0,o.canvas.width,o.canvas.height)}return{type:"esriPMS",imageData:o.canvas.toDataURL("image/png").substr(22),angle:e.angle,contentType:"image/png",height:n(l),width:n(s),xoffset:e.xoffset,yoffset:e.yoffset}}async function pe(e,t){const a=e.type;if("simple"===a&&ge(e.symbol))e.symbol=await ye(e.symbol,t);else if("uniqueValue"===a||"classBreaks"===a){ge(e.defaultSymbol)&&(e.defaultSymbol=await ye(e.defaultSymbol,t));const i=e["uniqueValue"===a?"uniqueValueInfos":"classBreakInfos"];if(i)for(const e of i)ge(e.symbol)&&(e.symbol=await ye(e.symbol,t))}}async function fe(e){return e.queryFeatures(e.createQuery()).then((e=>e.features))}function me(e,t){return e.write({},{ignorePersistenceEnabled:!0,origin:t})??{}}function de(e){return e.gpMetadata?.executionType?N.fromJSON(e.gpMetadata.executionType):"sync"}function ge(e){return e&&(e.path||"image/svg+xml"===e.contentType||e.url?.endsWith(".svg"))}export{J as execute,A as getGpPrintParams,C as getGpServerUrl,j as getMode,k as getTasks,U as printCacheMap};
|
|
5
|
+
import{id as e}from"../kernel.js";import t from"../request.js";import{JSONMap as i}from"../core/jsonMap.js";import{createScreenPoint as a,pt2px as r,px2pt as n}from"../core/screenUtils.js";import{normalize as o,dataComponents as s}from"../core/urlUtils.js";import l from"../geometry/Polygon.js";import{collectLabelingFields as c}from"../layers/support/fieldUtils.js";import{getFloorFilterClause as u}from"../layers/support/floorFilterUtils.js";import{getSizeRangeAtScale as y}from"../renderers/visualVariables/support/visualVariableUtils.js";import{asValidOptions as p,getToken as f}from"./utils.js";import{execute as d}from"./geoprocessor/execute.js";import{submitJob as m}from"./geoprocessor/submitJob.js";import{toJSON as g}from"./support/fileFormat.js";import{toJSON as h}from"./support/layoutTemplate.js";import{getVisibleLayerViews as b,isScreenshotRequired as w,isBingMapsLayer as S,isCSVLayer as x,isBlendLayer as I,getSelectionSymbol as v,getContextBoundingBox as D,createPolygonLayer as L,createPolylineLayer as T,createPointLayer as O,createMultipointLayer as E}from"./support/printTaskUtils.js";import P from"./support/PrintTemplate.js";import{toJSON as M}from"./support/reportTemplate.js";const V={Feet:"ft",Kilometers:"km",Meters:"m",Miles:"mi"},F=new i({esriFeet:"Feet",esriKilometers:"Kilometers",esriMeters:"Meters",esriMiles:"Miles"}),N=new i({esriExecutionTypeSynchronous:"sync",esriExecutionTypeAsynchronous:"async"}),U=new Map;async function J(e,t,i){const a=await R(e,i),r=await A(t,a);if("sync"===await j(e,i)){const{results:t}=await d(e,r,void 0,i);return t?.[0]?.value}const n=await m(e,r,void 0,i);await n.waitForJobCompletion({interval:t.updateDelay});const{value:o}=await n.fetchResultData("Output_File",null,i);return o}async function R(e,i){const a=C(e),r=U.get(a)??{gpServerUrl:a,legendLayerNameMap:{},legendLayers:[]};return r.gpMetadata??=(await t(a,p({f:"json"},i))).data,r.cimVersion=r.gpMetadata.cimVersion,U.set(a,r),r}async function j(e,t){return me(await R(e,t))}async function k(e,t){return(await R(e,t)).gpMetadata.tasks}async function A(t,i){i=i||{is11xService:!1,legendLayerNameMap:{},legendLayers:[]};const a=t.template||new P;null==a.showLabels&&(a.showLabels=!0);const r=a.exportOptions;let n;const o=h(a.layout);if(r){if(n={dpi:r.dpi},"map_only"===o.toLowerCase()||""===o){const e=r.width,t=r.height;n.outputSize=null!=e&&null!=t?[e,t]:void 0}}const s=a.layoutOptions;let l;if(s){let e,t;"Miles"===s.scalebarUnit||"Kilometers"===s.scalebarUnit?(e="Kilometers",t="Miles"):"Meters"!==s.scalebarUnit&&"Feet"!==s.scalebarUnit||(e="Meters",t="Feet"),l={titleText:s.titleText,authorText:s.authorText,copyrightText:s.copyrightText,customTextElements:s.customTextElements,elementOverrides:s.elementOverrides,scaleBarOptions:{metricUnit:F.toJSON(e),metricLabel:e?V[e]:void 0,nonMetricUnit:F.toJSON(t),nonMetricLabel:t?V[t]:void 0}}}let c=null;s?.legendLayers&&(c=s.legendLayers.map((e=>{const t=e.layerId;i.legendLayerNameMap[t]=e.title;const a={id:t};return e.subLayerIds&&(a.subLayerIds=e.subLayerIds),a})));const u=await _(t,a,i);if(u.operationalLayers){const e=new RegExp("[\\u4E00-\\u9FFF\\u0E00-\\u0E7F\\u0900-\\u097F\\u3040-\\u309F\\u30A0-\\u30FF\\u31F0-\\u31FF]"),t=/[\u0600-\u06FF]/,i=i=>{const a=i.text,r=i.font,n=r?.family?.toLowerCase();a&&r&&("arial"===n||"arial unicode ms"===n)&&(r.family=e.test(a)?"Arial Unicode MS":"Arial","normal"!==r.style&&t.test(a)&&(r.family="Arial Unicode MS"))};for(const a of u.operationalLayers)if(a.featureCollection?.layers)for(const e of a.featureCollection.layers){if(e.layerDefinition?.drawingInfo?.renderer?.symbol){const t=e.layerDefinition.drawingInfo.renderer;"esriTS"===t.symbol.type&&i(t.symbol)}if(e.featureSet?.features)for(const t of e.featureSet.features)t.symbol&&"esriTS"===t.symbol.type&&i(t.symbol)}}t.outSpatialReference&&(u.mapOptions.spatialReference=t.outSpatialReference.toJSON()),Object.assign(u,{exportOptions:n,layoutOptions:l||{}}),Object.assign(u.layoutOptions,{legendOptions:{operationalLayers:null!=c?c:i.legendLayers.slice()}}),i.legendLayers.length=0,U.set(i.gpServerUrl,i);const y={Web_Map_as_JSON:JSON.stringify(u),Format:g(a.format),Layout_Template:o,Layout_Item_ID:void 0,Report_Template:M(a.report),Report_Item_ID:void 0};if(a.layoutItem){delete y.Layout_Template;const t=a.layoutItem;await t.load(),"public"!==t.access&&e&&await e.getCredential(i.gpServerUrl),y.Layout_Item_ID=JSON.stringify({id:t.id})}if(a.reportItem){delete y.Report_Template;const t=a.reportItem;await t.load(),"public"!==t.access&&e&&await e.getCredential(i.gpServerUrl),y.Report_Item_ID=JSON.stringify({id:t.id})}return t.extraParameters&&Object.assign(y,t.extraParameters),y}async function _(e,t,i){const a=e.view;let r=a.spatialReference;const n={operationalLayers:await z(a,t,i)};t.includeTables&&(n.tables=await re(a));let o=e.extent||i.ssExtent||a.extent;if(r?.isWrappable&&(o=o.clone()._normalize(!0),r=o.spatialReference),n.mapOptions={extent:o&&o.toJSON(),spatialReference:r&&r.toJSON(),showAttribution:t.attributionVisible},i.ssExtent=null,a.background&&(n.background=a.background.toJSON()),a.rotation&&(n.mapOptions.rotation=-a.rotation),t.scalePreserved&&(n.mapOptions.scale=t.outScale||a.scale),null!=a.timeExtent){const e=null!=a.timeExtent.start?a.timeExtent.start.getTime():null,t=null!=a.timeExtent.end?a.timeExtent.end.getTime():null;n.mapOptions.time=[e,t]}return t.reportOptions&&(n.reportOptions=t.reportOptions),n}function C(e){let t=e;const i=t.lastIndexOf("/GPServer/");return i>0&&(t=t.slice(0,i+9)),t}async function z(e,t,i){const a=[],r={layerView:null,printTemplate:t,view:e};let n=0;t.scalePreserved&&(n=t.outScale||e.scale);const o=b(e,n);for(const s of o){const e=s.layer;if(!e.loaded||"layers"in e)continue;let t;r.layerView=s,t=w(s)?await ie(e,r,i):S(e)?$(e):x(e)?await K(e,r,i):"catalog-footprint"===e?.type?await q(e,r,i):"feature"===e?.type?await B(e,r,i):"geojson"===e?.type?await G(e,r,i):"graphics"===e?.type?await H(e,r,i):"imagery"===e?.type?Q(e,i):"imagery-tile"===e?.type?await X(e,r,i):"kml"===e?.type?await Y(e,r,i):"map-image"===e?.type?Z(e,r,i):"map-notes"===e?.type?await ee(r,i):"open-street-map"===e?.type?te():"stream"===e?.type?await ae(e,r,i):"tile"===e?.type?ne(e,i):"vector-tile"===e?.type?await oe(e,r,i):"web-tile"===e?.type?se(e):"wms"===e?.type?le(e,i):"wmts"===e?.type?ce(e):await ie(e,r,i),t&&(Array.isArray(t)?a.push(...t):(t.id=e.id,t.title=i.legendLayerNameMap[e.id]||e.title,t.opacity=s.fullOpacity,t.minScale=e.minScale||0,t.maxScale=e.maxScale||0,I(e)&&e.blendMode&&"normal"!==e.blendMode&&(t.blendMode=e.blendMode),a.push(t)))}if(n)for(const s of a)s.minScale=0,s.maxScale=0;if(e.graphics?.length){const r=await W(null,e.graphics,t,i);r&&a.push(r)}return a}function $(e){return{culture:e.culture,key:e.key,type:"BingMaps"+("aerial"===e.style?"Aerial":"hybrid"===e.style?"Hybrid":"Road")}}async function q(e,{layerView:t,printTemplate:i},a){if(parseFloat(a.cimVersion)<3.1){return W(e,await fe(t),i,a)}const r=e.parent,n={id:(o=de(r,"web-map")).id,url:o.url,layerType:o.layerType,customParameters:o.customParameters,dynamicGroupLayer:{visibility:!1},footprintLayer:o.footprintLayer,layerDefinition:o.layerDefinition};var o;return ue(n,r),n}async function K(e,t,i){e.legendEnabled&&i.legendLayers.push({id:e.id});const a=t.layerView,r=t.printTemplate;if(!(a.filter||e.portalItem&&"public"!==e.portalItem.access)){const t=de(e,"web-map");return t.type="CSV",delete t.popupInfo,delete t.layerType,t.showLabels=r.showLabels&&e.labelsVisible,t}return W(e,await fe(a),r,i)}async function W(e,t,i,a){let r;const n=L(),o=T(),s=O(),u=E(),y=O();if(y.layerDefinition.name="textLayer",delete y.layerDefinition.drawingInfo,e){if("esri.layers.FeatureLayer"===e.declaredClass||"esri.layers.StreamLayer"===e.declaredClass?n.layerDefinition.name=o.layerDefinition.name=s.layerDefinition.name=u.layerDefinition.name=a.legendLayerNameMap[e.id]||e.get("arcgisProps.title")||e.title:"esri.layers.GraphicsLayer"===e.declaredClass&&(t=e.graphics.items),e.renderer){const t=e.renderer.toJSON(),i=n.layerDefinition.drawingInfo;i&&(i.renderer=t);const a=o.layerDefinition.drawingInfo;a&&(a.renderer=t);const r=s.layerDefinition.drawingInfo;r&&(r.renderer=t);const l=u.layerDefinition.drawingInfo;l&&(l.renderer=t)}if(i.showLabels&&e.labelsVisible&&"function"==typeof e.write){const t=de(e,"web-map"),i=t.layerDefinition?.drawingInfo?.labelingInfo;if(i){r=!0;const e=n.layerDefinition.drawingInfo;e&&(e.labelingInfo=i);const t=o.layerDefinition.drawingInfo;t&&(t.labelingInfo=i);const a=s.layerDefinition.drawingInfo;a&&(a.labelingInfo=i);const l=u.layerDefinition.drawingInfo;l&&(l.labelingInfo=i)}}}let p;e?.renderer||r||(delete n.layerDefinition.drawingInfo,delete o.layerDefinition.drawingInfo,delete s.layerDefinition.drawingInfo,delete u.layerDefinition.drawingInfo);const f=e?.fieldsIndex,d=e?.renderer;if(f){const t=new Set;r&&await c(t,e),d&&"function"==typeof d.collectRequiredFields&&await d.collectRequiredFields(t,f),p=Array.from(t);const i=f.fields.map((e=>e.toJSON()));n.layerDefinition.fields=i,o.layerDefinition.fields=i,s.layerDefinition.fields=i,u.layerDefinition.fields=i}const m=t?.length;let g;for(let c=0;c<m;c++){const e=t[c]||t.at(c);if(!1!==e.visible&&e.geometry){if(g=e.toJSON(),g.hasOwnProperty("popupTemplate")&&delete g.popupTemplate,g.geometry?.z&&delete g.geometry.z,g.symbol&&(g.symbol.angle||delete g.symbol.angle,ge(g.symbol)?g.symbol=await ye(g.symbol,a):g.symbol.text&&delete g.attributes),(!i||!i.forceFeatureAttributes)&&p?.length){const e={};for(const t of p)g.attributes?.hasOwnProperty(t)&&(e[t]=g.attributes[t]);g.attributes=e}"polygon"===e.geometry.type?n.featureSet.features.push(g):"polyline"===e.geometry.type?o.featureSet.features.push(g):"point"===e.geometry.type?g.symbol?.text?y.featureSet.features.push(g):s.featureSet.features.push(g):"multipoint"===e.geometry.type?u.featureSet.features.push(g):"extent"===e.geometry.type&&(g.geometry=l.fromExtent(e.geometry).toJSON(),n.featureSet.features.push(g))}}const h=[n,o,u,s,y].filter((e=>e.featureSet.features.length>0));for(const l of h){const e=l.featureSet.features.every((e=>e.symbol));if(e&&(!i||!i.forceFeatureAttributes))for(const t of l.featureSet.features)delete t.attributes;e&&delete l.layerDefinition.drawingInfo,l.layerDefinition.drawingInfo?.renderer&&await pe(l.layerDefinition.drawingInfo.renderer,a)}return h.length?{featureCollection:{layers:h},showLabels:r}:null}async function B(e,t,i){let a;const r=e.renderer,n=parseFloat(i.cimVersion);if("binning"===e.featureReduction?.type||"cluster"===e.featureReduction?.type&&n<2.9||"pie-chart"===r?.type||"dot-density"===r?.type&&n<2.6)return ie(e,t,i);e.legendEnabled&&i.legendLayers.push({id:e.id});const o=t.layerView,{printTemplate:s,view:l}=t,c="feature-layer"!==e.source?.type&&"ogc-feature"!==e.source?.type;if(o.filter||c||!r||"field"in r&&null!=r.field&&!e.getField(r.field)){const t=await fe(o);a=await W(e,t,s,i)}else{if(a={id:(p=de(e)).id,title:p.title,url:p.url,layerType:p.layerType,customParameters:p.customParameters,layerDefinition:p.layerDefinition,charts:s.includeCharts?p.charts:void 0},a.showLabels=s.showLabels&&e.labelsVisible,ue(a,e),a.layerDefinition?.drawingInfo?.renderer&&(delete a.layerDefinition.minScale,delete a.layerDefinition.maxScale,await pe(a.layerDefinition.drawingInfo.renderer,i),"visualVariables"in r&&r.visualVariables&&r.visualVariables[0])){const e=r.visualVariables[0];if("size"===e.type&&e.maxSize&&"number"!=typeof e.maxSize&&e.minSize&&"number"!=typeof e.minSize){const t=y(e,l.scale);a.layerDefinition.drawingInfo.renderer.visualVariables[0].minSize=t.minSize,a.layerDefinition.drawingInfo.renderer.visualVariables[0].maxSize=t.maxSize}}const t=u(o);if(t&&(a.layerDefinition??={},a.layerDefinition.definitionExpression=a.layerDefinition.definitionExpression?`(${a.layerDefinition.definitionExpression}) AND (${t})`:t),e.gdbVersion&&(a.layerDefinition??={},a.layerDefinition.gdbVersion=e.gdbVersion),o.hasHighlight?.()&&"getHighlightIds"in o){const t=o;a.selectionObjectIds=t.getHighlightIds(),a.selectionSymbol=v(e.geometryType,t.highlightOptions??l.highlightOptions)}}var p;return a}async function G(e,t,i){if("binning"===e.featureReduction?.type||"cluster"===e.featureReduction?.type)return ie(e,t,i);e.legendEnabled&&i.legendLayers.push({id:e.id});return W(e,await fe(t.layerView),t.printTemplate,i)}async function H(e,{printTemplate:t},i){return W(e,null,t,i)}function Q(e,t){e.legendEnabled&&t.legendLayers.push({id:e.id});const i={layerType:(a=de(e)).layerType,customParameters:a.customParameters};var a;return i.bandIds=e.bandIds,i.compressionQuality=e.compressionQuality,i.format=e.format,i.interpolation=e.interpolation,(e.mosaicRule||e.definitionExpression)&&(i.mosaicRule=e.exportImageServiceParameters.mosaicRule.toJSON()),e.rasterFunction&&(i.renderingRule=e.rasterFunction.toJSON()),e.renderer&&(i.layerDefinition??={},i.layerDefinition.drawingInfo??={},i.layerDefinition.drawingInfo.renderer=e.renderer.toJSON()),ue(i,e),i}async function X(e,t,i){if("flow"===e.renderer?.type)return ie(e,t,i);e.legendEnabled&&i.legendLayers.push({id:e.id});const a={bandIds:(r=de(e)).bandIds,customParameters:r.customParameters,interpolation:r.interpolation,layerDefinition:r.layerDefinition};var r;return a.layerType="ArcGISImageServiceLayer",ue(a,e),a}async function Y(e,t,i){const a=t.printTemplate;if(!e.portalItem||"public"===e.portalItem.access){const t=de(e,"web-map");return t.type="kml",delete t.layerType,t.url=o(e.url),t}const r=[],n=t.layerView;n.allVisibleMapImages.forEach(((t,i)=>{const a={id:`${e.id}_image${i}`,type:"image",title:e.id,minScale:e.minScale||0,maxScale:e.maxScale||0,opacity:n.fullOpacity,extent:t.extent};"data:image/png;base64,"===t.href.substr(0,22)?a.imageData=t.href.substr(22):a.url=t.href,r.push(a)}));const s=[...n.allVisiblePoints.items,...n.allVisiblePolylines.items,...n.allVisiblePolygons.items],l={id:e.id,...await W(null,s,a,i)};return r.push(l),r}function Z(e,{view:t},i){let a;const r={id:e.id,subLayerIds:[]};let n=[];const o=t.scale,s=e=>{const t=0===o,i=0===e.minScale||o<=e.minScale,a=0===e.maxScale||o>=e.maxScale;if(e.visible&&(t||i&&a))if(e.sublayers)e.sublayers.forEach(s);else{const t=e.toExportImageJSON(),i={id:e.id,name:e.title,layerDefinition:{drawingInfo:t.drawingInfo,definitionExpression:t.definitionExpression,source:t.source}};n.unshift(i),r.subLayerIds.push(e.id)}};var l;return e.sublayers&&e.sublayers.forEach(s),n.length&&(n=n.map((({id:e,name:t,layerDefinition:i})=>({id:e,name:t,layerDefinition:i}))),a={layerType:(l=de(e)).layerType,customParameters:l.customParameters},a.layers=n,a.visibleLayers=e.capabilities?.exportMap?.supportsDynamicLayers?void 0:r.subLayerIds,e.gdbVersion&&(a.gdbVersion=e.gdbVersion),ue(a,e),e.legendEnabled&&i.legendLayers.push(r)),a}async function ee({layerView:e,printTemplate:t},i){const a=[],r=e.layer;if(null!=r.featureCollections)for(const n of r.featureCollections){const e=await W(n,n.source,t,i);e&&a.push(...e.featureCollection.layers)}else if(null!=r.sublayers)for(const n of r.sublayers){const e=await W(null,n.graphics,t,i);e&&a.push(...e.featureCollection.layers)}return{featureCollection:{layers:a}}}function te(){return{type:"OpenStreetMap"}}async function ie(e,{printTemplate:t,view:i},r){const n={type:"image"},o={format:"png",ignoreBackground:!0,ignorePadding:!0,layers:[e]};0!==i.rotation&&(o.rotation=0);const l=r.ssExtent||i.state.extent.clone();let c=96,u=!0,y=!0;if(t.exportOptions){const e=t.exportOptions;null!=e.dpi&&e.dpi>0&&(c=e.dpi),null!=e.width&&e.width>0&&(u=e.width%2==i.width%2),null!=e.height&&e.height>0&&(y=e.height%2==i.height%2)}if("map-only"===t.layout&&t.scalePreserved&&(!t.outScale||t.outScale===i.scale)&&96===c&&(!u||!y)&&i.state.extent.equals(i.extent)&&(o.area={x:0,y:0,width:i.width,height:i.height},u||(o.area.width-=1),y||(o.area.height-=1),!r.ssExtent)){const e=i.toMap(a(o.area.width,o.area.height));l.ymin=e.y,l.xmax=e.x,r.ssExtent=l}n.extent=l.clone()._normalize(!0).toJSON();const p=await i.takeScreenshot(o);return n.imageData=s(p.dataUrl)?.data,n}async function ae(e,{layerView:t,printTemplate:i},a){e.legendEnabled&&a.legendLayers.push({id:e.id});return W(e,await fe(t),i,a)}async function re(e){const t=[],i=[];for(const r of e.map.allTables)"feature"!==r.type||r.loaded||i.push(r.load());i.length&&await Promise.allSettled(i);for(const r of e.map.allTables)if("feature"===r.type&&r.loaded&&r.isTable&&"feature-layer"===r.source?.type){const e={id:(a=de(r)).id,title:a.title,customParameters:a.customParameters,layerDefinition:{definitionExpression:a.layerDefinition?.definitionExpression},url:a.url};ue(e,r),t.push(e)}var a;return t.length?t:void 0}function ne(e,t){e.legendEnabled&&t.legendLayers.push({id:e.id});const i={layerType:(a=de(e)).layerType,customParameters:a.customParameters};var a;return ue(i,e),i}async function oe(e,t,i){if(e.serviceUrl&&e.styleUrl){const t=f(e.styleUrl,e.apiKey),a=f(e.serviceUrl,e.apiKey);if(!t&&!a||"2.1.0"!==i.cimVersion){const i={type:"VectorTileLayer"};return i.styleUrl=o(e.styleUrl),i.token=t,a!==t&&(i.additionalTokens=[{url:e.serviceUrl,token:a}]),i}}return ie(e,t,i)}function se(e){const t=e.urlTemplate?.replace(/\${/g,"{"),i={type:"WebTiledLayer",urlTemplate:t,credits:e.copyright};return e.subDomains&&e.subDomains.length>0&&(i.subDomains=e.subDomains),i}function le(e,t){let i;const a=[],r=e=>{e.visible&&(e.sublayers?e.sublayers.forEach(r):e.name&&a.unshift(e.name))};return e.sublayers&&e.sublayers.forEach(r),a.length&&(e.legendEnabled&&t.legendLayers.push({id:e.id,subLayerIds:a}),i={type:"wms",customLayerParameters:e.customLayerParameters,customParameters:e.customParameters,transparentBackground:e.imageTransparency,visibleLayers:a,url:o(e.url),version:e.version}),i}function ce(e){const t=e.activeLayer;return{type:"wmts",customLayerParameters:e.customLayerParameters,customParameters:e.customParameters,format:t.imageFormat,layer:t.id,style:t.styleId,tileMatrixSet:t.tileMatrixSetId,url:o(e.url)}}function ue(e,t){t.url&&(e.url=o(e.url||t.url),e.token=f(e.url,t.apiKey))}async function ye(e,i){i.canvas||(i.canvas=document.createElement("canvas"));const a=1024;i.canvas.width=a,i.canvas.height=a;const o=i.canvas.getContext("2d");let s,l;if(e.path){const t=new Path2D(e.path);t.closePath(),o.fillStyle=Array.isArray(e.color)?`rgba(${e.color[0]},${e.color[1]},${e.color[2]},${e.color[3]/255})`:"rgb(0,0,0)",o.fill(t);const i=D(o);if(!i)return null;o.clearRect(0,0,a,a);const n=r(e.size)/Math.max(i.width,i.height);o.scale(n,n);const c=a/n,u=c/2-i.width/2-i.x,y=c/2-i.height/2-i.y;if(o.translate(u,y),Array.isArray(e.color)&&o.fill(t),e.outline?.width&&Array.isArray(e.outline.color)){const a=e.outline;o.lineWidth=r(a.width)/n,o.lineJoin="round",o.strokeStyle=`rgba(${a.color[0]},${a.color[1]},${a.color[2]},${a.color[3]/255})`,o.stroke(t),i.width+=o.lineWidth,i.height+=o.lineWidth}i.width*=n,i.height*=n;const p=o.getImageData(a/2-i.width/2,a/2-i.height/2,Math.ceil(i.width),Math.ceil(i.height));s=p.width,l=p.height,o.canvas.width=s,o.canvas.height=l,o.putImageData(p,0,0)}else{const i="image/svg+xml"===e.contentType?"data:image/svg+xml;base64,"+e.imageData:e.url,a=(await t(i,{responseType:"image"})).data;s=r(e.width),l=r(e.height),o.canvas.width=s,o.canvas.height=l,o.drawImage(a,0,0,o.canvas.width,o.canvas.height)}return{type:"esriPMS",imageData:o.canvas.toDataURL("image/png").substr(22),angle:e.angle,contentType:"image/png",height:n(l),width:n(s),xoffset:e.xoffset,yoffset:e.yoffset}}async function pe(e,t){const i=e.type;if("simple"===i&&ge(e.symbol))e.symbol=await ye(e.symbol,t);else if("uniqueValue"===i||"classBreaks"===i){ge(e.defaultSymbol)&&(e.defaultSymbol=await ye(e.defaultSymbol,t));const a=e["uniqueValue"===i?"uniqueValueInfos":"classBreakInfos"];if(a)for(const e of a)ge(e.symbol)&&(e.symbol=await ye(e.symbol,t))}}async function fe(e){return e.queryFeatures(e.createQuery()).then((e=>e.features))}function de(e,t){return e.write({},{ignorePersistenceEnabled:!0,origin:t})??{}}function me(e){return e.gpMetadata?.executionType?N.fromJSON(e.gpMetadata.executionType):"sync"}function ge(e){return e&&(e.path||"image/svg+xml"===e.contentType||e.url?.endsWith(".svg"))}export{J as execute,A as getGpPrintParams,C as getGpServerUrl,j as getMode,k as getTasks,U as printCacheMap};
|
package/rest/symbolService.js
CHANGED
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.30/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import e from"../request.js";import{join as o}from"../core/urlUtils.js";import{parseUrl as t}from"./utils.js";import m from"../symbols/CIMSymbol.js";async function
|
|
5
|
+
import e from"../request.js";import{join as o}from"../core/urlUtils.js";import{parseUrl as t}from"./utils.js";import m from"../symbols/CIMSymbol.js";async function a(a,s,n){const r=t(a),g=s.svgImage,i=new FormData;if("FormData"in globalThis&&"HTMLFormElement"in globalThis)if(g instanceof FormData){const e=g.get("svgImage");i.append("svgImage",e,e.name)}else if(g instanceof HTMLFormElement){const e=new FormData(g).get("svgImage");i.append("svgImage",e,e.name)}if("string"==typeof g){const e=new Blob([g.trim()],{type:"image/svg+xml"});i.append("svgImage",e,"symbol.svg")}i.append("f","json");const l={...n,method:"post",body:i},p=o(r.path,"generateSymbol"),{data:f}=await e(p,l);return{symbol:new m({data:{type:"CIMSymbolReference",symbol:f}})}}export{a as generateSymbol};
|
package/support/revision.js
CHANGED
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.30/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
const c="
|
|
5
|
+
const c="20240703",a="c2e27693be5ad62ff80ac547c420439d7fa3d50b";export{c as buildDate,a as commitHash};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.30/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
const e={action:"EsriFeatureTableActionColumn",attachments:"EsriFeatureTableAttachmentsColumn",relationship:"EsriFeatureTableRelationshipColumn"};function n(e){return e&&"selection"===e.type}function t(e){return null!=e&&"object"==typeof e&&"createQuery"in e&&"getField"in e&&"queryFeatureCount"in e&&"queryFeatures"in e&&"queryObjectIds"in e&&"capabilities"in e&&"fields"in e&&"fieldsIndex"in e&&"id"in e&&"load"in e&&"objectIdField"in e&&"type"in e&&"when"in e}function i(e){return t(e)&&"queryAttachments"in e}function r(e){return t(e)&&"editingEnabled"in e&&"applyEdits"in e}function a(e){return t(e)&&"relationships"in e&&"queryRelatedFeatures"in e&&"queryRelatedFeaturesCount"in e}function u(e){return null!=e&&"object"==typeof e&&"type"in e&&null!==e.type&&("column"===e.type||"field"===e.type||"group"===e.type)}function l(e){return null!=e&&"object"==typeof e&&"type"in e&&"map-image"===e.type}function s(e,n,{relatedTableId:t}){if(!n?.map)return;const i="scene"===e.type&&e.associatedLayer?e.associatedLayer.url:e.url,r=n=>!(!a(n)||n===e)&&("sublayer"===n.type?n.id===t:i===n.url&&n.layerId===t);if("sublayer"===e.type&&l(e.parent)){const n=e.parent,
|
|
5
|
+
const e={action:"EsriFeatureTableActionColumn",attachments:"EsriFeatureTableAttachmentsColumn",relationship:"EsriFeatureTableRelationshipColumn"};function n(e){return e&&"selection"===e.type}function t(e){return null!=e&&"object"==typeof e&&"createQuery"in e&&"getField"in e&&"queryFeatureCount"in e&&"queryFeatures"in e&&"queryObjectIds"in e&&"capabilities"in e&&"fields"in e&&"fieldsIndex"in e&&"id"in e&&"load"in e&&"objectIdField"in e&&"type"in e&&"when"in e}function i(e){return t(e)&&"queryAttachments"in e}function r(e){return t(e)&&"editingEnabled"in e&&"applyEdits"in e}function a(e){return t(e)&&"relationships"in e&&"queryRelatedFeatures"in e&&"queryRelatedFeaturesCount"in e}function u(e){return null!=e&&"object"==typeof e&&"type"in e&&null!==e.type&&("column"===e.type||"field"===e.type||"group"===e.type)}function l(e){return null!=e&&"object"==typeof e&&"type"in e&&"map-image"===e.type}function s(e,n,{relatedTableId:t}){if(!n?.map)return;const i="scene"===e.type&&e.associatedLayer?e.associatedLayer.url:e.url,r=n=>!(!a(n)||n===e)&&("sublayer"===n.type&&n.layer?.url===e.url?n.id===t:i===n.url&&n.layerId===t);if("sublayer"===e.type&&l(e.parent)){const n=n=>a(n)&&n!==e&&n.id===t,i=e.parent,r=i.sublayers?.find(n)||i.subtables?.find(n);if(a(r))return r}const u=[...n.map.allLayers,...n.map.allTables];let s=null;for(const a of u)if(l(a)){const e=a.sublayers?.find(r)||a.subtables?.find(r);if(e){s=e;break}}else if(r(a)){s=a;break}return a(s)?s:void 0}export{s as findRelatedLayer,t as isIFeatureTableSupportedLayer,i as isIFeatureTableSupportedLayerWithAttachments,r as isIFeatureTableSupportedLayerWithEditing,a as isIFeatureTableSupportedLayerWithRelationships,l as isMapImageLayer,n as isSelectionFilter,u as isTemplateObjectWithType,e as uniqueColumnNames};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.30/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as t}from"../../chunks/tslib.es6.js";import i from"../../Graphic.js";import"../../intl.js";import s from"../../core/Accessor.js";import o from"../../core/Collection.js";import e from"../../core/Error.js";import r from"../../core/Logger.js";import{watch as n}from"../../core/reactiveUtils.js";import{property as a}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/RandomLCG.js";import{subclass as c}from"../../core/accessorSupport/decorators/subclass.js";import{UpdatingHandles as l}from"../../core/support/UpdatingHandles.js";import h from"../../layers/GraphicsLayer.js";import y from"../../symbols/LineSymbolMarker.js";import m from"../../symbols/SimpleLineSymbol.js";import{addUniqueLayer as u}from"../../views/draw/support/layerUtils.js";import{onLocaleChange as p}from"../../intl/locale.js";import{fetchMessageBundle as A}from"../../intl/messages.js";let w=class extends s{constructor(t){super(t),this._internalGraphicsLayerConnectivity=this._createInternalGraphicsLayer("Connectivity Associations (Internal)"),this._internalGraphicsLayerStructuralAttachment=this._createInternalGraphicsLayer("Structural Attachment Associations (Internal)"),this._initialValidationsFinished=!1,this._updatingHandles=new l,this.autoRefreshAssociations=!1,this.connectivityAssociationsLineSymbol=new m({style:"short-dash",width:2,color:[190,159,159,1]}),this.executionError="",this.loadErrors=new o,this.maxAllowableAssociations=250,this.showAssociationsEnabled=!1,this.showArrowsConnectivity=!1,this.showArrowsStructuralAttachment=!1,this.structuralAttachmentAssociationsLineSymbol=new m({style:"short-dash",width:2,color:[159,190,159,1]})}initialize(){const t=async()=>{this.messages||(this.messages=await A("esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations"))};t().then((()=>{this.view||(this.view=null),this.utilityNetwork||(this.utilityNetwork=null),this.addHandles([n((()=>[this.view,this.utilityNetwork]),(async()=>{const{loadErrors:t,messages:{info:{noUtilityNetwork:i,noView:s}}}=this;this._initialValidationsFinished=!1,t.removeAll();let o=!1,n=!1;this.removeAssociations(),"utility"!==this.utilityNetwork?.type?(this.loadErrors.push(i),r.getLogger(this).error(new e("utilityNetworkAssociations:missing-property",i))):(this.utilityNetwork.loaded||await this.utilityNetwork.load(),o=!0),"2d"!==this.view?.type?(this.loadErrors.push(s),r.getLogger(this).error(new e("utilityNetworkAssociations:missing-property",s))):(u(this.view,this._internalGraphicsLayerConnectivity),u(this.view,this._internalGraphicsLayerStructuralAttachment),n=!0),o&&n&&this.showAssociationsEnabled&&await this.showAssociations(),this._internalGraphicsLayerConnectivity.visible=this.includeConnectivityAssociations,this._internalGraphicsLayerStructuralAttachment.visible=this.includeStructuralAttachmentAssociations,this._initialValidationsFinished=!0}),{initial:!0}),n((()=>[this.view?.stationary,this.showAssociationsEnabled,this.maxAllowableAssociations]),(async()=>{this.view?.stationary&&this.showAssociationsEnabled&&(this.includeConnectivityAssociations||this.includeStructuralAttachmentAssociations)&&await this.showAssociations()})),n((()=>[this.showArrowsConnectivity]),(()=>{const t=this.connectivityAssociationsLineSymbol.clone();t.marker=null,this.showArrowsConnectivity&&(t.marker=new y({color:this.connectivityAssociationsLineSymbol.color,placement:"end",style:"arrow"}));for(const i of this._internalGraphicsLayerConnectivity.graphics)i.symbol=t})),n((()=>[this.showArrowsStructuralAttachment]),(()=>{const t=this.structuralAttachmentAssociationsLineSymbol.clone();t.marker=null,this.showArrowsStructuralAttachment&&(t.marker=new y({color:this.structuralAttachmentAssociationsLineSymbol.color,placement:"end",style:"arrow"}));for(const i of this._internalGraphicsLayerStructuralAttachment.graphics)i.symbol=t})),n((()=>{const{cap:t,color:i,style:s,width:o,marker:e}=this.connectivityAssociationsLineSymbol;return[t,i,s,o,e]}),(()=>{const t=this.connectivityAssociationsLineSymbol.clone();for(const i of this._internalGraphicsLayerConnectivity.graphics)i.symbol=t;this.showArrowsConnectivity=!1,t.marker=null,this.connectivityAssociationsLineSymbol.marker&&(this.showArrowsConnectivity=!0,t.marker=new y({color:this.connectivityAssociationsLineSymbol.color,placement:"end",style:"arrow"}))})),n((()=>{const{cap:t,color:i,style:s,width:o,marker:e}=this.structuralAttachmentAssociationsLineSymbol;return[t,i,s,o,e]}),(()=>{const t=this.structuralAttachmentAssociationsLineSymbol.clone();for(const i of this._internalGraphicsLayerStructuralAttachment.graphics)i.symbol=t;this.showArrowsStructuralAttachment=!1,t.marker=null,this.structuralAttachmentAssociationsLineSymbol.marker&&(this.showArrowsStructuralAttachment=!0,t.marker=new y({color:this.structuralAttachmentAssociationsLineSymbol.color,placement:"end",style:"arrow"}))})),p(t)])}))}destroy(){this._updatingHandles.destroy(),this.view=null,this._removeInternalGraphicsLayers()}set includeConnectivityAssociations(t){this._set("includeConnectivityAssociations",t),this._internalGraphicsLayerConnectivity.visible=t}set includeStructuralAttachmentAssociations(t){this._set("includeStructuralAttachmentAssociations",t),this._internalGraphicsLayerStructuralAttachment.visible=t}get state(){return this.loadErrors.length?"disabled":this._updatingHandles.updating?"executing":""!==this.executionError?"warning":this._initialValidationsFinished?"ready":"loading"}set utilityNetwork(t){this._get("utilityNetwork")!==t&&this._set("utilityNetwork",t)}set view(t){this._get("view")!==t&&this._set("view",t)}removeAssociations(){this._internalGraphicsLayerConnectivity.removeAll(),this._internalGraphicsLayerStructuralAttachment.removeAll()}async showAssociations(){const{messages:{info:{maxAllowableAssociationsExceeded:t,noAssociationsFound:s}},utilityNetwork:o}=this;this._set("executionError",""),this._updatingHandles.addPromise(o?.synthesizeAssociationGeometries({returnConnectivityAssociations:this.includeConnectivityAssociations,returnAttachmentAssociations:this.includeStructuralAttachmentAssociations,extent:this.view?.extent,outSpatialReference:this.
|
|
5
|
+
import{_ as t}from"../../chunks/tslib.es6.js";import i from"../../Graphic.js";import"../../intl.js";import s from"../../core/Accessor.js";import o from"../../core/Collection.js";import e from"../../core/Error.js";import r from"../../core/Logger.js";import{watch as n}from"../../core/reactiveUtils.js";import{property as a}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/RandomLCG.js";import{subclass as c}from"../../core/accessorSupport/decorators/subclass.js";import{UpdatingHandles as l}from"../../core/support/UpdatingHandles.js";import h from"../../layers/GraphicsLayer.js";import y from"../../symbols/LineSymbolMarker.js";import m from"../../symbols/SimpleLineSymbol.js";import{addUniqueLayer as u}from"../../views/draw/support/layerUtils.js";import{onLocaleChange as p}from"../../intl/locale.js";import{fetchMessageBundle as A}from"../../intl/messages.js";let w=class extends s{constructor(t){super(t),this._internalGraphicsLayerConnectivity=this._createInternalGraphicsLayer("Connectivity Associations (Internal)"),this._internalGraphicsLayerStructuralAttachment=this._createInternalGraphicsLayer("Structural Attachment Associations (Internal)"),this._initialValidationsFinished=!1,this._updatingHandles=new l,this.autoRefreshAssociations=!1,this.connectivityAssociationsLineSymbol=new m({style:"short-dash",width:2,color:[190,159,159,1]}),this.executionError="",this.loadErrors=new o,this.maxAllowableAssociations=250,this.showAssociationsEnabled=!1,this.showArrowsConnectivity=!1,this.showArrowsStructuralAttachment=!1,this.structuralAttachmentAssociationsLineSymbol=new m({style:"short-dash",width:2,color:[159,190,159,1]})}initialize(){const t=async()=>{this.messages||(this.messages=await A("esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations"))};t().then((()=>{this.view||(this.view=null),this.utilityNetwork||(this.utilityNetwork=null),this.addHandles([n((()=>[this.view,this.utilityNetwork]),(async()=>{const{loadErrors:t,messages:{info:{noUtilityNetwork:i,noView:s}}}=this;this._initialValidationsFinished=!1,t.removeAll();let o=!1,n=!1;this.removeAssociations(),"utility"!==this.utilityNetwork?.type?(this.loadErrors.push(i),r.getLogger(this).error(new e("utilityNetworkAssociations:missing-property",i))):(this.utilityNetwork.loaded||await this.utilityNetwork.load(),o=!0),"2d"!==this.view?.type?(this.loadErrors.push(s),r.getLogger(this).error(new e("utilityNetworkAssociations:missing-property",s))):(u(this.view,this._internalGraphicsLayerConnectivity),u(this.view,this._internalGraphicsLayerStructuralAttachment),n=!0),o&&n&&this.showAssociationsEnabled&&await this.showAssociations(),this._internalGraphicsLayerConnectivity.visible=this.includeConnectivityAssociations,this._internalGraphicsLayerStructuralAttachment.visible=this.includeStructuralAttachmentAssociations,this._initialValidationsFinished=!0}),{initial:!0}),n((()=>[this.view?.stationary,this.showAssociationsEnabled,this.maxAllowableAssociations]),(async()=>{this.view?.stationary&&this.showAssociationsEnabled&&(this.includeConnectivityAssociations||this.includeStructuralAttachmentAssociations)&&await this.showAssociations()})),n((()=>[this.showArrowsConnectivity]),(()=>{const t=this.connectivityAssociationsLineSymbol.clone();t.marker=null,this.showArrowsConnectivity&&(t.marker=new y({color:this.connectivityAssociationsLineSymbol.color,placement:"end",style:"arrow"}));for(const i of this._internalGraphicsLayerConnectivity.graphics)i.symbol=t})),n((()=>[this.showArrowsStructuralAttachment]),(()=>{const t=this.structuralAttachmentAssociationsLineSymbol.clone();t.marker=null,this.showArrowsStructuralAttachment&&(t.marker=new y({color:this.structuralAttachmentAssociationsLineSymbol.color,placement:"end",style:"arrow"}));for(const i of this._internalGraphicsLayerStructuralAttachment.graphics)i.symbol=t})),n((()=>{const{cap:t,color:i,style:s,width:o,marker:e}=this.connectivityAssociationsLineSymbol;return[t,i,s,o,e]}),(()=>{const t=this.connectivityAssociationsLineSymbol.clone();for(const i of this._internalGraphicsLayerConnectivity.graphics)i.symbol=t;this.showArrowsConnectivity=!1,t.marker=null,this.connectivityAssociationsLineSymbol.marker&&(this.showArrowsConnectivity=!0,t.marker=new y({color:this.connectivityAssociationsLineSymbol.color,placement:"end",style:"arrow"}))})),n((()=>{const{cap:t,color:i,style:s,width:o,marker:e}=this.structuralAttachmentAssociationsLineSymbol;return[t,i,s,o,e]}),(()=>{const t=this.structuralAttachmentAssociationsLineSymbol.clone();for(const i of this._internalGraphicsLayerStructuralAttachment.graphics)i.symbol=t;this.showArrowsStructuralAttachment=!1,t.marker=null,this.structuralAttachmentAssociationsLineSymbol.marker&&(this.showArrowsStructuralAttachment=!0,t.marker=new y({color:this.structuralAttachmentAssociationsLineSymbol.color,placement:"end",style:"arrow"}))})),p(t)])}))}destroy(){this._updatingHandles.destroy(),this.view=null,this._removeInternalGraphicsLayers()}set includeConnectivityAssociations(t){this._set("includeConnectivityAssociations",t),this._internalGraphicsLayerConnectivity.visible=t}set includeStructuralAttachmentAssociations(t){this._set("includeStructuralAttachmentAssociations",t),this._internalGraphicsLayerStructuralAttachment.visible=t}get state(){return this.loadErrors.length?"disabled":this._updatingHandles.updating?"executing":""!==this.executionError?"warning":this._initialValidationsFinished?"ready":"loading"}set utilityNetwork(t){this._get("utilityNetwork")!==t&&this._set("utilityNetwork",t)}set view(t){this._get("view")!==t&&this._set("view",t)}removeAssociations(){this._internalGraphicsLayerConnectivity.removeAll(),this._internalGraphicsLayerStructuralAttachment.removeAll()}async showAssociations(){const{messages:{info:{maxAllowableAssociationsExceeded:t,noAssociationsFound:s}},utilityNetwork:o}=this;this._set("executionError",""),this._updatingHandles.addPromise(o?.synthesizeAssociationGeometries({returnConnectivityAssociations:this.includeConnectivityAssociations,returnAttachmentAssociations:this.includeStructuralAttachmentAssociations,extent:this.view?.extent,outSpatialReference:this.utilityNetwork?.spatialReference.clone(),maxGeometryCount:this.maxAllowableAssociations}).then((o=>{let e=[],r=[];return o?.maxGeometryCountExceeded?(this.removeAssociations(),void this._set("executionError",t)):0===o?.associations.length?(this.removeAssociations(),void this._set("executionError",s)):void(o&&(e=o?.associations.filter((({associationType:t})=>"connectivity"===t)).map((t=>(this.connectivityAssociationsLineSymbol.marker=null,this.showArrowsConnectivity&&(this.connectivityAssociationsLineSymbol.marker=new y({color:this.connectivityAssociationsLineSymbol.color,placement:"end",style:"arrow"})),new i({geometry:t.geometry.clone(),symbol:this.connectivityAssociationsLineSymbol})))),r=o.associations.filter((({associationType:t})=>"attachment"===t)).map((t=>(this.structuralAttachmentAssociationsLineSymbol.marker=null,this.showArrowsStructuralAttachment&&(this.structuralAttachmentAssociationsLineSymbol.marker=new y({color:this.structuralAttachmentAssociationsLineSymbol.color,placement:"end",style:"arrow"})),new i({geometry:t.geometry.clone(),symbol:this.structuralAttachmentAssociationsLineSymbol})))),this._internalGraphicsLayerConnectivity.removeAll(),e.length>0&&this._internalGraphicsLayerConnectivity.addMany(e),this._internalGraphicsLayerStructuralAttachment.removeAll(),r.length>0&&this._internalGraphicsLayerStructuralAttachment.addMany(r)))}),(({message:t})=>{this._set("executionError",t)})))}_createInternalGraphicsLayer(t){return new h({listMode:"hide",internal:!0,title:t})}_removeInternalGraphicsLayers(){this._internalGraphicsLayerConnectivity&&this._internalGraphicsLayerStructuralAttachment&&this.view?.map&&(this.view.map.remove(this._internalGraphicsLayerConnectivity),this.view.map.remove(this._internalGraphicsLayerStructuralAttachment))}};t([a()],w.prototype,"_initialValidationsFinished",void 0),t([a()],w.prototype,"autoRefreshAssociations",void 0),t([a({type:m,nonNullable:!0})],w.prototype,"connectivityAssociationsLineSymbol",void 0),t([a({readOnly:!0})],w.prototype,"executionError",void 0),t([a({type:Boolean,value:!0})],w.prototype,"includeConnectivityAssociations",null),t([a({type:Boolean,value:!0})],w.prototype,"includeStructuralAttachmentAssociations",null),t([a()],w.prototype,"loadErrors",void 0),t([a()],w.prototype,"maxAllowableAssociations",void 0),t([a()],w.prototype,"messages",void 0),t([a()],w.prototype,"showAssociationsEnabled",void 0),t([a()],w.prototype,"showArrowsConnectivity",void 0),t([a()],w.prototype,"showArrowsStructuralAttachment",void 0),t([a({readOnly:!0})],w.prototype,"state",null),t([a({type:m,nonNullable:!0})],w.prototype,"structuralAttachmentAssociationsLineSymbol",void 0),t([a()],w.prototype,"utilityNetwork",null),t([a()],w.prototype,"view",null),w=t([c("esri.widgets.UtilityNetworkAssociations.UtilityNetworkAssociationsViewModel")],w);const d=w;export{d as default};
|