@arcgis/core 4.25.0-next.20220821 → 4.25.0-next.20220824
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/analysis/DimensioningAnalysis.d.ts +4 -0
- package/analysis/LengthDimension.d.ts +4 -0
- package/arcade/featureset/support/shared.js +1 -1
- package/arcade/kernel.js +1 -1
- package/arcade.js +1 -1
- package/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/0455c2cc352743827b6f.js +1 -0
- package/assets/esri/core/workers/chunks/{da13db62d54cbca350c3.js → 2909c5e28c05ddb007a0.js} +1 -1
- package/assets/esri/core/workers/chunks/2a2cad4a163777419b88.js +1 -0
- package/assets/esri/core/workers/chunks/2c783124624070505cf9.js +1 -0
- package/assets/esri/core/workers/chunks/31eab53447f47774354e.js +1 -0
- package/assets/esri/core/workers/chunks/{9dbe94a70624a5592690.js → 3e108ee81b5684f81cea.js} +1 -1
- package/assets/esri/core/workers/chunks/40bb4e2acbe5c3323715.js +1 -0
- package/assets/esri/core/workers/chunks/45397532008f955faf6f.js +2 -0
- package/assets/esri/core/workers/chunks/45397532008f955faf6f.js.LICENSE.txt +20 -0
- package/assets/esri/core/workers/chunks/4e045b0b3f49fcdecce0.js +1 -0
- package/assets/esri/core/workers/chunks/616a20dfd38f25453765.js +1 -0
- package/assets/esri/core/workers/chunks/{94784576d519d2440184.js → 69b8fef9bd487b8fb7c9.js} +1 -1
- package/assets/esri/core/workers/chunks/{32c7ea6e2068d5646988.js → 6e38ba64131c36edec43.js} +1 -1
- package/assets/esri/core/workers/chunks/6f99d0cdee66275cc68e.js +1 -0
- package/assets/esri/core/workers/chunks/{3485e2342f44e4d760a2.js → 70171492b13071b68db0.js} +1 -1
- package/assets/esri/core/workers/chunks/{b81c0d35f169a7df25c0.js → 8543c2f0a0eb67b101d7.js} +1 -1
- package/assets/esri/core/workers/chunks/8ba83fee56dd4f306d87.js +1 -0
- package/assets/esri/core/workers/chunks/{0f1fae79b5311d55c0da.js → 92f10a6f8eae3ecf5ac2.js} +1 -1
- package/assets/esri/core/workers/chunks/96673467342935d3d99a.js +1 -0
- package/assets/esri/core/workers/chunks/9f9418e4b1c39fe4571d.js +1 -0
- package/assets/esri/core/workers/chunks/a507e85f388b0504bb6a.js +1 -0
- package/assets/esri/core/workers/chunks/{8c2c1909359d794ac8fa.js → b0afc51c778d752488c6.js} +1 -1
- package/assets/esri/core/workers/chunks/{70dd8b67e69b084422a3.js → bfea5f112dc5bc08bb11.js} +1 -1
- package/assets/esri/core/workers/chunks/{2407a32902f012997e6a.js → c12c6d10edb4953145fa.js} +1 -1
- package/assets/esri/core/workers/chunks/{495dfd24894e8d5149c6.js → cfb3cfbc508840d2ea60.js} +1 -1
- package/assets/esri/core/workers/chunks/e8d0dbb6b6b241138fcf.js +1 -0
- package/assets/esri/core/workers/chunks/{a32c618ad62db6ecba67.js → e97ac86180a3381baf33.js} +1 -1
- package/assets/esri/core/workers/chunks/ef174d2fbcca4c3844d7.js +1 -0
- package/assets/esri/core/workers/chunks/f2cca221d9bea32f7594.js +1 -0
- package/assets/esri/core/workers/chunks/ff729a122ddffd95a6b5.js +1 -0
- package/chunks/Clouds.glsl.js +12 -12
- package/core/PerformanceSampler.js +1 -1
- package/core/imageUtils.js +5 -0
- package/geometry/support/MeshTexture.js +1 -1
- package/geometry/support/meshUtils/exporters/gltf/buffer.js +1 -1
- package/geometry/support/meshUtils/exporters/gltf/gltf.js +1 -1
- package/geometry/support/meshUtils/exporters/gltf/imageutils.js +1 -1
- package/geometry/support/meshUtils/exporters/gltf/index.js +1 -1
- package/geometry/support/meshUtils/loadExternal.js +1 -1
- package/geometry/support/meshUtils/loadGLTFMesh.js +1 -1
- package/geometry/support/meshUtils/merge.js +1 -1
- package/geometry/support/meshUtils/offset.js +1 -1
- package/geometry/support/meshUtils/rotate.js +1 -1
- package/geometry/support/meshUtils/scale.js +1 -1
- package/interfaces.d.ts +147 -4
- package/layers/RouteLayer.js +1 -1
- package/layers/graphics/data/projectionSupport.js +1 -1
- package/layers/graphics/data/spatialQuerySupport.js +1 -1
- package/layers/graphics/data/utils.js +1 -1
- package/layers/graphics/featureConversionUtils.js +1 -1
- package/layers/ogc/crsUtils.js +1 -1
- package/layers/support/FieldsIndex.js +1 -1
- package/layers/support/PromiseQueue.js +1 -1
- package/layers/support/TileInfo.js +1 -1
- package/layers/support/infoFor3D.js +0 -1
- package/layers/support/mediaUtils.js +1 -1
- package/layers/support/rasterDatasets/FunctionRaster.js +1 -1
- package/layers/support/rasterDatasets/pamParser.js +1 -1
- package/layers/support/rasterDatasets/wcsCapabilitiesParser.js +1 -1
- package/layers/support/rasterFunctions/AspectFunction.js +1 -1
- package/layers/support/rasterFunctions/BandArithmeticFunction.js +5 -0
- package/layers/support/rasterFunctions/BandArithmeticFunctionArguments.js +5 -0
- package/layers/support/rasterFunctions/BaseRasterFunction.js +1 -1
- package/layers/support/rasterFunctions/ColormapFunction.js +1 -1
- package/layers/support/rasterFunctions/LocalFunction.js +5 -0
- package/layers/support/rasterFunctions/LocalFunctionArguments.js +5 -0
- package/layers/support/rasterFunctions/SlopeFunction.js +1 -1
- package/layers/support/rasterFunctions/StretchFunction.js +1 -1
- package/layers/support/rasterFunctions/bandIndexUtils.js +1 -1
- package/layers/support/rasterFunctions/customBandIndexUtils.js +5 -0
- package/layers/support/rasterFunctions/localUtils.js +1 -1
- package/layers/support/rasterFunctions/rasterFunctionHelper.js +1 -1
- package/layers/support/wmtsUtils.js +1 -1
- package/networks/Network.js +1 -1
- package/networks/UtilityNetwork.js +1 -1
- package/networks/support/NamedTraceConfiguration.js +1 -1
- package/package.json +3 -3
- package/portal/AssetMapFieldRole.js +5 -0
- package/renderers/DotDensityRenderer.js +1 -1
- package/renderers/support/utils.js +1 -1
- package/rest/networks/queryNamedTraceConfigurations.js +5 -0
- package/rest/networks/support/QueryNamedTraceConfigurationsParameters.js +5 -0
- package/rest/networks/support/QueryNamedTraceConfigurationsResult.js +5 -0
- package/rest/print.js +1 -1
- package/rest/support/GeneralizeParameters.js +1 -1
- package/rest/support/ImagePixelLocationParameters.js +1 -1
- package/rest/support/OffsetParameters.js +1 -1
- package/rest/support/PrintTemplate.js +1 -1
- package/rest/support/RelationParameters.js +1 -1
- package/rest/support/TopFeaturesQuery.js +1 -1
- package/rest/support/meshFeatureSet.js +1 -1
- package/support/revision.js +1 -1
- package/symbols/cim/GeometryWalker.js +1 -1
- package/symbols/cim/effects/EffectDashes.js +1 -1
- package/symbols/cim/effects/EffectWave.js +1 -1
- package/symbols/cim/placements/PlacementAlongLineSameSize.js +1 -1
- package/symbols/cim/placements/PlacementAtRatioPositions.js +1 -1
- package/views/2d/constraints/ZoomConstraint.js +1 -1
- package/views/2d/engine/Stage.js +1 -1
- package/views/2d/engine/webgl/mesh/templates/WGLDynamicMarkerTemplate.js +1 -1
- package/views/2d/engine/webgl/mesh/templates/WGLMarkerTemplate.js +1 -1
- package/views/2d/tiling/TileCache.js +1 -1
- package/views/2d/tiling/TileInfoView.js +1 -1
- package/views/3d/analysis/Dimensioning/LengthDimensionComputation.js +1 -1
- package/views/3d/analysis/Dimensioning/LengthDimensionSubTool.js +1 -1
- package/views/3d/analysis/Dimensioning/settings.js +1 -1
- package/views/3d/environment/CloudsComposition.js +1 -1
- package/views/3d/environment/CloudsCompositionParameters.js +1 -1
- package/views/3d/environment/CloudsData.js +1 -1
- package/views/3d/environment/CloudsGenerator.js +1 -1
- package/views/3d/environment/CloudsTechnique.js +1 -1
- package/views/3d/environment/CloudsTechniqueConfiguration.js +1 -1
- package/views/3d/layers/I3SMeshView3D.js +1 -1
- package/views/3d/support/StreamDataLoader.js +1 -1
- package/views/3d/support/earthUtils.js +1 -1
- package/views/3d/terrain/PatchGeometry.js +1 -1
- package/views/3d/terrain/PatchGeometryFactory.js +1 -1
- package/views/3d/terrain/PatchGeometryLUT.js +1 -1
- package/views/3d/terrain/TerrainSurface.js +1 -1
- package/views/3d/webgl-engine/core/shaderLibrary/attributes/VertexNormal.glsl.js +2 -2
- package/views/3d/webgl-engine/core/shaderLibrary/shading/ScreenSpaceReflections.glsl.js +1 -1
- package/views/3d/webgl-engine/core/shaderLibrary/util/CloudsParallaxShading.glsl.js +22 -13
- package/views/3d/webgl-engine/lib/OffscreenRendering.js +1 -1
- package/views/3d/webgl-engine/lib/Renderer.js +1 -1
- package/views/3d/webgl-engine/lib/lodRendering/LodRenderer.js +1 -1
- package/views/3d/webgl-engine/parts/ScreenshotManager.js +1 -1
- package/views/3d/webgl-engine/statistics/RendererPerformanceInfo.js +1 -1
- package/views/LayerViewManager.js +1 -1
- package/views/ViewAnimation.js +1 -1
- package/views/interactive/editGeometry/operations/AppendVertex.js +1 -1
- package/views/interactive/editGeometry/operations/RemoveVertices.js +1 -1
- package/views/interactive/editGeometry/operations/SplitEdge.js +1 -1
- package/views/layers/MapImageLayerView.js +1 -1
- package/views/layers/support/Geometry.js +1 -1
- package/views/support/screenshotUtils.js +1 -1
- package/views/webgl/Measurement.js +1 -1
- package/views/webgl/TimerPool.js +5 -0
- package/views/webgl/capabilities/DisjointTimerQuery.js +1 -1
- package/widgets/Editor/EditorViewModel.js +1 -1
- package/widgets/Editor.js +1 -1
- package/widgets/FeatureForm/support/formTemplateUtils.js +1 -1
- package/assets/esri/core/workers/chunks/0c625803648e554f1fcf.js +0 -1
- package/assets/esri/core/workers/chunks/172c15e3dfa53554f591.js +0 -1
- package/assets/esri/core/workers/chunks/1e8e9967904da93c687e.js +0 -1
- package/assets/esri/core/workers/chunks/2efadbb06bf4a7f83f16.js +0 -1
- package/assets/esri/core/workers/chunks/30d7796ee6f7e4a6a3e1.js +0 -2
- package/assets/esri/core/workers/chunks/30d7796ee6f7e4a6a3e1.js.LICENSE.txt +0 -9
- package/assets/esri/core/workers/chunks/3281656a9bd3627e41ff.js +0 -1
- package/assets/esri/core/workers/chunks/3381b5454cd530cf940a.js +0 -1
- package/assets/esri/core/workers/chunks/4f4cb6d5b226ab5a38a1.js +0 -1
- package/assets/esri/core/workers/chunks/821a0754eae11421e56a.js +0 -1
- package/assets/esri/core/workers/chunks/8befbb2679e8285a8acd.js +0 -1
- package/assets/esri/core/workers/chunks/9e4c125d37ce66638b22.js +0 -1
- package/assets/esri/core/workers/chunks/a0750175b499a89fd07d.js +0 -1
- package/assets/esri/core/workers/chunks/c93d6bbe1af74d7bd7f9.js +0 -1
- package/assets/esri/core/workers/chunks/cc0a0782b8b9f6ec511e.js +0 -1
- package/assets/esri/core/workers/chunks/ef885b22ac8ec2695ad7.js +0 -1
- package/assets/esri/core/workers/chunks/f10379f663177a0150e9.js +0 -1
- package/assets/esri/core/workers/chunks/f351cccf879ba295acbc.js +0 -1
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.25/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{unique as e}from"../../core/arrayUtils.js";import
|
|
5
|
+
import{unique as e}from"../../core/arrayUtils.js";import t from"../../core/Logger.js";import{getOrCreateMapValue as l}from"../../core/MapUtils.js";import{convertDateFormatToIntlOptions as a,formatDate as n}from"../../intl/date.js";import{format as i,round as o}from"./numberUtils.js";import s from"../visualVariables/support/ColorStop.js";import{getColorFromSymbol as r}from"../../symbols/support/utils.js";import{getRampStops as u}from"../../widgets/Legend/support/colorRampUtils.js";import{getHeatmapRampStops as f}from"../../widgets/Legend/support/heatmapRampUtils.js";const d=t.getLogger("esri.renderers.support.utils"),m={lte:"<=",gte:">=",lt:"<",gt:">",pct:"%",ld:"–"},p={millisecond:0,second:1,minute:2,hour:3,day:4,month:5,year:6},c={millisecond:"long-month-day-year-long-time",second:"long-month-day-year-long-time",minute:"long-month-day-year-short-time",hour:"long-month-day-year-short-time",day:"long-month-day-year",month:"long-month-day-year",year:"year"},y=a("short-date");async function g(e,t,a){l(e,t,(()=>[])).push(...a)}async function h(t){const l=new Map;if(!t)return l;if("visualVariables"in t&&t.visualVariables){const e=t.visualVariables.filter((e=>"color"===e.type));for(const t of e){const e=(await u(t)).map((e=>e.color));await g(l,t.field||t.valueExpression,e)}}if("heatmap"===t.type){const e=f(t).map((e=>e.color));await g(l,t.field||t.valueExpression,e)}else if("pie-chart"===t.type){for(const e of t.attributes)await g(l,e.field||e.valueExpression,[e.color]);await g(l,"default",[t?.othersCategory?.color,r(t.backgroundFillSymbol,null)])}else if("dot-density"===t.type){for(const e of t.attributes)await g(l,e.field||e.valueExpression,[e.color]);await g(l,"default",[t.backgroundColor])}else if("unique-value"===t.type)if("predominance"===t.authoringInfo?.type)for(const e of t.uniqueValueInfos)await g(l,e.value.toString(),[r(e.symbol,null)]);else{const e=t.uniqueValueInfos.map((e=>r(e.symbol,null))),{field:a,field2:n,field3:i,valueExpression:o}=t;(a||o)&&await g(l,a||o,e),n&&await g(l,n,e),i&&await g(l,i,e)}else if("class-breaks"===t.type){const e=t.classBreakInfos.map((e=>r(e.symbol,null))),{field:a,valueExpression:n}=t;await g(l,a||n,e)}else"simple"===t.type&&await g(l,"default",[r(t.symbol,null)]);return"defaultSymbol"in t&&t.defaultSymbol&&await g(l,"default",[r(t.defaultSymbol,null)]),l.forEach(((t,a)=>{const n=e(t.filter(Boolean),((e,t)=>JSON.stringify(e)===JSON.stringify(t)));l.set(a,n)})),l}function b(e,t,l){let a="";return 0===t?a=m.lt+" ":t===l&&(a=m.gt+" "),a+e}function v(e){const{values:t,colors:l,labelIndexes:a,isDate:o,dateFormatOptions:r}=e;return t.map(((e,u)=>{let f=null;if(!a||a.includes(u)){let l;l=o?n(e,r):i(e),l&&(f=b(l,u,t.length-1))}return new s({value:e,color:l[u],label:f})}))}function x(e){const{stops:t,changes:l,isDate:a,dateFormatOptions:s}=e,r=t.map((e=>e.value)),u=[];for(const n of l)u.push(n.index),r[n.index]=n.value;const f=o(r,{indexes:u});t.forEach(((e,l)=>{if(e.value=r[l],null!=e.label){let o,r=null;o=a?n(f[l],s):i(f[l]),o&&(r=b(o,l,t.length-1)),e.label=r}}))}function V(e){let t=e.minValue,l=e.maxValue;const a=e.isFirstBreak?"":m.gt+" ",n="percent-of-total"===e.normalizationType?m.pct:"";return t=null==t?"":i(t),l=null==l?"":i(l),a+t+n+" "+m.ld+" "+l+n}function F(e){const t=e.classBreakInfos,l=e.normalizationType;let a=[];if(t&&t.length)if("standard-deviation"!==e.classificationMethod)if(e.round){a.push(t[0].minValue);for(const e of t)a.push(e.maxValue);a=o(a),t.forEach(((e,t)=>{e.label=V({minValue:0===t?a[0]:a[t],maxValue:a[t+1],isFirstBreak:0===t,normalizationType:l})}))}else t.forEach(((e,t)=>{e.label=V({minValue:e.minValue,maxValue:e.maxValue,isFirstBreak:0===t,normalizationType:l})}));else d.warn("setLabelsForClassBreaks","cannot set labels for class breaks generated using 'standard-deviation' method.")}function w(e){if("standard-deviation"===e.classificationMethod)return void d.warn("updateClassBreak","cannot update labels for class breaks generated using 'standard-deviation' method.");const t=e.classBreaks,l=e.change,a=l.index,n=l.value,i=t.length;let o=-1,s=-1;0===a?o=a:a===i?s=a-1:(s=a-1,o=a);const r=e.normalizationType;let u=null;o>-1&&o<i&&(u=t[o],u.minValue=n,u.label=V({minValue:u.minValue,maxValue:u.maxValue,isFirstBreak:0===o,normalizationType:r})),s>-1&&s<i&&(u=t[s],u.maxValue=n,u.label=V({minValue:u.minValue,maxValue:u.maxValue,isFirstBreak:0===s,normalizationType:r}))}function z(e){const t=e.map((e=>new Date(e))),l=t.length;let a=1/0,n=null;for(let i=0;i<l-1;i++){const e=t[i];let o=1/0,s=null;for(let a=i+1;a<l;a++){const l=t[a],n=(e.getFullYear()!==l.getFullYear()?"year":e.getMonth()!==l.getMonth()&&"month")||e.getDate()!==l.getDate()&&"day"||e.getHours()!==l.getHours()&&"hour"||e.getMinutes()!==l.getMinutes()&&"minute"||e.getSeconds()!==l.getSeconds()&&"second"||"millisecond",i=p[n];i<o&&(o=i,s=n)}o<a&&(a=o,n=s)}return n}function E(e){const{value:t,domain:l,fieldInfo:o,dateFormatInterval:s}=e;let r=String(t);const u=l&&"codedValues"in l&&l.codedValues?l.getName(t):null;return u?r=u:"number"==typeof t&&(r=o&&"date"===o.type?n(t,s&&a(c[s])):i(t)),r}function k(e,t){return"normalizationField"in e&&e.normalizationField?I(e.field,e.normalizationField):"field"in e&&e.field?B(e.field):"valueExpression"in e&&e.valueExpression?S(e.valueExpression,e.valueExpressionTitle,t):null}function B(e){return{type:"field",field:e}}function I(e,t){return{type:"normalized-field",field:e,normalizationField:t}}function S(e,t,l){return{type:"expression",expression:e,title:t,returnType:l}}function j(t,l){const a=[];if("class-breaks"===t.type||"heatmap"===t.type)a.push(k(t,"number"));else if("unique-value"===t.type){const e=t.authoringInfo;if(e&&"relationship"===e.type){if(e.field1&&e.field2){const t=e.field1.field,l=e.field2.field,n=e.field1.normalizationField,i=e.field2.normalizationField;a.push(k({field:t,normalizationField:n})),a.push(k({field:l,normalizationField:i}))}}else{const e=t.uniqueValueInfos[0];let l=null;if(e&&e.value){const e=typeof t.uniqueValueInfos[0].value;"string"!==e&&"number"!==e||(l=e)}a.push(k(t,l)),[t.field2,t.field3].forEach((e=>e&&a.push(B(e))))}}else"attributes"in t&&t.attributes.forEach((e=>a.push(k(e,"number"))));const n=l?l(t):"visualVariables"in t?t.visualVariables:null;return n&&n.forEach((e=>a.push(k(e,"number")))),e(a.filter(Boolean),((e,t)=>"field"===e.type&&"field"===t.type?e.field===t.field:"normalized-field"===e.type&&"normalized-field"===t.type?e.field===t.field&&e.normalizationField===t.normalizationField:"expression"===e.type&&"expression"===t.type&&e.expression===t.expression))}export{z as calculateDateFormatInterval,V as createClassBreakLabel,v as createColorStops,E as createUniqueValueLabel,k as getAttribute,j as getAttributes,h as getColorsFromRenderer,F as setLabelsForClassBreaks,y as timelineDateFormatOptions,w as updateClassBreak,x as updateColorStops};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/*
|
|
2
|
+
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
|
+
See https://js.arcgis.com/4.25/esri/copyright.txt for details.
|
|
4
|
+
*/
|
|
5
|
+
import t from"../../request.js";import{parseUrl as s,encode as r,asValidOptions as o}from"../utils.js";import a from"./support/QueryNamedTraceConfigurationsResult.js";async function e(e,n,i){const g=s(e),l=n.toJSON();n.globalIds&&n.globalIds.length>0&&(l.globalIds=JSON.stringify(n.globalIds)),n.creators&&n.creators.length>0&&(l.creators=JSON.stringify(n.creators)),n.tags&&n.tags.length>0&&(l.tags=JSON.stringify(n.tags)),n.names&&n.names.length>0&&(l.names=JSON.stringify(n.names));const f={...l,f:"json"},m=r({...g.query,...f}),u=o(m,{...i,method:"post"}),c=`${g.path}/traceConfigurations/query`,{data:p}=await t(c,u);if(!p)return null;return a.fromJSON(p)}export{e as queryNamedTraceConfigurations};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/*
|
|
2
|
+
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
|
+
See https://js.arcgis.com/4.25/esri/copyright.txt for details.
|
|
4
|
+
*/
|
|
5
|
+
import{_ as r}from"../../../chunks/tslib.es6.js";import{JSONSupport as o}from"../../../core/JSONSupport.js";import{property as t}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/arrayUtils.js";import"../../../core/has.js";import"../../../core/accessorSupport/ensureType.js";import{subclass as s}from"../../../core/accessorSupport/decorators/subclass.js";let e=class extends o{constructor(r){super(r),this.globalIds=[],this.creators=[],this.tags=[],this.names=[]}};r([t({type:[String],json:{write:!0}})],e.prototype,"globalIds",void 0),r([t({type:[String],json:{write:!0}})],e.prototype,"creators",void 0),r([t({type:[String],json:{write:!0}})],e.prototype,"tags",void 0),r([t({type:[String],json:{write:!0}})],e.prototype,"names",void 0),e=r([s("esri.rest.networks.support.QueryNamedTraceConfigurationsParameters")],e);const p=e;export{p as default};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/*
|
|
2
|
+
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
|
+
See https://js.arcgis.com/4.25/esri/copyright.txt for details.
|
|
4
|
+
*/
|
|
5
|
+
import{_ as r}from"../../../chunks/tslib.es6.js";import{JSONSupport as o}from"../../../core/JSONSupport.js";import{property as s}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/arrayUtils.js";import"../../../core/has.js";import"../../../core/accessorSupport/ensureType.js";import{subclass as t}from"../../../core/accessorSupport/decorators/subclass.js";import e from"../../../networks/support/NamedTraceConfiguration.js";let a=class extends o{constructor(r){super(r),this.namedTraceConfigurations=[]}};r([s({type:[e],json:{read:{source:"traceConfigurations"},write:{target:"traceConfigurations"}}})],a.prototype,"namedTraceConfigurations",void 0),a=r([t("esri.rest.networks.support.QueryNamedTraceConfigurationsResult")],a);const p=a;export{p 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.25/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import e from"../config.js";import{id as t}from"../kernel.js";import i from"../request.js";import r from"../core/Error.js";import{JSONMap as a}from"../core/jsonMap.js";import{isSome as n}from"../core/maybe.js";import{createScreenPoint as s,pt2px as o,px2pt as l}from"../core/screenUtils.js";import{normalize as c,dataComponents as y}from"../core/urlUtils.js";import u from"../geometry/Polygon.js";import{collectLabelingFields as m}from"../layers/support/fieldUtils.js";import{getFloorFilterClause as f}from"../layers/support/floorFilterUtils.js";import{getSizeRangeAtScale as p}from"../renderers/visualVariables/support/visualVariableUtils.js";import{execute as d}from"./geoprocessor/execute.js";import{submitJob as g}from"./geoprocessor/submitJob.js";import{toJSON as b}from"./support/fileFormat.js";import{toJSON as h}from"./support/layoutTemplate.js";import{getVisibleLayerViews as w,isScreenshotRequired as S,isBingMapsLayer as x,isCSVLayer as v,isBlendLayer as D,applyVisualVariables as I,getContextBoundingBox as L,createPolygonLayer as T,createPolylineLayer as E,createPointLayer as M,createMultipointLayer as O}from"./support/printTaskUtils.js";import V from"./support/PrintTemplate.js";import{supportsApiKey as P}from"../support/apiKeyUtils.js";const F={Feet:"ft",Kilometers:"km",Meters:"m",Miles:"mi"},R=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,r){const a=C(e);let n=U.get(a);return Promise.resolve().then((()=>n?{data:n.gpMetadata}:(n={gpServerUrl:a,is11xService:!1,legendLayerNameMap:{},legendLayers:[]},i(a,{query:{f:"json"}})))).then((e=>(n.gpMetadata=e.data,n.cimVersion=n.gpMetadata.cimVersion,n.is11xService=!!n.cimVersion,U.set(a,n),A(t,n)))).then((i=>{const a=me(n);let s;const o=e=>"sync"===a?e.results&&e.results[0]&&e.results[0].value:s.fetchResultData("Output_File",null,r).then((e=>e.value));return"async"===a?g(e,i,null,r).then((e=>(s=e,e.waitForJobCompletion({interval:t.updateDelay}).then(o)))):d(e,i,null,r).then(o)}))}async function J(e){const t=C(e);return me(U.get(t))}async function A(e,t){t=t||{is11xService:!1,legendLayerNameMap:{},legendLayers:[]};const i=e.template||new V;null==i.showLabels&&(i.showLabels=!0);const a=i.exportOptions;let n;const s=h(i.layout);if(a){if(n={dpi:a.dpi},"map_only"===s.toLowerCase()||""===s){const e=a.width,t=a.height;n.outputSize=[e,t]}}const o=i.layoutOptions;let l;if(o){let e,t;"Miles"===o.scalebarUnit||"Kilometers"===o.scalebarUnit?(e="Kilometers",t="Miles"):"Meters"!==o.scalebarUnit&&"Feet"!==o.scalebarUnit||(e="Meters",t="Feet"),l={titleText:o.titleText,authorText:o.authorText,copyrightText:o.copyrightText,customTextElements:o.customTextElements,elementOverrides:o.elementOverrides,scaleBarOptions:{metricUnit:R.toJSON(e),metricLabel:F[e],nonMetricUnit:R.toJSON(t),nonMetricLabel:F[t]}}}let c=null;o?.legendLayers&&(c=o.legendLayers.map((e=>{t.legendLayerNameMap[e.layerId]=e.title;const i={id:e.layerId};return e.subLayerIds&&(i.subLayerIds=e.subLayerIds),i})));const y=await k(e,i,t);if(y.operationalLayers){const e=new RegExp("[\\u4E00-\\u9FFF\\u0E00-\\u0E7F\\u0900-\\u097F\\u3040-\\u309F\\u30A0-\\u30FF\\u31F0-\\u31FF]"),i=/[\u0600-\u06FF]/,a=t=>{const r=t.text,a=t.font,n=a&&a.family&&a.family.toLowerCase();r&&a&&("arial"===n||"arial unicode ms"===n)&&(a.family=e.test(r)?"Arial Unicode MS":"Arial","normal"!==a.style&&i.test(r)&&(a.family="Arial Unicode MS"))},n=()=>{throw new r("print:cim-symbol-unsupported","CIMSymbol is not supported by a print service published from ArcMap")};y.operationalLayers.forEach((e=>{e.featureCollection?.layers?e.featureCollection.layers.forEach((e=>{if(e.layerDefinition?.drawingInfo?.renderer?.symbol){const i=e.layerDefinition.drawingInfo.renderer;"esriTS"===i.symbol.type?a(i.symbol):"CIMSymbolReference"!==i.symbol.type||t.is11xService||n()}e.featureSet?.features&&e.featureSet.features.forEach((e=>{e.symbol&&("esriTS"===e.symbol.type?a(e.symbol):"CIMSymbolReference"!==e.symbol.type||t.is11xService||n())}))})):!t.is11xService&&e.layerDefinition?.drawingInfo?.renderer&&JSON.stringify(e.layerDefinition.drawingInfo.renderer).includes('"type":"CIMSymbolReference"')&&n()}))}e.outSpatialReference&&(y.mapOptions.spatialReference=e.outSpatialReference.toJSON()),Object.assign(y,{exportOptions:n,layoutOptions:l||{}}),Object.assign(y.layoutOptions,{legendOptions:{operationalLayers:null!=c?c:t.legendLayers.slice()}}),t.legendLayers.length=0,U.set(t.gpServerUrl,t);const u={Web_Map_as_JSON:JSON.stringify(y),Format:b(i.format),Layout_Template:s};return e.extraParameters&&Object.assign(u,e.extraParameters),u}async function k(e,t,i){const r=e.view;let a=r.spatialReference;const s={operationalLayers:await z(r,t,i)};let o=i.ssExtent||e.extent||r.extent;if(a&&a.isWrappable&&(o=o.clone()._normalize(!0),a=o.spatialReference),s.mapOptions={extent:o&&o.toJSON(),spatialReference:a&&a.toJSON(),showAttribution:t.attributionVisible},i.ssExtent=null,r.background&&(s.background=r.background.toJSON()),r.rotation&&(s.mapOptions.rotation=-r.rotation),t.scalePreserved&&(s.mapOptions.scale=t.outScale||r.scale),n(r.timeExtent)){const e=n(r.timeExtent.start)?r.timeExtent.start.getTime():null,t=n(r.timeExtent.end)?r.timeExtent.end.getTime():null;s.mapOptions.time=[e,t]}return s}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 r=[],a={layerView:null,printTemplate:t,view:e};let n=0;t.scalePreserved&&(n=t.outScale||e.scale);const s=w(e,n);for(const o of s){const e=o.layer;if(!e.loaded||"group"===e?.type)continue;let t;a.layerView=o,t=S(o)?await ee(e,a,i):x(e)?$(e):v(e)?await K(e,a,i):"feature"===e?.type?await q(e,a,i):"geojson"===e?.type?await W(e,a,i):"graphics"===e?.type?await B(e,a,i):"imagery"===e?.type?G(e,i):"imagery-tile"===e?.type?await Q(e,a,i):"kml"===e?.type?await H(e,a,i):"map-image"===e?.type?X(e,a,i):"map-notes"===e?.type?await Y(a,i):"open-street-map"===e?.type?Z():"stream"===e?.type?await te(e,a,i):"tile"===e?.type?ie(e,i):"vector-tile"===e?.type?await re(e,a,i):"web-tile"===e?.type?ae(e):"wms"===e?.type?ne(e):"wmts"===e?.type?se(e):await ee(e,a,i),t&&(Array.isArray(t)?r.push(...t):(t.id=e.id,t.title=i.legendLayerNameMap[e.id]||e.title,t.opacity=e.opacity,t.minScale=e.minScale||0,t.maxScale=e.maxScale||0,D(e)&&e.blendMode&&"normal"!==e.blendMode&&(t.blendMode=e.blendMode),r.push(t)))}if(n&&r.forEach((e=>{e.minScale=0,e.maxScale=0})),e.graphics&&e.graphics.length){const a=await _(null,e.graphics,t,i);a&&r.push(a)}return r}function $(e){return{culture:e.culture,key:e.key,type:"BingMaps"+("aerial"===e.style?"Aerial":"hybrid"===e.style?"Hybrid":"Road")}}async function K(e,t,i){e.legendEnabled&&i.legendLayers.push({id:e.id});const r=t.layerView,a=t.printTemplate;let n;if(!i.is11xService||r.filter){return _(e,await ue(r),a,i)}return n={type:"CSV"},e.write(n,{origin:"web-map"}),delete n.popupInfo,delete n.layerType,n.showLabels=a.showLabels&&e.labelsVisible,n}async function _(e,t,i,r){let a;const n=T(),s=E(),o=M(),l=O(),c=M();if(c.layerDefinition.name="textLayer",delete c.layerDefinition.drawingInfo,e){if("esri.layers.FeatureLayer"===e.declaredClass||"esri.layers.StreamLayer"===e.declaredClass?n.layerDefinition.name=s.layerDefinition.name=o.layerDefinition.name=l.layerDefinition.name=r.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();n.layerDefinition.drawingInfo.renderer=t,s.layerDefinition.drawingInfo.renderer=t,o.layerDefinition.drawingInfo.renderer=t,l.layerDefinition.drawingInfo.renderer=t}if(i.showLabels&&e.labelsVisible&&"function"==typeof e.write){const t=e.write({},{origin:"web-map"}).layerDefinition?.drawingInfo?.labelingInfo;t&&(a=!0,n.layerDefinition.drawingInfo.labelingInfo=t,s.layerDefinition.drawingInfo.labelingInfo=t,o.layerDefinition.drawingInfo.labelingInfo=t,l.layerDefinition.drawingInfo.labelingInfo=t)}}let y;e?.renderer||a||(delete n.layerDefinition.drawingInfo,delete s.layerDefinition.drawingInfo,delete o.layerDefinition.drawingInfo,delete l.layerDefinition.drawingInfo);const f=e?.fieldsIndex,p=e?.renderer;if(f){const t=new Set;a&&await m(t,e),p&&"function"==typeof p.collectRequiredFields&&await p.collectRequiredFields(t,f),y=Array.from(t);const i=f.fields.map((e=>e.toJSON()));n.layerDefinition.fields=i,s.layerDefinition.fields=i,o.layerDefinition.fields=i,l.layerDefinition.fields=i}const d=t&&t.length;let g;for(let m=0;m<d;m++){const a=t[m]||t.getItemAt(m);if(!1===a.visible||!a.geometry)continue;if(g=a.toJSON(),g.hasOwnProperty("popupTemplate")&&delete g.popupTemplate,g.geometry&&g.geometry.z&&delete g.geometry.z,g.symbol&&g.symbol.outline&&"esriCLS"===g.symbol.outline.type&&!r.is11xService)continue;!r.is11xService&&g.symbol&&g.symbol.outline&&g.symbol.outline.color&&g.symbol.outline.color[3]&&(g.symbol.outline.color[3]=255);const f=e&&e.renderer&&("valueExpression"in e.renderer&&e.renderer.valueExpression||"hasVisualVariables"in e.renderer&&e.renderer.hasVisualVariables());if(!g.symbol&&e&&e.renderer&&f&&!r.is11xService){const t=e.renderer,i=await t.getSymbolAsync(a);if(!i)continue;g.symbol=i.toJSON(),"hasVisualVariables"in t&&t.hasVisualVariables()&&I(g.symbol,{renderer:t,graphic:a,symbol:i})}if(g.symbol&&(g.symbol.angle||delete g.symbol.angle,fe(g.symbol)?g.symbol=await ce(g.symbol,r):g.symbol.text&&delete g.attributes),(!i||!i.forceFeatureAttributes)&&y?.length){const e={};y.forEach((t=>{g.attributes&&g.attributes.hasOwnProperty(t)&&(e[t]=g.attributes[t])})),g.attributes=e}"polygon"===a.geometry.type?n.featureSet.features.push(g):"polyline"===a.geometry.type?s.featureSet.features.push(g):"point"===a.geometry.type?g.symbol&&g.symbol.text?c.featureSet.features.push(g):o.featureSet.features.push(g):"multipoint"===a.geometry.type?l.featureSet.features.push(g):"extent"===a.geometry.type&&(g.geometry=u.fromExtent(a.geometry).toJSON(),n.featureSet.features.push(g))}const b=[n,s,l,o,c].filter((e=>e.featureSet.features.length>0));for(const u of b){const e=u.featureSet.features.every((e=>e.symbol));!e||i&&i.forceFeatureAttributes||u.featureSet.features.forEach((e=>{delete e.attributes})),e&&delete u.layerDefinition.drawingInfo,u.layerDefinition.drawingInfo&&u.layerDefinition.drawingInfo.renderer&&await ye(u.layerDefinition.drawingInfo.renderer,r)}return b.length?{featureCollection:{layers:b},showLabels:a}:null}async function q(e,t,i){let r;const a=e.renderer,n=parseFloat(i.cimVersion);if("binning"===e.featureReduction?.type||"cluster"===e.featureReduction?.type&&(!i.is11xService||n<2.9)||"pie-chart"===a?.type||"dot-density"===a?.type&&(!i.is11xService||n<2.6))return ee(e,t,i);e.legendEnabled&&i.legendLayers.push({id:e.id});const s=t.layerView,{printTemplate:o,view:l}=t,c=a&&("valueExpression"in a&&a.valueExpression||"hasVisualVariables"in a&&a.hasVisualVariables()),y="feature-layer"!==e.source?.type&&"ogc-feature"!==e.source?.type;if(!i.is11xService&&c||s.filter||y||!a||"field"in a&&null!=a.field&&("string"!=typeof a.field||!e.getField(a.field))){const t=await ue(s);r=await _(e,t,o,i)}else{if(r={id:(u=e.write()).id,title:u.title,opacity:u.opacity,minScale:u.minScale,maxScale:u.maxScale,url:u.url,layerType:u.layerType,customParameters:u.customParameters,layerDefinition:u.layerDefinition},r.showLabels=o.showLabels&&e.labelsVisible,oe(r,e),r.layerDefinition?.drawingInfo?.renderer&&(delete r.layerDefinition.minScale,delete r.layerDefinition.maxScale,await ye(r.layerDefinition.drawingInfo.renderer,i),"visualVariables"in a&&a.visualVariables&&a.visualVariables[0])){const e=a.visualVariables[0];if("size"===e.type&&e.maxSize&&"number"!=typeof e.maxSize&&e.minSize&&"number"!=typeof e.minSize){const t=p(e,l.scale);r.layerDefinition.drawingInfo.renderer.visualVariables[0].minSize=t.minSize,r.layerDefinition.drawingInfo.renderer.visualVariables[0].maxSize=t.maxSize}}const t=f(s);t&&(r.layerDefinition||(r.layerDefinition={}),r.layerDefinition.definitionExpression=r.layerDefinition.definitionExpression?`(${r.layerDefinition.definitionExpression}) AND (${t})`:t)}var u;return r}async function W(e,{layerView:t,printTemplate:i},r){e.legendEnabled&&r.legendLayers.push({id:e.id});return _(e,await ue(t),i,r)}async function B(e,{printTemplate:t},i){return _(e,null,t,i)}function G(e,t){e.legendEnabled&&t.legendLayers.push({id:e.id});const i={layerType:(r=e.write()).layerType,customParameters:r.customParameters};var r;if(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.renderingRule||e.renderer)if(t.is11xService)e.renderingRule&&(i.renderingRule=e.renderingRule.toJSON()),e.renderer&&(i.layerDefinition=i.layerDefinition||{},i.layerDefinition.drawingInfo=i.layerDefinition.drawingInfo||{},i.layerDefinition.drawingInfo.renderer=e.renderer.toJSON());else{const t=e.exportImageServiceParameters.combineRendererWithRenderingRule();t&&(i.renderingRule=t.toJSON())}return oe(i,e),i}async function Q(e,t,i){if("flow"===e.renderer?.type)return ee(e,t,i);e.legendEnabled&&i.legendLayers.push({id:e.id});const r={bandIds:(a=e.write()||{}).bandIds,customParameters:a.customParameters,interpolation:a.interpolation,layerDefinition:a.layerDefinition};var a;return r.layerType="ArcGISImageServiceLayer",oe(r,e),r}async function H(e,t,i){const r=t.printTemplate;if(i.is11xService){const t={type:"kml"};return e.write(t,{origin:"web-map"}),delete t.layerType,t.url=c(e.url),t}{const a=[],n=t.layerView;n.allVisibleMapImages.forEach(((t,i)=>{const r={id:`${e.id}_image${i}`,type:"image",title:e.id,minScale:e.minScale||0,maxScale:e.maxScale||0,opacity:e.opacity,extent:t.extent};"data:image/png;base64,"===t.href.substr(0,22)?r.imageData=t.href.substr(22):r.url=t.href,a.push(r)}));const s=[...n.allVisiblePoints.items,...n.allVisiblePolylines.items,...n.allVisiblePolygons.items],o={id:e.id,...await _(null,s,r,i)};return a.push(o),a}}function X(e,{view:t},i){let r;const a={id:e.id,subLayerIds:[]};let n=[];const s=t.scale,o=e=>{const t=0===s,i=0===e.minScale||s<=e.minScale,r=0===e.maxScale||s>=e.maxScale;if(e.visible&&(t||i&&r))if(e.sublayers)e.sublayers.forEach(o);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),a.subLayerIds.push(e.id)}};var l;return e.sublayers&&e.sublayers.forEach(o),n.length&&(n=n.map((({id:e,name:t,layerDefinition:i})=>({id:e,name:t,layerDefinition:i}))),r={layerType:(l=e.write()).layerType,customParameters:l.customParameters},r.layers=n,r.visibleLayers=e.capabilities.exportMap.supportsDynamicLayers?void 0:a.subLayerIds,oe(r,e),e.legendEnabled&&i.legendLayers.push(a)),r}async function Y({layerView:e,printTemplate:t},i){const r=[],a=e.layer;if(n(a.featureCollections))for(const n of a.featureCollections){const e=await _(n,n.source,t,i);e&&r.push(...e.featureCollection.layers)}else if(n(a.sublayers))for(const n of a.sublayers){const e=await _(null,n.graphics,t,i);e&&r.push(...e.featureCollection.layers)}return{featureCollection:{layers:r}}}function Z(){return{type:"OpenStreetMap"}}async function ee(e,{printTemplate:t,view:i},r){const a={type:"image"},n={format:"png",ignoreBackground:!0,layers:[e],rotation:0},o=r.ssExtent||i.extent.clone();let l=96,c=!0,u=!0;if(t.exportOptions){const e=t.exportOptions;e.dpi>0&&(l=e.dpi),e.width>0&&(c=e.width%2==i.width%2),e.height>0&&(u=e.height%2==i.height%2)}if("map-only"===t.layout&&t.scalePreserved&&(!t.outScale||t.outScale===i.scale)&&96===l&&(!c||!u)&&(n.area={x:0,y:0,width:i.width,height:i.height},c||(n.area.width-=1),u||(n.area.height-=1),!r.ssExtent)){const e=i.toMap(s(n.area.width,n.area.height));o.ymin=e.y,o.xmax=e.x,r.ssExtent=o}a.extent=o.clone()._normalize(!0).toJSON();const m=await i.takeScreenshot(n),{data:f}=y(m.dataUrl);return a.imageData=f,a}async function te(e,{layerView:t,printTemplate:i},r){e.legendEnabled&&r.legendLayers.push({id:e.id});return _(e,await ue(t),i,r)}function ie(e,t){e.legendEnabled&&t.legendLayers.push({id:e.id});const i={layerType:(r=e.write()).layerType,customParameters:r.customParameters};var r;return oe(i,e),i}async function re(e,t,i){if(i.is11xService&&e.serviceUrl&&e.styleUrl){const t=le(e.styleUrl,e.apiKey),r=le(e.serviceUrl,e.apiKey);if(!t&&!r||"2.1.0"!==i.cimVersion){const i={type:"VectorTileLayer"};return i.styleUrl=c(e.styleUrl),i.token=t,r!==t&&(i.additionalTokens=[{url:e.serviceUrl,token:r}]),i}}return ee(e,t,i)}function ae(e){const t={type:"WebTiledLayer",urlTemplate:e.urlTemplate.replace(/\${/g,"{"),credits:e.copyright};return e.subDomains&&e.subDomains.length>0&&(t.subDomains=e.subDomains),t}function ne(e){let t;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&&(t={type:"wms",customLayerParameters:e.customLayerParameters,customParameters:e.customParameters,transparentBackground:e.imageTransparency,visibleLayers:i,url:c(e.url),version:e.version}),t}function se(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:c(e.url)}}function oe(e,t){t.url&&(e.url=c(e.url||t.url),e.token=le(e.url,t.apiKey))}function le(i,r){return P(i)&&(r||e.apiKey)?r||e.apiKey:t?.findCredential(i)?.token}async function ce(e,t){t.canvas||(t.canvas=document.createElement("canvas"));const r=1024;t.canvas.width=r,t.canvas.height=r;const a=t.canvas.getContext("2d");let n,s;if(e.path){const t=new Path2D(e.path);t.closePath(),a.fillStyle=Array.isArray(e.color)?`rgba(${e.color[0]},${e.color[1]},${e.color[2]},${e.color[3]/255})`:"rgb(0,0,0)",a.fill(t);const i=L(a);if(!i)return null;a.clearRect(0,0,r,r);const l=o(e.size)/Math.max(i.width,i.height);a.scale(l,l);const c=r/l,y=c/2-i.width/2-i.x,u=c/2-i.height/2-i.y;if(a.translate(y,u),Array.isArray(e.color)&&a.fill(t),e.outline?.width&&Array.isArray(e.outline.color)){const r=e.outline;a.lineWidth=o(r.width)/l,a.lineJoin="round",a.strokeStyle=`rgba(${r.color[0]},${r.color[1]},${r.color[2]},${r.color[3]/255})`,a.stroke(t),i.width+=a.lineWidth,i.height+=a.lineWidth}i.width*=l,i.height*=l;const m=a.getImageData(r/2-i.width/2,r/2-i.height/2,Math.ceil(i.width),Math.ceil(i.height));n=m.width,s=m.height,a.canvas.width=n,a.canvas.height=s,a.putImageData(m,0,0)}else{const t="image/svg+xml"===e.contentType?"data:image/svg+xml;base64,"+e.imageData:e.url,r=(await i(t,{responseType:"image"})).data;n=o(e.width),s=o(e.height),a.canvas.width=n,a.canvas.height=s,a.drawImage(r,0,0,a.canvas.width,a.canvas.height)}return{type:"esriPMS",imageData:a.canvas.toDataURL("image/png").substr(22),angle:e.angle,contentType:"image/png",height:l(s),width:l(n),xoffset:e.xoffset,yoffset:e.yoffset}}async function ye(e,t){const i=e.type;if("simple"===i&&fe(e.symbol))e.symbol=await ce(e.symbol,t);else if("uniqueValue"===i||"classBreaks"===i){fe(e.defaultSymbol)&&(e.defaultSymbol=await ce(e.defaultSymbol,t));const r=e["uniqueValue"===i?"uniqueValueInfos":"classBreakInfos"];if(r)for(const e of r)fe(e.symbol)&&(e.symbol=await ce(e.symbol,t))}}async function ue(e){return e.queryFeatures(e.createQuery()).then((e=>e.features))}function me(e){return e.gpMetadata&&e.gpMetadata.executionType?N.fromJSON(e.gpMetadata.executionType):"sync"}function fe(e){return e&&(e.path||"image/svg+xml"===e.contentType||e.url&&e.url.endsWith(".svg"))}export{j as execute,A as getGpPrintParams,C as getGpServerUrl,J as getMode,U as printCacheMap};
|
|
5
|
+
import e from"../config.js";import{id as t}from"../kernel.js";import i from"../request.js";import r from"../core/Error.js";import{JSONMap as a}from"../core/jsonMap.js";import{isSome as n}from"../core/maybe.js";import{createScreenPoint as s,pt2px as o,px2pt as l}from"../core/screenUtils.js";import{normalize as c,dataComponents as y}from"../core/urlUtils.js";import u from"../geometry/Polygon.js";import{collectLabelingFields as m}from"../layers/support/fieldUtils.js";import{getFloorFilterClause as f}from"../layers/support/floorFilterUtils.js";import{getSizeRangeAtScale as p}from"../renderers/visualVariables/support/visualVariableUtils.js";import{execute as d}from"./geoprocessor/execute.js";import{submitJob as g}from"./geoprocessor/submitJob.js";import{toJSON as b}from"./support/fileFormat.js";import{toJSON as h}from"./support/layoutTemplate.js";import{getVisibleLayerViews as w,isScreenshotRequired as S,isBingMapsLayer as x,isCSVLayer as v,isBlendLayer as I,applyVisualVariables as D,getContextBoundingBox as L,createPolygonLayer as T,createPolylineLayer as E,createPointLayer as M,createMultipointLayer as O}from"./support/printTaskUtils.js";import V from"./support/PrintTemplate.js";import{supportsApiKey as P}from"../support/apiKeyUtils.js";const F={Feet:"ft",Kilometers:"km",Meters:"m",Miles:"mi"},N=new a({esriFeet:"Feet",esriKilometers:"Kilometers",esriMeters:"Meters",esriMiles:"Miles"}),R=new a({esriExecutionTypeSynchronous:"sync",esriExecutionTypeAsynchronous:"async"}),J=new Map;async function U(e,t,r){const a=C(e);let n=J.get(a);return Promise.resolve().then((()=>n?{data:n.gpMetadata}:(n={gpServerUrl:a,is11xService:!1,legendLayerNameMap:{},legendLayers:[]},i(a,{query:{f:"json"}})))).then((e=>(n.gpMetadata=e.data,n.cimVersion=n.gpMetadata.cimVersion,n.is11xService=!!n.cimVersion,J.set(a,n),A(t,n)))).then((i=>{const a=me(n);let s;const o=e=>"sync"===a?e.results&&e.results[0]&&e.results[0].value:s.fetchResultData("Output_File",null,r).then((e=>e.value));return"async"===a?g(e,i,null,r).then((e=>(s=e,e.waitForJobCompletion({interval:t.updateDelay}).then(o)))):d(e,i,null,r).then(o)}))}async function j(e){const t=C(e);return me(J.get(t))}async function A(e,t){t=t||{is11xService:!1,legendLayerNameMap:{},legendLayers:[]};const i=e.template||new V;null==i.showLabels&&(i.showLabels=!0);const a=i.exportOptions;let n;const s=h(i.layout);if(a){if(n={dpi:a.dpi},"map_only"===s.toLowerCase()||""===s){const e=a.width,t=a.height;n.outputSize=[e,t]}}const o=i.layoutOptions;let l;if(o){let e,t;"Miles"===o.scalebarUnit||"Kilometers"===o.scalebarUnit?(e="Kilometers",t="Miles"):"Meters"!==o.scalebarUnit&&"Feet"!==o.scalebarUnit||(e="Meters",t="Feet"),l={titleText:o.titleText,authorText:o.authorText,copyrightText:o.copyrightText,customTextElements:o.customTextElements,elementOverrides:o.elementOverrides,scaleBarOptions:{metricUnit:N.toJSON(e),metricLabel:F[e],nonMetricUnit:N.toJSON(t),nonMetricLabel:F[t]}}}let c=null;o?.legendLayers&&(c=o.legendLayers.map((e=>{t.legendLayerNameMap[e.layerId]=e.title;const i={id:e.layerId};return e.subLayerIds&&(i.subLayerIds=e.subLayerIds),i})));const y=await k(e,i,t);if(y.operationalLayers){const e=new RegExp("[\\u4E00-\\u9FFF\\u0E00-\\u0E7F\\u0900-\\u097F\\u3040-\\u309F\\u30A0-\\u30FF\\u31F0-\\u31FF]"),i=/[\u0600-\u06FF]/,a=t=>{const r=t.text,a=t.font,n=a&&a.family&&a.family.toLowerCase();r&&a&&("arial"===n||"arial unicode ms"===n)&&(a.family=e.test(r)?"Arial Unicode MS":"Arial","normal"!==a.style&&i.test(r)&&(a.family="Arial Unicode MS"))},n=()=>{throw new r("print:cim-symbol-unsupported","CIMSymbol is not supported by a print service published from ArcMap")};y.operationalLayers.forEach((e=>{e.featureCollection?.layers?e.featureCollection.layers.forEach((e=>{if(e.layerDefinition?.drawingInfo?.renderer?.symbol){const i=e.layerDefinition.drawingInfo.renderer;"esriTS"===i.symbol.type?a(i.symbol):"CIMSymbolReference"!==i.symbol.type||t.is11xService||n()}e.featureSet?.features&&e.featureSet.features.forEach((e=>{e.symbol&&("esriTS"===e.symbol.type?a(e.symbol):"CIMSymbolReference"!==e.symbol.type||t.is11xService||n())}))})):!t.is11xService&&e.layerDefinition?.drawingInfo?.renderer&&JSON.stringify(e.layerDefinition.drawingInfo.renderer).includes('"type":"CIMSymbolReference"')&&n()}))}e.outSpatialReference&&(y.mapOptions.spatialReference=e.outSpatialReference.toJSON()),Object.assign(y,{exportOptions:n,layoutOptions:l||{}}),Object.assign(y.layoutOptions,{legendOptions:{operationalLayers:null!=c?c:t.legendLayers.slice()}}),t.legendLayers.length=0,J.set(t.gpServerUrl,t);const u={Web_Map_as_JSON:JSON.stringify(y),Format:b(i.format),Layout_Template:s,Layout_Item_ID:void 0};return i.layoutItemId&&(delete u.Layout_Template,u.Layout_Item_ID=JSON.stringify({id:i.layoutItemId})),e.extraParameters&&Object.assign(u,e.extraParameters),u}async function k(e,t,i){const r=e.view;let a=r.spatialReference;const s={operationalLayers:await z(r,t,i)};let o=i.ssExtent||e.extent||r.extent;if(a&&a.isWrappable&&(o=o.clone()._normalize(!0),a=o.spatialReference),s.mapOptions={extent:o&&o.toJSON(),spatialReference:a&&a.toJSON(),showAttribution:t.attributionVisible},i.ssExtent=null,r.background&&(s.background=r.background.toJSON()),r.rotation&&(s.mapOptions.rotation=-r.rotation),t.scalePreserved&&(s.mapOptions.scale=t.outScale||r.scale),n(r.timeExtent)){const e=n(r.timeExtent.start)?r.timeExtent.start.getTime():null,t=n(r.timeExtent.end)?r.timeExtent.end.getTime():null;s.mapOptions.time=[e,t]}return s}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 r=[],a={layerView:null,printTemplate:t,view:e};let n=0;t.scalePreserved&&(n=t.outScale||e.scale);const s=w(e,n);for(const o of s){const e=o.layer;if(!e.loaded||"group"===e?.type)continue;let t;a.layerView=o,t=S(o)?await ee(e,a,i):x(e)?_(e):v(e)?await $(e,a,i):"feature"===e?.type?await q(e,a,i):"geojson"===e?.type?await W(e,a,i):"graphics"===e?.type?await B(e,a,i):"imagery"===e?.type?G(e,i):"imagery-tile"===e?.type?await Q(e,a,i):"kml"===e?.type?await H(e,a,i):"map-image"===e?.type?X(e,a,i):"map-notes"===e?.type?await Y(a,i):"open-street-map"===e?.type?Z():"stream"===e?.type?await te(e,a,i):"tile"===e?.type?ie(e,i):"vector-tile"===e?.type?await re(e,a,i):"web-tile"===e?.type?ae(e):"wms"===e?.type?ne(e):"wmts"===e?.type?se(e):await ee(e,a,i),t&&(Array.isArray(t)?r.push(...t):(t.id=e.id,t.title=i.legendLayerNameMap[e.id]||e.title,t.opacity=e.opacity,t.minScale=e.minScale||0,t.maxScale=e.maxScale||0,I(e)&&e.blendMode&&"normal"!==e.blendMode&&(t.blendMode=e.blendMode),r.push(t)))}if(n&&r.forEach((e=>{e.minScale=0,e.maxScale=0})),e.graphics&&e.graphics.length){const a=await K(null,e.graphics,t,i);a&&r.push(a)}return r}function _(e){return{culture:e.culture,key:e.key,type:"BingMaps"+("aerial"===e.style?"Aerial":"hybrid"===e.style?"Hybrid":"Road")}}async function $(e,t,i){e.legendEnabled&&i.legendLayers.push({id:e.id});const r=t.layerView,a=t.printTemplate;let n;if(!i.is11xService||r.filter){return K(e,await ue(r),a,i)}return n={type:"CSV"},e.write(n,{origin:"web-map"}),delete n.popupInfo,delete n.layerType,n.showLabels=a.showLabels&&e.labelsVisible,n}async function K(e,t,i,r){let a;const n=T(),s=E(),o=M(),l=O(),c=M();if(c.layerDefinition.name="textLayer",delete c.layerDefinition.drawingInfo,e){if("esri.layers.FeatureLayer"===e.declaredClass||"esri.layers.StreamLayer"===e.declaredClass?n.layerDefinition.name=s.layerDefinition.name=o.layerDefinition.name=l.layerDefinition.name=r.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();n.layerDefinition.drawingInfo.renderer=t,s.layerDefinition.drawingInfo.renderer=t,o.layerDefinition.drawingInfo.renderer=t,l.layerDefinition.drawingInfo.renderer=t}if(i.showLabels&&e.labelsVisible&&"function"==typeof e.write){const t=e.write({},{origin:"web-map"}).layerDefinition?.drawingInfo?.labelingInfo;t&&(a=!0,n.layerDefinition.drawingInfo.labelingInfo=t,s.layerDefinition.drawingInfo.labelingInfo=t,o.layerDefinition.drawingInfo.labelingInfo=t,l.layerDefinition.drawingInfo.labelingInfo=t)}}let y;e?.renderer||a||(delete n.layerDefinition.drawingInfo,delete s.layerDefinition.drawingInfo,delete o.layerDefinition.drawingInfo,delete l.layerDefinition.drawingInfo);const f=e?.fieldsIndex,p=e?.renderer;if(f){const t=new Set;a&&await m(t,e),p&&"function"==typeof p.collectRequiredFields&&await p.collectRequiredFields(t,f),y=Array.from(t);const i=f.fields.map((e=>e.toJSON()));n.layerDefinition.fields=i,s.layerDefinition.fields=i,o.layerDefinition.fields=i,l.layerDefinition.fields=i}const d=t&&t.length;let g;for(let m=0;m<d;m++){const a=t[m]||t.getItemAt(m);if(!1===a.visible||!a.geometry)continue;if(g=a.toJSON(),g.hasOwnProperty("popupTemplate")&&delete g.popupTemplate,g.geometry&&g.geometry.z&&delete g.geometry.z,g.symbol&&g.symbol.outline&&"esriCLS"===g.symbol.outline.type&&!r.is11xService)continue;!r.is11xService&&g.symbol&&g.symbol.outline&&g.symbol.outline.color&&g.symbol.outline.color[3]&&(g.symbol.outline.color[3]=255);const f=e&&e.renderer&&("valueExpression"in e.renderer&&e.renderer.valueExpression||"hasVisualVariables"in e.renderer&&e.renderer.hasVisualVariables());if(!g.symbol&&e&&e.renderer&&f&&!r.is11xService){const t=e.renderer,i=await t.getSymbolAsync(a);if(!i)continue;g.symbol=i.toJSON(),"hasVisualVariables"in t&&t.hasVisualVariables()&&D(g.symbol,{renderer:t,graphic:a,symbol:i})}if(g.symbol&&(g.symbol.angle||delete g.symbol.angle,fe(g.symbol)?g.symbol=await ce(g.symbol,r):g.symbol.text&&delete g.attributes),(!i||!i.forceFeatureAttributes)&&y?.length){const e={};y.forEach((t=>{g.attributes&&g.attributes.hasOwnProperty(t)&&(e[t]=g.attributes[t])})),g.attributes=e}"polygon"===a.geometry.type?n.featureSet.features.push(g):"polyline"===a.geometry.type?s.featureSet.features.push(g):"point"===a.geometry.type?g.symbol&&g.symbol.text?c.featureSet.features.push(g):o.featureSet.features.push(g):"multipoint"===a.geometry.type?l.featureSet.features.push(g):"extent"===a.geometry.type&&(g.geometry=u.fromExtent(a.geometry).toJSON(),n.featureSet.features.push(g))}const b=[n,s,l,o,c].filter((e=>e.featureSet.features.length>0));for(const u of b){const e=u.featureSet.features.every((e=>e.symbol));!e||i&&i.forceFeatureAttributes||u.featureSet.features.forEach((e=>{delete e.attributes})),e&&delete u.layerDefinition.drawingInfo,u.layerDefinition.drawingInfo&&u.layerDefinition.drawingInfo.renderer&&await ye(u.layerDefinition.drawingInfo.renderer,r)}return b.length?{featureCollection:{layers:b},showLabels:a}:null}async function q(e,t,i){let r;const a=e.renderer,n=parseFloat(i.cimVersion);if("binning"===e.featureReduction?.type||"cluster"===e.featureReduction?.type&&(!i.is11xService||n<2.9)||"pie-chart"===a?.type||"dot-density"===a?.type&&(!i.is11xService||n<2.6))return ee(e,t,i);e.legendEnabled&&i.legendLayers.push({id:e.id});const s=t.layerView,{printTemplate:o,view:l}=t,c=a&&("valueExpression"in a&&a.valueExpression||"hasVisualVariables"in a&&a.hasVisualVariables()),y="feature-layer"!==e.source?.type&&"ogc-feature"!==e.source?.type;if(!i.is11xService&&c||s.filter||y||!a||"field"in a&&null!=a.field&&("string"!=typeof a.field||!e.getField(a.field))){const t=await ue(s);r=await K(e,t,o,i)}else{if(r={id:(u=e.write()).id,title:u.title,opacity:u.opacity,minScale:u.minScale,maxScale:u.maxScale,url:u.url,layerType:u.layerType,customParameters:u.customParameters,layerDefinition:u.layerDefinition},r.showLabels=o.showLabels&&e.labelsVisible,oe(r,e),r.layerDefinition?.drawingInfo?.renderer&&(delete r.layerDefinition.minScale,delete r.layerDefinition.maxScale,await ye(r.layerDefinition.drawingInfo.renderer,i),"visualVariables"in a&&a.visualVariables&&a.visualVariables[0])){const e=a.visualVariables[0];if("size"===e.type&&e.maxSize&&"number"!=typeof e.maxSize&&e.minSize&&"number"!=typeof e.minSize){const t=p(e,l.scale);r.layerDefinition.drawingInfo.renderer.visualVariables[0].minSize=t.minSize,r.layerDefinition.drawingInfo.renderer.visualVariables[0].maxSize=t.maxSize}}const t=f(s);t&&(r.layerDefinition||(r.layerDefinition={}),r.layerDefinition.definitionExpression=r.layerDefinition.definitionExpression?`(${r.layerDefinition.definitionExpression}) AND (${t})`:t)}var u;return r}async function W(e,{layerView:t,printTemplate:i},r){e.legendEnabled&&r.legendLayers.push({id:e.id});return K(e,await ue(t),i,r)}async function B(e,{printTemplate:t},i){return K(e,null,t,i)}function G(e,t){e.legendEnabled&&t.legendLayers.push({id:e.id});const i={layerType:(r=e.write()).layerType,customParameters:r.customParameters};var r;if(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.renderingRule||e.renderer)if(t.is11xService)e.renderingRule&&(i.renderingRule=e.renderingRule.toJSON()),e.renderer&&(i.layerDefinition=i.layerDefinition||{},i.layerDefinition.drawingInfo=i.layerDefinition.drawingInfo||{},i.layerDefinition.drawingInfo.renderer=e.renderer.toJSON());else{const t=e.exportImageServiceParameters.combineRendererWithRenderingRule();t&&(i.renderingRule=t.toJSON())}return oe(i,e),i}async function Q(e,t,i){if("flow"===e.renderer?.type)return ee(e,t,i);e.legendEnabled&&i.legendLayers.push({id:e.id});const r={bandIds:(a=e.write()||{}).bandIds,customParameters:a.customParameters,interpolation:a.interpolation,layerDefinition:a.layerDefinition};var a;return r.layerType="ArcGISImageServiceLayer",oe(r,e),r}async function H(e,t,i){const r=t.printTemplate;if(i.is11xService){const t={type:"kml"};return e.write(t,{origin:"web-map"}),delete t.layerType,t.url=c(e.url),t}{const a=[],n=t.layerView;n.allVisibleMapImages.forEach(((t,i)=>{const r={id:`${e.id}_image${i}`,type:"image",title:e.id,minScale:e.minScale||0,maxScale:e.maxScale||0,opacity:e.opacity,extent:t.extent};"data:image/png;base64,"===t.href.substr(0,22)?r.imageData=t.href.substr(22):r.url=t.href,a.push(r)}));const s=[...n.allVisiblePoints.items,...n.allVisiblePolylines.items,...n.allVisiblePolygons.items],o={id:e.id,...await K(null,s,r,i)};return a.push(o),a}}function X(e,{view:t},i){let r;const a={id:e.id,subLayerIds:[]};let n=[];const s=t.scale,o=e=>{const t=0===s,i=0===e.minScale||s<=e.minScale,r=0===e.maxScale||s>=e.maxScale;if(e.visible&&(t||i&&r))if(e.sublayers)e.sublayers.forEach(o);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),a.subLayerIds.push(e.id)}};var l;return e.sublayers&&e.sublayers.forEach(o),n.length&&(n=n.map((({id:e,name:t,layerDefinition:i})=>({id:e,name:t,layerDefinition:i}))),r={layerType:(l=e.write()).layerType,customParameters:l.customParameters},r.layers=n,r.visibleLayers=e.capabilities.exportMap.supportsDynamicLayers?void 0:a.subLayerIds,oe(r,e),e.legendEnabled&&i.legendLayers.push(a)),r}async function Y({layerView:e,printTemplate:t},i){const r=[],a=e.layer;if(n(a.featureCollections))for(const n of a.featureCollections){const e=await K(n,n.source,t,i);e&&r.push(...e.featureCollection.layers)}else if(n(a.sublayers))for(const n of a.sublayers){const e=await K(null,n.graphics,t,i);e&&r.push(...e.featureCollection.layers)}return{featureCollection:{layers:r}}}function Z(){return{type:"OpenStreetMap"}}async function ee(e,{printTemplate:t,view:i},r){const a={type:"image"},n={format:"png",ignoreBackground:!0,layers:[e],rotation:0},o=r.ssExtent||i.extent.clone();let l=96,c=!0,u=!0;if(t.exportOptions){const e=t.exportOptions;e.dpi>0&&(l=e.dpi),e.width>0&&(c=e.width%2==i.width%2),e.height>0&&(u=e.height%2==i.height%2)}if("map-only"===t.layout&&t.scalePreserved&&(!t.outScale||t.outScale===i.scale)&&96===l&&(!c||!u)&&(n.area={x:0,y:0,width:i.width,height:i.height},c||(n.area.width-=1),u||(n.area.height-=1),!r.ssExtent)){const e=i.toMap(s(n.area.width,n.area.height));o.ymin=e.y,o.xmax=e.x,r.ssExtent=o}a.extent=o.clone()._normalize(!0).toJSON();const m=await i.takeScreenshot(n),{data:f}=y(m.dataUrl);return a.imageData=f,a}async function te(e,{layerView:t,printTemplate:i},r){e.legendEnabled&&r.legendLayers.push({id:e.id});return K(e,await ue(t),i,r)}function ie(e,t){e.legendEnabled&&t.legendLayers.push({id:e.id});const i={layerType:(r=e.write()).layerType,customParameters:r.customParameters};var r;return oe(i,e),i}async function re(e,t,i){if(i.is11xService&&e.serviceUrl&&e.styleUrl){const t=le(e.styleUrl,e.apiKey),r=le(e.serviceUrl,e.apiKey);if(!t&&!r||"2.1.0"!==i.cimVersion){const i={type:"VectorTileLayer"};return i.styleUrl=c(e.styleUrl),i.token=t,r!==t&&(i.additionalTokens=[{url:e.serviceUrl,token:r}]),i}}return ee(e,t,i)}function ae(e){const t={type:"WebTiledLayer",urlTemplate:e.urlTemplate.replace(/\${/g,"{"),credits:e.copyright};return e.subDomains&&e.subDomains.length>0&&(t.subDomains=e.subDomains),t}function ne(e){let t;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&&(t={type:"wms",customLayerParameters:e.customLayerParameters,customParameters:e.customParameters,transparentBackground:e.imageTransparency,visibleLayers:i,url:c(e.url),version:e.version}),t}function se(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:c(e.url)}}function oe(e,t){t.url&&(e.url=c(e.url||t.url),e.token=le(e.url,t.apiKey))}function le(i,r){return P(i)&&(r||e.apiKey)?r||e.apiKey:t?.findCredential(i)?.token}async function ce(e,t){t.canvas||(t.canvas=document.createElement("canvas"));const r=1024;t.canvas.width=r,t.canvas.height=r;const a=t.canvas.getContext("2d");let n,s;if(e.path){const t=new Path2D(e.path);t.closePath(),a.fillStyle=Array.isArray(e.color)?`rgba(${e.color[0]},${e.color[1]},${e.color[2]},${e.color[3]/255})`:"rgb(0,0,0)",a.fill(t);const i=L(a);if(!i)return null;a.clearRect(0,0,r,r);const l=o(e.size)/Math.max(i.width,i.height);a.scale(l,l);const c=r/l,y=c/2-i.width/2-i.x,u=c/2-i.height/2-i.y;if(a.translate(y,u),Array.isArray(e.color)&&a.fill(t),e.outline?.width&&Array.isArray(e.outline.color)){const r=e.outline;a.lineWidth=o(r.width)/l,a.lineJoin="round",a.strokeStyle=`rgba(${r.color[0]},${r.color[1]},${r.color[2]},${r.color[3]/255})`,a.stroke(t),i.width+=a.lineWidth,i.height+=a.lineWidth}i.width*=l,i.height*=l;const m=a.getImageData(r/2-i.width/2,r/2-i.height/2,Math.ceil(i.width),Math.ceil(i.height));n=m.width,s=m.height,a.canvas.width=n,a.canvas.height=s,a.putImageData(m,0,0)}else{const t="image/svg+xml"===e.contentType?"data:image/svg+xml;base64,"+e.imageData:e.url,r=(await i(t,{responseType:"image"})).data;n=o(e.width),s=o(e.height),a.canvas.width=n,a.canvas.height=s,a.drawImage(r,0,0,a.canvas.width,a.canvas.height)}return{type:"esriPMS",imageData:a.canvas.toDataURL("image/png").substr(22),angle:e.angle,contentType:"image/png",height:l(s),width:l(n),xoffset:e.xoffset,yoffset:e.yoffset}}async function ye(e,t){const i=e.type;if("simple"===i&&fe(e.symbol))e.symbol=await ce(e.symbol,t);else if("uniqueValue"===i||"classBreaks"===i){fe(e.defaultSymbol)&&(e.defaultSymbol=await ce(e.defaultSymbol,t));const r=e["uniqueValue"===i?"uniqueValueInfos":"classBreakInfos"];if(r)for(const e of r)fe(e.symbol)&&(e.symbol=await ce(e.symbol,t))}}async function ue(e){return e.queryFeatures(e.createQuery()).then((e=>e.features))}function me(e){return e.gpMetadata&&e.gpMetadata.executionType?R.fromJSON(e.gpMetadata.executionType):"sync"}function fe(e){return e&&(e.path||"image/svg+xml"===e.contentType||e.url&&e.url.endsWith(".svg"))}export{U as execute,A as getGpPrintParams,C as getGpServerUrl,j as getMode,J as printCacheMap};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.25/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as r}from"../../chunks/tslib.es6.js";import{JSONSupport as o}from"../../core/JSONSupport.js";import{
|
|
5
|
+
import{_ as r}from"../../chunks/tslib.es6.js";import{JSONSupport as o}from"../../core/JSONSupport.js";import{isSome as e}from"../../core/maybe.js";import{property as t}from"../../core/accessorSupport/decorators/property.js";import"../../core/arrayUtils.js";import"../../core/has.js";import{ensureType as s}from"../../core/accessorSupport/ensureType.js";import{subclass as i}from"../../core/accessorSupport/decorators/subclass.js";import{fromJSON as p}from"../../geometry/support/jsonUtils.js";let m=class extends o{constructor(r){super(r),this.deviationUnit=null,this.geometries=null,this.maxDeviation=null}};r([t({type:String,json:{write:!0}})],m.prototype,"deviationUnit",void 0),r([t({json:{read:{reader:r=>r?r.map((r=>p(r))).filter(e):null},write:{writer:(r,o)=>{o.geometries=r?.map((r=>r.toJSON()))??null}}}})],m.prototype,"geometries",void 0),r([t({type:Number,json:{write:!0}})],m.prototype,"maxDeviation",void 0),m=r([i("esri.rest.support.GeneralizeParameters")],m),m.from=s(m);const a=m;export{a 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.25/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as r}from"../../chunks/tslib.es6.js";import"../../geometry.js";import{JSONSupport as e}from"../../core/JSONSupport.js";import{property as o}from"../../core/accessorSupport/decorators/property.js";import"../../core/arrayUtils.js";import"../../core/has.js";import{Integer as t}from"../../core/accessorSupport/ensureType.js";import{subclass as s}from"../../core/accessorSupport/decorators/subclass.js";import{writer as p}from"../../core/accessorSupport/decorators/writer.js";import i from"../../geometry/Point.js";var m;let c=m=class extends e{constructor(){super(...arguments),this.geometries=null,this.rasterId=null}writeGeometry(r,e,o){e.geometries={geometryType:"esriGeometryPoint",geometries:r.map((r=>r.toJSON()))}}clone(){return new m({geometries:this.geometries
|
|
5
|
+
import{_ as r}from"../../chunks/tslib.es6.js";import"../../geometry.js";import{JSONSupport as e}from"../../core/JSONSupport.js";import{property as o}from"../../core/accessorSupport/decorators/property.js";import"../../core/arrayUtils.js";import"../../core/has.js";import{Integer as t}from"../../core/accessorSupport/ensureType.js";import{subclass as s}from"../../core/accessorSupport/decorators/subclass.js";import{writer as p}from"../../core/accessorSupport/decorators/writer.js";import i from"../../geometry/Point.js";var m;let c=m=class extends e{constructor(){super(...arguments),this.geometries=null,this.rasterId=null}writeGeometry(r,e,o){e.geometries={geometryType:"esriGeometryPoint",geometries:r.map((r=>r.toJSON()))}}clone(){return new m({geometries:this.geometries?.map((r=>r.clone()))??[],rasterId:this.rasterId})}};r([o({type:[i],json:{write:!0}})],c.prototype,"geometries",void 0),r([p("geometries")],c.prototype,"writeGeometry",null),r([o({type:t,json:{write:!0}})],c.prototype,"rasterId",void 0),c=m=r([s("esri.rest.support.ImagePixelLocationParameters")],c);const a=c;export{a 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.25/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as o}from"../../chunks/tslib.es6.js";import{JSONSupport as t}from"../../core/JSONSupport.js";import{property as e}from"../../core/accessorSupport/decorators/property.js";import"../../core/arrayUtils.js";import"../../core/has.js";import{ensureType as
|
|
5
|
+
import{_ as o}from"../../chunks/tslib.es6.js";import{JSONSupport as t}from"../../core/JSONSupport.js";import{isSome as r}from"../../core/maybe.js";import{property as e}from"../../core/accessorSupport/decorators/property.js";import"../../core/arrayUtils.js";import"../../core/has.js";import{ensureType as s}from"../../core/accessorSupport/ensureType.js";import{subclass as p}from"../../core/accessorSupport/decorators/subclass.js";import{fromJSON as i}from"../../geometry/support/jsonUtils.js";let m=class extends t{constructor(o){super(o),this.bevelRatio=null,this.geometries=null,this.offsetDistance=null,this.offsetHow=null,this.offsetUnit=null}};o([e({type:Number,json:{write:!0}})],m.prototype,"bevelRatio",void 0),o([e({json:{read:{reader:o=>o?o.map((o=>i(o))).filter(r):null},write:{writer:(o,t)=>{t.geometries=o?.map((o=>o.toJSON()))??null}}}})],m.prototype,"geometries",void 0),o([e({type:Number,json:{write:!0}})],m.prototype,"offsetDistance",void 0),o([e({type:String,json:{write:!0}})],m.prototype,"offsetHow",void 0),o([e({type:String,json:{write:!0}})],m.prototype,"offsetUnit",void 0),m=o([p("esri.rest.support.OffsetParameters")],m),m.from=s(m);const a=m;export{a 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.25/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as t}from"../../chunks/tslib.es6.js";import o from"../../core/Accessor.js";import{property as r}from"../../core/accessorSupport/decorators/property.js";import"../../core/arrayUtils.js";import"../../core/has.js";import"../../core/accessorSupport/ensureType.js";import{subclass as e}from"../../core/accessorSupport/decorators/subclass.js";let s=class extends o{constructor(t){super(t),this.attributionVisible=!0,this.exportOptions={width:800,height:1100,dpi:96},this.forceFeatureAttributes=!1,this.format="png32",this.label=null,this.layout="map-only",this.layoutOptions=null,this.outScale=0,this.scalePreserved=!0,this.showLabels=!0}};t([r()],s.prototype,"attributionVisible",void 0),t([r()],s.prototype,"exportOptions",void 0),t([r()],s.prototype,"forceFeatureAttributes",void 0),t([r()],s.prototype,"format",void 0),t([r()],s.prototype,"label",void 0),t([r()],s.prototype,"layout",void 0),t([r()],s.prototype,"layoutOptions",void 0),t([r()],s.prototype,"outScale",void 0),t([r()],s.prototype,"scalePreserved",void 0),t([r()],s.prototype,"showLabels",void 0),s=t([e("esri.rest.support.PrintTemplate")],s);const p=s;export{p as default};
|
|
5
|
+
import{_ as t}from"../../chunks/tslib.es6.js";import o from"../../core/Accessor.js";import{property as r}from"../../core/accessorSupport/decorators/property.js";import"../../core/arrayUtils.js";import"../../core/has.js";import"../../core/accessorSupport/ensureType.js";import{subclass as e}from"../../core/accessorSupport/decorators/subclass.js";let s=class extends o{constructor(t){super(t),this.attributionVisible=!0,this.exportOptions={width:800,height:1100,dpi:96},this.forceFeatureAttributes=!1,this.format="png32",this.label=null,this.layout="map-only",this.layoutItemId=null,this.layoutOptions=null,this.outScale=0,this.scalePreserved=!0,this.showLabels=!0}};t([r()],s.prototype,"attributionVisible",void 0),t([r()],s.prototype,"exportOptions",void 0),t([r()],s.prototype,"forceFeatureAttributes",void 0),t([r()],s.prototype,"format",void 0),t([r()],s.prototype,"label",void 0),t([r()],s.prototype,"layout",void 0),t([r()],s.prototype,"layoutItemId",void 0),t([r()],s.prototype,"layoutOptions",void 0),t([r()],s.prototype,"outScale",void 0),t([r()],s.prototype,"scalePreserved",void 0),t([r()],s.prototype,"showLabels",void 0),s=t([e("esri.rest.support.PrintTemplate")],s);const p=s;export{p 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.25/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as r}from"../../chunks/tslib.es6.js";import{JSONSupport as e}from"../../core/JSONSupport.js";import{
|
|
5
|
+
import{_ as r}from"../../chunks/tslib.es6.js";import{JSONSupport as e}from"../../core/JSONSupport.js";import{isSome as o}from"../../core/maybe.js";import{property as t}from"../../core/accessorSupport/decorators/property.js";import"../../core/arrayUtils.js";import"../../core/has.js";import{ensureType as s}from"../../core/accessorSupport/ensureType.js";import{subclass as i}from"../../core/accessorSupport/decorators/subclass.js";import{fromJSON as p}from"../../geometry/support/jsonUtils.js";let a=class extends e{constructor(r){super(r),this.geometries1=null,this.geometries2=null,this.relation=null,this.relationParameter=null}};r([t({json:{read:{reader:r=>r?r.map((r=>p(r))).filter(o):null},write:{writer:(r,e)=>{e.geometries1=r?.map((r=>r.toJSON()))??null}}}})],a.prototype,"geometries1",void 0),r([t({json:{read:{reader:r=>r?r.map((r=>p(r))).filter(o):null},write:{writer:(r,e)=>{e.geometries2=r?.map((r=>r.toJSON()))??null}}}})],a.prototype,"geometries2",void 0),r([t({type:String,json:{write:!0}})],a.prototype,"relation",void 0),r([t({type:String,json:{write:!0}})],a.prototype,"relationParameter",void 0),a=r([i("esri.rest.support.RelationParameters")],a),a.from=s(a);const m=a;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.25/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../chunks/tslib.es6.js";import{geometryTypes as t}from"../../geometry.js";import r from"../../TimeExtent.js";import{JSONMap as i}from"../../core/jsonMap.js";import{JSONSupport as o}from"../../core/JSONSupport.js";import{clone as s}from"../../core/lang.js";import{
|
|
5
|
+
import{_ as e}from"../../chunks/tslib.es6.js";import{geometryTypes as t}from"../../geometry.js";import r from"../../TimeExtent.js";import{JSONMap as i}from"../../core/jsonMap.js";import{JSONSupport as o}from"../../core/JSONSupport.js";import{clone as s}from"../../core/lang.js";import{isSome as n}from"../../core/maybe.js";import{property as p}from"../../core/accessorSupport/decorators/property.js";import{ensureType as l}from"../../core/accessorSupport/ensureType.js";import{subclass as a}from"../../core/accessorSupport/decorators/subclass.js";import{writer as u}from"../../core/accessorSupport/decorators/writer.js";import{fromJSON as c}from"../../geometry/support/jsonUtils.js";import d from"./TopFilter.js";import m from"../../geometry/SpatialReference.js";var y;const h=new i({esriSpatialRelIntersects:"intersects",esriSpatialRelContains:"contains",esriSpatialRelCrosses:"crosses",esriSpatialRelDisjoint:"disjoint",esriSpatialRelEnvelopeIntersects:"envelope-intersects",esriSpatialRelIndexIntersects:"index-intersects",esriSpatialRelOverlaps:"overlaps",esriSpatialRelTouches:"touches",esriSpatialRelWithin:"within",esriSpatialRelRelation:"relation"}),j=new i({esriSRUnit_Meter:"meters",esriSRUnit_Kilometer:"kilometers",esriSRUnit_Foot:"feet",esriSRUnit_StatuteMile:"miles",esriSRUnit_NauticalMile:"nautical-miles",esriSRUnit_USNauticalMile:"us-nautical-miles"});let S=y=class extends o{constructor(e){super(e),this.cacheHint=void 0,this.distance=void 0,this.geometry=null,this.geometryPrecision=void 0,this.maxAllowableOffset=void 0,this.num=void 0,this.objectIds=null,this.orderByFields=null,this.outFields=null,this.outSpatialReference=null,this.resultType=null,this.returnGeometry=!1,this.returnM=void 0,this.returnZ=void 0,this.start=void 0,this.spatialRelationship="intersects",this.timeExtent=null,this.topFilter=void 0,this.units=null,this.where="1=1"}writeStart(e,t){t.resultOffset=this.start,t.resultRecordCount=this.num||10}clone(){return new y(s({cacheHint:this.cacheHint,distance:this.distance,geometry:this.geometry,geometryPrecision:this.geometryPrecision,maxAllowableOffset:this.maxAllowableOffset,num:this.num,objectIds:this.objectIds,orderByFields:this.orderByFields,outFields:this.outFields,outSpatialReference:this.outSpatialReference,resultType:this.resultType,returnGeometry:this.returnGeometry,returnZ:this.returnZ,returnM:this.returnM,start:this.start,spatialRelationship:this.spatialRelationship,timeExtent:this.timeExtent,topFilter:this.topFilter,units:this.units,where:this.where}))}};e([p({type:Boolean,json:{write:!0}})],S.prototype,"cacheHint",void 0),e([p({type:Number,json:{write:{overridePolicy:e=>({enabled:e>0})}}})],S.prototype,"distance",void 0),e([p({types:t,json:{read:c,write:!0}})],S.prototype,"geometry",void 0),e([p({type:Number,json:{write:!0}})],S.prototype,"geometryPrecision",void 0),e([p({type:Number,json:{write:!0}})],S.prototype,"maxAllowableOffset",void 0),e([p({type:Number,json:{read:{source:"resultRecordCount"}}})],S.prototype,"num",void 0),e([p({json:{write:!0}})],S.prototype,"objectIds",void 0),e([p({type:[String],json:{write:!0}})],S.prototype,"orderByFields",void 0),e([p({type:[String],json:{write:!0}})],S.prototype,"outFields",void 0),e([p({type:m,json:{read:{source:"outSR"},write:{target:"outSR"}}})],S.prototype,"outSpatialReference",void 0),e([p({type:String,json:{write:!0}})],S.prototype,"resultType",void 0),e([p({json:{write:!0}})],S.prototype,"returnGeometry",void 0),e([p({type:Boolean,json:{write:{overridePolicy:e=>({enabled:e})}}})],S.prototype,"returnM",void 0),e([p({type:Boolean,json:{write:{overridePolicy:e=>({enabled:e})}}})],S.prototype,"returnZ",void 0),e([p({type:Number,json:{read:{source:"resultOffset"}}})],S.prototype,"start",void 0),e([u("start"),u("num")],S.prototype,"writeStart",null),e([p({type:String,json:{read:{source:"spatialRel",reader:h.read},write:{target:"spatialRel",writer:h.write}}})],S.prototype,"spatialRelationship",void 0),e([p({type:r,json:{write:!0}})],S.prototype,"timeExtent",void 0),e([p({type:d,json:{write:!0}})],S.prototype,"topFilter",void 0),e([p({type:String,json:{read:j.read,write:{writer:j.write,overridePolicy(e){return{enabled:n(e)&&n(this.distance)&&this.distance>0}}}}})],S.prototype,"units",void 0),e([p({type:String,json:{write:!0}})],S.prototype,"where",void 0),S=y=e([a("esri.rest.support.TopFeaturesQuery")],S),S.from=l(S);const v=S;export{v 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.25/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import t from"../../Graphic.js";import{isNone as e,isSome as r}from"../../core/maybe.js";import o from"../../geometry/Extent.js";import s from"../../geometry/Mesh.js";import n from"../../geometry/Point.js";import{fromAxisAndAngle as a}from"../../geometry/support/axisAngleDegrees.js";import i from"../../geometry/support/MeshTransform.js";import{AssetMapFieldRole as u,Status as
|
|
5
|
+
import t from"../../Graphic.js";import{isNone as e,isSome as r}from"../../core/maybe.js";import o from"../../geometry/Extent.js";import s from"../../geometry/Mesh.js";import n from"../../geometry/Point.js";import{fromAxisAndAngle as a}from"../../geometry/support/axisAngleDegrees.js";import i from"../../geometry/support/MeshTransform.js";import{AssetMapFieldRole as u,Status as m}from"../../portal/AssetMapFieldRole.js";import f from"./FeatureSet.js";function l(o,s,n){const a=n.features;n.features=[],delete n.geometryType;const i=f.fromJSON(n);i.geometryType="mesh";const u=i.spatialReference,m=e(o.outFields)||!o.outFields.length?()=>({}):c(o.outFields.includes("*")?null:new Set(o.outFields));for(const e of a){const o=p(e,u,s);r(o)&&i.features.push(new t({geometry:o,attributes:m(e)}))}return i}function c(t){return({attributes:e})=>{if(!e)return{};if(!t)return e;for(const r in e)t.has(r)||delete e[r];return e}}function p(t,e,r){const{status:n,source:a}=D(t);if(n===F.FAILED)return null;const i=g(t,e,r),u=o.fromJSON(t.geometry);u.spatialReference=e;const m=E(t,r);return n===F.PENDING?s.createIncomplete(i,{extent:u,transform:m}):s.createWithExternalSource(i,a,{extent:u,transform:m})}function g({attributes:t},e,{transformFieldRoles:r}){return new n({x:t[r.originX],y:t[r.originY],z:t[r.originZ],spatialReference:e})}function E({attributes:t,assetMappings:e},{transformFieldRoles:r}){return new i({translation:[t[r.translationX],t[r.translationY],t[r.translationZ]],rotation:a([t[r.rotationX],t[r.rotationY],t[r.rotationZ]],t[r.rotationDeg]),scale:[t[r.scaleX],t[r.scaleY],t[r.scaleZ]],geographic:!e[u.flags]?.includes("PROJECT_VERTICES")})}function D(t){if(!t.assetMappings)return{status:F.FAILED};const e=[],r=new Map;for(const o of t.assetMappings){const t=o[u.seqNo],s=o[u.assetName],n=o[u.assetURL],a=o[u.conversionStatus];if(a===m.FAILED)return{status:F.FAILED};if(a!==m.COMPLETED)return{status:F.PENDING};if(null==t)e.push({name:s,source:n});else{const o=r.get(s);let a;o?a=o.multipart:(a=[],e.push({name:s,source:{multipart:a}}),r.set(s,{multipart:a})),a[t]=n}}return{status:F.COMPLETED,source:e}}var F;!function(t){t[t.FAILED=0]="FAILED",t[t.PENDING=1]="PENDING",t[t.COMPLETED=2]="COMPLETED"}(F||(F={}));export{l as meshFeatureSetFromJSON};
|
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.25/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
const b="
|
|
5
|
+
const b="20220824",d="5e65b01952c660344143ff78d7dcd2aebd1b2aba";export{b as buildDate,d 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.25/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{getId as t}from"./CIMCursor.js";import{CurveHelper as s,PIXEL_TOLERANCE as e}from"./CurveHelper.js";const i=1e-7;class n{constructor(){this._values=[],this.extPtGap=0,this.ctrlPtGap=0,this._length=0,this._currentValue=0}isEmpty(){return 0===this._values.length}size(){return this._values.length}init(t,s,e=!0){if(this._setEmpty(),!t||0===t.length)return!1;for(let n=0;n<t.length;n++){let s=Math.abs(t[n]);e&&s<i&&(s=i),this._values.push(s),this._length+=s}return s&&1&t.length&&(this._length*=2),0!==this._length&&(this.ctrlPtGap=this.extPtGap=0,this._currentValue=-1,!0)}scale(t){const s=this._values?this._values.length:0;for(let e=0;e<s;++e)this._values[e]*=t;this._length*=t,this.extPtGap*=t,this.ctrlPtGap*=t}addValue(t){this._length+=t,this._values.push(t)}firstValue(){return this._values[0]}lastValue(){return this._values[this._values.length-1]}nextValue(){return this._currentValue++,this._currentValue===this._values.length&&(this._currentValue=0),this._values[this._currentValue]}reset(){this._currentValue=-1}length(){return this._length}_setEmpty(){this.extPtGap=this.ctrlPtGap=this._length=0,this._currentValue=-1,this._values.length=0}}var
|
|
5
|
+
import{getId as t}from"./CIMCursor.js";import{CurveHelper as s,PIXEL_TOLERANCE as e}from"./CurveHelper.js";const i=1e-7;class n{constructor(){this._values=[],this.extPtGap=0,this.ctrlPtGap=0,this._length=0,this._currentValue=0}isEmpty(){return 0===this._values.length}size(){return this._values.length}init(t,s,e=!0){if(this._setEmpty(),!t||0===t.length)return!1;for(let n=0;n<t.length;n++){let s=Math.abs(t[n]);e&&s<i&&(s=i),this._values.push(s),this._length+=s}return s&&1&t.length&&(this._length*=2),0!==this._length&&(this.ctrlPtGap=this.extPtGap=0,this._currentValue=-1,!0)}scale(t){const s=this._values?this._values.length:0;for(let e=0;e<s;++e)this._values[e]*=t;this._length*=t,this.extPtGap*=t,this.ctrlPtGap*=t}addValue(t){this._length+=t,this._values.push(t)}firstValue(){return this._values[0]}lastValue(){return this._values[this._values.length-1]}nextValue(){return this._currentValue++,this._currentValue===this._values.length&&(this._currentValue=0),this._values[this._currentValue]}reset(){this._currentValue=-1}length(){return this._length}_setEmpty(){this.extPtGap=this.ctrlPtGap=this._length=0,this._currentValue=-1,this._values.length=0}}class h{constructor(){this.pt=null,this.ca=0,this.sa=0}}var r;!function(t){t[t.FAIL=0]="FAIL",t[t.END=1]="END",t[t.CONTINUE=2]="CONTINUE"}(r||(r={}));class a{constructor(){this.reset()}reset(){this.segment=-1,this.segmentLength=0,this.abscissa=0,this.isPathEnd=!1,this.isPartEnd=!1}isValid(){return-1!==this.segment}copyTo(t){t.segment=this.segment,t.segmentLength=this.segmentLength,t.abscissa=this.abscissa,t.isPathEnd=this.isPathEnd,t.isPartEnd=this.isPartEnd}}class g extends s{constructor(t=0,s=!1){super(t,s),this._tolerance=e,this._currentPosition=new a}updateTolerance(t){this._tolerance=e*t}init(t,s,e=!0){return e?(this._patternLength=s.length(),this._partExtPtGap=s.extPtGap,this._partCtrlPtGap=s.ctrlPtGap):(this._patternLength=0,this._partExtPtGap=0,this._partCtrlPtGap=0),this._currentPosition.reset(),this._partSegCount=0,this._path=t,this._seg=-1,this._setPosAtNextPart()}curPositionIsValid(){return this._currentPosition.isValid()}nextPosition(t,s=r.FAIL){const e=new a;return!!this._nextPosition(t,e,null,s)&&(e.copyTo(this._currentPosition),!0)}curPointAndAngle(t){t.pt=this._getPoint(this._currentPosition);const[s,e]=this._getAngle(this._currentPosition);t.ca=s,t.sa=e}nextPointAndAngle(t,s,e=r.FAIL){const i=new a;if(!this._nextPosition(t,i,null,e))return!1;i.copyTo(this._currentPosition),s.pt=this._getPoint(i);const[n,h]=this._getAngle(i);return s.ca=n,s.sa=h,!0}nextCurve(t){if(0===t)return null;const s=[],e=new a;return this._nextPosition(t,e,s,r.END)?(e.copyTo(this._currentPosition),s):null}isPathEnd(){return this._currentPosition.isPathEnd}getPathEnd(){if(-1===this._currentPosition.segment)throw new Error("missing segment");return this._path[this._currentPosition.segment+1]}_nextPosition(t,s,e,i){if(this._currentPosition.isPathEnd)return!1;let n=this._currentPosition.abscissa;for(this._currentPosition.segmentLength>0&&(n/=this._currentPosition.segmentLength),this._currentPosition.copyTo(s);s.abscissa+t*this._partLengthRatio>s.segmentLength+this._tolerance;){if(e){if(0===e.length)if(0===n){const t=this._path[s.segment];e.push([t[0],t[1]])}else e.push(this.getSegCoord2D(this._path,s.segment,n));const t=this._path[s.segment+1];e.push([t[0],t[1]])}if(n=0,t-=(s.segmentLength-s.abscissa)/this._partLengthRatio,this._partSegCount)s.segment=this._nextSegment(),s.segmentLength=this.calculateSegLength(this._path,s.segment),s.abscissa=0,this._partSegCount--;else{if(!this._setPosAtNextPart())return i!==r.FAIL&&(s.segmentLength=this.calculateSegLength(this._path,s.segment),s.isPartEnd=!0,i===r.END?(s.abscissa=s.segmentLength,s.isPathEnd=!0):s.abscissa=s.segmentLength+t,!0);this._currentPosition.copyTo(s)}}if(s.abscissa+=t*this._partLengthRatio,e){if(0===e.length)if(0===n){const t=this._path[s.segment];e.push([t[0],t[1]])}else e.push(this.getSegCoord2D(this._path,s.segment,n));const t=s.abscissa/s.segmentLength;if(1===t){const t=this._path[s.segment+1];e.push([t[0],t[1]])}else e.push(this.getSegCoord2D(this._path,s.segment,t))}return this._partSegCount||Math.abs(s.abscissa-s.segmentLength)<this._tolerance&&(s.isPathEnd=this._partIsLast,s.isPartEnd=!0),!0}_getPoint(t){if(-1===t.segment)throw new Error("missing segment");const s=t.segmentLength<=0?0:t.abscissa/t.segmentLength;return this.getSegCoord2D(this._path,t.segment,s)}_getAngle(t){if(-1===t.segment)throw new Error("missing segment");const s=t.segmentLength<=0?0:t.abscissa/t.segmentLength;return this.getSegAngleCS(this._path,t.segment,s)}_setPosAtNextPart(){for(;this._partSegCount;)this._hasNextSegment()&&this._nextSegment(),this._partSegCount--;if(!this._hasNextSegment())return!1;for(this._partLength=0,this._partIsLast=!0,this._partSegCount=0;this._hasNextSegment();)if(this._partLength+=this.calculateSegLength(this._path,this._nextSegment()),this._partSegCount++,1===t(this._path[this._getEndPointIndex()])){this._partIsLast=!this._hasNextSegment();break}let s=this._partSegCount;for(;s;)this._previousSegment(),--s;this._currentPosition.segment=this._nextSegment(),this._currentPosition.segmentLength=this.calculateSegLength(this._path,this._currentPosition.segment),this._currentPosition.abscissa=0,this._currentPosition.isPathEnd=this._currentPosition.isPartEnd=!1,--this._partSegCount;const e=this._getStartPointIndex();this._ctrlPtBegin=1===t(this._path[e]);let i=e+this._partSegCount+1;if(i>=this._path.length&&(i=0),this._ctrlPtEnd=1===t(this._path[i]),this._patternLength>0){const t=this._ctrlPtBegin?this._partCtrlPtGap:this._partExtPtGap,s=this._ctrlPtEnd?this._partCtrlPtGap:this._partExtPtGap;let e=Math.round((this._partLength-(t+s))/this._patternLength);e<=0&&(e=t+s>0?0:1),this._partLengthRatio=this._partLength/(t+s+e*this._patternLength),this._partLengthRatio<.01&&(this._partLengthRatio=1)}else this._partLengthRatio=1;return!0}_hasNextSegment(){return this._seg<this._path.length-2}_previousSegment(){return--this._seg}_nextSegment(){return++this._seg}_getStartPointIndex(){return this._seg}_getEndPointIndex(){return this._seg+1}}export{n as DashPattern,r as EndType,g as GeometryWalker,h as Pos};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.25/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{PathGeometryCursor as t}from"../CIMCursor.js";import{PathHelper as e}from"../CurveHelper.js";import{LineDashEnding as s}from"../enums.js";import{GeometryWalker as a,DashPattern as i}from"../GeometryWalker.js";class r{static local(){return null===r.instance&&(r.instance=new r),r.instance}execute(t,e,s,a){return new n(t,e,s)}}r.instance=null;class n extends t{constructor(t,e,s){super(t,!0,!0),this._walker=new a,this._walker.updateTolerance(s),this._endings=e.lineDashEnding,this._customDashPos=-(e.offsetAlongLine??0)*s,this._offsetAtEnd=(e.customEndingOffset??0)*s,this._pattern=new i,this._pattern.init(e.dashTemplate,!0),this._pattern.scale(s)}processPath(t){if(0===this._pattern.length())return this.iteratePath=!1,{paths:[t]};if(!this.iteratePath){let e=!0;switch(this._endings){case s.HalfPattern:case s.HalfGap:default:this._pattern.extPtGap=0;break;case s.FullPattern:this.isClosed||(this._pattern.extPtGap=.5*this._pattern.firstValue());break;case s.FullGap:this.isClosed||(this._pattern.extPtGap=.5*this._pattern.lastValue());break;case s.NoConstraint:this.isClosed||(e=!1);break;case s.Custom:this.isClosed||(this._pattern.extPtGap=.5*this._offsetAtEnd)}const a=this._walker.calculatePathLength(t);if(this._pattern.isEmpty()||a<.1*this._pattern.length())return{paths:[t]};if(!this._walker.init(t,this._pattern,e))return{paths:[t]}}let a;if(this.iteratePath)a=this._pattern.nextValue();else{let t;switch(this._endings){case s.HalfPattern:default:t=.5*this._pattern.firstValue();break;case s.HalfGap:t=.5*-this._pattern.lastValue();break;case s.FullGap:t=-this._pattern.lastValue();break;case s.FullPattern:t=0;break;case s.NoConstraint:case s.Custom:t=-this._customDashPos}let e=t/this._pattern.length();e-=Math.floor(e),t=e*this._pattern.length(),this._pattern.reset(),a=this._pattern.nextValue();let i=!1;for(;t>=a;)t-=a,a=this._pattern.nextValue(),i=!i;a-=t,i?(this._walker.nextPosition(a),a=this._pattern.nextValue()):this.isClosed&&(this._firstCurve=this._walker.nextCurve(a),a=this._pattern.nextValue(),this._walker.nextPosition(a),a=this._pattern.nextValue())}let i=this._walker.nextCurve(a);return i?this._walker.isPathEnd()?(this.iteratePath=!1,this._firstCurve&&(this._firstCurve.splice(0,1),e.mergePath(i,this._firstCurve),this._firstCurve=null)):(a=this._pattern.nextValue(),!this._walker.nextPosition(a)||this._walker.isPathEnd()?(this.iteratePath=!1,this._firstCurve&&(i=this._firstCurve,this._firstCurve=null)):this.iteratePath=!0):(this.iteratePath=!1,i=this._firstCurve,this._firstCurve=null),{paths:[i]}}}export{r as EffectDashes};
|
|
5
|
+
import{PathGeometryCursor as t}from"../CIMCursor.js";import{PathHelper as e}from"../CurveHelper.js";import{LineDashEnding as s}from"../enums.js";import{GeometryWalker as a,DashPattern as i}from"../GeometryWalker.js";class r{static local(){return null===r.instance&&(r.instance=new r),r.instance}execute(t,e,s,a){return new n(t,e,s)}}r.instance=null;class n extends t{constructor(t,e,s){super(t,!0,!0),this._firstCurve=null,this._walker=new a,this._walker.updateTolerance(s),this._endings=e.lineDashEnding,this._customDashPos=-(e.offsetAlongLine??0)*s,this._offsetAtEnd=(e.customEndingOffset??0)*s,this._pattern=new i,this._pattern.init(e.dashTemplate,!0),this._pattern.scale(s)}processPath(t){if(0===this._pattern.length())return this.iteratePath=!1,{paths:[t]};if(!this.iteratePath){let e=!0;switch(this._endings){case s.HalfPattern:case s.HalfGap:default:this._pattern.extPtGap=0;break;case s.FullPattern:this.isClosed||(this._pattern.extPtGap=.5*this._pattern.firstValue());break;case s.FullGap:this.isClosed||(this._pattern.extPtGap=.5*this._pattern.lastValue());break;case s.NoConstraint:this.isClosed||(e=!1);break;case s.Custom:this.isClosed||(this._pattern.extPtGap=.5*this._offsetAtEnd)}const a=this._walker.calculatePathLength(t);if(this._pattern.isEmpty()||a<.1*this._pattern.length())return{paths:[t]};if(!this._walker.init(t,this._pattern,e))return{paths:[t]}}let a;if(this.iteratePath)a=this._pattern.nextValue();else{let t;switch(this._endings){case s.HalfPattern:default:t=.5*this._pattern.firstValue();break;case s.HalfGap:t=.5*-this._pattern.lastValue();break;case s.FullGap:t=-this._pattern.lastValue();break;case s.FullPattern:t=0;break;case s.NoConstraint:case s.Custom:t=-this._customDashPos}let e=t/this._pattern.length();e-=Math.floor(e),t=e*this._pattern.length(),this._pattern.reset(),a=this._pattern.nextValue();let i=!1;for(;t>=a;)t-=a,a=this._pattern.nextValue(),i=!i;a-=t,i?(this._walker.nextPosition(a),a=this._pattern.nextValue()):this.isClosed&&(this._firstCurve=this._walker.nextCurve(a),a=this._pattern.nextValue(),this._walker.nextPosition(a),a=this._pattern.nextValue())}let i=this._walker.nextCurve(a);return i?this._walker.isPathEnd()?(this.iteratePath=!1,this._firstCurve&&(this._firstCurve.splice(0,1),e.mergePath(i,this._firstCurve),this._firstCurve=null)):(a=this._pattern.nextValue(),!this._walker.nextPosition(a)||this._walker.isPathEnd()?(this.iteratePath=!1,this._firstCurve&&(i=this._firstCurve,this._firstCurve=null)):this.iteratePath=!0):(this.iteratePath=!1,i=this._firstCurve,this._firstCurve=null),{paths:[i]}}}export{r as EffectDashes};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.25/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{isPolyline as t,isPolygon as e}from"../../../geometry/support/jsonUtils.js";import{PathHelper as i}from"../CurveHelper.js";import{GeometricEffectWaveform as s}from"../enums.js";import{DashPattern as h,GeometryWalker as n}from"../GeometryWalker.js";class
|
|
5
|
+
import{isPolyline as t,isPolygon as e}from"../../../geometry/support/jsonUtils.js";import{PathHelper as i}from"../CurveHelper.js";import{GeometricEffectWaveform as s}from"../enums.js";import{DashPattern as h,GeometryWalker as n,Pos as r}from"../GeometryWalker.js";class a{static local(){return null===a.instance&&(a.instance=new a),a.instance}execute(t,e,i,s){return new o(t,e,i)}}a.instance=null;class o{constructor(t,e,i){this._inputGeometries=t,this._height=(void 0!==e.amplitude?e.amplitude:2)*i,this._period=(void 0!==e.period?e.period:3)*i,this._style=e.waveform,this._height<=0&&(this._height=Math.abs(this._height)),this._period<=0&&(this._period=Math.abs(this._period)),this._pattern=new h,this._pattern.addValue(this._period),this._pattern.addValue(this._period),this._walker=new n,this._walker.updateTolerance(i)}next(){let i=this._inputGeometries.next();for(;i;){if(0===this._height||0===this._period)return i;if(t(i)){const t=this._processGeom(i.paths);if(t.length)return{paths:t}}if(e(i)){const t=this._processGeom(i.rings);if(t.length)return{rings:t}}i=this._inputGeometries.next()}return null}_processGeom(t){const e=[];for(const i of t)if(this._walker.init(i,this._pattern))switch(this._style){case s.Sinus:default:e.push(this._constructCurve(i,!1));break;case s.Square:e.push(this._constructSquare(i));break;case s.Triangle:e.push(this._constructTriangle(i));break;case s.Random:e.push(this._constructCurve(i,!0))}else e.push(i);return e}_constructCurve(t,e){const s=new i,h=this._walker.calculatePathLength(t);let n=Math.round(h/this._period);0===n&&(n=1);const a=n*16+1,o=h/n,l=this._period/16,_=1/a,c=2*Math.PI*h/o,p=2*Math.PI*Math.random(),u=2*Math.PI*Math.random(),d=2*Math.PI*Math.random(),g=.75-Math.random()/2,w=.75-Math.random()/2,f=new r;this._walker.curPointAndAngle(f),s.startPath(f.pt);let k=0;for(;;){if(!this._walker.nextPointAndAngle(l,f)){s.lineTo(t[t.length-1]);break}{const t=k;let i;if(k+=_,e){const e=this._height/2*(1+.3*Math.sin(g*c*t+p));i=e*Math.sin(c*t+u),i+=e*Math.sin(w*c*t+d),i/=2}else i=.5*this._height*Math.sin(.5*c*t);s.lineTo([f.pt[0]-i*f.sa,f.pt[1]+i*f.ca])}}return s.path()}_constructSquare(t){const e=new i,s=this._walker.calculatePathLength(t);Math.round(s/this._period);let h=!0;for(;;){let t=!1;if(this._walker.curPositionIsValid()){const i=new r;this._walker.curPointAndAngle(i);const s=new r;if(this._walker.nextPointAndAngle(this._period,s)){const n=new r;this._walker.nextPointAndAngle(this._period,n)&&(h?(e.startPath(i.pt),h=!1):e.lineTo(i.pt),e.lineTo([i.pt[0]-this._height/2*i.sa,i.pt[1]+this._height/2*i.ca]),e.lineTo([s.pt[0]-this._height/2*s.sa,s.pt[1]+this._height/2*s.ca]),e.lineTo([s.pt[0]+this._height/2*s.sa,s.pt[1]-this._height/2*s.ca]),e.lineTo([n.pt[0]+this._height/2*n.sa,n.pt[1]-this._height/2*n.ca]),t=!0)}}if(!t){e.lineTo(this._walker.getPathEnd());break}}return e.path()}_constructTriangle(t){const e=new i,s=this._walker.calculatePathLength(t);Math.round(s/this._period);let h=!0;for(;;){let t=!1;if(this._walker.curPositionIsValid()){const i=new r;this._walker.curPointAndAngle(i);const s=new r;if(this._walker.nextPointAndAngle(this._period/2,s)){const n=new r;this._walker.nextPointAndAngle(this._period,n)&&(this._walker.nextPosition(this._period/2)&&(h?(e.startPath(i.pt),h=!1):e.lineTo(i.pt),e.lineTo([s.pt[0]-this._height/2*s.sa,s.pt[1]+this._height/2*s.ca]),e.lineTo([n.pt[0]+this._height/2*n.sa,n.pt[1]-this._height/2*n.ca])),t=!0)}}if(!t){e.lineTo(this._walker.getPathEnd());break}}return e.path()}}export{a as EffectWave};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.25/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{PathTransformationCursor as t}from"../CIMCursor.js";import{PlacementEndings as e}from"../enums.js";import{GeometryWalker as s,DashPattern as i}from"../GeometryWalker.js";class
|
|
5
|
+
import{PathTransformationCursor as t}from"../CIMCursor.js";import{PlacementEndings as e}from"../enums.js";import{GeometryWalker as s,DashPattern as i,Pos as n}from"../GeometryWalker.js";class a{static local(){return null===a.instance&&(a.instance=new a),a.instance}execute(t,e,s,i){return new r(t,e,s)}}a.instance=null;class r extends t{constructor(t,e,n){super(t,!0,!0),this._geometryWalker=new s,this._geometryWalker.updateTolerance(n),this._angleToLine=e.angleToLine??!0,this._offset=(e.offset?e.offset:0)*n,this._originalEndings=e.endings,this._offsetAtEnd=(e.customEndingOffset?e.customEndingOffset:0)*n,this._position=-(e.offsetAlongLine?e.offsetAlongLine:0)*n,this._pattern=new i,this._pattern.init(e.placementTemplate,!1),this._pattern.scale(n),this._endings=this._originalEndings}processPath(t){if(this._pattern.isEmpty())return null;let s;if(this.iteratePath)s=this._pattern.nextValue();else{this._originalEndings===e.WithFullGap&&this.isClosed?this._endings=e.WithMarkers:this._endings=this._originalEndings,this._pattern.extPtGap=0;let i,n=!0;switch(this._endings){case e.NoConstraint:i=-this._position,i=this._adjustPosition(i),n=!1;break;case e.WithHalfGap:default:i=-this._pattern.lastValue()/2;break;case e.WithFullGap:i=-this._pattern.lastValue(),this._pattern.extPtGap=this._pattern.lastValue();break;case e.WithMarkers:i=0;break;case e.Custom:i=-this._position,i=this._adjustPosition(i),this._pattern.extPtGap=.5*this._offsetAtEnd}if(!this._geometryWalker.init(t,this._pattern,n))return null;this._pattern.reset();let a=0;for(;i>a;)i-=a,a=this._pattern.nextValue();a-=i,s=a,this.iteratePath=!0}const i=new n;return this._geometryWalker.nextPointAndAngle(s,i)?this._endings===e.WithFullGap&&this._geometryWalker.isPathEnd()?(this.iteratePath=!1,null):this._endings===e.WithMarkers&&this._geometryWalker.isPathEnd()&&(this.iteratePath=!1,this.isClosed)?null:(this.internalPlacement.setTranslate(i.pt[0]-this._offset*i.sa,i.pt[1]+this._offset*i.ca),this._angleToLine&&this.internalPlacement.setRotateCS(i.ca,i.sa),this.internalPlacement):(this.iteratePath=!1,null)}_adjustPosition(t){let e=t/this._pattern.length();return e-=Math.floor(e),e*this._pattern.length()}}export{a as PlacementAlongLineSameSize};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.25/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{PathTransformationCursor as t}from"../CIMCursor.js";import{GeometryWalker as i,DashPattern as s,EndType as
|
|
5
|
+
import{PathTransformationCursor as t}from"../CIMCursor.js";import{GeometryWalker as i,DashPattern as s,Pos as e,EndType as n}from"../GeometryWalker.js";class a{static local(){return null===a.instance&&(a.instance=new a),a.instance}execute(t,i,s,e){return new r(t,i,s)}}a.instance=null;class r extends t{constructor(t,e,n){super(t,!0,!0),this._walker=new i,this._walker.updateTolerance(n),this._angleToLine=void 0===e.angleToLine||e.angleToLine,this._offset=void 0!==e.offset?e.offset*n:0,this._beginGap=void 0!==e.beginPosition?e.beginPosition*n:0,this._endGap=void 0!==e.endPosition?e.endPosition*n:0,this._flipFirst=void 0===e.flipFirst||e.flipFirst,this._pattern=new s,this._pattern.init(e.positionArray,!1,!1),this._subPathLen=0,this._posCount=this._pattern.size(),this._isFirst=!0,this._prevPos=0}processPath(t){if(this._pattern.isEmpty())return null;let i;if(this.iteratePath){const t=this._pattern.nextValue()*this._subPathLen,s=this._beginGap+t;i=s-this._prevPos,this._prevPos=s}else{if(this._posCount=this._pattern.size(),this._isFirst=!0,this._prevPos=0,this._subPathLen=this._walker.calculatePathLength(t)-this._beginGap-this._endGap,this._subPathLen<0)return this.iteratePath=!1,null;if(!this._walker.init(t,this._pattern,!1))return null;this._pattern.reset();const s=this._pattern.nextValue()*this._subPathLen,e=this._beginGap+s;i=e-this._prevPos,this._prevPos=e,this.iteratePath=!0}const s=new e;if(!this._walker.nextPointAndAngle(i,s,n.END))return this.iteratePath=!1,null;this.internalPlacement.setTranslate(s.pt[0]-this._offset*s.sa,s.pt[1]+this._offset*s.ca);const a=this._isFirst&&this._flipFirst;let r,h;return this._angleToLine?(r=s.ca,h=s.sa):(r=1,h=0),a&&(r=-r,h=-h),this.internalPlacement.setRotateCS(r,h),this._isFirst=!1,this._posCount--,0===this._posCount&&(this.iteratePath=!1),this.internalPlacement}}export{a as PlacementAtRatioPositions};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.25/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../core/Accessor.js";import{property as o}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/arrayUtils.js";import"../../../core/has.js";import"../../../core/accessorSupport/ensureType.js";import{subclass as s}from"../../../core/accessorSupport/decorators/subclass.js";var i;let a=i=class extends t{constructor(e){super(e),this._lodByScale={},this._scales=[],this.effectiveLODs=null,this.effectiveMinZoom=-1,this.effectiveMaxZoom=-1,this.effectiveMinScale=0,this.effectiveMaxScale=0,this.lods=null,this.minZoom=-1,this.maxZoom=-1,this.minScale=0,this.maxScale=0,this.snapToZoom=!0}initialize(){let e,{lods:t,minScale:o,maxScale:s,minZoom:i,maxZoom:a}=this,c=-1,r=-1,l=!1,n=!1;if(0!==o&&0!==s&&o<s&&([o,s]=[s,o]),!t||!t.length)return this._set("effectiveMinScale",o),void this._set("effectiveMaxScale",s);t=t.map((e=>e.clone())),t.sort(((e,t)=>t.scale-e.scale)),t.forEach(((e,t)=>e.level=t));for(const f of t)!l&&o>0&&o>=f.scale&&(c=f.level,l=!0),!n&&s>0&&s>=f.scale&&(r=e?e.level:-1,n=!0),e=f;-1===i&&(i=0===o?0:c),-1===a&&(a=0===s?t.length-1:r),i=Math.max(i,0),i=Math.min(i,t.length-1),a=Math.max(a,0),a=Math.min(a,t.length-1),i>a&&([i,a]=[a,i]),o=t[i].scale,s=t[a].scale,t.splice(0,i),t.splice(a-i+1,t.length),t.forEach(((e,t)=>{this._lodByScale[e.scale]=e,this._scales[t]=e.scale})),this._set("effectiveLODs",t),this._set("effectiveMinZoom",i),this._set("effectiveMaxZoom",a),this._set("effectiveMinScale",o),this._set("effectiveMaxScale",s)}constrain(e,t){if(t&&e.scale===t.scale)return e;const o=this.effectiveMinScale,s=this.effectiveMaxScale,i=e.targetGeometry,a=t&&t.targetGeometry,c=0!==s&&e.scale<s,r=0!==o&&e.scale>o;if(c||r){const c=r?o:s;if(a){const o=(c-t.scale)/(e.scale-t.scale);i.x=a.x+(i.x-a.x)*o,i.y=a.y+(i.y-a.y)*o}e.scale=c}return this.snapToZoom&&this.effectiveLODs&&(e.scale=this._getClosestScale(e.scale)),e}fit(e){if(!this.effectiveLODs||!this.snapToZoom)return this.constrain(e,null);const t=this.scaleToZoom(e.scale),o=Math.abs(t-Math.floor(t));return e.scale=this.zoomToScale(o>.99?Math.round(t):Math.floor(t)),e}zoomToScale(e){if(!this.effectiveLODs)return 0;e-=this.effectiveMinZoom,e=Math.max(0,e);const t=this._scales;if(e<=0)return t[0];if(e>=t.length)return t[t.length-1];const o=Math.round(e-.5),s=Math.round(e);return t[s]+(s-e)*(t[o]-t[s])}scaleToZoom(e){if(!this.effectiveLODs)return-1;const t=this._scales;let o,s;if(e>=t[0])return this.effectiveMinZoom;if(e<=t[t.length-1])return this.effectiveMaxZoom;for(let i=0;i<t.length-1;i++){if(o=t[i],s=t[i+1],s===e){return i+this.effectiveMinZoom+1}if(o>e&&s<e){return i+this.effectiveMinZoom+1-(e-s)/(o-s)}}}snapToClosestScale(e){if(!this.effectiveLODs)return e;const t=this.scaleToZoom(e);return this.zoomToScale(Math.round(t))}snapToNextScale(e,t=.5){if(!this.effectiveLODs)return e*t;const o=Math.round(this.scaleToZoom(e));return this.zoomToScale(o+1)}snapToPreviousScale(e,t=2){if(!this.effectiveLODs)return e*t;const o=Math.round(this.scaleToZoom(e));return this.zoomToScale(o-1)}clone(){return new i({lods:this.lods,minZoom:this.minZoom,maxZoom:this.maxZoom,minScale:this.minScale,maxScale:this.maxScale})}_getClosestScale(e){return this._lodByScale[e]||(e=this._scales.reduce(((t,o)=>Math.abs(o-e)<=Math.abs(t-e)?o:t),this._scales[0])),this._lodByScale[e].scale}};e([o({readOnly:!0})],a.prototype,"effectiveLODs",void 0),e([o({readOnly:!0})],a.prototype,"effectiveMinZoom",void 0),e([o({readOnly:!0})],a.prototype,"effectiveMaxZoom",void 0),e([o({readOnly:!0})],a.prototype,"effectiveMinScale",void 0),e([o({readOnly:!0})],a.prototype,"effectiveMaxScale",void 0),e([o()],a.prototype,"lods",void 0),e([o()],a.prototype,"minZoom",void 0),e([o()],a.prototype,"maxZoom",void 0),e([o()],a.prototype,"minScale",void 0),e([o()],a.prototype,"maxScale",void 0),e([o()],a.prototype,"snapToZoom",void 0),a=i=e([s("esri.views.2d.constraints.ZoomConstraint")],a);const c=a;export{c as default};
|
|
5
|
+
import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../core/Accessor.js";import{property as o}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/arrayUtils.js";import"../../../core/has.js";import"../../../core/accessorSupport/ensureType.js";import{subclass as s}from"../../../core/accessorSupport/decorators/subclass.js";var i;let a=i=class extends t{constructor(e){super(e),this._lodByScale={},this._scales=[],this.effectiveLODs=null,this.effectiveMinZoom=-1,this.effectiveMaxZoom=-1,this.effectiveMinScale=0,this.effectiveMaxScale=0,this.lods=null,this.minZoom=-1,this.maxZoom=-1,this.minScale=0,this.maxScale=0,this.snapToZoom=!0}initialize(){let e,{lods:t,minScale:o,maxScale:s,minZoom:i,maxZoom:a}=this,c=-1,r=-1,l=!1,n=!1;if(0!==o&&0!==s&&o<s&&([o,s]=[s,o]),!t||!t.length)return this._set("effectiveMinScale",o),void this._set("effectiveMaxScale",s);t=t.map((e=>e.clone())),t.sort(((e,t)=>t.scale-e.scale)),t.forEach(((e,t)=>e.level=t));for(const f of t)!l&&o>0&&o>=f.scale&&(c=f.level,l=!0),!n&&s>0&&s>=f.scale&&(r=e?e.level:-1,n=!0),e=f;-1===i&&(i=0===o?0:c),-1===a&&(a=0===s?t.length-1:r),i=Math.max(i,0),i=Math.min(i,t.length-1),a=Math.max(a,0),a=Math.min(a,t.length-1),i>a&&([i,a]=[a,i]),o=t[i].scale,s=t[a].scale,t.splice(0,i),t.splice(a-i+1,t.length),t.forEach(((e,t)=>{this._lodByScale[e.scale]=e,this._scales[t]=e.scale})),this._set("effectiveLODs",t),this._set("effectiveMinZoom",i),this._set("effectiveMaxZoom",a),this._set("effectiveMinScale",o),this._set("effectiveMaxScale",s)}constrain(e,t){if(t&&e.scale===t.scale)return e;const o=this.effectiveMinScale,s=this.effectiveMaxScale,i=e.targetGeometry,a=t&&t.targetGeometry,c=0!==s&&e.scale<s,r=0!==o&&e.scale>o;if(c||r){const c=r?o:s;if(t&&a){const o=(c-t.scale)/(e.scale-t.scale);i.x=a.x+(i.x-a.x)*o,i.y=a.y+(i.y-a.y)*o}e.scale=c}return this.snapToZoom&&this.effectiveLODs&&(e.scale=this._getClosestScale(e.scale)),e}fit(e){if(!this.effectiveLODs||!this.snapToZoom)return this.constrain(e,null);const t=this.scaleToZoom(e.scale),o=Math.abs(t-Math.floor(t));return e.scale=this.zoomToScale(o>.99?Math.round(t):Math.floor(t)),e}zoomToScale(e){if(!this.effectiveLODs)return 0;e-=this.effectiveMinZoom,e=Math.max(0,e);const t=this._scales;if(e<=0)return t[0];if(e>=t.length)return t[t.length-1];const o=Math.round(e-.5),s=Math.round(e);return t[s]+(s-e)*(t[o]-t[s])}scaleToZoom(e){if(!this.effectiveLODs)return-1;const t=this._scales;let o,s;if(e>=t[0])return this.effectiveMinZoom;if(e<=t[t.length-1])return this.effectiveMaxZoom;for(let i=0;i<t.length-1;i++){if(o=t[i],s=t[i+1],s===e){return i+this.effectiveMinZoom+1}if(o>e&&s<e){return i+this.effectiveMinZoom+1-(e-s)/(o-s)}}return-1}snapToClosestScale(e){if(!this.effectiveLODs)return e;const t=this.scaleToZoom(e);return this.zoomToScale(Math.round(t))}snapToNextScale(e,t=.5){if(!this.effectiveLODs)return e*t;const o=Math.round(this.scaleToZoom(e));return this.zoomToScale(o+1)}snapToPreviousScale(e,t=2){if(!this.effectiveLODs)return e*t;const o=Math.round(this.scaleToZoom(e));return this.zoomToScale(o-1)}clone(){return new i({lods:this.lods,minZoom:this.minZoom,maxZoom:this.maxZoom,minScale:this.minScale,maxScale:this.maxScale})}_getClosestScale(e){return this._lodByScale[e]||(e=this._scales.reduce(((t,o)=>Math.abs(o-e)<=Math.abs(t-e)?o:t),this._scales[0])),this._lodByScale[e].scale}};e([o({readOnly:!0})],a.prototype,"effectiveLODs",void 0),e([o({readOnly:!0})],a.prototype,"effectiveMinZoom",void 0),e([o({readOnly:!0})],a.prototype,"effectiveMaxZoom",void 0),e([o({readOnly:!0})],a.prototype,"effectiveMinScale",void 0),e([o({readOnly:!0})],a.prototype,"effectiveMaxScale",void 0),e([o()],a.prototype,"lods",void 0),e([o()],a.prototype,"minZoom",void 0),e([o()],a.prototype,"maxZoom",void 0),e([o()],a.prototype,"minScale",void 0),e([o()],a.prototype,"maxScale",void 0),e([o()],a.prototype,"snapToZoom",void 0),a=i=e([s("esri.views.2d.constraints.ZoomConstraint")],a);const c=a;export{c as default};
|
package/views/2d/engine/Stage.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.25/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import e from"../../../core/Error.js";import{on as t}from"../../../core/events.js";import has from"../../../core/has.js";import{isSome as r}from"../../../core/maybe.js";import{watch as s,initial as i}from"../../../core/reactiveUtils.js";import{addFrameTask as n}from"../../../core/scheduling.js";import{c as a}from"../../../chunks/mat3f32.js";import o from"../../../symbols/cim/CIMResourceManager.js";import{Container as h}from"./Container.js";import{WGLDrawPhase as d}from"./webgl/enums.js";import l from"./webgl/Painter.js";import{Profiler as p}from"./webgl/Profiler.js";import{Timeline as c}from"../support/Timeline.js";import{resampleHermite as u
|
|
5
|
+
import e from"../../../core/Error.js";import{on as t}from"../../../core/events.js";import has from"../../../core/has.js";import{isSome as r}from"../../../core/maybe.js";import{watch as s,initial as i}from"../../../core/reactiveUtils.js";import{addFrameTask as n}from"../../../core/scheduling.js";import{c as a}from"../../../chunks/mat3f32.js";import o from"../../../symbols/cim/CIMResourceManager.js";import{Container as h}from"./Container.js";import{WGLDrawPhase as d}from"./webgl/enums.js";import l from"./webgl/Painter.js";import{Profiler as p}from"./webgl/Profiler.js";import{Timeline as c}from"../support/Timeline.js";import{resampleHermite as u}from"../../support/screenshotUtils.js";import{createContextOrErrorHTML as m}from"../../webgl/context-util.js";import{TargetType as g,DepthStencilTargetType as f,PixelFormat as _,PixelType as b}from"../../webgl/enums.js";import{FramebufferObject as w}from"../../webgl/FramebufferObject.js";import{RenderingContext as R}from"../../webgl/RenderingContext.js";import{createEmptyImageData as y}from"../../../core/imageUtils.js";const O=2e3;class x extends h{constructor(s,i){super(),this._trash=new Set,this._renderRemainingTime=0,this._lastFrameRenderTime=0,this.renderRequested=!1,this.stage=this,this._stationary=!0;const{canvas:a=document.createElement("canvas"),alpha:h=!0,stencil:d=!0,contextOptions:u={}}=i;this._canvas=a;const g=m("2d",a,{alpha:h,antialias:!1,depth:!0,stencil:d});this.context=new R(r(g)?g:null,u),this.resourceManager=new o,this.painter=new l(this.context,this,this.resourceManager),has("esri-2d-profiler")&&(this._debugOutput=document.createElement("div"),this._debugOutput.setAttribute("style","margin: 24px 64px; position: absolute; color: red;"),s.appendChild(this._debugOutput)),this._renderParameters={drawPhase:0,state:this.state,pixelRatio:window.devicePixelRatio,stationary:!1,globalOpacity:1,blendMode:null,deltaTime:-1,time:0,inFadeTransition:!1,effects:null,context:this.context,painter:this.painter,timeline:i.timeline||new c,renderingOptions:i.renderingOptions,requestRender:()=>this.requestRender(),allowDelayedRender:!1,requireFBO:!1,profiler:new p(this.context,this._debugOutput),dataUploadCounter:0},this._taskHandle=n({render:e=>this.renderFrame(e)}),this._taskHandle.pause(),this._lostWebGLContextHandle=t(a,"webglcontextlost",(()=>{this.emit("webgl-error",{error:new e("webgl-context-lost")})})),a.setAttribute("style","width: 100%; height:100%; display:block;"),s.appendChild(a)}destroy(){this.removeAllChildren(),this._emptyTrash(),this._taskHandle.remove(),this._taskHandle=null,this._lostWebGLContextHandle&&(this._lostWebGLContextHandle.remove(),this._lostWebGLContextHandle=null),this._canvas.parentNode&&this._canvas.parentNode.removeChild(this._canvas),this._debugOutput&&this._debugOutput.parentNode&&this._debugOutput.parentNode.removeChild(this._debugOutput),this.highlightOptions=null,this.resourceManager.destroy(),this.painter.dispose(),this.context.dispose(),this._canvas=null}get background(){return this._background}set background(e){this._background=e,this.requestRender()}get highlightOptions(){return this._highlightOptions}set highlightOptions(e){this._highlightOptionsHandle&&(this._highlightOptionsHandle.remove(),this._highlightOptionsHandle=null),this._highlightOptions=e,this._highlightOptions&&(this._highlightOptionsHandle=s((()=>this._highlightOptions?.version),(()=>{this.painter.setHighlightOptions(e),this.requestRender()}),i))}get renderingOptions(){return this._renderingOptions}set renderingOptions(e){this._renderingOptions=e,this.requestRender()}get state(){return this._state}set state(e){this._state=e,this.requestRender()}get stationary(){return this._stationary}set stationary(e){this._stationary!==e&&(this._stationary=e,this.requestRender())}trashDisplayObject(e){this._trash.add(e),this.requestRender()}untrashDisplayObject(e){return this._trash.delete(e)}requestRender(){this._renderRemainingTime=O,this.renderRequested||(this.renderRequested=!0,this.emit("will-render"),this._taskHandle.resume())}renderFrame(e){const t=this._lastFrameRenderTime?e.time-this._lastFrameRenderTime:0;this._renderRemainingTime-=t,this._renderRemainingTime<=0&&this._taskHandle.pause(),this._lastFrameRenderTime=e.time,this.renderRequested=!1,this._renderParameters.state=this._state,this._renderParameters.stationary=this.stationary,this._renderParameters.pixelRatio=window.devicePixelRatio,this._renderParameters.globalOpacity=1,this._renderParameters.time=e.time,this._renderParameters.deltaTime=e.deltaTime,this._renderParameters.effects=null,this.processRender(this._renderParameters),this._emptyTrash(),this.emit("post-render")}_createTransforms(){return{dvs:a()}}renderChildren(e){for(const t of this.children)t.beforeRender(e);this._renderChildren(this.children,e);for(const t of this.children)t.afterRender(e)}_renderChildren(e,t){const r=this.context;r.resetInfo(),t.profiler.recordStart("drawLayers"),t.dataUploadCounter=0,t.drawPhase=d.MAP,this.painter.beforeRenderLayers(r,this.background);for(const s of e)s.processRender(t);this.painter.prepareDisplay(t,this.background,this.state.padding),this.painter.renderLayers(r),t.drawPhase=d.HIGHLIGHT,this.painter.beforeRenderLayers(r);for(const s of e)s.processRender(t);this.painter.renderLayers(r);if(this._isLabelDrawPhaseRequired(e)){t.drawPhase=d.LABEL,this.painter.beforeRenderLayers(r);for(const r of e)r.processRender(t);this.painter.renderLayers(r)}if(has("esri-tiles-debug")){t.drawPhase=d.DEBUG,this.painter.beforeRenderLayers(r);for(const r of e)r.processRender(t);this.painter.renderLayers(r)}t.profiler.recordEnd("drawLayers"),r.logInfo()}doRender(e){const t=this.context,{state:r,pixelRatio:s}=e;this._resizeCanvas(e),t.setViewport(0,0,s*r.size[0],s*r.size[1]),t.setDepthWriteEnabled(!0),t.setStencilWriteMask(255),super.doRender(e)}async takeScreenshot(e){const{framebufferWidth:t,framebufferHeight:r}={framebufferWidth:Math.round(this.state.size[0]*e.resolutionScale),framebufferHeight:Math.round(this.state.size[1]*e.resolutionScale)},s=1,i=this.context,n=this._state.clone();if(null!=e.rotation){const t=n.viewpoint;n.viewpoint.rotation=e.rotation,n.viewpoint=t}const a={...this._renderParameters,drawPhase:null,globalOpacity:1,stationary:!0,state:n,pixelRatio:s,time:performance.now(),deltaTime:0,blendMode:null,effects:null,inFadeTransition:!1},o=new w(i,{colorTarget:g.TEXTURE,depthStencilTarget:f.DEPTH_STENCIL_RENDER_BUFFER,width:t,height:r}),h=i.getBoundFramebufferObject(),d=i.getViewport();i.bindFramebuffer(o),i.setViewport(0,0,t,r),this._renderChildren(e.children,a);const l=this._readbackScreenshot(o,{...e.cropArea,y:r-(e.cropArea.y+e.cropArea.height)});i.bindFramebuffer(h),i.setViewport(d.x,d.y,d.width,d.height),this.requestRender();const p=await l;let c;return 1===e.outputScale?c=p:(c=new ImageData(Math.round(p.width*e.outputScale),Math.round(p.height*e.outputScale)),u(p,c,!0)),c}async _readbackScreenshot(e,t){const r=y(t.width,t.height,document.createElement("canvas"));return await e.readPixelsAsync(t.x,t.y,t.width,t.height,_.RGBA,b.UNSIGNED_BYTE,new Uint8Array(r.data.buffer)),r}_resizeCanvas(e){const t=this._canvas,r=t.style,{state:{size:s},pixelRatio:i}=e,n=s[0],a=s[1],o=Math.round(n*i),h=Math.round(a*i);t.width===o&&t.height===h||(t.width=o,t.height=h),r.width=n+"px",r.height=a+"px"}_emptyTrash(){for(;this._trash.size>0;){const e=Array.from(this._trash);this._trash.clear();for(const t of e)t.processDetach()}}_isLabelDrawPhaseRequired(e){let t=!1;for(const r of e){if(!(r instanceof h)){t=t||!1;break}if(r.hasLabels)return!0;t=t||this._isLabelDrawPhaseRequired(r.children)}return t}}export{O as EXTRA_RENDER_TIME,x as Stage};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.25/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import t from"../../../../../../core/Error.js";import e from"../../../../../../core/Logger.js";import{
|
|
5
|
+
import t from"../../../../../../core/Error.js";import e from"../../../../../../core/Logger.js";import{unwrapOr as i,isSome as s}from"../../../../../../core/maybe.js";import{pt2px as r}from"../../../../../../core/screenUtils.js";import{c as o}from"../../../../../../chunks/mat2df32.js";import{c as a}from"../../../../../../chunks/vec2f32.js";import{Alignment as h}from"../../../../../../symbols/cim/enums.js";import{premultiplyAlphaRGBA as c}from"../../color.js";import{SPRITE_PADDING as n,MIN_MAX_ZOOM_PRECISION_FACTOR as m}from"../../definitions.js";import{i1616to32 as l,i8888to32 as f}from"../../number.js";import{MarkerMaterialKey as _}from"../../materialKey/MaterialKey.js";import{isFunction as p,getMinMaxZoom as y}from"./util.js";import d from"./WGLBaseMarkerTemplate.js";import M from"./WGLDynamicMeshTemplate.js";import{ok as u}from"../../util/Result.js";const g=a(),k=o();class P extends(d(M)){constructor(t,e,o){super(t),this._cimMarkerLayer=t,this._minMaxZoom=l(Math.round(e*m),Math.round(o*m));const a=t.color;if(p(a)){const t=(t,e,i)=>c(a(t,e,i));this._dynamicPropertyMap.set("_fillColor",t)}else this._fillColor=c(a);const n=t.outlineColor;if(p(n)){const t=(t,e,i)=>c(n(t,e,i));this._dynamicPropertyMap.set("_outlineColor",t)}else this._outlineColor=c(n);const f=t.size;if(p(f)){const t=(t,e,i)=>r(f(t,e,i));this._dynamicPropertyMap.set("_size",t)}else this._size=r(f)||0;const _=t.scaleX;p(_)?this._dynamicPropertyMap.set("_scaleX",_):this._scaleX=i(_,1);const y=t.offsetX;if(p(y)){const t=(t,e,i)=>r(y(t,e,i));this._dynamicPropertyMap.set("xOffset",t)}else this.xOffset=r(y)||0;const d=t.offsetY;if(p(d)){const t=(t,e,i)=>r(d(t,e,i));this._dynamicPropertyMap.set("yOffset",t)}else this.yOffset=r(d)||0;const M=t.outlineWidth;if(p(M)){const t=(t,e,i)=>r(M(t,e,i));this._dynamicPropertyMap.set("_outlineWidth",t)}else this._outlineWidth=r(M)||0;const u=t.rotation;if(p(u)?this._dynamicPropertyMap.set("_angle",u):this._angle=u||0,s(t.effects)){const e=t.effects;p(e)?this._dynamicPropertyMap.set("_effects",e):this._effects=e}if(s(t.markerPlacement)){const e=t.markerPlacement;p(e)?this._dynamicPropertyMap.set("_markerPlacement",e):this._markerPlacement=e}this._scaleFactor=i(t.scaleFactor,1),this._bitSet=(t.alignment===h.MAP?1:0)|(t.colorLocked?1:0)<<1|(t.scaleSymbolsProportionally?1:0)<<3,this._materialKey=t.materialKey}static fromCIMMarker(t,e){const[i,s]=y(t.scaleInfo,e);return new P(t,i,s)}bindFeature(i,s,o){const a=i.readLegacyFeature(),h=i.getObjectId();this._dynamicPropertyMap.forEach(((t,e)=>{this[e]=t(a,s,o)}));const c=this._cimMarkerLayer.materialHash,m="function"==typeof c?c(a,s,o,h):c,p=this._materialCache.get(m);if(!p||!u(p.spriteMosaicItem)||!p.spriteMosaicItem)return void e.getLogger("esri.views.2d.engine.webgl.WGLDynamicMarkerTemplate").error(new t("mapview-cim","Encountered an error when binding feature"));const y=p.spriteMosaicItem,d=this._cimMarkerLayer.sizeRatio,M=y.width/y.height*this._scaleX,P=this._cimMarkerLayer.rotateClockwise?this._angle:-this._angle;let L=this._size,x=L*M;const j=this.xOffset,b=this.yOffset;this.xOffset*=this._scaleFactor,this.yOffset*=this._scaleFactor;const O=this._cimMarkerLayer.scaleSymbolsProportionally&&this._cimMarkerLayer.frameHeight?this._size/r(this._cimMarkerLayer.frameHeight):1,w=this._outlineWidth*O,z=r(this._cimMarkerLayer.referenceSize);let W=0,C=0;const F=this._cimMarkerLayer.anchorPoint;F&&(this._cimMarkerLayer.isAbsoluteAnchorPoint?this._size&&(W=r(F.x)/(this._size*M),C=r(F.y)/this._size):(W=F.x,C=F.y)),this._anchorX=W,this._anchorY=C,this._sizeOutlineWidth=f(Math.round(Math.min(Math.sqrt(128*x),255)),Math.round(Math.min(Math.sqrt(128*L),255)),Math.round(Math.min(Math.sqrt(128*w),255)),Math.round(Math.min(Math.sqrt(128*z),255))),this.angle=P;const I=Math.round(64*d);this._bitestAndDistRatio=l(this._bitSet,I);const K=y.rect.x+n,X=y.rect.y+n,B=K+y.width,R=X+y.height;this._texUpperLeft=l(K,X),this._texUpperRight=l(B,X),this._texBottomLeft=l(K,R),this._texBottomRight=l(B,R);const S=_.load(this._materialKey);S.sdf=y.sdf,S.pattern=!0,S.textureBinding=y.textureBinding,this._materialKey=S.data,x*=d,L*=d,x*=this._scaleFactor,L*=this._scaleFactor,x*=y.rect.width/y.width,L*=y.rect.height/y.height,this._computedWidth=x,this._computedHeight=L,this._applyTransformation(k,g),this.xOffset=j,this.yOffset=b}}export{P 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.25/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{unwrapOr as t}from"../../../../../../core/maybe.js";import{pt2px as e}from"../../../../../../core/screenUtils.js";import{c as o}from"../../../../../../chunks/mat2df32.js";import{c as s}from"../../../../../../chunks/vec2f32.js";import{Alignment as i,ExtremityPlacement as r}from"../../../../../../symbols/cim/enums.js";import{premultiplyAlphaRGBA as a,premultiplyAlphaRGBAArray as n}from"../../color.js";import{BITSET_MARKER_ALIGNMENT_MAP as h,BITSET_MARKER_ALIGNMENT_SCREEN as l,BITSET_GENERIC_LOCK_COLOR as m,BITSET_MARKER_OUTLINE_ALLOW_COLOR_OVERRIDE as f,BITSET_MARKER_SCALE_SYMBOLS_PROPORTIONALLY as c,SPRITE_PADDING as u,MIN_MAX_ZOOM_PRECISION_FACTOR as d,PICTURE_FILL_COLOR as p}from"../../definitions.js";import{WGLSymbologyType as x}from"../../enums.js";import{i1616to32 as M,i8888to32 as y}from"../../number.js";import{MarkerMaterialKey as _}from"../../materialKey/MaterialKey.js";import{getMinMaxZoom as S,DEFAULT_MIN_ZOOM as g,DEFAULT_MAX_ZOOM as V}from"./util.js";import z from"./WGLBaseMarkerTemplate.js";import B from"./WGLMeshTemplate.js";class b extends(z(B)){constructor(t,e,r,a,n,p,S,g,V,z,B,b,k,L,R,j,w,C,P,E,U,A,T){super(),this.angle=a,this.height=S,this.width=p,this.xOffset=e*P,this.yOffset=r*P,this._markerPlacement=E,this._effects=U,this._anchorX=j,this._anchorY=w,this._minMaxZoom=M(Math.round(A*d),Math.round(T*d));const v=(L===i.MAP?h:l)|(B?m:0)|(k?f:0)|(b?c:0),K=R&&R.sdf,W=_.load(t);W.sdf=K,W.pattern=!0,W.textureBinding=R.textureBinding,this._materialKey=W.data,this._fillColor=n,this._outlineColor=V,this._sizeOutlineWidth=y(Math.round(Math.min(Math.sqrt(128*p),255)),Math.round(Math.min(Math.sqrt(128*S),255)),Math.round(Math.min(Math.sqrt(128*z),255)),Math.round(Math.min(Math.sqrt(128*g),255)));const X=R.rect.x+u,q=R.rect.y+u,Y=X+R.width,H=q+R.height;this._offsets.xUpperLeft=X,this._offsets.yUpperLeft=q,this._offsets.xUpperRight=Y,this._offsets.yUpperRight=q,this._offsets.xBottomLeft=X,this._offsets.yBottomLeft=H,this._offsets.xBottomRight=Y,this._offsets.yBottomRight=H,W.symbologyType===x.PIE_CHART?(this._texUpperLeft=M(0,1),this._texUpperRight=M(1,1),this._texBottomLeft=M(0,0),this._texBottomRight=M(1,0)):(this._texUpperLeft=M(X,q),this._texUpperRight=M(Y,q),this._texBottomLeft=M(X,H),this._texBottomRight=M(Y,H)),p*=C,S*=C,p*=P,S*=P;const I=Math.round(64*C);this._bitestAndDistRatio=M(v,I),this._computedWidth=p,this._computedHeight=S;const N=s(),O=o();this._applyTransformation(O,N)}static fromCIMMarker(o,s,r){const n=s&&s.width||1,h=s&&s.height||1,l=o.size,m=n/h*o.scaleX,f=o.scaleSymbolsProportionally&&o.frameHeight?l/o.frameHeight:1;let c=a(o.color);const u=a(o.outlineColor),d=e(l),p=d*m,x=e(o.offsetX||0),M=e(o.offsetY||0),y=e(o.outlineWidth||0)*f,_=o.alignment||i.SCREEN,g=e(o.referenceSize),[V,z]=S(o.scaleInfo,r);s.sdf||0!==c||(c=-1);let B=o.rotation||0;o.rotateClockwise||(B=-B);let k=0,L=0;const R=o.anchorPoint;R&&(o.isAbsoluteAnchorPoint?l&&(k=R.x/(l*m),L=R.y/l):(k=R.x,L=R.y));const j=new b(o.materialKey,x,M,B,c,p,d,g,u,y,o.colorLocked,o.scaleSymbolsProportionally,!1,_,s,k,L,o.sizeRatio,t(o.scaleFactor,1),o.markerPlacement,o.effects,V,z);return j._vertexBoundsScaleX=o.maxVVSize?o.maxVVSize/p:1,j._vertexBoundsScaleY=o.maxVVSize?o.maxVVSize/d:1,j}static fromPictureMarker(t,o){const s=Math.round(e(t.width)),r=Math.round(e(t.height)),a=p,n=Math.round(e(t.xoffset||0)),h=Math.round(e(t.yoffset||0)),l=new b(t.materialKey,n,h,t.angle,a,s,r,r,0,0,!1,!1,!1,i.SCREEN,o,0,0,1,1,null,null,g,V);return l._vertexBoundsScaleX=t.maxVVSize?t.maxVVSize/t.width:1,l._vertexBoundsScaleY=t.maxVVSize?t.maxVVSize/t.height:1,l}static fromSimpleMarker(t,o){const s=n(t.color),r=Math.round(e(t.size)),a=r,h=Math.round(e(t.xoffset||0)),l=Math.round(e(t.yoffset||0)),m=t.style,f=t.outline,c=0|(f&&f.color&&n(f.color)),u=0|(f&&f.width&&Math.round(e(f.width))),d=new b(t.materialKey,h,l,t.angle,s,r,a,a,c,u,!1,!1,"esriSMSCross"===m||"esriSMSX"===m,i.SCREEN,o,0,0,126/64,1,null,null,g,V);return d.boundsType="esriSMSCircle"===m?"circle":"square",d._vertexBoundsScaleX=t.maxVVSize?t.maxVVSize/t.size:1,d._vertexBoundsScaleY=t.maxVVSize?t.maxVVSize/t.size:1,d}static fromLineSymbolMarker(t,o){const s=n(t.color),a=6,h=Math.round(e(a*t.lineWidth)),l=h,m="cross"===t.style||"x"===t.style;let f;switch(t.placement){case"begin-end":f=r.Both;break;case"begin":f=r.JustBegin;break;case"end":f=r.JustEnd;break;default:f=r.None}const c={type:"CIMMarkerPlacementAtExtremities",angleToLine:!0,offset:0,extremityPlacement:f,offsetAlongLine:0},u=new b(t.materialKey,0,0,0,s,h,l,l/a,s,m?Math.round(e(t.lineWidth)):0,!1,!1,m,i.MAP,o,0,0,126/64,1,c,null,g,V);return u.boundsType="circle"===t.style?"circle":"square",u}}export{b as default};
|
|
5
|
+
import{unwrapOr as t}from"../../../../../../core/maybe.js";import{pt2px as e}from"../../../../../../core/screenUtils.js";import{c as o}from"../../../../../../chunks/mat2df32.js";import{c as s}from"../../../../../../chunks/vec2f32.js";import{Alignment as i,ExtremityPlacement as r}from"../../../../../../symbols/cim/enums.js";import{premultiplyAlphaRGBA as a,premultiplyAlphaRGBAArray as n}from"../../color.js";import{BITSET_MARKER_ALIGNMENT_MAP as h,BITSET_MARKER_ALIGNMENT_SCREEN as l,BITSET_GENERIC_LOCK_COLOR as m,BITSET_MARKER_OUTLINE_ALLOW_COLOR_OVERRIDE as f,BITSET_MARKER_SCALE_SYMBOLS_PROPORTIONALLY as c,SPRITE_PADDING as u,MIN_MAX_ZOOM_PRECISION_FACTOR as d,PICTURE_FILL_COLOR as p}from"../../definitions.js";import{WGLSymbologyType as x}from"../../enums.js";import{i1616to32 as M,i8888to32 as y}from"../../number.js";import{MarkerMaterialKey as _}from"../../materialKey/MaterialKey.js";import{getMinMaxZoom as S,DEFAULT_MIN_ZOOM as g,DEFAULT_MAX_ZOOM as V}from"./util.js";import z from"./WGLBaseMarkerTemplate.js";import B from"./WGLMeshTemplate.js";class b extends(z(B)){constructor(t,e,r,a,n,p,S,g,V,z,B,b,k,L,R,j,w,C,P,E,U,A,T){super(),this.angle=a,this.height=S,this.width=p,this.xOffset=e*P,this.yOffset=r*P,this._markerPlacement=E,this._effects=U,this._anchorX=j,this._anchorY=w,this._minMaxZoom=M(Math.round(A*d),Math.round(T*d));const v=(L===i.MAP?h:l)|(B?m:0)|(k?f:0)|(b?c:0),K=R&&R.sdf,W=_.load(t);W.sdf=K,W.pattern=!0,W.textureBinding=R.textureBinding,this._materialKey=W.data,this._fillColor=n,this._outlineColor=V,this._sizeOutlineWidth=y(Math.round(Math.min(Math.sqrt(128*p),255)),Math.round(Math.min(Math.sqrt(128*S),255)),Math.round(Math.min(Math.sqrt(128*z),255)),Math.round(Math.min(Math.sqrt(128*g),255)));const X=R.rect.x+u,q=R.rect.y+u,Y=X+R.width,H=q+R.height;this._offsets.xUpperLeft=X,this._offsets.yUpperLeft=q,this._offsets.xUpperRight=Y,this._offsets.yUpperRight=q,this._offsets.xBottomLeft=X,this._offsets.yBottomLeft=H,this._offsets.xBottomRight=Y,this._offsets.yBottomRight=H,W.symbologyType===x.PIE_CHART?(this._texUpperLeft=M(0,1),this._texUpperRight=M(1,1),this._texBottomLeft=M(0,0),this._texBottomRight=M(1,0)):(this._texUpperLeft=M(X,q),this._texUpperRight=M(Y,q),this._texBottomLeft=M(X,H),this._texBottomRight=M(Y,H)),p*=C,S*=C,p*=P,S*=P;const I=Math.round(64*C);this._bitestAndDistRatio=M(v,I),this._computedWidth=p,this._computedHeight=S;const N=s(),O=o();this._applyTransformation(O,N)}static fromCIMMarker(o,s,r){const n=s&&s.width||1,h=s&&s.height||1,l=o.size,m=n/h*t(o.scaleX,1),f=o.scaleSymbolsProportionally&&o.frameHeight?l/o.frameHeight:1;let c=a(o.color);const u=a(o.outlineColor),d=e(l),p=d*m,x=e(o.offsetX||0),M=e(o.offsetY||0),y=e(o.outlineWidth||0)*f,_=o.alignment||i.SCREEN,g=e(o.referenceSize),[V,z]=S(o.scaleInfo,r);s.sdf||0!==c||(c=-1);let B=o.rotation||0;o.rotateClockwise||(B=-B);let k=0,L=0;const R=o.anchorPoint;R&&(o.isAbsoluteAnchorPoint?l&&(k=R.x/(l*m),L=R.y/l):(k=R.x,L=R.y));const j=new b(o.materialKey,x,M,B,c,p,d,g,u,y,o.colorLocked,o.scaleSymbolsProportionally,!1,_,s,k,L,o.sizeRatio,t(o.scaleFactor,1),o.markerPlacement,o.effects,V,z);return j._vertexBoundsScaleX=o.maxVVSize?o.maxVVSize/p:1,j._vertexBoundsScaleY=o.maxVVSize?o.maxVVSize/d:1,j}static fromPictureMarker(t,o){const s=Math.round(e(t.width)),r=Math.round(e(t.height)),a=p,n=Math.round(e(t.xoffset||0)),h=Math.round(e(t.yoffset||0)),l=new b(t.materialKey,n,h,t.angle,a,s,r,r,0,0,!1,!1,!1,i.SCREEN,o,0,0,1,1,null,null,g,V);return l._vertexBoundsScaleX=t.maxVVSize?t.maxVVSize/t.width:1,l._vertexBoundsScaleY=t.maxVVSize?t.maxVVSize/t.height:1,l}static fromSimpleMarker(t,o){const s=n(t.color),r=Math.round(e(t.size)),a=r,h=Math.round(e(t.xoffset||0)),l=Math.round(e(t.yoffset||0)),m=t.style,f=t.outline,c=0|(f&&f.color&&n(f.color)),u=0|(f&&f.width&&Math.round(e(f.width))),d=new b(t.materialKey,h,l,t.angle,s,r,a,a,c,u,!1,!1,"esriSMSCross"===m||"esriSMSX"===m,i.SCREEN,o,0,0,126/64,1,null,null,g,V);return d.boundsType="esriSMSCircle"===m?"circle":"square",d._vertexBoundsScaleX=t.maxVVSize?t.maxVVSize/t.size:1,d._vertexBoundsScaleY=t.maxVVSize?t.maxVVSize/t.size:1,d}static fromLineSymbolMarker(t,o){const s=n(t.color),a=6,h=Math.round(e(a*t.lineWidth)),l=h,m="cross"===t.style||"x"===t.style;let f;switch(t.placement){case"begin-end":f=r.Both;break;case"begin":f=r.JustBegin;break;case"end":f=r.JustEnd;break;default:f=r.None}const c={type:"CIMMarkerPlacementAtExtremities",angleToLine:!0,offset:0,extremityPlacement:f,offsetAlongLine:0},u=new b(t.materialKey,0,0,0,s,h,l,l/a,s,m?Math.round(e(t.lineWidth)):0,!1,!1,m,i.MAP,o,0,0,126/64,1,c,null,g,V);return u.boundsType="circle"===t.style?"circle":"square",u}}export{b as default};
|