@arcgis/core 4.34.0-next.53 → 4.34.0-next.54
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/applications/Components/formatUtils.d.ts +3 -0
- package/applications/Components/formatUtils.js +5 -0
- package/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/{e58336aafe8c95bb6831.js → 0eb728cee6e40cb30c01.js} +1 -1
- package/assets/esri/core/workers/chunks/23f54b49742098def8ae.js +1 -0
- package/assets/esri/core/workers/chunks/435169b455fd2846799b.js +1 -0
- package/assets/esri/core/workers/chunks/69e6000044bfb03776ac.js +1 -0
- package/assets/esri/core/workers/chunks/813efde41e90e652b7db.js +1 -0
- package/assets/esri/core/workers/chunks/82404ff7c298493ff6f4.js +1 -0
- package/assets/esri/core/workers/chunks/9639a6f6fab52a501bf7.js +1 -0
- package/assets/esri/core/workers/chunks/dd120d562b63618e71c0.js +1 -0
- package/assets/esri/core/workers/chunks/{fb4950995f6780f6c22a.js → ee0286b5f5475f2d853f.js} +1 -1
- package/config.js +1 -1
- package/geometry/operators/json/graphicBufferOperator.js +5 -0
- package/geometry/support/coordinateSystem.js +1 -1
- package/interfaces.d.ts +91 -183
- package/kernel.js +1 -1
- package/networks/support/typeUtils.js +1 -1
- package/package.json +1 -1
- package/rest/networks/support/Circuit.js +5 -0
- package/rest/networks/support/CircuitSection.js +1 -1
- package/rest/networks/support/Subcircuit.js +1 -1
- package/rest/print.js +1 -1
- package/support/revision.js +1 -1
- package/symbols/cim/CIMEffects.js +1 -1
- package/symbols/cim/effects/EffectOffset.js +1 -1
- package/views/2d/analysisViewModuleImportUtils.js +5 -0
- package/views/2d/engine/webgl/shaderGraph/techniques/labels/LabelMeshWriter.js +1 -1
- package/views/2d/input/MapViewInputManager.js +1 -1
- package/views/2d/layers/LayerView2D.js +1 -1
- package/views/3d/analysis/Dimension/LengthDimensionSubTool.js +1 -1
- package/views/3d/analysis/LineOfSight/LineOfSightRayIntersector.js +1 -1
- package/views/3d/analysis/Viewshed/FieldOfViewManipulation.js +1 -1
- package/views/3d/analysisViewModuleImportUtils.js +5 -0
- package/views/3d/input/SceneInputManager.js +1 -1
- package/views/3d/interactive/editingTools/draw/DrawGraphicTool3D.js +1 -1
- package/views/3d/interactive/editingTools/manipulations/MoveManipulation.js +1 -1
- package/views/3d/interactive/editingTools/reshape/ReshapeOperation.js +1 -1
- package/views/3d/interactive/measurementTools/areaMeasurement3D/AreaMeasurement3DTool.js +1 -1
- package/views/3d/webgl-engine/effects/highlight/ShadowHighlight.js +1 -1
- package/views/SceneView.js +1 -1
- package/views/ToolViewManager.js +1 -1
- package/views/View.js +1 -1
- package/views/View2D.js +1 -1
- package/views/draw/DrawGraphicTool.js +1 -1
- package/views/draw/DrawOperation.js +1 -1
- package/views/draw/LegacyDrawManipulator.js +1 -1
- package/views/input/InputManager.js +1 -1
- package/views/input/handlers/LatestPointer.js +1 -1
- package/views/interactive/InteractiveToolBase.js +1 -1
- package/views/interactive/ToolViewManagerManipulatorState.js +1 -1
- package/views/interactive/Tooltip.js +1 -1
- package/views/support/AnalysisViewManager.js +5 -0
- package/widgets/Feature/FeatureViewModel.js +1 -1
- package/widgets/Sketch/SketchViewModel.js +1 -1
- package/assets/esri/core/workers/chunks/2b75212c31145cc07d16.js +0 -1
- package/assets/esri/core/workers/chunks/4c6862ad3af947c704f7.js +0 -1
- package/assets/esri/core/workers/chunks/781b59ba0cabe78bc122.js +0 -1
- package/assets/esri/core/workers/chunks/b877142a275188a16e17.js +0 -1
- package/assets/esri/core/workers/chunks/cc0cb4906e4419f7c4a9.js +0 -1
- package/assets/esri/core/workers/chunks/f75ddd79be506423be09.js +0 -1
- package/views/3d/analysis/AnalysisViewManager3D.js +0 -5
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{__decorate as t}from"tslib";import{JSONSupport as o}from"../../../core/JSONSupport.js";import{property as r}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import"../../../core/
|
|
5
|
+
import{__decorate as t}from"tslib";import{JSONSupport as o}from"../../../core/JSONSupport.js";import i from"../../../core/Logger.js";import{property as r}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import"../../../core/RandomLCG.js";import{subclass as s}from"../../../core/accessorSupport/decorators/subclass.js";import{CircuitSectionRoleKebabDict as e,CircuitTypeKebabDict as a}from"../../../networks/support/typeUtils.js";import n from"./CircuitLocation.js";import c from"./CircuitPath.js";import p from"./Subcircuit.js";let u=class extends o{constructor(t){super(t),this.sectionId=null,this.role="start-and-end",this.sectionType="physical",this.startLocation=null,this.stopLocation=null,this.subcircuit=null,this.path=null}normalizeCtorArgs(t){if(void 0===t)return t;const{sectionId:o,startLocation:r,stopLocation:s,subcircuit:e}=t;return(r||s)&&e?(delete t.startLocation,delete t.stopLocation,i.getLogger(this).warn("Cannot instantiate CircuitSection with both start/stop locations and subcircuit.",`CircuitSection with ID '${o}' was defaulted to having a subcircuit only.`)):(r&&!s||!r&&s)&&!e&&i.getLogger(this).warn(`CircuitSection with ID '${o}' must have both start and stop locations.`,"Create/alter operations involving this section will fail unless both are populated."),t}setStartStopLocations(t,o){this.startLocation=t,this.stopLocation=o,this.subcircuit=null}setSubcircuit(t){this.subcircuit=t,this.startLocation=null,this.stopLocation=null}};t([r({type:Number,json:{write:!0}})],u.prototype,"sectionId",void 0),t([r({type:e.apiValues,json:{type:e.jsonValues,read:e.read},readOnly:!0})],u.prototype,"role",void 0),t([r({type:a.apiValues,json:{type:a.jsonValues,read:a.read,write:a.write}})],u.prototype,"sectionType",void 0),t([r({type:n,json:{write:!0}})],u.prototype,"startLocation",void 0),t([r({type:n,json:{write:!0}})],u.prototype,"stopLocation",void 0),t([r({type:p,json:{write:!0}})],u.prototype,"subcircuit",void 0),t([r({type:c,readOnly:!0})],u.prototype,"path",void 0),u=t([s("esri.rest.networks.support.CircuitSection")],u);const l=u;export{l 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.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{__decorate as o}from"tslib";import{JSONSupport as r}from"../../../core/JSONSupport.js";import{property as t}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import"../../../core/Logger.js";import"../../../core/RandomLCG.js";import{subclass as e}from"../../../core/accessorSupport/decorators/subclass.js";let s=class extends r{constructor(o){super(o),this.name=null,this.globalId=null,this.providerId=null,this.consumerId=null,this.isReserved=!1}};o([t({type:String,json:{write:!0}})],s.prototype,"name",void 0),o([t({type:String,json:{write:!0}})],s.prototype,"globalId",void 0),o([t({type:String
|
|
5
|
+
import{__decorate as o}from"tslib";import{JSONSupport as r}from"../../../core/JSONSupport.js";import{property as t}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import"../../../core/Logger.js";import"../../../core/RandomLCG.js";import{subclass as e}from"../../../core/accessorSupport/decorators/subclass.js";let s=class extends r{constructor(o){super(o),this.name=null,this.globalId=null,this.providerId=null,this.consumerId=null,this.isReserved=!1}};o([t({type:String,json:{write:!0}})],s.prototype,"name",void 0),o([t({type:String,json:{write:!0}})],s.prototype,"globalId",void 0),o([t({type:String})],s.prototype,"providerId",void 0),o([t({type:String})],s.prototype,"consumerId",void 0),o([t({type:Boolean,json:{write:!0}})],s.prototype,"isReserved",void 0),s=o([e("esri.rest.networks.support.Subcircuit")],s);const p=s;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.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{id as e}from"../kernel.js";import t from"../request.js";import{JSONMap as a}from"../core/jsonMap.js";import{createScreenPoint as i,pt2px as r,px2pt as n}from"../core/screenUtils.js";import{dataComponents as o,normalize as s}from"../core/urlUtils.js";import l from"../geometry/Polygon.js";import{collectLabelingFields as c}from"../layers/support/fieldUtils.js";import{getFloorFilterClause as u}from"../layers/support/floorFilterUtils.js";import{getSizeRangeAtScale as y}from"../renderers/visualVariables/support/visualVariableUtils.js";import{asValidOptions as p,findToken as f}from"./utils.js";import{execute as d}from"./geoprocessor/execute.js";import{submitJob as m}from"./geoprocessor/submitJob.js";import{formatJsonMap as g}from"./support/fileFormat.js";import{toJSON as h}from"./support/layoutTemplate.js";import{getVisibleLayerViews as b,isScreenshotRequired as w,isBingMapsLayer as S,isBlendLayer as x,getCopyright as I,getSelectionSymbol as v,createPointLayer as D,createPolygonLayer as T,createPolylineLayer as L,createMultipointLayer as O,getContextBoundingBox as E}from"./support/printTaskUtils.js";import P from"./support/PrintTemplate.js";import{toJSON as M}from"./support/reportTemplate.js";const V={Feet:"ft",Kilometers:"km",Meters:"m",Miles:"mi"},F=new a({esriFeet:"Feet",esriKilometers:"Kilometers",esriMeters:"Meters",esriMiles:"Miles"}),k=new a({esriExecutionTypeSynchronous:"sync",esriExecutionTypeAsynchronous:"async"}),N=new Map;async function R(e,t,a){const i=await U(e,a),r=await _(t,i);if("sync"===await J(e,a)){const{results:t}=await d(e,r,void 0,a);return t?.[0]?.value}const n=await m(e,r,void 0,a);await n.waitForJobCompletion({interval:t.updateDelay});const{value:o}=await n.fetchResultData("Output_File",null,a);return o}async function U(e,a){const i=$(e),r=N.get(i)??{gpServerUrl:i,legendLayerNameMap:{},legendLayers:[]};return r.gpMetadata??=(await t(i,p({f:"json"},a))).data,r.cimVersion=r.gpMetadata.cimVersion,N.set(i,r),r}async function J(e,t){return we(await U(e,t))}async function j(e,a){const i=await U(e,a),r=i.gpMetadata.tasks,n=i.gpServerUrl;return i.taskInfos||(i.taskInfos={},await Promise.all(r?.map(async e=>{const r=(await t(`${n}/${e}`,p({f:"json"},a))).data,o=r.name.startsWith("GetLayoutTemplatesInfo")?"GetLayoutTemplatesInfo":r.name.startsWith("ExportWebMap")?"ExportWebMap":null;o&&(i.taskInfos[o]??=r)})??[])),i.taskInfos}async function A(e,t,a){return(await j(e,a))[t]??null}async function C(e,t,a){const i=await A(e,t,a);return i?.executionType?k.fromJSON(i.executionType):"sync"}async function _(t,a){a=a||{is11xService:!1,legendLayerNameMap:{},legendLayers:[]};const i=t.template||new P;null==i.showLabels&&(i.showLabels=!0);const r=i.exportOptions;let n;const o=h(i.layout);if(r){if(n={dpi:r.dpi},"map_only"===o?.toLowerCase()||""===o){const{width:e,height:t}=r;n.outputSize=null!=e&&null!=t?[e,t]:void 0}}const s=i.layoutOptions;let l;if(s){let e,t;"Miles"===s.scalebarUnit||"Kilometers"===s.scalebarUnit?(e="Kilometers",t="Miles"):"Meters"!==s.scalebarUnit&&"Feet"!==s.scalebarUnit||(e="Meters",t="Feet"),l={titleText:s.titleText,authorText:s.authorText,copyrightText:s.copyrightText,customTextElements:s.customTextElements,elementOverrides:s.elementOverrides,scaleBarOptions:e||t?{metricUnit:F.toJSON(e)??void 0,metricLabel:e?V[e]:void 0,nonMetricUnit:F.toJSON(t)??void 0,nonMetricLabel:t?V[t]:void 0}:void 0}}let c=null;s?.legendLayers&&(c=s.legendLayers.map(e=>{const t=e.layerId;a.legendLayerNameMap[t]=e.title;const i={id:t};return e.subLayerIds&&(i.subLayerIds=e.subLayerIds),i}));const u=await z(t,i,a);if(u.operationalLayers){const e=new RegExp("[\\u4E00-\\u9FFF\\u0E00-\\u0E7F\\u0900-\\u097F\\u3040-\\u309F\\u30A0-\\u30FF\\u31F0-\\u31FF]"),t=/[\u0600-\u06FF]/,a=a=>{const i=a.text,r=a.font,n=r?.family?.toLowerCase();i&&r&&("arial"===n||"arial unicode ms"===n)&&(r.family=e.test(i)?"Arial Unicode MS":"Arial","normal"!==r.style&&t.test(i)&&(r.family="Arial Unicode MS"))};for(const i of u.operationalLayers)if(i.featureCollection?.layers)for(const e of i.featureCollection.layers){if(e.layerDefinition?.drawingInfo?.renderer?.symbol){const t=e.layerDefinition.drawingInfo.renderer;"esriTS"===t.symbol.type&&a(t.symbol)}if(e.featureSet?.features)for(const t of e.featureSet.features)t.symbol&&"esriTS"===t.symbol.type&&a(t.symbol)}}t.outSpatialReference&&(u.mapOptions.spatialReference=t.outSpatialReference.toJSON()),Object.assign(u,{exportOptions:n,layoutOptions:l||{}}),Object.assign(u.layoutOptions,{legendOptions:{operationalLayers:null!=c?c:a.legendLayers.slice()}}),a.legendLayers.length=0,N.set(a.gpServerUrl,a);const y={Web_Map_as_JSON:JSON.stringify(u),Format:g.toJSON(i.format),Layout_Template:o,Layout_Item_ID:void 0,Report_Template:M(i.report),Report_Item_ID:void 0};if(i.layoutItem){delete y.Layout_Template;const t=i.layoutItem;await t.load(),"public"!==t.access&&e&&await e.getCredential(a.gpServerUrl),y.Layout_Item_ID=JSON.stringify({id:t.id})}if(i.reportItem){delete y.Report_Template;const t=i.reportItem;await t.load(),"public"!==t.access&&e&&await e.getCredential(a.gpServerUrl),y.Report_Item_ID=JSON.stringify({id:t.id})}return t.extraParameters&&Object.assign(y,t.extraParameters),y}async function z(e,t,a){const i=e.view;let r=i.spatialReference;const n={operationalLayers:await W(i,t,a)};t.includeTables&&(n.tables=await se(i));let o=e.extent||a.ssExtent||i.extent;if(r?.isWrappable&&(o=o.clone()._normalize(!0),r=o.spatialReference),n.mapOptions={extent:o&&o.toJSON(),spatialReference:r&&r.toJSON(),showAttribution:t.attributionVisible},a.ssExtent=null,i.background&&(n.background=i.background.toJSON()),i.rotation&&(n.mapOptions.rotation=-i.rotation),t.scalePreserved&&(n.mapOptions.scale=t.outScale||i.scale),null!=i.timeExtent){const e=null!=i.timeExtent.start?i.timeExtent.start.getTime():null,t=null!=i.timeExtent.end?i.timeExtent.end.getTime():null;n.mapOptions.time=[e,t]}return t.reportOptions&&(n.reportOptions=t.reportOptions),n}function $(e){let t=e;const a=t.lastIndexOf("/GPServer/");return a>0&&(t=t.slice(0,a+9)),t}async function W(e,t,a){const i=[],r={layerView:null,printTemplate:t,view:e};let n=0;t.scalePreserved&&(n=t.outScale||e.scale);const o=b(e,n);for(const s of o){const e=s.layer;if(!e.loaded||"layers"in e)continue;let t;r.layerView=s,t=w(s)?await re(e,r,a):S(e)?q(e):"csv"===e?.type?await K(e,r,a):"catalog-footprint"===e?.type?await B(e,r,a):"feature"===e?.type?await Q(e,r,a):"geojson"===e?.type?await H(e,r,a):"graphics"===e?.type?await X(e,r,a):"imagery"===e?.type?Y(e,a):"imagery-tile"===e?.type?await Z(e,r,a):"kml"===e?.type?await ee(e,r,a):"map-image"===e?.type?te(e,r,a):"map-notes"===e?.type?await ae(r,a):"open-street-map"===e?.type?ie():"stream"===e?.type?await ne(e,r,a):"subtype-group"===e?.type?await oe(e,a):"tile"===e?.type?le(e,a):"vector-tile"===e?.type?await ce(e,r,a):"web-tile"===e?.type?ue(e):"wfs"===e?.type?await ye(e,r,a):"wms"===e?.type?pe(e,a):"wmts"===e?.type?fe(e):await re(e,r,a),t&&(Array.isArray(t)?i.push(...t):(t.id=e.id,t.title=a.legendLayerNameMap[e.id]||e.title,t.opacity=s.fullOpacity,t.minScale=e.minScale||0,t.maxScale=e.maxScale||0,x(e)&&e.blendMode&&"normal"!==e.blendMode&&(t.blendMode=e.blendMode),i.push(t)))}if(n)for(const s of i)s.minScale=0,s.maxScale=0;if(e.graphics?.length){const r=await G(null,e.graphics,t,a);r&&i.push(r)}return i}function q(e){return{culture:e.culture,key:e.key,type:"BingMaps"+("aerial"===e.style?"Aerial":"hybrid"===e.style?"Hybrid":"Road")}}async function B(e,{layerView:t,printTemplate:a},i){if(parseFloat(i.cimVersion)<3.1){return G(e,await he(t),a,i)}const r=e.parent,n={id:(o=be(r,"web-map")).id,url:o.url,layerType:o.layerType,customParameters:o.customParameters,dynamicGroupLayer:{visibility:!1},footprintLayer:o.footprintLayer,layerDefinition:o.layerDefinition};var o;return de(n,r),n}async function K(e,t,a){e.legendEnabled&&a.legendLayers.push({id:e.id});const i=t.layerView,r=t.printTemplate;if(!(i.filter||e.portalItem&&"public"!==e.portalItem.access)){const t=be(e,"web-map");return t.type="CSV",delete t.popupInfo,delete t.layerType,t.showLabels=r.showLabels&&e.labelsVisible,t}return G(e,await he(i),r,a)}async function G(e,t,a,i){let r;const n=T(),o=L(),s=D(),u=O(),y=D();if(y.layerDefinition.name="textLayer",delete y.layerDefinition.drawingInfo,e){if("esri.layers.FeatureLayer"===e.declaredClass||"esri.layers.StreamLayer"===e.declaredClass?n.layerDefinition.name=o.layerDefinition.name=s.layerDefinition.name=u.layerDefinition.name=i.legendLayerNameMap[e.id]||e.arcgisProps?.title||e.title:"esri.layers.GraphicsLayer"===e.declaredClass&&(t=e.graphics.items),e.renderer){const t=e.renderer.toJSON(),a=n.layerDefinition.drawingInfo;a&&(a.renderer=t);const i=o.layerDefinition.drawingInfo;i&&(i.renderer=t);const r=s.layerDefinition.drawingInfo;r&&(r.renderer=t);const l=u.layerDefinition.drawingInfo;l&&(l.renderer=t)}if(a.showLabels&&e.labelsVisible&&"function"==typeof e.write){const t=be(e,"web-map"),a=t.layerDefinition?.drawingInfo?.labelingInfo;if(a){r=!0;const e=n.layerDefinition.drawingInfo;e&&(e.labelingInfo=a);const t=o.layerDefinition.drawingInfo;t&&(t.labelingInfo=a);const i=s.layerDefinition.drawingInfo;i&&(i.labelingInfo=a);const l=u.layerDefinition.drawingInfo;l&&(l.labelingInfo=a)}}}let p;e?.renderer||r||(delete n.layerDefinition.drawingInfo,delete o.layerDefinition.drawingInfo,delete s.layerDefinition.drawingInfo,delete u.layerDefinition.drawingInfo);const f=e?.fieldsIndex,d=e?.renderer;if(f){const t=new Set;r&&await c(t,e),d&&"function"==typeof d.collectRequiredFields&&await d.collectRequiredFields(t,f),p=Array.from(t);const a=f.fields.map(e=>e.toJSON());n.layerDefinition.fields=a,o.layerDefinition.fields=a,s.layerDefinition.fields=a,u.layerDefinition.fields=a}const m=t?.length;let g;for(let c=0;c<m;c++){const e=t[c]||t.at(c);if(!1!==e.visible&&e.geometry){if(g=e.toJSON(),g.hasOwnProperty("popupTemplate")&&delete g.popupTemplate,g.geometry?.z&&delete g.geometry.z,g.symbol&&(g.symbol.angle||delete g.symbol.angle,Se(g.symbol)?g.symbol=await me(g.symbol,i):g.symbol.text&&delete g.attributes),(!a||!a.forceFeatureAttributes)&&p?.length){const e={};for(const t of p)g.attributes?.hasOwnProperty(t)&&(e[t]=g.attributes[t]);g.attributes=e}"polygon"===e.geometry.type?n.featureSet.features.push(g):"polyline"===e.geometry.type?o.featureSet.features.push(g):"point"===e.geometry.type?g.symbol?.text?y.featureSet.features.push(g):s.featureSet.features.push(g):"multipoint"===e.geometry.type?u.featureSet.features.push(g):"extent"===e.geometry.type&&(g.geometry=l.fromExtent(e.geometry).toJSON(),n.featureSet.features.push(g))}}const h=[n,o,u,s,y].filter(e=>e.featureSet.features.length>0);for(const l of h){const e=l.featureSet.features.every(e=>e.symbol);if(e&&(!a||!a.forceFeatureAttributes))for(const t of l.featureSet.features)delete t.attributes;e&&delete l.layerDefinition.drawingInfo,l.layerDefinition.drawingInfo?.renderer&&await ge(l.layerDefinition.drawingInfo.renderer,i)}return h.length?{featureCollection:{layers:h},showLabels:r}:null}async function Q(e,t,a){let i;const r=e.renderer,n=parseFloat(a.cimVersion);if("binning"===e.featureReduction?.type||"cluster"===e.featureReduction?.type&&(n<2.9||"pie-chart"===e.featureReduction.renderer?.type)||"pie-chart"===r?.type&&n<3.1||"dot-density"===r?.type&&n<2.6)return re(e,t,a);e.legendEnabled&&a.legendLayers.push({id:e.id});const o=t.layerView,{printTemplate:s,view:l}=t,c="feature-layer"!==e.source?.type&&"ogc-feature"!==e.source?.type;if(o.filter||c||!r||"field"in r&&null!=r.field&&!e.getField(r.field)){const t=await he(o);i=await G(e,t,s,a)}else{if(i={id:(p=be(e)).id,title:p.title,url:p.url,layerType:p.layerType,customParameters:p.customParameters,layerDefinition:p.layerDefinition,charts:s.includeCharts?p.charts:void 0},s.attributionVisible&&(i.credits=I(e)),i.showLabels=s.showLabels&&e.labelsVisible,de(i,e),delete i.layerDefinition?.featureReduction?.disablePopup,delete i.layerDefinition?.featureReduction?.popupInfo,o.displayFilterEnabled||delete i.layerDefinition?.displayFilterInfo,i.layerDefinition?.drawingInfo?.renderer&&(delete i.layerDefinition.minScale,delete i.layerDefinition.maxScale,await ge(i.layerDefinition.drawingInfo.renderer,a),"visualVariables"in r&&r.visualVariables?.[0])){const e=r.visualVariables[0];if("size"===e.type&&e.maxSize&&"number"!=typeof e.maxSize&&e.minSize&&"number"!=typeof e.minSize){const t=y(e,l.scale);i.layerDefinition.drawingInfo.renderer.visualVariables[0].minSize=t.minSize,i.layerDefinition.drawingInfo.renderer.visualVariables[0].maxSize=t.maxSize}}const t=u(o);if(t&&(i.layerDefinition??={},i.layerDefinition.definitionExpression=i.layerDefinition.definitionExpression?`(${i.layerDefinition.definitionExpression}) AND (${t})`:t),e.gdbVersion&&(i.layerDefinition??={},i.layerDefinition.gdbVersion=e.gdbVersion),o.hasHighlight&&"highlightIds"in o){const t=o;i.selectionObjectIds=t.highlightIds,i.selectionSymbol=v(e.geometryType,t.highlightOptions??l.highlightOptions)}}var p;return i}async function H(e,t,a){if("binning"===e.featureReduction?.type||"cluster"===e.featureReduction?.type)return re(e,t,a);e.legendEnabled&&a.legendLayers.push({id:e.id});return G(e,await he(t.layerView),t.printTemplate,a)}async function X(e,{printTemplate:t},a){return G(e,null,t,a)}function Y(e,t){e.legendEnabled&&t.legendLayers.push({id:e.id});const a={layerType:(i=be(e)).layerType,customParameters:i.customParameters};var i;return a.bandIds=e.bandIds,a.compressionQuality=e.compressionQuality,a.format=e.format,a.interpolation=e.interpolation,(e.mosaicRule||e.definitionExpression)&&(a.mosaicRule=e.exportImageServiceParameters.mosaicRule.toJSON()),e.rasterFunction&&(a.renderingRule=e.rasterFunction.toJSON()),e.renderer&&(a.layerDefinition??={},a.layerDefinition.drawingInfo??={},a.layerDefinition.drawingInfo.renderer=e.renderer.toJSON()),de(a,e),a}async function Z(e,t,a){if("flow"===e.renderer?.type)return re(e,t,a);e.legendEnabled&&a.legendLayers.push({id:e.id});const i={bandIds:(r=be(e)).bandIds,customParameters:r.customParameters,interpolation:r.interpolation,layerDefinition:r.layerDefinition};var r;return i.layerType="ArcGISImageServiceLayer",de(i,e),i}async function ee(e,t,a){const i=t.printTemplate;if(!e.portalItem||"public"===e.portalItem.access){const t=be(e,"web-map");return t.type="kml",delete t.layerType,t.url=s(e.url),t}const r=[],n=t.layerView,o="data:image/png;base64,";n.allVisibleMapImages.forEach((t,a)=>{const i={id:`${e.id}_image${a}`,type:"image",title:e.id,minScale:e.minScale||0,maxScale:e.maxScale||0,opacity:n.fullOpacity,extent:t.extent};t.href.startsWith(o)?i.imageData=t.href.slice(o.length):i.url=t.href,r.push(i)});const l=[...n.allVisiblePoints.items,...n.allVisiblePolylines.items,...n.allVisiblePolygons.items],c={id:e.id,...await G(null,l,i,a)};return r.push(c),r}function te(e,{printTemplate:t,view:a},i){let r;const n={id:e.id,subLayerIds:[]};let o=[];const s=a.scale,l=e=>{const t=0===s,a=0===e.minScale||s<=e.minScale,i=0===e.maxScale||s>=e.maxScale;if(e.visible&&(t||a&&i))if(e.sublayers)e.sublayers.forEach(l);else{const t=e.toExportImageJSON(),a={id:e.id,name:e.title,layerDefinition:{definitionExpression:t.definitionExpression,drawingInfo:t.drawingInfo,orderBy:t.orderBy,source:t.source}};o.unshift(a),n.subLayerIds.push(e.id)}};var c;return e.sublayers?.forEach(l),o.length&&(o=o.map(({id:e,name:t,layerDefinition:a})=>({id:e,name:t,layerDefinition:a})),r={layerType:(c=be(e)).layerType,customParameters:c.customParameters},r.layers=o,r.visibleLayers=e.capabilities?.exportMap?.supportsDynamicLayers?void 0:n.subLayerIds,t.attributionVisible&&(r.credits=I(e)),e.gdbVersion&&(r.gdbVersion=e.gdbVersion),de(r,e),e.legendEnabled&&i.legendLayers.push(n)),r}async function ae({layerView:e,printTemplate:t},a){const i=[],r=e.layer;if(null!=r.featureCollections)for(const n of r.featureCollections){const e=await G(n,n.source,t,a);e&&i.push(...e.featureCollection.layers)}else if(null!=r.sublayers)for(const n of r.sublayers){const e=await G(null,n.graphics,t,a);e&&i.push(...e.featureCollection.layers)}return{featureCollection:{layers:i}}}function ie(){return{type:"OpenStreetMap"}}async function re(e,{printTemplate:t,view:a},r){const n={type:"image"},s={format:"png",ignoreBackground:!0,ignorePadding:!0,layers:[e]};0!==a.rotation&&(s.rotation=0);const l=r.ssExtent||a.state.extent.clone();let c=96,u=!0,y=!0;if(t.exportOptions){const e=t.exportOptions;null!=e.dpi&&e.dpi>0&&(c=e.dpi),null!=e.width&&e.width>0&&(u=e.width%2==a.width%2),null!=e.height&&e.height>0&&(y=e.height%2==a.height%2)}if("map-only"===t.layout&&t.scalePreserved&&(!t.outScale||t.outScale===a.scale)&&96===c&&(!u||!y)&&a.state.extent.equals(a.extent)&&(s.area={x:0,y:0,width:a.width,height:a.height},u||(s.area.width-=1),y||(s.area.height-=1),!r.ssExtent)){const e=a.toMap(i(s.area.width,s.area.height));l.ymin=e.y,l.xmax=e.x,r.ssExtent=l}n.extent=l.clone()._normalize(!0).toJSON();const p=await a.takeScreenshot(s);return n.imageData=o(p.dataUrl)?.data,n}async function ne(e,{layerView:t,printTemplate:a},i){e.legendEnabled&&i.legendLayers.push({id:e.id});return G(e,await he(t),a,i)}async function oe(e,t){if(e.legendEnabled)for(const r of e.sublayers)r.legendEnabled&&t.legendLayers.push({id:r.id});const a={customParameters:(i=be(e)).customParameters,effect:i.effect,layerDefinition:i.layerDefinition,layerType:i.layerType,layers:i.layers,url:i.url};var i;if(de(a,e),Array.isArray(a.layers)){for(const e of a.layers)delete e.popupInfo;a.token&&a.layers.length>0&&(a.layers[a.layers.length-1].token=a.token,delete a.token)}return a}async function se(e){const t=[],a=[];for(const i of e.map.allTables)"feature"!==i.type||i.loaded||a.push(i.load());a.length&&await Promise.allSettled(a);for(const i of e.map.allTables)if("feature"===i.type&&i.loaded&&i.isTable&&"feature-layer"===i.source?.type){const e=(e=>({id:e.id,title:e.title,customParameters:e.customParameters,layerDefinition:{definitionExpression:e.layerDefinition?.definitionExpression},url:e.url}))(be(i));de(e,i),t.push(e)}return t.length?t:void 0}function le(e,t){e.legendEnabled&&t.legendLayers.push({id:e.id});const a={layerType:(i=be(e)).layerType,customParameters:i.customParameters};var i;return de(a,e),a}async function ce(e,t,a){const i=t.layerView;if(e.serviceUrl&&e.styleUrl&&!i.spriteSourceChanged&&!i.styleChanged){const t=f(e.styleUrl,e.apiKey),i=f(e.serviceUrl,e.apiKey);if(!t&&!i||"2.1.0"!==a.cimVersion){const a={type:"VectorTileLayer"};return a.styleUrl=s(e.styleUrl),a.token=t,i!==t&&(a.additionalTokens=[{url:e.serviceUrl,token:i}]),a}}return re(e,t,a)}function ue(e){const t=e.urlTemplate?.replace(/\${/g,"{"),a={type:"WebTiledLayer",urlTemplate:t,credits:e.copyright};return e.subDomains&&e.subDomains.length>0&&(a.subDomains=e.subDomains),a}async function ye(e,t,a){return parseFloat(a.cimVersion)<3.5?re(e,t,a):(e.legendEnabled&&a.legendLayers.push({id:e.id}),{layerType:(i=be(e,"web-map")).layerType,layerDefinition:i.layerDefinition,url:i.url,wfsInfo:i.wfsInfo});var i}function pe(e,t){let a;const i=[],r=e=>{e.visible&&(e.sublayers?e.sublayers.forEach(r):e.name&&i.unshift(e.name))};return e.sublayers&&e.sublayers.forEach(r),i.length&&(e.legendEnabled&&t.legendLayers.push({id:e.id,subLayerIds:i}),a={type:"wms",customLayerParameters:e.customLayerParameters,customParameters:e.customParameters,transparentBackground:e.imageTransparency,visibleLayers:i,url:s(e.url),version:e.version}),a}function fe(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:s(e.url)}}function de(e,t){t.url&&(e.url=s(e.url||t.url),e.token=f(e.url,t.apiKey))}async function me(e,a){a.canvas||(a.canvas=document.createElement("canvas"));const i=1024;a.canvas.width=i,a.canvas.height=i;const o=a.canvas.getContext("2d");let s,l;if(e.path){const t=new Path2D(e.path);t.closePath(),o.fillStyle=Array.isArray(e.color)?`rgba(${e.color[0]},${e.color[1]},${e.color[2]},${e.color[3]/255})`:"rgb(0,0,0)",o.fill(t);const a=E(o);if(!a)return null;o.clearRect(0,0,i,i);const n=r(e.size)/Math.max(a.width,a.height);o.scale(n,n);const c=i/n,u=c/2-a.width/2-a.x,y=c/2-a.height/2-a.y;if(o.translate(u,y),Array.isArray(e.color)&&o.fill(t),e.outline?.width&&Array.isArray(e.outline.color)){const i=e.outline;o.lineWidth=r(i.width)/n,o.lineJoin="round",o.strokeStyle=`rgba(${i.color[0]},${i.color[1]},${i.color[2]},${i.color[3]/255})`,o.stroke(t),a.width+=o.lineWidth,a.height+=o.lineWidth}a.width*=n,a.height*=n;const p=o.getImageData(i/2-a.width/2,i/2-a.height/2,Math.ceil(a.width),Math.ceil(a.height));s=p.width,l=p.height,o.canvas.width=s,o.canvas.height=l,o.putImageData(p,0,0)}else{const a="image/svg+xml"===e.contentType?"data:image/svg+xml;base64,"+e.imageData:e.url,i=(await t(a,{responseType:"image"})).data;s=r(e.width),l=r(e.height),o.canvas.width=s,o.canvas.height=l,o.drawImage(i,0,0,o.canvas.width,o.canvas.height)}return{type:"esriPMS",imageData:o.canvas.toDataURL("image/png").slice(22),angle:e.angle,contentType:"image/png",height:n(l),width:n(s),xoffset:e.xoffset,yoffset:e.yoffset}}async function ge(e,t){const a=e.type;if("simple"===a&&Se(e.symbol))e.symbol=await me(e.symbol,t);else if("uniqueValue"===a||"classBreaks"===a){Se(e.defaultSymbol)&&(e.defaultSymbol=await me(e.defaultSymbol,t));const i=e["uniqueValue"===a?"uniqueValueInfos":"classBreakInfos"];if(i)for(const e of i)Se(e.symbol)&&(e.symbol=await me(e.symbol,t))}}async function he(e){return e.queryFeatures(e.createQuery()).then(e=>e.features)}function be(e,t){return e.write({},{ignorePersistenceEnabled:!0,origin:t})??{}}function we(e){return e.gpMetadata?.executionType?k.fromJSON(e.gpMetadata.executionType):"sync"}function Se(e){return e&&(e.path||"image/svg+xml"===e.contentType||e.url?.endsWith(".svg"))}export{R as execute,_ as getGpPrintParams,$ as getGpServerUrl,J as getMode,C as getTaskExecutionMode,A as getTaskInfo,j as getTaskInfos,N as printCacheMap};
|
|
5
|
+
import{id as e}from"../kernel.js";import t from"../request.js";import{JSONMap as i}from"../core/jsonMap.js";import{createScreenPoint as a,pt2px as r,px2pt as n}from"../core/screenUtils.js";import{dataComponents as o,normalize as s}from"../core/urlUtils.js";import l from"../geometry/Polygon.js";import{collectLabelingFields as c}from"../layers/support/fieldUtils.js";import{getFloorFilterClause as u}from"../layers/support/floorFilterUtils.js";import{getSizeRangeAtScale as y}from"../renderers/visualVariables/support/visualVariableUtils.js";import{asValidOptions as p,findToken as f}from"./utils.js";import{execute as d}from"./geoprocessor/execute.js";import{submitJob as m}from"./geoprocessor/submitJob.js";import{formatJsonMap as g}from"./support/fileFormat.js";import{toJSON as h}from"./support/layoutTemplate.js";import{getVisibleLayerViews as b,isScreenshotRequired as w,isBingMapsLayer as S,isBlendLayer as x,getCopyright as I,getSelectionSymbol as v,createPointLayer as D,createPolygonLayer as T,createPolylineLayer as L,createMultipointLayer as O,getContextBoundingBox as E}from"./support/printTaskUtils.js";import P from"./support/PrintTemplate.js";import{toJSON as M}from"./support/reportTemplate.js";import{getDefaultHighlightOptions as V}from"../views/2d/support/highlightOptionsUtils.js";import F from"../views/support/HighlightOptions.js";const k={Feet:"ft",Kilometers:"km",Meters:"m",Miles:"mi"},N=new i({esriFeet:"Feet",esriKilometers:"Kilometers",esriMeters:"Meters",esriMiles:"Miles"}),U=new i({esriExecutionTypeSynchronous:"sync",esriExecutionTypeAsynchronous:"async"}),R=new Map;async function j(e,t,i){const a=await J(e,i),r=await $(t,a);if("sync"===await A(e,i)){const{results:t}=await d(e,r,void 0,i);return t?.[0]?.value}const n=await m(e,r,void 0,i);await n.waitForJobCompletion({interval:t.updateDelay});const{value:o}=await n.fetchResultData("Output_File",null,i);return o}async function J(e,i){const a=q(e),r=R.get(a)??{gpServerUrl:a,legendLayerNameMap:{},legendLayers:[]};return r.gpMetadata??=(await t(a,p({f:"json"},i))).data,r.cimVersion=r.gpMetadata.cimVersion,R.set(a,r),r}async function A(e,t){return xe(await J(e,t))}async function C(e,i){const a=await J(e,i),r=a.gpMetadata.tasks,n=a.gpServerUrl;return a.taskInfos||(a.taskInfos={},await Promise.all(r?.map(async e=>{const r=(await t(`${n}/${e}`,p({f:"json"},i))).data,o=r.name.startsWith("GetLayoutTemplatesInfo")?"GetLayoutTemplatesInfo":r.name.startsWith("ExportWebMap")?"ExportWebMap":null;o&&(a.taskInfos[o]??=r)})??[])),a.taskInfos}async function _(e,t,i){return(await C(e,i))[t]??null}async function z(e,t,i){const a=await _(e,t,i);return a?.executionType?U.fromJSON(a.executionType):"sync"}async function $(t,i){i=i||{is11xService:!1,legendLayerNameMap:{},legendLayers:[]};const a=t.template||new P;null==a.showLabels&&(a.showLabels=!0);const r=a.exportOptions;let n;const o=h(a.layout);if(r){if(n={dpi:r.dpi},"map_only"===o?.toLowerCase()||""===o){const{width:e,height:t}=r;n.outputSize=null!=e&&null!=t?[e,t]:void 0}}const s=a.layoutOptions;let l;if(s){let e,t;"Miles"===s.scalebarUnit||"Kilometers"===s.scalebarUnit?(e="Kilometers",t="Miles"):"Meters"!==s.scalebarUnit&&"Feet"!==s.scalebarUnit||(e="Meters",t="Feet"),l={titleText:s.titleText,authorText:s.authorText,copyrightText:s.copyrightText,customTextElements:s.customTextElements,elementOverrides:s.elementOverrides,scaleBarOptions:e||t?{metricUnit:N.toJSON(e)??void 0,metricLabel:e?k[e]:void 0,nonMetricUnit:N.toJSON(t)??void 0,nonMetricLabel:t?k[t]:void 0}:void 0}}let c=null;s?.legendLayers&&(c=s.legendLayers.map(e=>{const t=e.layerId;i.legendLayerNameMap[t]=e.title;const a={id:t};return e.subLayerIds&&(a.subLayerIds=e.subLayerIds),a}));const u=await W(t,a,i);if(u.operationalLayers){const e=new RegExp("[\\u4E00-\\u9FFF\\u0E00-\\u0E7F\\u0900-\\u097F\\u3040-\\u309F\\u30A0-\\u30FF\\u31F0-\\u31FF]"),t=/[\u0600-\u06FF]/,i=i=>{const a=i.text,r=i.font,n=r?.family?.toLowerCase();a&&r&&("arial"===n||"arial unicode ms"===n)&&(r.family=e.test(a)?"Arial Unicode MS":"Arial","normal"!==r.style&&t.test(a)&&(r.family="Arial Unicode MS"))};for(const a of u.operationalLayers)if(a.featureCollection?.layers)for(const e of a.featureCollection.layers){if(e.layerDefinition?.drawingInfo?.renderer?.symbol){const t=e.layerDefinition.drawingInfo.renderer;"esriTS"===t.symbol.type&&i(t.symbol)}if(e.featureSet?.features)for(const t of e.featureSet.features)t.symbol&&"esriTS"===t.symbol.type&&i(t.symbol)}}t.outSpatialReference&&(u.mapOptions.spatialReference=t.outSpatialReference.toJSON()),Object.assign(u,{exportOptions:n,layoutOptions:l||{}}),Object.assign(u.layoutOptions,{legendOptions:{operationalLayers:null!=c?c:i.legendLayers.slice()}}),i.legendLayers.length=0,R.set(i.gpServerUrl,i);const y={Web_Map_as_JSON:JSON.stringify(u),Format:g.toJSON(a.format),Layout_Template:o,Layout_Item_ID:void 0,Report_Template:M(a.report),Report_Item_ID:void 0};if(a.layoutItem){delete y.Layout_Template;const t=a.layoutItem;await t.load(),"public"!==t.access&&e&&await e.getCredential(i.gpServerUrl),y.Layout_Item_ID=JSON.stringify({id:t.id})}if(a.reportItem){delete y.Report_Template;const t=a.reportItem;await t.load(),"public"!==t.access&&e&&await e.getCredential(i.gpServerUrl),y.Report_Item_ID=JSON.stringify({id:t.id})}return t.extraParameters&&Object.assign(y,t.extraParameters),y}async function W(e,t,i){const a=e.view;let r=a.spatialReference;const n={operationalLayers:await B(a,t,i)};t.includeTables&&(n.tables=await ce(a));let o=e.extent||i.ssExtent||a.extent;if(r?.isWrappable&&(o=o.clone()._normalize(!0),r=o.spatialReference),n.mapOptions={extent:o&&o.toJSON(),spatialReference:r&&r.toJSON(),showAttribution:t.attributionVisible},i.ssExtent=null,a.background&&(n.background=a.background.toJSON()),a.rotation&&(n.mapOptions.rotation=-a.rotation),t.scalePreserved&&(n.mapOptions.scale=t.outScale||a.scale),null!=a.timeExtent){const e=null!=a.timeExtent.start?a.timeExtent.start.getTime():null,t=null!=a.timeExtent.end?a.timeExtent.end.getTime():null;n.mapOptions.time=[e,t]}return t.reportOptions&&(n.reportOptions=t.reportOptions),n}function q(e){let t=e;const i=t.lastIndexOf("/GPServer/");return i>0&&(t=t.slice(0,i+9)),t}async function B(e,t,i){const a=[],r={layerView:null,printTemplate:t,view:e};let n=0;t.scalePreserved&&(n=t.outScale||e.scale);const o=b(e,n);for(const s of o){const e=s.layer;if(!e.loaded||"layers"in e)continue;let t;r.layerView=s,t=w(s)?await oe(e,r,i):S(e)?K(e):"csv"===e?.type?await H(e,r,i):"catalog-footprint"===e?.type?await G(e,r,i):"feature"===e?.type?await X(e,r,i):"geojson"===e?.type?await Y(e,r,i):"graphics"===e?.type?await Z(e,r,i):"imagery"===e?.type?ee(e,i):"imagery-tile"===e?.type?await te(e,r,i):"kml"===e?.type?await ie(e,r,i):"map-image"===e?.type?ae(e,r,i):"map-notes"===e?.type?await re(r,i):"open-street-map"===e?.type?ne():"stream"===e?.type?await se(e,r,i):"subtype-group"===e?.type?await le(e,i):"tile"===e?.type?ue(e,i):"vector-tile"===e?.type?await ye(e,r,i):"web-tile"===e?.type?pe(e):"wfs"===e?.type?await fe(e,r,i):"wms"===e?.type?de(e,i):"wmts"===e?.type?me(e):await oe(e,r,i),t&&(Array.isArray(t)?a.push(...t):(t.id=e.id,t.title=i.legendLayerNameMap[e.id]||e.title,t.opacity=s.fullOpacity,t.minScale=e.minScale||0,t.maxScale=e.maxScale||0,x(e)&&e.blendMode&&"normal"!==e.blendMode&&(t.blendMode=e.blendMode),a.push(t)))}if(n)for(const s of a)s.minScale=0,s.maxScale=0;if(e.graphics?.length){const r=await Q(null,e.graphics,t,i);r&&a.push(r)}return a}function K(e){return{culture:e.culture,key:e.key,type:"BingMaps"+("aerial"===e.style?"Aerial":"hybrid"===e.style?"Hybrid":"Road")}}async function G(e,{layerView:t,printTemplate:i},a){if(parseFloat(a.cimVersion)<3.1){return Q(e,await we(t),i,a)}const r=e.parent,n={id:(o=Se(r,"web-map")).id,url:o.url,layerType:o.layerType,customParameters:o.customParameters,dynamicGroupLayer:{visibility:!1},footprintLayer:o.footprintLayer,layerDefinition:o.layerDefinition};var o;return ge(n,r),n}async function H(e,t,i){e.legendEnabled&&i.legendLayers.push({id:e.id});const a=t.layerView,r=t.printTemplate;if(!(a.filter||e.portalItem&&"public"!==e.portalItem.access)){const t=Se(e,"web-map");return t.type="CSV",delete t.popupInfo,delete t.layerType,t.showLabels=r.showLabels&&e.labelsVisible,t}return Q(e,await we(a),r,i)}async function Q(e,t,i,a){let r;const n=T(),o=L(),s=D(),u=O(),y=D();if(y.layerDefinition.name="textLayer",delete y.layerDefinition.drawingInfo,e){if("esri.layers.FeatureLayer"===e.declaredClass||"esri.layers.StreamLayer"===e.declaredClass?n.layerDefinition.name=o.layerDefinition.name=s.layerDefinition.name=u.layerDefinition.name=a.legendLayerNameMap[e.id]||e.arcgisProps?.title||e.title:"esri.layers.GraphicsLayer"===e.declaredClass&&(t=e.graphics.items),e.renderer){const t=e.renderer.toJSON(),i=n.layerDefinition.drawingInfo;i&&(i.renderer=t);const a=o.layerDefinition.drawingInfo;a&&(a.renderer=t);const r=s.layerDefinition.drawingInfo;r&&(r.renderer=t);const l=u.layerDefinition.drawingInfo;l&&(l.renderer=t)}if(i.showLabels&&e.labelsVisible&&"function"==typeof e.write){const t=Se(e,"web-map"),i=t.layerDefinition?.drawingInfo?.labelingInfo;if(i){r=!0;const e=n.layerDefinition.drawingInfo;e&&(e.labelingInfo=i);const t=o.layerDefinition.drawingInfo;t&&(t.labelingInfo=i);const a=s.layerDefinition.drawingInfo;a&&(a.labelingInfo=i);const l=u.layerDefinition.drawingInfo;l&&(l.labelingInfo=i)}}}let p;e?.renderer||r||(delete n.layerDefinition.drawingInfo,delete o.layerDefinition.drawingInfo,delete s.layerDefinition.drawingInfo,delete u.layerDefinition.drawingInfo);const f=e?.fieldsIndex,d=e?.renderer;if(f){const t=new Set;r&&await c(t,e),d&&"function"==typeof d.collectRequiredFields&&await d.collectRequiredFields(t,f),p=Array.from(t);const i=f.fields.map(e=>e.toJSON());n.layerDefinition.fields=i,o.layerDefinition.fields=i,s.layerDefinition.fields=i,u.layerDefinition.fields=i}const m=t?.length;let g;for(let c=0;c<m;c++){const e=t[c]||t.at(c);if(!1!==e.visible&&e.geometry){if(g=e.toJSON(),g.hasOwnProperty("popupTemplate")&&delete g.popupTemplate,g.geometry?.z&&delete g.geometry.z,g.symbol&&(g.symbol.angle||delete g.symbol.angle,Ie(g.symbol)?g.symbol=await he(g.symbol,a):g.symbol.text&&delete g.attributes),(!i||!i.forceFeatureAttributes)&&p?.length){const e={};for(const t of p)g.attributes?.hasOwnProperty(t)&&(e[t]=g.attributes[t]);g.attributes=e}"polygon"===e.geometry.type?n.featureSet.features.push(g):"polyline"===e.geometry.type?o.featureSet.features.push(g):"point"===e.geometry.type?g.symbol?.text?y.featureSet.features.push(g):s.featureSet.features.push(g):"multipoint"===e.geometry.type?u.featureSet.features.push(g):"extent"===e.geometry.type&&(g.geometry=l.fromExtent(e.geometry).toJSON(),n.featureSet.features.push(g))}}const h=[n,o,u,s,y].filter(e=>e.featureSet.features.length>0);for(const l of h){const e=l.featureSet.features.every(e=>e.symbol);if(e&&(!i||!i.forceFeatureAttributes))for(const t of l.featureSet.features)delete t.attributes;e&&delete l.layerDefinition.drawingInfo,l.layerDefinition.drawingInfo?.renderer&&await be(l.layerDefinition.drawingInfo.renderer,a)}return h.length?{featureCollection:{layers:h},showLabels:r}:null}async function X(e,t,i){let a;const r=e.renderer,n=parseFloat(i.cimVersion);if("binning"===e.featureReduction?.type||"cluster"===e.featureReduction?.type&&(n<2.9||"pie-chart"===e.featureReduction.renderer?.type)||"pie-chart"===r?.type&&n<3.1||"dot-density"===r?.type&&n<2.6)return oe(e,t,i);e.legendEnabled&&i.legendLayers.push({id:e.id});const o=t.layerView,{printTemplate:s,view:l}=t,c="feature-layer"!==e.source?.type&&"ogc-feature"!==e.source?.type;if(o.filter||c||!r||"field"in r&&null!=r.field&&!e.getField(r.field)){const t=await we(o);a=await Q(e,t,s,i)}else{if(a={id:(p=Se(e)).id,title:p.title,url:p.url,layerType:p.layerType,customParameters:p.customParameters,layerDefinition:p.layerDefinition,charts:s.includeCharts?p.charts:void 0},s.attributionVisible&&(a.credits=I(e)),a.showLabels=s.showLabels&&e.labelsVisible,ge(a,e),delete a.layerDefinition?.featureReduction?.disablePopup,delete a.layerDefinition?.featureReduction?.popupInfo,o.displayFilterEnabled||delete a.layerDefinition?.displayFilterInfo,a.layerDefinition?.drawingInfo?.renderer&&(delete a.layerDefinition.minScale,delete a.layerDefinition.maxScale,await be(a.layerDefinition.drawingInfo.renderer,i),"visualVariables"in r&&r.visualVariables?.[0])){const e=r.visualVariables[0];if("size"===e.type&&e.maxSize&&"number"!=typeof e.maxSize&&e.minSize&&"number"!=typeof e.minSize){const t=y(e,l.scale);a.layerDefinition.drawingInfo.renderer.visualVariables[0].minSize=t.minSize,a.layerDefinition.drawingInfo.renderer.visualVariables[0].maxSize=t.maxSize}}const t=u(o);if(t&&(a.layerDefinition??={},a.layerDefinition.definitionExpression=a.layerDefinition.definitionExpression?`(${a.layerDefinition.definitionExpression}) AND (${t})`:t),e.gdbVersion&&(a.layerDefinition??={},a.layerDefinition.gdbVersion=e.gdbVersion),o.hasHighlight&&"highlightIds"in o){const t=o;a.selectionObjectIds=t.highlightIds;const i=V(t)||V(l)||new F;a.selectionSymbol=v(e.geometryType,i)}}var p;return a}async function Y(e,t,i){if("binning"===e.featureReduction?.type||"cluster"===e.featureReduction?.type)return oe(e,t,i);e.legendEnabled&&i.legendLayers.push({id:e.id});return Q(e,await we(t.layerView),t.printTemplate,i)}async function Z(e,{printTemplate:t},i){return Q(e,null,t,i)}function ee(e,t){e.legendEnabled&&t.legendLayers.push({id:e.id});const i={layerType:(a=Se(e)).layerType,customParameters:a.customParameters};var a;return i.bandIds=e.bandIds,i.compressionQuality=e.compressionQuality,i.format=e.format,i.interpolation=e.interpolation,(e.mosaicRule||e.definitionExpression)&&(i.mosaicRule=e.exportImageServiceParameters.mosaicRule.toJSON()),e.rasterFunction&&(i.renderingRule=e.rasterFunction.toJSON()),e.renderer&&(i.layerDefinition??={},i.layerDefinition.drawingInfo??={},i.layerDefinition.drawingInfo.renderer=e.renderer.toJSON()),ge(i,e),i}async function te(e,t,i){if("flow"===e.renderer?.type)return oe(e,t,i);e.legendEnabled&&i.legendLayers.push({id:e.id});const a={bandIds:(r=Se(e)).bandIds,customParameters:r.customParameters,interpolation:r.interpolation,layerDefinition:r.layerDefinition};var r;return a.layerType="ArcGISImageServiceLayer",ge(a,e),a}async function ie(e,t,i){const a=t.printTemplate;if(!e.portalItem||"public"===e.portalItem.access){const t=Se(e,"web-map");return t.type="kml",delete t.layerType,t.url=s(e.url),t}const r=[],n=t.layerView,o="data:image/png;base64,";n.allVisibleMapImages.forEach((t,i)=>{const a={id:`${e.id}_image${i}`,type:"image",title:e.id,minScale:e.minScale||0,maxScale:e.maxScale||0,opacity:n.fullOpacity,extent:t.extent};t.href.startsWith(o)?a.imageData=t.href.slice(o.length):a.url=t.href,r.push(a)});const l=[...n.allVisiblePoints.items,...n.allVisiblePolylines.items,...n.allVisiblePolygons.items],c={id:e.id,...await Q(null,l,a,i)};return r.push(c),r}function ae(e,{printTemplate:t,view:i},a){let r;const n={id:e.id,subLayerIds:[]};let o=[];const s=i.scale,l=e=>{const t=0===s,i=0===e.minScale||s<=e.minScale,a=0===e.maxScale||s>=e.maxScale;if(e.visible&&(t||i&&a))if(e.sublayers)e.sublayers.forEach(l);else{const t=e.toExportImageJSON(),i={id:e.id,name:e.title,layerDefinition:{definitionExpression:t.definitionExpression,drawingInfo:t.drawingInfo,orderBy:t.orderBy,source:t.source}};o.unshift(i),n.subLayerIds.push(e.id)}};var c;return e.sublayers?.forEach(l),o.length&&(o=o.map(({id:e,name:t,layerDefinition:i})=>({id:e,name:t,layerDefinition:i})),r={layerType:(c=Se(e)).layerType,customParameters:c.customParameters},r.layers=o,r.visibleLayers=e.capabilities?.exportMap?.supportsDynamicLayers?void 0:n.subLayerIds,t.attributionVisible&&(r.credits=I(e)),e.gdbVersion&&(r.gdbVersion=e.gdbVersion),ge(r,e),e.legendEnabled&&a.legendLayers.push(n)),r}async function re({layerView:e,printTemplate:t},i){const a=[],r=e.layer;if(null!=r.featureCollections)for(const n of r.featureCollections){const e=await Q(n,n.source,t,i);e&&a.push(...e.featureCollection.layers)}else if(null!=r.sublayers)for(const n of r.sublayers){const e=await Q(null,n.graphics,t,i);e&&a.push(...e.featureCollection.layers)}return{featureCollection:{layers:a}}}function ne(){return{type:"OpenStreetMap"}}async function oe(e,{printTemplate:t,view:i},r){const n={type:"image"},s={format:"png",ignoreBackground:!0,ignorePadding:!0,layers:[e]};0!==i.rotation&&(s.rotation=0);const l=r.ssExtent||i.state.extent.clone();let c=96,u=!0,y=!0;if(t.exportOptions){const e=t.exportOptions;null!=e.dpi&&e.dpi>0&&(c=e.dpi),null!=e.width&&e.width>0&&(u=e.width%2==i.width%2),null!=e.height&&e.height>0&&(y=e.height%2==i.height%2)}if("map-only"===t.layout&&t.scalePreserved&&(!t.outScale||t.outScale===i.scale)&&96===c&&(!u||!y)&&i.state.extent.equals(i.extent)&&(s.area={x:0,y:0,width:i.width,height:i.height},u||(s.area.width-=1),y||(s.area.height-=1),!r.ssExtent)){const e=i.toMap(a(s.area.width,s.area.height));l.ymin=e.y,l.xmax=e.x,r.ssExtent=l}n.extent=l.clone()._normalize(!0).toJSON();const p=await i.takeScreenshot(s);return n.imageData=o(p.dataUrl)?.data,n}async function se(e,{layerView:t,printTemplate:i},a){e.legendEnabled&&a.legendLayers.push({id:e.id});return Q(e,await we(t),i,a)}async function le(e,t){if(e.legendEnabled)for(const r of e.sublayers)r.legendEnabled&&t.legendLayers.push({id:r.id});const i={customParameters:(a=Se(e)).customParameters,effect:a.effect,layerDefinition:a.layerDefinition,layerType:a.layerType,layers:a.layers,url:a.url};var a;if(ge(i,e),Array.isArray(i.layers)){for(const e of i.layers)delete e.popupInfo;i.token&&i.layers.length>0&&(i.layers[i.layers.length-1].token=i.token,delete i.token)}return i}async function ce(e){const t=[],i=[];for(const a of e.map.allTables)"feature"!==a.type||a.loaded||i.push(a.load());i.length&&await Promise.allSettled(i);for(const a of e.map.allTables)if("feature"===a.type&&a.loaded&&a.isTable&&"feature-layer"===a.source?.type){const e=(e=>({id:e.id,title:e.title,customParameters:e.customParameters,layerDefinition:{definitionExpression:e.layerDefinition?.definitionExpression},url:e.url}))(Se(a));ge(e,a),t.push(e)}return t.length?t:void 0}function ue(e,t){e.legendEnabled&&t.legendLayers.push({id:e.id});const i={layerType:(a=Se(e)).layerType,customParameters:a.customParameters};var a;return ge(i,e),i}async function ye(e,t,i){const a=t.layerView;if(e.serviceUrl&&e.styleUrl&&!a.spriteSourceChanged&&!a.styleChanged){const t=f(e.styleUrl,e.apiKey),a=f(e.serviceUrl,e.apiKey);if(!t&&!a||"2.1.0"!==i.cimVersion){const i={type:"VectorTileLayer"};return i.styleUrl=s(e.styleUrl),i.token=t,a!==t&&(i.additionalTokens=[{url:e.serviceUrl,token:a}]),i}}return oe(e,t,i)}function pe(e){const t=e.urlTemplate?.replace(/\${/g,"{"),i={type:"WebTiledLayer",urlTemplate:t,credits:e.copyright};return e.subDomains&&e.subDomains.length>0&&(i.subDomains=e.subDomains),i}async function fe(e,t,i){return parseFloat(i.cimVersion)<3.5?oe(e,t,i):(e.legendEnabled&&i.legendLayers.push({id:e.id}),{layerType:(a=Se(e,"web-map")).layerType,layerDefinition:a.layerDefinition,url:a.url,wfsInfo:a.wfsInfo});var a}function de(e,t){let i;const a=[],r=e=>{e.visible&&(e.sublayers?e.sublayers.forEach(r):e.name&&a.unshift(e.name))};return e.sublayers&&e.sublayers.forEach(r),a.length&&(e.legendEnabled&&t.legendLayers.push({id:e.id,subLayerIds:a}),i={type:"wms",customLayerParameters:e.customLayerParameters,customParameters:e.customParameters,transparentBackground:e.imageTransparency,visibleLayers:a,url:s(e.url),version:e.version}),i}function me(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:s(e.url)}}function ge(e,t){t.url&&(e.url=s(e.url||t.url),e.token=f(e.url,t.apiKey))}async function he(e,i){i.canvas||(i.canvas=document.createElement("canvas"));const a=1024;i.canvas.width=a,i.canvas.height=a;const o=i.canvas.getContext("2d");let s,l;if(e.path){const t=new Path2D(e.path);t.closePath(),o.fillStyle=Array.isArray(e.color)?`rgba(${e.color[0]},${e.color[1]},${e.color[2]},${e.color[3]/255})`:"rgb(0,0,0)",o.fill(t);const i=E(o);if(!i)return null;o.clearRect(0,0,a,a);const n=r(e.size)/Math.max(i.width,i.height);o.scale(n,n);const c=a/n,u=c/2-i.width/2-i.x,y=c/2-i.height/2-i.y;if(o.translate(u,y),Array.isArray(e.color)&&o.fill(t),e.outline?.width&&Array.isArray(e.outline.color)){const a=e.outline;o.lineWidth=r(a.width)/n,o.lineJoin="round",o.strokeStyle=`rgba(${a.color[0]},${a.color[1]},${a.color[2]},${a.color[3]/255})`,o.stroke(t),i.width+=o.lineWidth,i.height+=o.lineWidth}i.width*=n,i.height*=n;const p=o.getImageData(a/2-i.width/2,a/2-i.height/2,Math.ceil(i.width),Math.ceil(i.height));s=p.width,l=p.height,o.canvas.width=s,o.canvas.height=l,o.putImageData(p,0,0)}else{const i="image/svg+xml"===e.contentType?"data:image/svg+xml;base64,"+e.imageData:e.url,a=(await t(i,{responseType:"image"})).data;s=r(e.width),l=r(e.height),o.canvas.width=s,o.canvas.height=l,o.drawImage(a,0,0,o.canvas.width,o.canvas.height)}return{type:"esriPMS",imageData:o.canvas.toDataURL("image/png").slice(22),angle:e.angle,contentType:"image/png",height:n(l),width:n(s),xoffset:e.xoffset,yoffset:e.yoffset}}async function be(e,t){const i=e.type;if("simple"===i&&Ie(e.symbol))e.symbol=await he(e.symbol,t);else if("uniqueValue"===i||"classBreaks"===i){Ie(e.defaultSymbol)&&(e.defaultSymbol=await he(e.defaultSymbol,t));const a=e["uniqueValue"===i?"uniqueValueInfos":"classBreakInfos"];if(a)for(const e of a)Ie(e.symbol)&&(e.symbol=await he(e.symbol,t))}}async function we(e){return e.queryFeatures(e.createQuery()).then(e=>e.features)}function Se(e,t){return e.write({},{ignorePersistenceEnabled:!0,origin:t})??{}}function xe(e){return e.gpMetadata?.executionType?U.fromJSON(e.gpMetadata.executionType):"sync"}function Ie(e){return e&&(e.path||"image/svg+xml"===e.contentType||e.url?.endsWith(".svg"))}export{j as execute,$ as getGpPrintParams,q as getGpServerUrl,A as getMode,z as getTaskExecutionMode,_ as getTaskInfo,C as getTaskInfos,R as printCacheMap};
|
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.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
const
|
|
5
|
+
const b="20250806",d="7ed3634d5e3ddc792aa1325bb11351b19b915713";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.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{GeometryCursor as e}from"../../geometry/GeometryCursor.js";import{TileClipper as
|
|
5
|
+
import{GeometryCursor as e}from"../../geometry/GeometryCursor.js";import{TileClipper as r}from"../../geometry/support/TileClipper.js";import{importLazily as t}from"./utils.js";const o=t(()=>import("../../geometry/operators/json/bufferOperator.js")),s=t(()=>import("../../geometry/operators/json/convexHullOperator.js")),m=t(()=>import("../../geometry/operators/json/lengthOperator.js")),i=t(()=>import("../../geometry/operators/json/generalizeOperator.js")),n=t(()=>import("../../geometry/operators/json/graphicBufferOperator.js")),p=t(()=>import("../../geometry/operators/json/offsetOperator.js")),f=t(()=>import("../../geometry/operators/json/simplifyOperator.js")),c=512;let a;function l(e){switch(e.type){case"CIMGeometricEffectDonut":case"CIMGeometricEffectBuffer":return o.getImportPromise();case"CIMGeometricEffectEnclosingPolygon":return s.getImportPromise();case"CIMGeometricEffectOffset":return Promise.all([p.getImportPromise(),n.getImportPromise()]);case"CIMGeometricEffectTaperedPolygon":return Promise.all([f.getImportPromise(),m.getImportPromise(),i.getImportPromise()]);default:return Promise.resolve()}}class g{constructor(e){this._geometry=e}next(){const e=this._geometry;return this._geometry=null,e}}function y(t,o,s){if(!t)return null;a||(a=new r(0,0,0,1));const m=s?-1:1,i="esriGeometryPolygon"===t.geometryType,n=i?3:2,p=i?3:2;let f,l;for(a.reset(n),a.setPixelMargin(o+1),a.setExtent(c);t.nextPath();)if(!(t.pathSize<p)){for(t.nextPoint(),f=t.x,l=m*t.y,a.moveTo(f,l);t.nextPoint();)f=t.x,l=m*t.y,a.lineTo(f,l);i&&a.close()}const g=a.result(!1);if(g){const r=e.createEmptyOptimizedCIM(t.geometryType);for(const e of g){r.startPath();for(const t of e)r.pushXY(t.x,m*t.y)}return r.reset(),r}return null}export{g as SimpleEffectCursor,y as clipCursorToTileExtent,o as lazyBufferOperator,s as lazyConvexHullOperator,i as lazyGeneralizeOperator,n as lazyGraphicBufferOperator,m as lazyLengthOperator,p as lazyOffsetOperator,f as lazySimplifyOperator,l as loadGeometryOperatorsForEffect};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{GeometryCursor as
|
|
5
|
+
import{GeometryCursor as e}from"../../../geometry/GeometryCursor.js";import{collectPath as t}from"../../../geometry/geometryCursorCollectUtils.js";import s from"../../../geometry/SpatialReference.js";import{isExtent as r}from"../../../geometry/support/jsonUtils.js";import{clipCursorToTileExtent as i,lazyOffsetOperator as o,lazyGraphicBufferOperator as n}from"../CIMEffects.js";import{CurveHelper as f,pixelTolerance as m}from"../CurveHelper.js";const a=10;class l{static{this.instance=null}static local(){return null===l.instance&&(l.instance=new l),l.instance}execute(e,t,s,r,i,o){return new h(e,t,s,r,i,o)}}class h{constructor(e,t,s,r,i,o){this._preventClipping=o,this._inputGeometries=e,this._tileKey=r,this._curveHelper=new f,this._offset=(t.offset??1)*s,this._method=t.method,this._maxInflateSize=Math.max(Math.abs(i*s),a),this._option=t.option,this._offsetFlattenError=m*s}next(){let f;for(;f=this._inputGeometries.next();){if(0===this._offset)return f.clone();if("esriGeometryEnvelope"===f.geometryType){if("Rounded"===this._method&&this._offset>0){const s=t(f),r=this._curveHelper.offset(s,-this._offset,this._method,4,this._offsetFlattenError);if(r){const t=e.createEmptyOptimizedCIM(f.geometryType);return t.pushPath(r),t}return null}const s=f.asJSON();if(r(s)&&Math.min(s.xmax-s.xmin,s.ymax-s.ymin)+2*this._offset>0)return e.fromJSONCIM({xmin:s.xmin-this._offset,xmax:s.xmax+this._offset,ymin:s.ymin-this._offset,ymax:s.ymax+this._offset})}const m=!this._preventClipping&&this._tileKey?i(f,this._maxInflateSize,!0):f.clone();if(!m)continue;const a=o.module,l=n.module,h={...m.asJSON(),spatialReference:{wkid:s.WebMercator.wkid}};let c,p=u(this._method);return"esriGeometryPolygon"===f.geometryType&&this._offset>0?("square"===p&&(p="bevel"),c=l.executeMany([h],[this._offset],{joins:p})[0]):c=a.execute(h,-this._offset,{joins:p,flattenError:this._offsetFlattenError,miterLimit:4}),c?e.fromJSONCIM(c):null}return null}}function u(e){switch(e){case"Rounded":return"round";case"Bevelled":return"bevel";case"Mitered":return"miter";case"Square":return"square"}}export{l as EffectOffset};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/*
|
|
2
|
+
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
|
+
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
|
+
*/
|
|
5
|
+
import o from"../../core/Error.js";function r(r){throw new o("analysis-view-module-import-utils:analysis-not-supported",`Analysis "${r.type}" is not supported`)}export{r as importAnalysisViewModule};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{memoize as e}from"../../../../../../../core/MapUtils.js";import{pt2px as t}from"../../../../../../../core/screenUtils.js";import{numericHash as i}from"../../../../../../../core/string.js";import{fromRotation as r,translate as s}from"../../../../../../../core/libs/gl-matrix-2/math/mat2d.js";import{create as o}from"../../../../../../../core/libs/gl-matrix-2/factories/mat2df32.js";import{transformMat2d as n,set as a,sub as l,normalize as h,add as c,scale as m}from"../../../../../../../core/libs/gl-matrix-2/math/vec2.js";import{fromValues as u}from"../../../../../../../core/libs/gl-matrix-2/factories/vec2f32.js";import{create as d}from"../../../../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{GeometryCursor as f}from"../../../../../../../geometry/GeometryCursor.js";import{generalizeOptimizedGeometry as g,convertToGeometry as _}from"../../../../../../../layers/graphics/featureConversionUtils.js";import p from"../../../../../../../layers/graphics/OptimizedGeometry.js";import{tileSize as b,minMaxZoomPrecisionFactor as x}from"../../../definitions.js";import M from"../../../collisions/BoundingBox.js";import{LabelMetric as v}from"../../../collisions/LabelMetric.js";import{smoothPaths as y,pathDivide as P}from"../../../mesh/templates/segmentUtils.js";import{getMinMaxZoom as w,processColorInput as L}from"../fill/meshWriterUtils.js";import{TextMeshWriter as I,maxLabelZoom as B}from"../text/TextMeshWriter.js";const S=1,z=0,j=128;function A(e,t){return i(`${e}${t}`)}function D(e,t,r){return i(`${e}${t}${r}`)}function G(e,t,r,s){return i(`${e}${t}${r*2**(B-s)}`)}function Z(e,t,r,s,o){return i(`${e}${o}${t}${r*2**(B-s)}`)}const k=e(e=>{let t=0;if(0===e)return 1/0;for(;!(e%2);)t++,e/=2;return t});class F extends I{constructor(){super(...arguments),this._zoomLevel=0}_write(e,t,i,r){if(this._zoomLevel=r||0,null!=i)throw new Error("InternalError: EffectGeometry not support for LabelMeshWriter");switch(t.geometryType){case"esriGeometryPoint":{const i=t.readXForDisplay(),r=t.readYForDisplay();this._writePoint(e,i,r,0,t);break}case"esriGeometryEnvelope":case"esriGeometryPolygon":{const i=t.readCentroidForDisplay();if(!i)return;const[r,s]=i.coords;this._writePoint(e,r,s,0,t);break}case"esriGeometryMultipoint":{let i=0;const r=f.fromFeatureSetReader(t);if(r?.nextPath())for(;r.nextPoint();)this._writePoint(e,r.x,r.y,i++,t);break}case"esriGeometryPolyline":this._writeLines(e,t)}}_getMetricDir(){const{horizontalAlignment:e,verticalAlignment:t}=this.evaluatedMeshParams;return["center"===e?0:"right"===e?-1:1,"middle"===t?0:"bottom"===t?-1:1]}_createLineLabelMetric(e,t,i,r,s,o){const[n,a]=this._getMetricDir(),l=this.evaluatedMeshParams.scaleInfo?.maxScale??0,h=this.evaluatedMeshParams.scaleInfo?.minScale??0,c=this.evaluatedMeshParams.labelClassId;return new v(e,c,t,i,r,s,n,a,l,h,o)}_writePoint(e,t,i,r,s){if(t<0||t>b||i<0||i>b)return;const o=this._getShaping();if(!o)return;const n=s.getDisplayId(),a=this.evaluatedMeshParams.labelClassId,l=A(s.getObjectId(),r),h=D(s.getObjectId(),a,r),[c,m]=this._getMetricDir(),u=this.evaluatedMeshParams.scaleInfo?.maxScale??0,d=this.evaluatedMeshParams.scaleInfo?.minScale??0,f=this._getPointReferenceBounds()||{offsetX:0,offsetY:0,size:0};e.metricStart(new v(n,a,l,h,t,i,c,m,u,d,f)),this._writeGlyphs(e,n,t,i,o,0,f,void 0,!1),e.metricBoxWrite(o.boundsT),e.metricEnd()}_getPointReferenceBounds(){if(!this._references)return null;for(const e of this._references){const t=e.getBoundsInfo();if(t)return t}return null}_writeLines(e,t){const{scaleInfo:i,verticalAlignment:r}=this.evaluatedMeshParams,s=this.evaluatedMeshParams.repeatLabelDistance||128,o=this._getShaping("middle");if(!o)return;const n=(e,t,i,r)=>this._placeSubdivGlyphs(e,t,i,r),a=(o.bounds.width+s)/(1<<S);this._current={out:e,id:t.getDisplayId(),objId:t.getObjectId(),shaping:o,zoomRange:w(i,this.getTileInfo()),referenceBounds:this._getPointReferenceBounds()||{offsetX:0,offsetY:0,size:0},offsetDirection:null,pathIndex:0},this._verticalPlacement="bottom"===r?"above":"top"===r?"below":null,this._verticalPlacement?this._writeAboveAndBelowAlong(t,n,a):this._writeCenterAlong(t,n,a)}_writeAboveAndBelowAlong(e,t,i){const{repeatLabel:r}=this.evaluatedMeshParams,{shaping:s}=this._current,o=s.bounds.halfHeight,n=e.readGeometryForDisplay();if(!n)return;const a=new p;g(a,n,!1,!1,"esriGeometryPolyline",1);const l=C(new p,a,o),h=C(new p,a,-o),c=_(h,"esriGeometryPolyline",!1,!1),m=_(l,"esriGeometryPolyline",!1,!1),u=y(m.paths,s.bounds.width),d=y(c.paths,s.bounds.width);this._current.offsetDirection="above";for(let f=0;f<u.length;f++)this._current.pathIndex=f,P(u[f],i,t,!!r);this._current.offsetDirection="below";for(let f=0;f<d.length;f++)this._current.pathIndex=f,P(d[f],i,t,!!r)}_writeCenterAlong(e,t,i){const{repeatLabel:r}=this.evaluatedMeshParams,{shaping:s}=this._current,o=y(e.readLegacyGeometryForDisplay().paths,s.bounds.width);for(let n=0;n<o.length;n++)this._current.pathIndex=n,P(o[n],i,t,!!r)}_placeSubdivGlyphs(e,t,i,r){const{allowOverrun:s,labelPosition:o,repeatLabelDistance:n}=this.evaluatedMeshParams,a=this._current.zoomRange[0],l=k(t),h=this._current.shaping.bounds.width/(1<<S),c=Math.sqrt(n||j)/(1<<S),m=Math.min(i,r-i),u=this._current.shaping.isMultiline?B:Math.log2(m/(c+h/2)),d=0===t?u:Math.min(l,u),f=Math.max(a,this._zoomLevel+S-d),g=this._zoomLevel-f,_=this._current.shaping.bounds.width/2*2**g,p=G(this._current.objId,this._current.pathIndex,t,this._zoomLevel),b=Z(this._current.objId,this._current.pathIndex,t,this._zoomLevel,this.evaluatedMeshParams.labelClassId);this._current.shaping.isMultiline?0===t&&this._placeStraight(e,f,p,b):s&&g<0?this._placeStraightAlong(e,a,p,b):"parallel"===o?this._placeStraightAlong(e,f,p,b):"curved"===o&&this._placeCurved(e,f,_,p,b)}_placeStraight(e,t,i,r){const{out:s,id:o,shaping:n,referenceBounds:a}=this._current,{x:l,y:h}=e;s.metricStart(this._createLineLabelMetric(o,i,r,l,h)),s.metricBoxWrite(n.boundsT);const c=e.angle*(180/Math.PI)%360,m=(e.angle*(180/Math.PI)+180)%360,u={clipAngle:c,mapAligned:!0,isLineLabel:!0,minZoom:t};this._writeGlyphs(s,o,l,h,n,0,a,u,!1);const d={clipAngle:m,mapAligned:!0,isLineLabel:!0,minZoom:t};this._writeGlyphs(s,o,l,h,n,0,a,d,!1),s.metricEnd()}_placeCurved(e,t,i,r,s){const{out:o,id:n}=this._current;o.metricStart(this._createLineLabelMetric(n,r,s,e.x,e.y));const a=e.clone(),l=e.angle*(180/Math.PI)%360,h=(e.angle*(180/Math.PI)+180)%360;this._verticalPlacement&&this._verticalPlacement!==this._current.offsetDirection||(this._placeFirst(a,t,1,l),this._placeBack(e,a,t,i,1,l),this._placeForward(e,a,t,i,1,l)),this._verticalPlacement&&this._verticalPlacement===this._current.offsetDirection||(this._placeFirst(a,t,0,h),this._placeBack(e,a,t,i,0,h),this._placeForward(e,a,t,i,0,h)),o.metricEnd()}_placeStraightAlong(e,i,n,a){const{out:l,id:h,shaping:c,zoomRange:m,referenceBounds:d}=this._current,{boxBorderLineColor:f,boxBackgroundColor:g}=this.evaluatedMeshParams,_=e.clone(),p=e.angle*(180/Math.PI)%360,b=(e.angle*(180/Math.PI)+180)%360,x=c.glyphs.length>0&&!(!f&&!g);if(l.metricStart(this._createLineLabelMetric(h,n,a,e.x,e.y)),x){const n=Math.max(i,m[0],0),a=Math.min(B,m[1]),f=r(o(),-e.angle),g={minZoom:n,maxZoom:a,clipAngle:p,mapAligned:!0,isLineLabel:!0},_=t(this.evaluatedMeshParams.offsetX),x=t(this.evaluatedMeshParams.offsetY);if(!this._verticalPlacement||this._verticalPlacement===this._current.offsetDirection){const t=u(_,-1*x),[i,r]=c.shapeBackground(s(o(),f,t));l.recordStart(this.instanceId,this.attributeLayout,c.glyphs[0].textureBinding),this._writeTextBox(l,h,e.x,e.y,r,d,g),l.recordEnd()}if(!this._verticalPlacement||this._verticalPlacement!==this._current.offsetDirection){const t=u(_,x),[i,r]=c.shapeBackground(s(o(),f,t));g.clipAngle=b,l.recordStart(this.instanceId,this.attributeLayout,c.glyphs[0].textureBinding),this._writeTextBox(l,h,e.x,e.y,r,d,g),l.recordEnd()}}this._verticalPlacement&&this._verticalPlacement!==this._current.offsetDirection||this._placeFirst(_,i,1,p,!0),this._verticalPlacement&&this._verticalPlacement===this._current.offsetDirection||this._placeFirst(_,i,0,b,!0),l.metricEnd()}_placeBack(e,t,i,r,s,o){const n=e.clone();let a=e.backwardLength+z;for(;n.prev()&&!(a>=r);)this._placeOnSegment(n,t,a,i,-1,s,o),a+=n.length+z}_placeForward(e,t,i,r,s,o){const n=e.clone();let a=e.remainingLength+z;for(;n.next()&&!(a>=r);)this._placeOnSegment(n,t,a,i,1,s,o),a+=n.length+z}_placeFirst(e,i,s,a,l=!1){const{out:h,id:c,shaping:m,zoomRange:d,referenceBounds:f}=this._current,g=m.glyphs,_=t(this.evaluatedMeshParams.offsetX),p=t(this.evaluatedMeshParams.offsetY),b=u(_,p),x=r(o(),-e.angle);n(b,b,x);for(const t of g){const r=t.x>m.bounds.x?s:1-s,o=r*e.remainingLength+(1-r)*e.backwardLength,n=Math.abs(t.x+t.width/2-m.bounds.x),u=Math.max(0,this._zoomLevel+Math.log2(n/(o+z))),g=Math.max(i,l?0:u);if(t.maxZoom=Math.min(d[1],B),t.angle=e.angle+(1-s)*Math.PI,t.minZoom=Math.max(d[0],g),this._writeLineGlyph(h,c,e.x,e.y,t,a,f,!0),(s||this._current.offsetDirection)&&this._isVisible(t.minZoom,t.maxZoom)){const e=new M(t.bounds.x+b[0],t.bounds.y+b[1],t.bounds.width,t.bounds.height);h.metricBoxWrite(e)}}}_placeOnSegment(e,i,s,a,l,h,c){const{out:m,id:d,shaping:f,referenceBounds:g}=this._current,_=f.glyphs,p=e.dx/e.length,b=e.dy/e.length,x={x:e.x+s*-l*p,y:e.y+s*-l*b},v=t(this.evaluatedMeshParams.offsetX),y=t(this.evaluatedMeshParams.offsetY),P=u(v,y),w=r(o(),-e.angle);n(P,P,w);for(const t of _){const i=t.x>f.bounds.x?h:1-h;if(!(i&&1===l||!i&&-1===l))continue;const r=Math.abs(t.x+t.width/2-f.bounds.x),o=Math.max(0,this._zoomLevel+Math.log2(r/s)-.1),n=Math.max(a,this._zoomLevel+Math.log2(r/(s+e.length+z)));if(0!==o&&(t.angle=e.angle+(1-h)*Math.PI,t.minZoom=n,t.maxZoom=o,this._writeLineGlyph(m,d,x.x,x.y,t,c,g,!0),(h||this._current.offsetDirection)&&this._isVisible(t.minZoom,t.maxZoom))){const e=new M(t.bounds.x+P[0],t.bounds.y+P[1],t.bounds.width,t.bounds.height);m.metricBoxWrite(e)}}}_writeLineGlyph(e,t,i,r,s,o,n,a){if(i<0||i>b||r<0||r>b)return;e.recordStart(this.instanceId,this.attributeLayout,s.textureBinding);const{texcoords:l,offsets:h}=s,{fontSize:c,haloSize:m,outlineSize:u}=this._textMeshTransformProps;this._writeQuad(e,t,i,r,{texcoords:l,offsets:h,fontSize:c,haloSize:m,outlineSize:u,color:L(this.evaluatedMeshParams.color),isBackground:!1,referenceBounds:n,minZoom:Math.max(this._current.zoomRange[0],s.minZoom),maxZoom:Math.min(this._current.zoomRange[1],s.maxZoom),clipAngle:o,mapAligned:a,isLineLabel:!0}),e.recordEnd()}_packedZoom(e){return Math.floor(e*x)/x}_isVisible(e,t){let i=Math.max(this._current.zoomRange[0],e),r=Math.min(this._current.zoomRange[1],t);i=this._packedZoom(i),r=this._packedZoom(r);const s=this._packedZoom(this._zoomLevel);return i<=s&&s<=r}}function C(e,t,i){const{coords:r,lengths:s}=t,o=d(),n=d(),u=d(),f=d(),g=d(),_=d(),p=2;let b=0;for(let d=0;d<s.length;d++){const t=s[d];for(let s=0;s<t;s++){const d=p*(s+b-1),x=p*(s+b),M=p*(s+b+1);s>0?a(o,r[d],r[d+1]):a(o,0,0),a(n,r[x],r[x+1]),s<t-1?a(u,r[M],r[M+1]):a(u,0,0),0===s?a(f,0,0):(l(f,n,o),h(f,f),a(f,f[1],-f[0])),s===t-1?a(g,0,0):(l(g,u,n),h(g,g),a(g,g[1],-g[0])),c(_,f,g),h(_,_);const v=_[0]*g[0]+_[1]*g[1];0!==v&&m(_,_,v),m(_,_,i),e.coords.push(n[0]+_[0],n[1]+_[1])}e.lengths.push(t),b+=t}return e}export{F as LabelMeshWriter,A as labelIdHash,D as labelMetricHash,G as lineLabelIdHash,Z as lineLabelMetricHash};
|
|
5
|
+
import{memoize as e}from"../../../../../../../core/MapUtils.js";import{pt2px as t}from"../../../../../../../core/screenUtils.js";import{numericHash as i}from"../../../../../../../core/string.js";import{fromRotation as r,translate as s}from"../../../../../../../core/libs/gl-matrix-2/math/mat2d.js";import{create as o}from"../../../../../../../core/libs/gl-matrix-2/factories/mat2df32.js";import{transformMat2d as n,set as a,sub as l,normalize as c,add as h,scale as m}from"../../../../../../../core/libs/gl-matrix-2/math/vec2.js";import{fromValues as u}from"../../../../../../../core/libs/gl-matrix-2/factories/vec2f32.js";import{create as d}from"../../../../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{GeometryCursor as f}from"../../../../../../../geometry/GeometryCursor.js";import{generalizeOptimizedGeometry as _,convertToGeometry as g}from"../../../../../../../layers/graphics/featureConversionUtils.js";import p from"../../../../../../../layers/graphics/OptimizedGeometry.js";import{tileSize as b,minMaxZoomPrecisionFactor as x}from"../../../definitions.js";import v from"../../../collisions/BoundingBox.js";import{LabelMetric as M}from"../../../collisions/LabelMetric.js";import{smoothPaths as P,pathDivide as y}from"../../../mesh/templates/segmentUtils.js";import{getMinMaxZoom as w,processColorInput as L}from"../fill/meshWriterUtils.js";import{TextMeshWriter as I,maxLabelZoom as B}from"../text/TextMeshWriter.js";const S=1,z=0,D=128;function j(e,t){return i(`${e}${t}`)}function A(e,t,r){return i(`${e}${t}${r}`)}function G(e,t,r,s){return i(`${e}${t}${r*2**(B-s)}`)}function Z(e,t,r,s,o){return i(`${e}${o}${t}${r*2**(B-s)}`)}const k=e(e=>{let t=0;if(0===e)return 1/0;for(;!(e%2);)t++,e/=2;return t});class F extends I{constructor(){super(...arguments),this._zoomLevel=0}_write(e,t,i,r){if(this._zoomLevel=r||0,null!=i)throw new Error("InternalError: EffectGeometry not support for LabelMeshWriter");switch(t.geometryType){case"esriGeometryPoint":{const i=t.readXForDisplay(),r=t.readYForDisplay();this._writePoint(e,i,r,0,t);break}case"esriGeometryEnvelope":case"esriGeometryPolygon":{const i=t.readCentroidForDisplay();if(!i)return;const[r,s]=i.coords;this._writePoint(e,r,s,0,t);break}case"esriGeometryMultipoint":{let i=0;const r=f.fromFeatureSetReader(t);if(r?.nextPath())for(;r.nextPoint();)this._writePoint(e,r.x,r.y,i++,t);break}case"esriGeometryPolyline":this._writeLines(e,t)}}_getMetricDir(){const{horizontalAlignment:e,verticalAlignment:t}=this.evaluatedMeshParams;return["center"===e?0:"right"===e?-1:1,"middle"===t?0:"bottom"===t?-1:1]}_createLineLabelMetric(e,t,i,r,s,o){const[n,a]=this._getMetricDir(),l=this.evaluatedMeshParams.scaleInfo?.maxScale??0,c=this.evaluatedMeshParams.scaleInfo?.minScale??0,h=this.evaluatedMeshParams.labelClassId;return new M(e,h,t,i,r,s,n,a,l,c,o)}_writePoint(e,t,i,r,s){if(t<0||t>b||i<0||i>b)return;const o=this._getShaping();if(!o)return;const n=s.getDisplayId(),a=this.evaluatedMeshParams.labelClassId,l=j(s.getObjectId(),r),c=A(s.getObjectId(),a,r),[h,m]=this._getMetricDir(),u=this.evaluatedMeshParams.scaleInfo?.maxScale??0,d=this.evaluatedMeshParams.scaleInfo?.minScale??0,f=this._getPointReferenceBounds()||{offsetX:0,offsetY:0,size:0};e.metricStart(new M(n,a,l,c,t,i,h,m,u,d,f)),this._writeGlyphs(e,n,t,i,o,0,f,void 0,!1),e.metricBoxWrite(o.boundsT),e.metricEnd()}_getPointReferenceBounds(){if(!this._references)return null;for(const e of this._references){const t=e.getBoundsInfo();if(t)return t}return null}_writeLines(e,t){const{scaleInfo:i,verticalAlignment:r}=this.evaluatedMeshParams,s=this.evaluatedMeshParams.repeatLabelDistance||128,o=this._getShaping("middle");if(!o)return;const n=(e,t,i,r)=>this._placeSubdivGlyphs(e,t,i,r),a=(o.bounds.width+s)/(1<<S);this._current={out:e,id:t.getDisplayId(),objId:t.getObjectId(),shaping:o,zoomRange:w(i,this.getTileInfo()),referenceBounds:this._getPointReferenceBounds()||{offsetX:0,offsetY:0,size:0},offsetDirection:null,pathIndex:0},this._verticalPlacement="bottom"===r?"above":"top"===r?"below":null,this._verticalPlacement?this._writeAboveAndBelowAlong(t,n,a):this._writeCenterAlong(t,n,a)}_writeAboveAndBelowAlong(e,t,i){const{repeatLabel:r}=this.evaluatedMeshParams,{shaping:s}=this._current,o=s.bounds.halfHeight,n=e.readGeometryForDisplay();if(!n)return;const a=new p;_(a,n,!1,!1,"esriGeometryPolyline",1);const l=C(new p,a,o),c=C(new p,a,-o),h=g(c,"esriGeometryPolyline",!1,!1),m=g(l,"esriGeometryPolyline",!1,!1),u=P(m.paths,s.bounds.width),d=P(h.paths,s.bounds.width);this._current.offsetDirection="above";for(let f=0;f<u.length;f++)this._current.pathIndex=f,y(u[f],i,t,!!r);this._current.offsetDirection="below";for(let f=0;f<d.length;f++)this._current.pathIndex=f,y(d[f],i,t,!!r)}_writeCenterAlong(e,t,i){const{repeatLabel:r}=this.evaluatedMeshParams,{shaping:s}=this._current,o=P(e.readLegacyGeometryForDisplay().paths,s.bounds.width);for(let n=0;n<o.length;n++)this._current.pathIndex=n,y(o[n],i,t,!!r)}_placeSubdivGlyphs(e,t,i,r){const{allowOverrun:s,labelPosition:o,repeatLabelDistance:n}=this.evaluatedMeshParams,a=this._current.zoomRange[0],l=k(t),c=this._current.shaping.bounds.width/(1<<S),h=Math.sqrt(n||D)/(1<<S),m=Math.min(i,r-i),u=this._current.shaping.isMultiline?B:Math.log2(m/(h+c/2)),d=0===t?u:Math.min(l,u),f=Math.max(a,this._zoomLevel+S-d),_=this._zoomLevel-f,g=this._current.shaping.bounds.width/2*2**_,p=G(this._current.objId,this._current.pathIndex,t,this._zoomLevel),b=Z(this._current.objId,this._current.pathIndex,t,this._zoomLevel,this.evaluatedMeshParams.labelClassId);this._current.shaping.isMultiline?0===t&&this._placeStraight(e,f,p,b):s&&_<0?this._placeStraightAlong(e,a,p,b):"parallel"===o?this._placeStraightAlong(e,f,p,b):"curved"===o&&this._placeCurved(e,f,g,p,b)}_placeStraight(e,t,i,r){const{out:s,id:o,shaping:n,referenceBounds:a}=this._current,{x:l,y:c}=e;s.metricStart(this._createLineLabelMetric(o,i,r,l,c)),s.metricBoxWrite(n.boundsT);const h=e.angle*(180/Math.PI)%360,m=(e.angle*(180/Math.PI)+180)%360;if(!this._verticalPlacement||this._verticalPlacement===this._current.offsetDirection){const e={clipAngle:h,mapAligned:!0,isLineLabel:!0,minZoom:t};this._writeGlyphs(s,o,l,c,n,0,a,e,!1)}if(!this._verticalPlacement||this._verticalPlacement!==this._current.offsetDirection){const e={clipAngle:m,mapAligned:!0,isLineLabel:!0,minZoom:t};this._writeGlyphs(s,o,l,c,n,0,a,e,!1)}s.metricEnd()}_placeCurved(e,t,i,r,s){const{out:o,id:n}=this._current;o.metricStart(this._createLineLabelMetric(n,r,s,e.x,e.y));const a=e.clone(),l=e.angle*(180/Math.PI)%360,c=(e.angle*(180/Math.PI)+180)%360;this._verticalPlacement&&this._verticalPlacement!==this._current.offsetDirection||(this._placeFirst(a,t,1,l),this._placeBack(e,a,t,i,1,l),this._placeForward(e,a,t,i,1,l)),this._verticalPlacement&&this._verticalPlacement===this._current.offsetDirection||(this._placeFirst(a,t,0,c),this._placeBack(e,a,t,i,0,c),this._placeForward(e,a,t,i,0,c)),o.metricEnd()}_placeStraightAlong(e,i,n,a){const{out:l,id:c,shaping:h,zoomRange:m,referenceBounds:d}=this._current,{boxBorderLineColor:f,boxBackgroundColor:_}=this.evaluatedMeshParams,g=e.clone(),p=e.angle*(180/Math.PI)%360,b=(e.angle*(180/Math.PI)+180)%360,x=h.glyphs.length>0&&!(!f&&!_);if(l.metricStart(this._createLineLabelMetric(c,n,a,e.x,e.y)),x){const n=Math.max(i,m[0],0),a=Math.min(B,m[1]),f=r(o(),-e.angle),_={minZoom:n,maxZoom:a,clipAngle:p,mapAligned:!0,isLineLabel:!0},g=t(this.evaluatedMeshParams.offsetX),x=t(this.evaluatedMeshParams.offsetY);if(!this._verticalPlacement||this._verticalPlacement===this._current.offsetDirection){const t=u(g,-1*x),[i,r]=h.shapeBackground(s(o(),f,t));l.recordStart(this.instanceId,this.attributeLayout,h.glyphs[0].textureBinding),this._writeTextBox(l,c,e.x,e.y,r,d,_),l.recordEnd()}if(!this._verticalPlacement||this._verticalPlacement!==this._current.offsetDirection){const t=u(g,x),[i,r]=h.shapeBackground(s(o(),f,t));_.clipAngle=b,l.recordStart(this.instanceId,this.attributeLayout,h.glyphs[0].textureBinding),this._writeTextBox(l,c,e.x,e.y,r,d,_),l.recordEnd()}}this._verticalPlacement&&this._verticalPlacement!==this._current.offsetDirection||this._placeFirst(g,i,1,p,!0),this._verticalPlacement&&this._verticalPlacement===this._current.offsetDirection||this._placeFirst(g,i,0,b,!0),l.metricEnd()}_placeBack(e,t,i,r,s,o){const n=e.clone();let a=e.backwardLength+z;for(;n.prev()&&!(a>=r);)this._placeOnSegment(n,t,a,i,-1,s,o),a+=n.length+z}_placeForward(e,t,i,r,s,o){const n=e.clone();let a=e.remainingLength+z;for(;n.next()&&!(a>=r);)this._placeOnSegment(n,t,a,i,1,s,o),a+=n.length+z}_placeFirst(e,i,s,a,l=!1){const{out:c,id:h,shaping:m,zoomRange:d,referenceBounds:f}=this._current,_=m.glyphs,g=t(this.evaluatedMeshParams.offsetX),p=t(this.evaluatedMeshParams.offsetY),b=u(g,p),x=r(o(),-e.angle);n(b,b,x);for(const t of _){const r=t.x>m.bounds.x?s:1-s,o=r*e.remainingLength+(1-r)*e.backwardLength,n=Math.abs(t.x+t.width/2-m.bounds.x),u=Math.max(0,this._zoomLevel+Math.log2(n/(o+z))),_=Math.max(i,l?0:u);if(t.maxZoom=Math.min(d[1],B),t.angle=e.angle+(1-s)*Math.PI,t.minZoom=Math.max(d[0],_),this._writeLineGlyph(c,h,e.x,e.y,t,a,f,!0),(s||this._current.offsetDirection)&&this._isVisible(t.minZoom,t.maxZoom)){const e=new v(t.bounds.x+b[0],t.bounds.y+b[1],t.bounds.width,t.bounds.height);c.metricBoxWrite(e)}}}_placeOnSegment(e,i,s,a,l,c,h){const{out:m,id:d,shaping:f,referenceBounds:_}=this._current,g=f.glyphs,p=e.dx/e.length,b=e.dy/e.length,x={x:e.x+s*-l*p,y:e.y+s*-l*b},M=t(this.evaluatedMeshParams.offsetX),P=t(this.evaluatedMeshParams.offsetY),y=u(M,P),w=r(o(),-e.angle);n(y,y,w);for(const t of g){const i=t.x>f.bounds.x?c:1-c;if(!(i&&1===l||!i&&-1===l))continue;const r=Math.abs(t.x+t.width/2-f.bounds.x),o=Math.max(0,this._zoomLevel+Math.log2(r/s)-.1),n=Math.max(a,this._zoomLevel+Math.log2(r/(s+e.length+z)));if(0!==o&&(t.angle=e.angle+(1-c)*Math.PI,t.minZoom=n,t.maxZoom=o,this._writeLineGlyph(m,d,x.x,x.y,t,h,_,!0),(c||this._current.offsetDirection)&&this._isVisible(t.minZoom,t.maxZoom))){const e=new v(t.bounds.x+y[0],t.bounds.y+y[1],t.bounds.width,t.bounds.height);m.metricBoxWrite(e)}}}_writeLineGlyph(e,t,i,r,s,o,n,a){if(i<0||i>b||r<0||r>b)return;e.recordStart(this.instanceId,this.attributeLayout,s.textureBinding);const{texcoords:l,offsets:c}=s,{fontSize:h,haloSize:m,outlineSize:u}=this._textMeshTransformProps;this._writeQuad(e,t,i,r,{texcoords:l,offsets:c,fontSize:h,haloSize:m,outlineSize:u,color:L(this.evaluatedMeshParams.color),isBackground:!1,referenceBounds:n,minZoom:Math.max(this._current.zoomRange[0],s.minZoom),maxZoom:Math.min(this._current.zoomRange[1],s.maxZoom),clipAngle:o,mapAligned:a,isLineLabel:!0}),e.recordEnd()}_packedZoom(e){return Math.floor(e*x)/x}_isVisible(e,t){let i=Math.max(this._current.zoomRange[0],e),r=Math.min(this._current.zoomRange[1],t);i=this._packedZoom(i),r=this._packedZoom(r);const s=this._packedZoom(this._zoomLevel);return i<=s&&s<=r}}function C(e,t,i){const{coords:r,lengths:s}=t,o=d(),n=d(),u=d(),f=d(),_=d(),g=d(),p=2;let b=0;for(let d=0;d<s.length;d++){const t=s[d];for(let s=0;s<t;s++){const d=p*(s+b-1),x=p*(s+b),v=p*(s+b+1);s>0?a(o,r[d],r[d+1]):a(o,0,0),a(n,r[x],r[x+1]),s<t-1?a(u,r[v],r[v+1]):a(u,0,0),0===s?a(f,0,0):(l(f,n,o),c(f,f),a(f,f[1],-f[0])),s===t-1?a(_,0,0):(l(_,u,n),c(_,_),a(_,_[1],-_[0])),h(g,f,_),c(g,g);const M=g[0]*_[0]+g[1]*_[1];0!==M&&m(g,g,M),m(g,g,i),e.coords.push(n[0]+g[0],n[1]+g[1])}e.lengths.push(t),b+=t}return e}export{F as LabelMeshWriter,j as labelIdHash,A as labelMetricHash,G as lineLabelIdHash,Z as lineLabelMetricHash};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{__decorate as e}from"tslib";import t from"../../../core/Accessor.js";import"../../../core/has.js";import{destroyMaybe as o}from"../../../core/maybe.js";import{when as r,watch as i,initial as n,syncAndInitial as s}from"../../../core/reactiveUtils.js";import{property as a}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/Logger.js";import"../../../core/RandomLCG.js";import{subclass as
|
|
5
|
+
import{__decorate as e}from"tslib";import t from"../../../core/Accessor.js";import"../../../core/has.js";import{destroyMaybe as o}from"../../../core/maybe.js";import{when as r,watch as i,initial as n,syncAndInitial as s}from"../../../core/reactiveUtils.js";import{property as a}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/Logger.js";import"../../../core/RandomLCG.js";import{subclass as c}from"../../../core/accessorSupport/decorators/subclass.js";import{DoubleClickZoom as p}from"./handlers/DoubleClickZoom.js";import{DoubleTapDragZoom as m}from"./handlers/DoubleTapDragZoom.js";import{DragPan as h}from"./handlers/DragPan.js";import{DragRotate as l}from"./handlers/DragRotate.js";import{GamepadNavigation as u}from"./handlers/GamepadNavigation.js";import{KeyPan as w}from"./handlers/KeyPan.js";import{KeyRotate as d}from"./handlers/KeyRotate.js";import{KeyZoom as v}from"./handlers/KeyZoom.js";import{MouseWheelZoom as f}from"./handlers/MouseWheelZoom.js";import{PinchRotateAndZoom as g}from"./handlers/PinchAction.js";import{BrowserEventSource as j}from"../../input/BrowserEventSource.js";import{InputManager as A,ViewEventPriorities as y}from"../../input/InputManager.js";import{PreventContextMenu as D}from"../../input/handlers/PreventContextMenu.js";import{getPointerActions as _}from"../../input/handlers/support.js";import{DoubleTapDrag as M}from"../../input/recognizers/DoubleTapDrag.js";import{Drag as b}from"../../input/recognizers/Drag.js";import{ImmediateDoubleClick as z}from"../../input/recognizers/ImmediateDoubleClick.js";import{PointerClickHoldAndDrag as P}from"../../input/recognizers/PointerClickHoldAndDrag.js";import{SingleAndDoubleClick as I}from"../../input/recognizers/SingleAndDoubleClick.js";const T={counter:"Control",pan:{left:"ArrowLeft",right:"ArrowRight",up:"ArrowUp",down:"ArrowDown"},zoom:{zoomIn:["=","+"],zoomOut:["-","_"]},rotate:{clockwise:["a","A"],counterClockwise:["d","D"],reset:["n","N"]}},C=Symbol("handles");let E=class extends t{initialize(){const e=()=>this.view?.ready;this.addHandles([r(()=>!e(),()=>this._disconnect()),r(e,()=>this._connect())])}destroy(){this._disconnect()}get latestPointerInfo(){return this._inputManager?.latestPointerInfo}get multiTouchActive(){return this._inputManager?.multiTouchActive??!1}isModifierKeyDown(e){return this._inputManager?.isModifierKeyDown(e)??!1}_disconnect(){this.view.viewEvents.disconnect(),this.removeHandles(C),this._inputManager=o(this._inputManager)}_connect(){const e=this.view.surface,t=new j(e,this.view.input),o=[new z,new P,new I,new b(this.view.navigation),new M],r=new A({eventSource:t,recognizers:o}),a=new h(this.view,["primary"]),c=new l(this.view,["secondary"]);r.installHandlers("prevent-context-menu",[new D],y.INTERNAL),r.installHandlers("navigation",[new g(this.view),new u(this.view),new f(this.view),new p(this.view),new p(this.view,[T.counter]),a,new w(this.view,T.pan),new v(this.view,T.zoom),new d(this.view,T.rotate),c,new m(this.view,"touch")],y.INTERNAL),this.view.viewEvents.connect(r),this._source=t,this._inputManager=r,this.addHandles([i(()=>this.view?.navigation?.browserTouchPanEnabled,e=>{this._source&&(this._source.browserTouchPanningEnabled=!e)},n),i(()=>{const{actionMap:e}=this.view.navigation;return{panActions:_("pan",e),rotateActions:_("rotate",e)}},({panActions:e,rotateActions:t})=>{a.pointerActions=e,c.pointerActions=t},s)],C)}get test(){}};e([a()],E.prototype,"view",void 0),e([a()],E.prototype,"latestPointerInfo",null),e([a()],E.prototype,"multiTouchActive",null),E=e([c("esri.views.2d.input.MapViewInputManager")],E);const k=E;export{k 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.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{__decorate as t}from"tslib";import e from"../../../core/Collection.js";import{referenceSetter as i}from"../../../core/collectionUtils.js";import s from"../../../core/Error.js";import{watch as
|
|
5
|
+
import{__decorate as t}from"tslib";import e from"../../../core/Collection.js";import{referenceSetter as i}from"../../../core/collectionUtils.js";import{deprecatedFunction as s}from"../../../core/deprecate.js";import r from"../../../core/Error.js";import h from"../../../core/Logger.js";import{watch as o,on as a,syncAndInitial as n}from"../../../core/reactiveUtils.js";import{property as l}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import"../../../core/RandomLCG.js";import{subclass as p}from"../../../core/accessorSupport/decorators/subclass.js";import{isLinkChartView as c}from"../../../linkChart/utils.js";import{Container as d}from"../engine/Container.js";import{HighlightCounter as g}from"./support/HighlightCounter.js";import{createOrReuseHighlightGradient as u}from"./support/util.js";import{getDefaultHighlightOptions as m,setDefaultHighlightOptions as f}from"../support/highlightOptionsUtils.js";import y from"../../layers/support/ClipRect.js";import v from"../../layers/support/Geometry.js";import w from"../../layers/support/Path.js";import R from"../../support/HighlightOptions.js";import{isInEffectiveScaleRange as _}from"../../support/layerViewUtils.js";const S=e.ofType({key:"type",base:null,typeMap:{rect:y,path:w,geometry:v}}),H=new(e.ofType(R)),b=y=>{const v=y;let w=class extends v{constructor(){super(...arguments),this._highlightCounter=new g,this.attached=!1,this.clips=new S,this.highlights=null,this.lastUpdateId=-1,this.moving=!1,this.updateRequested=!1,this._visibleAtCurrentScale=!0}initialize(){const t=this.view?.spatialReferenceLocked??!0,e=this.view?.spatialReference;e&&t&&!this.spatialReferenceSupported?this.addResolvingPromise(Promise.reject(new r("layerview:spatial-reference-incompatible","The spatial reference of this layer does not meet the requirements of the view",{layer:this.layer}))):(this.container||(this.container=new d),this.container.fadeTransitionEnabled=!0,this.container.visible=!1,this.container.endTransitions(),this.addHandles([o(()=>this.suspended,t=>{this.container&&(this.container.visible=!t)},n),o(()=>this.updateSuspended,t=>{this.view&&!t&&this.updateRequested&&this.view.requestUpdate()},n),o(()=>this.layer?.opacity??1,t=>{this.container&&(this.container.opacity=t)},n),o(()=>this.layer&&"blendMode"in this.layer?this.layer.blendMode:"normal",t=>{this.container&&(this.container.blendMode=t)},n),o(()=>this.layer&&"effect"in this.layer?this.layer.effect:null,t=>{this.container&&(this.container.effect=t)},n),o(()=>this._mergedHighlights.items.map(t=>({name:t.name,options:{fillColor:t.color,haloColor:t.haloColor,fillOpacity:t.fillOpacity,haloOpacity:t.haloOpacity,haloWidth:t.haloWidth,haloBlur:t.haloBlur}})),()=>{this.container.highlightGradient=u(this.container.highlightGradient,this._mergedHighlights.items)},n),o(()=>this._mergedHighlights.items.map(t=>t.name),()=>{this._processHighlight()}),a(()=>this.clips,"change",()=>{this.container&&(this.container.clips=this.clips)},n),o(()=>({scale:this.view?.scale,scaleRange:this.layer&&"effectiveScaleRange"in this.layer?this.layer.effectiveScaleRange:null}),({scale:t,scaleRange:e})=>{const i=_(e,t);i!==this._visibleAtCurrentScale&&(this._visibleAtCurrentScale=i)},n)],"constructor"),this.view?.whenLayerView?this.view.whenLayerView(this.layer).then(t=>{t===this&&this.processAttach()},()=>{}):this.when().then(()=>{this.processAttach()},()=>{}))}destroy(){this.processDetach(),this.updateRequested=!1}get highlightOptions(){return this._logHighlightOptionsDeprecation(),m(this)}set highlightOptions(t){this._logHighlightOptionsDeprecation(),f(this,t)}_logHighlightOptionsDeprecation(){s(h.getLogger(this),"`LayerView.highlightOptions` is deprecated in favor of View.highlights",{replacement:"View.highlights",version:"4.33",see:"https://arcg.is/inbTa1#highlights",warnOnce:!0})}get hasHighlight(){return this._highlightCounter.size>0}get _mergedHighlights(){if(!this.view)return H;if(!this.highlights)return this.view.highlights;const t=this.view.highlights.clone();for(const e of this.highlights){const i=t.find(t=>t.name===e.name);i&&i.assignFrom(e)}return t}get highlightIds(){return Array.from(this._highlightCounter.objectIds)}get scheduler(){return this.view.scheduler}get spatialReferenceSupported(){const t=this.view?.spatialReference;return null==t||this.supportsSpatialReference(t)}get updating(){return this.spatialReferenceSupported&&(!this.attached||!this.suspended&&(this.updateRequested||this.isUpdating())||!!this._updatingHandles?.updating||this.container.transitioning)}get visibleAtCurrentScale(){return this._visibleAtCurrentScale}processAttach(){this.isResolved()&&!this.attached&&!this.destroyed&&this.spatialReferenceSupported&&(this.attach(),this.attached=!0,this.requestUpdate())}processDetach(){this.attached&&(this.attached=!1,this.removeHandles("attach"),this.detach(),this.updateRequested=!1)}requestUpdate(){this.destroyed||this.updateRequested||(this.updateRequested=!0,this.updateSuspended||this.view.requestUpdate())}processUpdate(t){!this.isFulfilled()||this.isResolved()?(this._set("updateParameters",t),this.updateRequested&&!this.updateSuspended&&(this.updateRequested=!1,this.update(t))):this.updateRequested=!1}hitTest(t,e){return Promise.resolve(null)}supportsSpatialReference(t){return!0}canResume(){if(!this.spatialReferenceSupported)return!1;switch(this.layer?.type){case"link-chart":case"knowledge-graph-sublayer":case"graphics":break;default:if(c(this.view)&&!this.view.inGeographicLayout)return!1}return!!super.canResume()&&this.visibleAtCurrentScale}getSuspendInfo(){const t=super.getSuspendInfo(),e=!this.spatialReferenceSupported;return e&&(t.spatialReferenceNotSupported=e),t}addAttachHandles(t){this.addHandles(t,"attach")}_addHighlights(t,e){this._highlightCounter.add(t,e)&&this._processHighlight()}_removeHighlights(t,e){this._highlightCounter.delete(t,e)&&this._processHighlight()}_processHighlight(){}_getHighlights(){const t=[];for(const[e,i]of this._highlightCounter.highlightNamesByObjectId){const s=this._getHighlightBits(i);t.push({objectId:e,highlightFlags:s})}return t}_getHighlightBits(t){const e=new Set(t);let i=1,s=0;if(!this.view)return 0;const r=this._mergedHighlights;for(const{name:h}of r)e.delete(h)&&(s=i),i<<=1;return s}};return t([l()],w.prototype,"attached",void 0),t([l({type:S,set(t){const e=i(t,this._get("clips"),S);this._set("clips",e)}})],w.prototype,"clips",void 0),t([l()],w.prototype,"container",void 0),t([l({type:R})],w.prototype,"highlightOptions",null),t([l({type:e.ofType(R)})],w.prototype,"highlights",void 0),t([l()],w.prototype,"_mergedHighlights",null),t([l()],w.prototype,"moving",void 0),t([l({readOnly:!0})],w.prototype,"spatialReferenceSupported",null),t([l({readOnly:!0})],w.prototype,"updateParameters",void 0),t([l()],w.prototype,"updateRequested",void 0),t([l()],w.prototype,"updating",null),t([l()],w.prototype,"view",void 0),t([l()],w.prototype,"_visibleAtCurrentScale",void 0),t([l({readOnly:!0})],w.prototype,"visibleAtCurrentScale",null),w=t([p("esri.views.2d.layers.LayerView2D")],w),w};export{b as LayerView2DMixin};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{__decorate as t}from"tslib";import e from"../../../../Color.js";import i from"../../../../analysis/LengthDimension.js";import a from"../../../../core/Accessor.js";import n from"../../../../core/Handles.js";import{destroyHandle as s,handlesGroup as o}from"../../../../core/handleUtils.js";import"../../../../core/has.js";import{equals as r}from"../../../../core/lang.js";import{mapCollection as p}from"../../../../core/mapCollectionUtils.js";import{releaseMaybe as l,destroyMaybe as u}from"../../../../core/maybe.js";import{memoize as d}from"../../../../core/memoize.js";import{ignoreAbortErrors as c}from"../../../../core/promiseUtils.js";import{watch as m,initial as h,sync as g,syncAndInitial as f,when as _}from"../../../../core/reactiveUtils.js";import{property as M}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/Logger.js";import{subclass as v}from"../../../../core/accessorSupport/decorators/subclass.js";import{create as y}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{UpdatingHandles as C}from"../../../../core/support/UpdatingHandles.js";import S from"../../../../geometry/Point.js";import{clonePoint as w}from"../../../../layers/graphics/hydratedFeatures.js";import{reapplyConstraint as b,applyConstraint as P,computeConstraint as O,constraintDependencies as D}from"./lengthDimensionConstraintUtils.js";import{LengthDimensionManipulators as H,LengthDimensionPointManipulator as j,pointManipulatorHandles as T,createOffsetManipulator as x,offsetManipulatorHandles as G,LineOfSightOrientationManipulator as z,headingManipulatorHandles as U,rotationManipulatorHandles as I,createMeasureTypeManipulator as V,measureTypeManipulatorHandles as R,updateOffsetManipulatorTransform as A,updateHeadingManipulatorTransform as E,updateRotationManipulatorTransform as k,updateMeasureTypeManipulatorTransform as L,unfocusedOffsetWidth as F,focusedOffsetWidth as q}from"./lengthDimensionManipulatorUtils.js";import{isValidComputation as B,arePointsVerticallyAligned as N,computationToGeometryDependencies as J,computeGeometryFromDimension as K}from"./lengthDimensionUtils.js";import{disabledPointColor as Q,pointRadius as W,getTransparentAccentColor as X,getContrastColor as Y,initialOffsetPx as Z}from"./settings.js";import{getRotateHeadingTexture as $}from"../images/Factory.js";import{SnappingVisualizer3D as tt}from"../../interactive/SnappingVisualizer3D.js";import{LineVisualElement as et}from"../../interactive/visualElements/LineVisualElement.js";import{VerticesVisualElement as it}from"../../interactive/visualElements/VerticesVisualElement.js";import{ImageMaterial as at}from"../../webgl-engine/materials/ImageMaterial.js";import{createStipplePatternSimple as nt}from"../../webgl-engine/materials/lineStippleUtils.js";import{RibbonLineMaterial as st}from"../../webgl-engine/materials/RibbonLineMaterial.js";import{createCoordinateHelper as ot}from"../../../interactive/coordinateHelper.js";import{EditGeometry as rt}from"../../../interactive/editGeometry/EditGeometry.js";import{EditGeometryOperations as pt}from"../../../interactive/editGeometry/EditGeometryOperations.js";import{SnappingContext as lt}from"../../../interactive/snapping/SnappingContext.js";import{createSnapDragEventPipelineStep as ut}from"../../../interactive/snapping/SnappingDragPipelineStep.js";import{acquire as dt}from"../../../interactive/snapping/SnappingManagerPool.js";import{SnappingOperation as ct}from"../../../interactive/snapping/SnappingOperation.js";import{setupSnappingToggleHandles as mt}from"../../../interactive/snapping/snappingUtils.js";let ht=class extends a{constructor(t){super(t),this._stagedDimension=null,this._computationManipulators=new Map,this._computationHandles=new n,this._updatingHandles=new C,this._getSnappingContext=d(t=>new lt({elevationInfo:{mode:"absolute-height",offset:0},pointer:t,editGeometryOperations:new pt(new rt("point",ot(!0,!1,this.view.spatialReference)),this.view.state.viewingMode),visualizer:new tt}));const{view:i}=t;this._snappingManagerResult=dt(i),this.addHandles(this._snappingManagerResult),this._unfocusedOffsetManipulatorMaterial=this._createOffsetManipulatorMaterial(),this._focusedOffsetManipulatorMaterial=this._createOffsetManipulatorMaterial(),this._thinOffsetManipulatorMaterial=this._createOffsetManipulatorMaterial(),this._thinOffsetManipulatorMaterial.setParameters({stipplePattern:nt(2)}),this._constraintSnappingIndicator=new et({view:i,attached:!0,width:1,renderOccluded:4,stipplePattern:nt(5),isDecoration:!0});const a=e.toUnitRGBA(Q);this._stagedStartIndicator=new it({view:i,attached:!1,elevationInfo:{mode:"absolute-height",offset:0},spatialReference:t.view.renderCoordsHelper.spatialReference,color:a,size:2*W,outlineSize:0,renderOccluded:4,isDecoration:!0})}initialize(){const{view:t}=this;this._snappingOperation=new ct({view:t});const i=X(t.effectiveTheme),a=Y(t.effectiveTheme),n=!t.stage?.renderView.renderingContext.driverTest.svgPremultipliesAlpha.result;this._textureHandle=$(t.stage.textures,{accentColor:i,contrastColor:a,preMultiplyAlpha:n}),this._orientationManipulatorMaterial=new at({draped:!1,texture:this._textureHandle.texture,writeDepth:!1,renderOccluded:16,isDecoration:!0});const o=p(()=>this.analysisViewData.computations,({computation:t})=>this._createManipulators(t));this.addHandles([m(()=>({accentColor:X(t.effectiveTheme),contrastColor:Y(t.effectiveTheme)}),({accentColor:i,contrastColor:a})=>{const s=this._textureHandle;this._textureHandle=$(t.stage.textures,{accentColor:i,contrastColor:a,preMultiplyAlpha:n}),this._orientationManipulatorMaterial.setParameters({texture:this._textureHandle.texture}),s?.release();const o=e.toUnitRGBA(i);this._unfocusedOffsetManipulatorMaterial.setParameters({color:o}),this._focusedOffsetManipulatorMaterial.setParameters({color:o}),this._thinOffsetManipulatorMaterial.setParameters({color:o}),this._constraintSnappingIndicator.color=o},h),s(o),m(()=>({stagedPoint:this._snappingOperation.stagedPoint,stagedComputation:this._stagedComputation}),({stagedPoint:t,stagedComputation:e})=>{if(null==e||null==t)return;const i=w(t,new S);this._applyPointUpdate(e,{endPoint:i})},g),m(()=>({stagedDimension:this._stagedDimension,selectedComputation:this.analysisViewData.selectedComputation,firstGrabbedManipulator:this.firstGrabbedManipulator}),(t,e)=>{const{stagedDimension:i,selectedComputation:a,firstGrabbedManipulator:n}=t;if(i===e?.stagedDimension&&n===e?.firstGrabbedManipulator){for(const s of[a,e?.selectedComputation])if(null!=s){const e=this._computationManipulators.get(s);null!=e&&this._updateManipulators(s,e,t)}}else for(const[s,o]of this._computationManipulators)this._updateManipulators(s,o,t)},f),m(()=>this.analysis.style.lineSize,t=>this._updateManipulatorStyle(t),h),m(()=>this.view.state.camera,()=>{null!=this._stagedComputation&&this._updateStagedDimensionOffset(this._stagedComputation)}),m(()=>{const t=this._stagedComputation;if(!t)return null;const e=t.elevationAlignedStartPoint,i=y();return null!=e&&this.view.renderCoordsHelper.toRenderCoords(e,i)?i:null},t=>{null!=t?(this._stagedStartIndicator.vertices=[t],this._stagedStartIndicator.attached=!0):this._stagedStartIndicator.attached=!1})]),this.addHandles(this._constraintHandles),this.addHandles(this._snappingIndicatorHandles),mt(this,()=>{const t=this._activeComputation,e=this._stagedComputation;if(null==t||null!=e){const t=this.view.inputManager.latestPointerType??"mouse",e=this._getSnappingContext(t);this._updatingHandles.addPromise(c(this._snappingOperation.snapAgainNearPreviousMapPoint(this._snappingManager,e)))}if(null!=t){const{start:e,end:i}=this._computationManipulators.get(t);if(e.grabbing||i.grabbing){const i=e.grabbing?"start":"end",a=this._computeConstraint(t);b(t,i,{constraint:a,view:this.view})}}})}destroy(){this._textureHandle=l(this._textureHandle),this._snappingOperation=u(this._snappingOperation),this._computationHandles.destroy(),this._constraintSnappingIndicator.destroy(),this._stagedStartIndicator.destroy(),this._orientationManipulatorMaterial.dispose()}get updating(){return this._updatingHandles.updating||this._snappingManager.updating}get firstGrabbedManipulator(){return this.parentTool.firstGrabbedManipulator}get hasGrabbedManipulators(){return this.parentTool.hasGrabbedManipulators}get snappingOptions(){return this._snappingManager.options}get _snappingManager(){return this._snappingManagerResult.snappingManager}get _activeComputation(){if(null!=this._stagedComputation)return this._stagedComputation;const{selectedComputation:t}=this.analysisViewData;return this.hasGrabbedManipulators&&null!=t?t:null}get _stagedComputation(){const t=this._stagedDimension,e=this.analysisViewData.computations.at(-1)?.computation;return null==t||null==e||e.dimension!==t?null:e}get _constraintHandles(){return[_(()=>this.analysisViewData.selectedComputation,t=>{t.previousConstraint=this._computeConstraint(t)},{...f,equals:r}),m(()=>{const t=this._activeComputation;if(null==t)return null;const{measureType:e,orientation:i}=t.dimension;return{measureType:e,orientation:i,computation:t}},(t,e)=>{if(null!=t&&null==e){const{measureType:e,orientation:i,computation:a}=t;switch(a.previousConstraint){case 0:a.preConstraintProperties={measureType:"horizontal",orientation:0};break;case 1:a.preConstraintProperties={measureType:"vertical",orientation:0};break;case 2:a.preConstraintProperties={measureType:"direct",orientation:i};break;default:a.preConstraintProperties={measureType:e,orientation:i}}}null==t&&null!=e&&(e.computation.preConstraintProperties=null)},g)]}get _snappingIndicatorHandles(){const t="snapping-indicator-event-handles";return[m(()=>({stagedComputation:this._stagedComputation,activeComputation:this._activeComputation}),({stagedComputation:e,activeComputation:i})=>{const a=this._constraintSnappingIndicator;if(this.removeHandles(t),null!=i)if(i===e)a.attached=!0;else{const{start:e,end:n}=this._computationManipulators.get(i),s=()=>{a.attached=e.grabbing||n.grabbing};s(),this.addHandles([e.events.on("grab-changed",s),n.events.on("grab-changed",s)],t)}else a.attached=!1}),m(()=>{const t=this._activeComputation;return null!=t?{geometry:t.geometry,constraint:t.previousConstraint}:{}},({geometry:t,constraint:e})=>{const i=this._constraintSnappingIndicator;null!=t&&null!=e&&2!==e?(i.visible=!0,i.setGeometryFromSegment(t.directSegment)):i.visible=!1})]}removeStaged(){return null!=this._stagedDimension&&(this.analysis.dimensions.remove(this._stagedDimension),this._stagedDimension=null,!0)}onDeactivate(){this.removeStaged(),this._resetSnappingState()}onClick(t){const{_stagedDimension:e}=this;if(null==e){const e=this._onUnstagedClick(t);return this.analysis.dimensions.add(e),null}return this._onStagedClick(t),e}onPointerMove({mapPoint:t,pointerType:e}){if("touch"===e)return;const i=this._getSnappingContext(e);this._updatingHandles.addPromise(c(this._snappingOperation.snap({point:t},this._snappingManager,i)))}onManipulatorSelectionChanged(){if(null!=this.analysisViewData.selectedComputation){this._computationManipulators.get(this.analysisViewData.selectedComputation).offset.selected||(this.analysisViewData.selectedDimension=null)}}_onUnstagedClick({mapPoint:t,pointerType:e}){let a=t;if("mouse"===e){const i=this._getSnappingContext(e);a=this._snappingManager.update({point:t,context:i})}const n=new i({startPoint:w(a,new S),endPoint:null,measureType:"horizontal"});return this._stagedDimension=n,this._resetSnappingState(),n}_onStagedClick({mapPoint:t,pointerType:e}){const i=this._stagedComputation;if(null==i)return;let a=t;if("mouse"===e){const i=this._getSnappingContext(e);a=this._snappingManager.update({point:t,context:i})}const n=w(a,new S);this._applyPointUpdate(i,{endPoint:n}),this._stagedDimension=null,this._resetSnappingState()}_resetSnappingState(){this._snappingManager.doneSnapping(),this._snappingOperation.abort(),this._snappingOperation.stagedPoint=null}_createManipulators(t){const e=this._setupPointManipulator(t,{isStart:!0}),i=this._setupPointManipulator(t,{isStart:!1}),a=this._setupOffsetManipulator(t),n=this._setupHeadingManipulator(t),s=this._setupRotationManipulator(t),r=this._setupMeasureTypeManipulator(t,"direct"),p=this._setupMeasureTypeManipulator(t,"horizontal"),l=this._setupMeasureTypeManipulator(t,"vertical"),u=new H({start:e,end:i,offset:a,heading:n,rotation:s,direct:r,horizontal:p,vertical:l});this._setupComputationToManipulatorsSync(t,u),this._computationManipulators.set(t,u),this.manipulators.addMany(u.values());const d=o(u.values().map(t=>t.events.on("focus-changed",()=>{u.values().some(t=>t.focused)&&this._resetSnappingState()})));return{manipulators:u,remove:()=>{d.remove(),this._computationHandles.remove(t),this._computationManipulators.delete(t);for(const t of u.values())this.manipulators.remove(t)}}}_setupComputationToManipulatorsSync(t,e){this._computationHandles.add([m(()=>t.geometry,()=>this._updateManipulators(t,e),{...f,equals:r})],t)}_setupPointManipulator(t,e){const{view:i}=this,{dimension:a}=t,n=new j(i,{metadata:a}),s=T(n,{isStart:e.isStart,createSnappingPipelineStep:t=>ut({snappingContext:this._getSnappingContext(t),snappingManager:this._snappingManager,updatingHandles:this._updatingHandles}),dimension:a,onUpdate:e=>this._applyPointUpdate(t,e),view:i});return this._computationHandles.add(s,t),n}_setupOffsetManipulator(t){const{view:e}=this,i=x(e,{lineSizePt:this.analysis.style.lineSize,unfocusedMaterial:this._unfocusedOffsetManipulatorMaterial,focusedMaterial:this._focusedOffsetManipulatorMaterial,metadata:t.dimension}),a=G(i,{computation:t,view:e});return this._computationHandles.add(a,t),i}_setupHeadingManipulator(t){const{view:e}=this,i=new z(e,{lineSizePt:this.analysis.style.lineSize,material:this._orientationManipulatorMaterial,metadata:t.dimension}),a=U(i,{computation:t,view:e});return this._computationHandles.add(a,t),i}_setupRotationManipulator(t){const{view:e}=this,i=new z(e,{lineSizePt:this.analysis.style.lineSize,material:this._orientationManipulatorMaterial,metadata:t.dimension}),a=I(i,{computation:t,view:e});return this._computationHandles.add(a,t),i}_setupMeasureTypeManipulator(t,e){const{view:i}=this,a=V(i,{lineSizePt:this.analysis.style.lineSize,unfocusedMaterial:this._unfocusedOffsetManipulatorMaterial,focusedMaterial:this._focusedOffsetManipulatorMaterial,thinOffsetManipulatorMaterial:this._thinOffsetManipulatorMaterial,metadata:t.dimension}),n=R(a,{computation:t,manipulatorMeasureType:e,view:i});return this._computationHandles.add(n,t),a}_updateManipulators(t,e,i={stagedDimension:this._stagedDimension,selectedComputation:this.analysisViewData.selectedComputation,firstGrabbedManipulator:this.firstGrabbedManipulator}){const{stagedDimension:a,selectedComputation:n,firstGrabbedManipulator:s}=i,{start:o,end:r,offset:p,heading:l,rotation:u}=e,d=n===t,c=B(t),{dimension:m}=t;for(const f of e.values()){const t=c&&null==a&&(null==s||f===s);f===p?(f.available=t,f.selected=d):f.available=t&&d}if(!c)return;null!=this._computeConstraint(t)?e.forEachMeasureTypeManipulator(t=>t.available=!1):e.manipulatorForMeasureType(m.measureType).available=!1;for(const f of[l,u])"direct"===m.measureType&&0!==m.offset||(f.available=!1);N(t)?u.available=!1:l.available=!1;const{geometry:h}=t;o.renderLocation=h.directSegment.startRenderSpace,r.renderLocation=h.directSegment.endRenderSpace;const{renderCoordsHelper:g}=this.view;A(p,h,g),l.available&&E(l,t,g),u.available&&k(u,t,g),e.forEachMeasureTypeManipulator((e,i)=>{e.available&&L(e,t,i,g)})}_updateManipulatorStyle(t){const e=F(t),i=q(t),a={lineSizePt:t,material:this._orientationManipulatorMaterial};for(const{offset:n,heading:s,rotation:o}of this._computationManipulators.values())n.radius=i/2,s.update(a),o.update(a);this._unfocusedOffsetManipulatorMaterial.setParameters({width:e}),this._focusedOffsetManipulatorMaterial.setParameters({width:i})}_applyPointUpdate(t,e){const{view:i}=this,a=J(t);"startPoint"in e&&(a.elevationAlignedStartPoint=e.startPoint),"endPoint"in e&&(a.elevationAlignedEndPoint=e.endPoint);const n=K(a,i.renderCoordsHelper);if(null==n)return;const s=this._computeConstraint({...a,geometry:n});P(t,e,{...a,constraint:s,unconstrainedGeometry:n,view:i}),t===this._stagedComputation&&this._updateStagedDimensionOffset(t)}_updateStagedDimensionOffset(t){if(null==t.geometry)return;t.geometry.directSegment.eval(.5,gt);const{state:e,renderCoordsHelper:i}=this.view,a=e.camera.computeScreenPixelSizeAt(gt);t.dimension.offset=Z*a*i.unitInMeters}_computeConstraint(t){return O(D(t,this._snappingManager.options),this.view)}_createOffsetManipulatorMaterial(){return new st({width:1,renderOccluded:4,writeDepth:!1,hasPolygonOffset:!0,isDecoration:!0})}get test(){}};t([M({constructOnly:!0})],ht.prototype,"analysis",void 0),t([M({constructOnly:!0})],ht.prototype,"analysisViewData",void 0),t([M({constructOnly:!0})],ht.prototype,"manipulators",void 0),t([M({constructOnly:!0})],ht.prototype,"parentTool",void 0),t([M({constructOnly:!0,nonNullable:!0})],ht.prototype,"view",void 0),t([M({readOnly:!0})],ht.prototype,"updating",null),t([M()],ht.prototype,"firstGrabbedManipulator",null),t([M()],ht.prototype,"hasGrabbedManipulators",null),t([M()],ht.prototype,"snappingOptions",null),t([M()],ht.prototype,"_stagedDimension",void 0),t([M()],ht.prototype,"_activeComputation",null),t([M()],ht.prototype,"_stagedComputation",null),ht=t([v("esri.views.3d.analysis.Dimension.LengthDimensionSubTool")],ht);const gt=y();export{ht as LengthDimensionSubTool};
|
|
5
|
+
import{__decorate as t}from"tslib";import e from"../../../../Color.js";import i from"../../../../analysis/LengthDimension.js";import a from"../../../../core/Accessor.js";import n from"../../../../core/Handles.js";import{destroyHandle as s,handlesGroup as o}from"../../../../core/handleUtils.js";import"../../../../core/has.js";import{equals as r}from"../../../../core/lang.js";import{mapCollection as p}from"../../../../core/mapCollectionUtils.js";import{releaseMaybe as l,destroyMaybe as u}from"../../../../core/maybe.js";import{memoize as d}from"../../../../core/memoize.js";import{ignoreAbortErrors as c}from"../../../../core/promiseUtils.js";import{watch as m,initial as h,sync as g,syncAndInitial as f,when as _}from"../../../../core/reactiveUtils.js";import{property as M}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/Logger.js";import{subclass as v}from"../../../../core/accessorSupport/decorators/subclass.js";import{create as y}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{UpdatingHandles as C}from"../../../../core/support/UpdatingHandles.js";import S from"../../../../geometry/Point.js";import{clonePoint as w}from"../../../../layers/graphics/hydratedFeatures.js";import{reapplyConstraint as b,applyConstraint as P,computeConstraint as O,constraintDependencies as D}from"./lengthDimensionConstraintUtils.js";import{LengthDimensionManipulators as H,LengthDimensionPointManipulator as j,pointManipulatorHandles as T,createOffsetManipulator as x,offsetManipulatorHandles as G,LineOfSightOrientationManipulator as z,headingManipulatorHandles as U,rotationManipulatorHandles as I,createMeasureTypeManipulator as V,measureTypeManipulatorHandles as R,updateOffsetManipulatorTransform as A,updateHeadingManipulatorTransform as E,updateRotationManipulatorTransform as k,updateMeasureTypeManipulatorTransform as L,unfocusedOffsetWidth as F,focusedOffsetWidth as q}from"./lengthDimensionManipulatorUtils.js";import{isValidComputation as B,arePointsVerticallyAligned as N,computationToGeometryDependencies as J,computeGeometryFromDimension as K}from"./lengthDimensionUtils.js";import{disabledPointColor as Q,pointRadius as W,getTransparentAccentColor as X,getContrastColor as Y,initialOffsetPx as Z}from"./settings.js";import{getRotateHeadingTexture as $}from"../images/Factory.js";import{SnappingVisualizer3D as tt}from"../../interactive/SnappingVisualizer3D.js";import{LineVisualElement as et}from"../../interactive/visualElements/LineVisualElement.js";import{VerticesVisualElement as it}from"../../interactive/visualElements/VerticesVisualElement.js";import{ImageMaterial as at}from"../../webgl-engine/materials/ImageMaterial.js";import{createStipplePatternSimple as nt}from"../../webgl-engine/materials/lineStippleUtils.js";import{RibbonLineMaterial as st}from"../../webgl-engine/materials/RibbonLineMaterial.js";import{createCoordinateHelper as ot}from"../../../interactive/coordinateHelper.js";import{EditGeometry as rt}from"../../../interactive/editGeometry/EditGeometry.js";import{EditGeometryOperations as pt}from"../../../interactive/editGeometry/EditGeometryOperations.js";import{SnappingContext as lt}from"../../../interactive/snapping/SnappingContext.js";import{createSnapDragEventPipelineStep as ut}from"../../../interactive/snapping/SnappingDragPipelineStep.js";import{acquire as dt}from"../../../interactive/snapping/SnappingManagerPool.js";import{SnappingOperation as ct}from"../../../interactive/snapping/SnappingOperation.js";import{setupSnappingToggleHandles as mt}from"../../../interactive/snapping/snappingUtils.js";let ht=class extends a{constructor(t){super(t),this._stagedDimension=null,this._computationManipulators=new Map,this._computationHandles=new n,this._updatingHandles=new C,this._getSnappingContext=d(t=>new lt({elevationInfo:{mode:"absolute-height",offset:0},pointer:t,editGeometryOperations:new pt(new rt("point",ot(!0,!1,this.view.spatialReference)),this.view.state.viewingMode),visualizer:new tt}));const{view:i}=t;this._snappingManagerResult=dt(i),this.addHandles(this._snappingManagerResult),this._unfocusedOffsetManipulatorMaterial=this._createOffsetManipulatorMaterial(),this._focusedOffsetManipulatorMaterial=this._createOffsetManipulatorMaterial(),this._thinOffsetManipulatorMaterial=this._createOffsetManipulatorMaterial(),this._thinOffsetManipulatorMaterial.setParameters({stipplePattern:nt(2)}),this._constraintSnappingIndicator=new et({view:i,attached:!0,width:1,renderOccluded:4,stipplePattern:nt(5),isDecoration:!0});const a=e.toUnitRGBA(Q);this._stagedStartIndicator=new it({view:i,attached:!1,elevationInfo:{mode:"absolute-height",offset:0},spatialReference:t.view.renderCoordsHelper.spatialReference,color:a,size:2*W,outlineSize:0,renderOccluded:4,isDecoration:!0})}initialize(){const{view:t}=this;this._snappingOperation=new ct({view:t});const i=X(t.effectiveTheme),a=Y(t.effectiveTheme),n=!t.stage?.renderView.renderingContext.driverTest.svgPremultipliesAlpha.result;this._textureHandle=$(t.stage.textures,{accentColor:i,contrastColor:a,preMultiplyAlpha:n}),this._orientationManipulatorMaterial=new at({draped:!1,texture:this._textureHandle.texture,writeDepth:!1,renderOccluded:16,isDecoration:!0});const o=p(()=>this.analysisViewData.computations,({computation:t})=>this._createManipulators(t));this.addHandles([m(()=>({accentColor:X(t.effectiveTheme),contrastColor:Y(t.effectiveTheme)}),({accentColor:i,contrastColor:a})=>{const s=this._textureHandle;this._textureHandle=$(t.stage.textures,{accentColor:i,contrastColor:a,preMultiplyAlpha:n}),this._orientationManipulatorMaterial.setParameters({texture:this._textureHandle.texture}),s?.release();const o=e.toUnitRGBA(i);this._unfocusedOffsetManipulatorMaterial.setParameters({color:o}),this._focusedOffsetManipulatorMaterial.setParameters({color:o}),this._thinOffsetManipulatorMaterial.setParameters({color:o}),this._constraintSnappingIndicator.color=o},h),s(o),m(()=>({stagedPoint:this._snappingOperation.stagedPoint,stagedComputation:this._stagedComputation}),({stagedPoint:t,stagedComputation:e})=>{if(null==e||null==t)return;const i=w(t,new S);this._applyPointUpdate(e,{endPoint:i})},g),m(()=>({stagedDimension:this._stagedDimension,selectedComputation:this.analysisViewData.selectedComputation,firstGrabbedManipulator:this.firstGrabbedManipulator}),(t,e)=>{const{stagedDimension:i,selectedComputation:a,firstGrabbedManipulator:n}=t;if(i===e?.stagedDimension&&n===e?.firstGrabbedManipulator){for(const s of[a,e?.selectedComputation])if(null!=s){const e=this._computationManipulators.get(s);null!=e&&this._updateManipulators(s,e,t)}}else for(const[s,o]of this._computationManipulators)this._updateManipulators(s,o,t)},f),m(()=>this.analysis.style.lineSize,t=>this._updateManipulatorStyle(t),h),m(()=>this.view.state.camera,()=>{null!=this._stagedComputation&&this._updateStagedDimensionOffset(this._stagedComputation)}),m(()=>{const t=this._stagedComputation;if(!t)return null;const e=t.elevationAlignedStartPoint,i=y();return null!=e&&this.view.renderCoordsHelper.toRenderCoords(e,i)?i:null},t=>{null!=t?(this._stagedStartIndicator.vertices=[t],this._stagedStartIndicator.attached=!0):this._stagedStartIndicator.attached=!1})]),this.addHandles(this._constraintHandles),this.addHandles(this._snappingIndicatorHandles),mt(this,()=>{const t=this._activeComputation,e=this._stagedComputation;if(null==t||null!=e){const t=this.view.inputManager.latestPointerInfo?.type??"mouse",e=this._getSnappingContext(t);this._updatingHandles.addPromise(c(this._snappingOperation.snapAgainNearPreviousMapPoint(this._snappingManager,e)))}if(null!=t){const{start:e,end:i}=this._computationManipulators.get(t);if(e.grabbing||i.grabbing){const i=e.grabbing?"start":"end",a=this._computeConstraint(t);b(t,i,{constraint:a,view:this.view})}}})}destroy(){this._textureHandle=l(this._textureHandle),this._snappingOperation=u(this._snappingOperation),this._computationHandles.destroy(),this._constraintSnappingIndicator.destroy(),this._stagedStartIndicator.destroy(),this._orientationManipulatorMaterial.dispose()}get updating(){return this._updatingHandles.updating||this._snappingManager.updating}get firstGrabbedManipulator(){return this.parentTool.firstGrabbedManipulator}get hasGrabbedManipulators(){return this.parentTool.hasGrabbedManipulators}get snappingOptions(){return this._snappingManager.options}get _snappingManager(){return this._snappingManagerResult.snappingManager}get _activeComputation(){if(null!=this._stagedComputation)return this._stagedComputation;const{selectedComputation:t}=this.analysisViewData;return this.hasGrabbedManipulators&&null!=t?t:null}get _stagedComputation(){const t=this._stagedDimension,e=this.analysisViewData.computations.at(-1)?.computation;return null==t||null==e||e.dimension!==t?null:e}get _constraintHandles(){return[_(()=>this.analysisViewData.selectedComputation,t=>{t.previousConstraint=this._computeConstraint(t)},{...f,equals:r}),m(()=>{const t=this._activeComputation;if(null==t)return null;const{measureType:e,orientation:i}=t.dimension;return{measureType:e,orientation:i,computation:t}},(t,e)=>{if(null!=t&&null==e){const{measureType:e,orientation:i,computation:a}=t;switch(a.previousConstraint){case 0:a.preConstraintProperties={measureType:"horizontal",orientation:0};break;case 1:a.preConstraintProperties={measureType:"vertical",orientation:0};break;case 2:a.preConstraintProperties={measureType:"direct",orientation:i};break;default:a.preConstraintProperties={measureType:e,orientation:i}}}null==t&&null!=e&&(e.computation.preConstraintProperties=null)},g)]}get _snappingIndicatorHandles(){const t="snapping-indicator-event-handles";return[m(()=>({stagedComputation:this._stagedComputation,activeComputation:this._activeComputation}),({stagedComputation:e,activeComputation:i})=>{const a=this._constraintSnappingIndicator;if(this.removeHandles(t),null!=i)if(i===e)a.attached=!0;else{const{start:e,end:n}=this._computationManipulators.get(i),s=()=>{a.attached=e.grabbing||n.grabbing};s(),this.addHandles([e.events.on("grab-changed",s),n.events.on("grab-changed",s)],t)}else a.attached=!1}),m(()=>{const t=this._activeComputation;return null!=t?{geometry:t.geometry,constraint:t.previousConstraint}:{}},({geometry:t,constraint:e})=>{const i=this._constraintSnappingIndicator;null!=t&&null!=e&&2!==e?(i.visible=!0,i.setGeometryFromSegment(t.directSegment)):i.visible=!1})]}removeStaged(){return null!=this._stagedDimension&&(this.analysis.dimensions.remove(this._stagedDimension),this._stagedDimension=null,!0)}onDeactivate(){this.removeStaged(),this._resetSnappingState()}onClick(t){const{_stagedDimension:e}=this;if(null==e){const e=this._onUnstagedClick(t);return this.analysis.dimensions.add(e),null}return this._onStagedClick(t),e}onPointerMove({mapPoint:t,pointerType:e}){if("touch"===e)return;const i=this._getSnappingContext(e);this._updatingHandles.addPromise(c(this._snappingOperation.snap({point:t},this._snappingManager,i)))}onManipulatorSelectionChanged(){if(null!=this.analysisViewData.selectedComputation){this._computationManipulators.get(this.analysisViewData.selectedComputation).offset.selected||(this.analysisViewData.selectedDimension=null)}}_onUnstagedClick({mapPoint:t,pointerType:e}){let a=t;if("mouse"===e){const i=this._getSnappingContext(e);a=this._snappingManager.update({point:t,context:i})}const n=new i({startPoint:w(a,new S),endPoint:null,measureType:"horizontal"});return this._stagedDimension=n,this._resetSnappingState(),n}_onStagedClick({mapPoint:t,pointerType:e}){const i=this._stagedComputation;if(null==i)return;let a=t;if("mouse"===e){const i=this._getSnappingContext(e);a=this._snappingManager.update({point:t,context:i})}const n=w(a,new S);this._applyPointUpdate(i,{endPoint:n}),this._stagedDimension=null,this._resetSnappingState()}_resetSnappingState(){this._snappingManager.doneSnapping(),this._snappingOperation.abort(),this._snappingOperation.stagedPoint=null}_createManipulators(t){const e=this._setupPointManipulator(t,{isStart:!0}),i=this._setupPointManipulator(t,{isStart:!1}),a=this._setupOffsetManipulator(t),n=this._setupHeadingManipulator(t),s=this._setupRotationManipulator(t),r=this._setupMeasureTypeManipulator(t,"direct"),p=this._setupMeasureTypeManipulator(t,"horizontal"),l=this._setupMeasureTypeManipulator(t,"vertical"),u=new H({start:e,end:i,offset:a,heading:n,rotation:s,direct:r,horizontal:p,vertical:l});this._setupComputationToManipulatorsSync(t,u),this._computationManipulators.set(t,u),this.manipulators.addMany(u.values());const d=o(u.values().map(t=>t.events.on("focus-changed",()=>{u.values().some(t=>t.focused)&&this._resetSnappingState()})));return{manipulators:u,remove:()=>{d.remove(),this._computationHandles.remove(t),this._computationManipulators.delete(t);for(const t of u.values())this.manipulators.remove(t)}}}_setupComputationToManipulatorsSync(t,e){this._computationHandles.add([m(()=>t.geometry,()=>this._updateManipulators(t,e),{...f,equals:r})],t)}_setupPointManipulator(t,e){const{view:i}=this,{dimension:a}=t,n=new j(i,{metadata:a}),s=T(n,{isStart:e.isStart,createSnappingPipelineStep:t=>ut({snappingContext:this._getSnappingContext(t),snappingManager:this._snappingManager,updatingHandles:this._updatingHandles}),dimension:a,onUpdate:e=>this._applyPointUpdate(t,e),view:i});return this._computationHandles.add(s,t),n}_setupOffsetManipulator(t){const{view:e}=this,i=x(e,{lineSizePt:this.analysis.style.lineSize,unfocusedMaterial:this._unfocusedOffsetManipulatorMaterial,focusedMaterial:this._focusedOffsetManipulatorMaterial,metadata:t.dimension}),a=G(i,{computation:t,view:e});return this._computationHandles.add(a,t),i}_setupHeadingManipulator(t){const{view:e}=this,i=new z(e,{lineSizePt:this.analysis.style.lineSize,material:this._orientationManipulatorMaterial,metadata:t.dimension}),a=U(i,{computation:t,view:e});return this._computationHandles.add(a,t),i}_setupRotationManipulator(t){const{view:e}=this,i=new z(e,{lineSizePt:this.analysis.style.lineSize,material:this._orientationManipulatorMaterial,metadata:t.dimension}),a=I(i,{computation:t,view:e});return this._computationHandles.add(a,t),i}_setupMeasureTypeManipulator(t,e){const{view:i}=this,a=V(i,{lineSizePt:this.analysis.style.lineSize,unfocusedMaterial:this._unfocusedOffsetManipulatorMaterial,focusedMaterial:this._focusedOffsetManipulatorMaterial,thinOffsetManipulatorMaterial:this._thinOffsetManipulatorMaterial,metadata:t.dimension}),n=R(a,{computation:t,manipulatorMeasureType:e,view:i});return this._computationHandles.add(n,t),a}_updateManipulators(t,e,i={stagedDimension:this._stagedDimension,selectedComputation:this.analysisViewData.selectedComputation,firstGrabbedManipulator:this.firstGrabbedManipulator}){const{stagedDimension:a,selectedComputation:n,firstGrabbedManipulator:s}=i,{start:o,end:r,offset:p,heading:l,rotation:u}=e,d=n===t,c=B(t),{dimension:m}=t;for(const f of e.values()){const t=c&&null==a&&(null==s||f===s);f===p?(f.available=t,f.selected=d):f.available=t&&d}if(!c)return;null!=this._computeConstraint(t)?e.forEachMeasureTypeManipulator(t=>t.available=!1):e.manipulatorForMeasureType(m.measureType).available=!1;for(const f of[l,u])"direct"===m.measureType&&0!==m.offset||(f.available=!1);N(t)?u.available=!1:l.available=!1;const{geometry:h}=t;o.renderLocation=h.directSegment.startRenderSpace,r.renderLocation=h.directSegment.endRenderSpace;const{renderCoordsHelper:g}=this.view;A(p,h,g),l.available&&E(l,t,g),u.available&&k(u,t,g),e.forEachMeasureTypeManipulator((e,i)=>{e.available&&L(e,t,i,g)})}_updateManipulatorStyle(t){const e=F(t),i=q(t),a={lineSizePt:t,material:this._orientationManipulatorMaterial};for(const{offset:n,heading:s,rotation:o}of this._computationManipulators.values())n.radius=i/2,s.update(a),o.update(a);this._unfocusedOffsetManipulatorMaterial.setParameters({width:e}),this._focusedOffsetManipulatorMaterial.setParameters({width:i})}_applyPointUpdate(t,e){const{view:i}=this,a=J(t);"startPoint"in e&&(a.elevationAlignedStartPoint=e.startPoint),"endPoint"in e&&(a.elevationAlignedEndPoint=e.endPoint);const n=K(a,i.renderCoordsHelper);if(null==n)return;const s=this._computeConstraint({...a,geometry:n});P(t,e,{...a,constraint:s,unconstrainedGeometry:n,view:i}),t===this._stagedComputation&&this._updateStagedDimensionOffset(t)}_updateStagedDimensionOffset(t){if(null==t.geometry)return;t.geometry.directSegment.eval(.5,gt);const{state:e,renderCoordsHelper:i}=this.view,a=e.camera.computeScreenPixelSizeAt(gt);t.dimension.offset=Z*a*i.unitInMeters}_computeConstraint(t){return O(D(t,this._snappingManager.options),this.view)}_createOffsetManipulatorMaterial(){return new st({width:1,renderOccluded:4,writeDepth:!1,hasPolygonOffset:!0,isDecoration:!0})}get test(){}};t([M({constructOnly:!0})],ht.prototype,"analysis",void 0),t([M({constructOnly:!0})],ht.prototype,"analysisViewData",void 0),t([M({constructOnly:!0})],ht.prototype,"manipulators",void 0),t([M({constructOnly:!0})],ht.prototype,"parentTool",void 0),t([M({constructOnly:!0,nonNullable:!0})],ht.prototype,"view",void 0),t([M({readOnly:!0})],ht.prototype,"updating",null),t([M()],ht.prototype,"firstGrabbedManipulator",null),t([M()],ht.prototype,"hasGrabbedManipulators",null),t([M()],ht.prototype,"snappingOptions",null),t([M()],ht.prototype,"_stagedDimension",void 0),t([M()],ht.prototype,"_activeComputation",null),t([M()],ht.prototype,"_stagedComputation",null),ht=t([v("esri.views.3d.analysis.Dimension.LengthDimensionSubTool")],ht);const gt=y();export{ht as LengthDimensionSubTool};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{__decorate as e}from"tslib";import r from"../../../../core/Accessor.js";import{screenPointObjectToArray as t}from"../../../../core/screenUtils.js";import{property as o}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/has.js";import"../../../../core/Logger.js";import"../../../../core/RandomLCG.js";import{subclass as s}from"../../../../core/accessorSupport/decorators/subclass.js";import{c as i,n,g as c,f as a}from"../../../../chunks/vec32.js";import{create as l,clone as p}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import m from"../../../../geometry/Point.js";import{
|
|
5
|
+
import{__decorate as e}from"tslib";import r from"../../../../core/Accessor.js";import{screenPointObjectToArray as t}from"../../../../core/screenUtils.js";import{property as o}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/has.js";import"../../../../core/Logger.js";import"../../../../core/RandomLCG.js";import{subclass as s}from"../../../../core/accessorSupport/decorators/subclass.js";import{c as i,n,g as c,f as a}from"../../../../chunks/vec32.js";import{create as l,clone as p}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import m from"../../../../geometry/Point.js";import{create as u,copy as d,fromPoints as f}from"../../../../geometry/support/ray.js";import{sv2d as g}from"../../../../geometry/support/vectorStacks.js";import{getObjectId as y}from"../../../../layers/graphics/dehydratedFeatures.js";import{LineOfSightIntersectionResult as h}from"./LineOfSightIntersectionResult.js";import{fromScreen as j}from"../../support/geometryUtils/ray.js";import{isTerrainIntersectorResult as w}from"../../terrain/Intersector.js";import{Intersector as v}from"../../webgl-engine/lib/Intersector.js";import{toGraphic as I}from"../../webgl-engine/lib/intersectorUtilsConversions.js";let b=class extends r{constructor(e){super(e),this._terrainIntersectionOptionsLayerUids=new Set(["terrain"])}initialize(){this.intersector=new v(this.view.state.viewingMode),this.intersector.options.hud=!1,this.intersector.options.store=0}getScreenPointIntersection(e){const r=t(e,g.get()),o=j(this.view.state.camera,r,x);return this._getRayIntersection(o)}_getRayIntersection(e,r){const{view:t,intersector:o}=this;if(null==e||null==t.sceneIntersectionHelper)return null;o.options.store=0,t.sceneIntersectionHelper.intersectToolIntersectorRay(e,o,r);const s=o.results.min;if(null==s.target)return null;const i=l();if(!s.getIntersectionPoint(i))return null;if(null!=r?.maxDistance&&!s.withinDistance(r.maxDistance))return null;const n=t.renderCoordsHelper.fromRenderCoords(i,new m({spatialReference:t.spatialReference})),c=p(s.normal);if(w(s))return new h({type:2,id:s.target.lij.slice(),mapPoint:n,renderPoint:i,normal:c,ray:d(e),graphic:null});const a=I(s,t);if(null==a)return null;const{layer:u,sourceLayer:f}=a,g="scene"===f?.type?y(a,f.objectIdField):a.uid;return new h({type:0,id:`${u?.uid}/${g}`,mapPoint:n,renderPoint:i,normal:c,ray:d(e),graphic:a})}updateFromGroundIntersection(e,r,t){const o=R,s=P,l=L,m=S;i(s,e),this.view.renderCoordsHelper.worldUpAtPosition(s,l),n(l,l);const u=this.view.basemapTerrain.visibleElevationBounds,d=(r>=0?1:-1)*((u?Math.abs(u.max-u.min):100)+Math.abs(r));c(m,l,d),a(o,s,m),f(o,s,x);const g=this._getRayIntersection(x,{include:this._terrainIntersectionOptionsLayerUids,maxDistance:d});if(null!=g){const e=S;return c(e,l,r),a(t,g.renderPoint,e),p(g.normal)}return i(t,e),null}};e([o()],b.prototype,"view",void 0),e([o()],b.prototype,"intersector",void 0),b=e([s("esri.views.3d.analysis.LineOfSight.LineOfSightRayIntersector")],b);const R=l(),P=l(),L=l(),S=l(),x=u();export{b as LineOfSightRayIntersector};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import t from"../../../../Color.js";import r from"../../../../core/Handles.js";import{handlesGroup as e}from"../../../../core/handleUtils.js";import{deg2rad as a,clamp as i}from"../../../../core/mathUtils.js";import{destroyMaybe as o}from"../../../../core/maybe.js";import{watch as n,initial as s}from"../../../../core/reactiveUtils.js";import{fromYRotation as l,fromXRotation as c,fromScaling as u,fromZRotation as p,fromRotation as m,multiply as h}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as f}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{i as d,a as
|
|
5
|
+
import t from"../../../../Color.js";import r from"../../../../core/Handles.js";import{handlesGroup as e}from"../../../../core/handleUtils.js";import{deg2rad as a,clamp as i}from"../../../../core/mathUtils.js";import{destroyMaybe as o}from"../../../../core/maybe.js";import{watch as n,initial as s}from"../../../../core/reactiveUtils.js";import{fromYRotation as l,fromXRotation as c,fromScaling as u,fromZRotation as p,fromRotation as m,multiply as h}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as f}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{i as d,a as g,g as _}from"../../../../chunks/vec32.js";import{create as M,fromValues as b}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{f as v}from"../../../../chunks/boundedPlane.js";import{viewshedToolManipulatorConfiguration as j}from"./ViewshedConfiguration.js";import{getViewshedRotationMatrix as w,screenToCircleAngle as A}from"./viewshedToolUtils.js";import{Manipulator3D as V}from"../../interactive/Manipulator3D.js";import{RenderObject as O}from"../../interactive/RenderObject.js";import{InteractiveManipulation as E}from"../../interactive/editingTools/manipulations/InteractiveManipulation.js";import{createPolylineGeometry as y}from"../../webgl-engine/lib/GeometryUtil.js";import{assert as R}from"../../webgl-engine/lib/Util.js";import{RibbonLineMaterial as T}from"../../webgl-engine/materials/RibbonLineMaterial.js";import{createManipulatorDragEventPipeline as U}from"../../../interactive/dragEventPipeline.js";class x extends E{constructor(t){super(),this._handles=new r,this._tool=t.tool,this._view=t.view,this._focusedArcMaterial=this._createArcMaterial(!0),this._unfocusedArcMaterial=this._createArcMaterial(!1),this._createManipulators(),this.forEachManipulator(t=>this._tool.manipulators.add(t))}destroy(){this._handles=o(this._handles),this.forEachManipulator(t=>{this._tool.manipulators.remove(t),t.destroy()}),this._tool=null,this._view=null,this._manipulators=null}createDragPipeline(t,r){const a=Object.values(this._manipulators);return e(a.map(({manipulator:e,side:a})=>U(e,(e,i,o,n,s)=>{const l=z(a,r),c=i.next(t=>({...t,manipulatorType:2,side:a})),u=A(c,this._view,l,r);t(e,u,o)})))}updateManipulatorsTransform(t){t.arcCentersPoints(H),this._forEachManipulatorInfo(r=>this._updateArcManipulatorTransform(r,t,H[r.side]))}updateManipulatorVisuals(t){this._forEachManipulatorInfo(r=>this._updateArcManipulatorVisuals(r,t))}_updateArcManipulatorVisuals({manipulator:t,side:r},e){const a=[];if(null!=e){const[i,o]=P(r,e,this._unfocusedArcMaterial);a.push(new O(i,1),new O(i.instantiate({material:this._focusedArcMaterial}),2)),t.collisionType={type:"line",paths:[o]}}t.renderObjects=a,t.radius=j.collisionRadius}_updateArcManipulatorTransform({manipulator:t,side:r},e,i){const o=e.horizontalFieldOfView,n=a(e.verticalFieldOfView/2),s=a(o/2),g=I(r);t.renderLocation=i;const _=f(),M=t=>{h(_,t,_)};M(l(k,a(-90))),g||M(c(k,n));const b=e.farDistanceRenderSpace;let v,j;M(u(k,d(L,b,b,b))),M(p(k,F(r))),M(w(e,k)),g?(v=s,j=e.tiltedUpVector):(j=e.rightVector,v=n),v*="right"===r||"bottom"===r?-1:1;const A=m(k,v,j);null!=A&&M(A),t.modelTransform=_}_createManipulators(){const t=this._createArcManipulator("left"),r=this._createArcManipulator("right"),e=this._createArcManipulator("top"),a=this._createArcManipulator("bottom");this._manipulators={left:t,right:r,top:e,bottom:a};[[a.manipulator,e.manipulator],[t.manipulator,r.manipulator]].forEach(([t,r])=>{t.metadata={pairedManipulator:r},r.metadata={pairedManipulator:t}})}_createArcManipulator(t){const r=new V({view:this._view,autoScaleRenderObjects:!1,worldSized:!0}),e={manipulator:r,side:t};return this._updateArcManipulatorVisuals(e),this._handles.add(r.events.on(["focus-changed","grab-changed"],t=>{const e=r.metadata?.pairedManipulator;null!=e&&(e.hovering!==r.hovering&&(e.hovering=r.hovering),e.grabbing!==r.grabbing&&(e.grabbing=r.grabbing))})),e}_createArcMaterial(r){const e=j.getFovArcWidth(r),a=new T({renderOccluded:4,isDecoration:!0,width:e});return this._handles.add(n(()=>t.toUnitRGBA(this._view.effectiveTheme.accentColor),t=>a.setParameters({color:t}),s)),a}forEachManipulator(t){Object.values(this._manipulators).forEach(({manipulator:r})=>t(r,2))}_forEachManipulatorInfo(t){Object.values(this._manipulators).forEach(r=>t(r))}get test(){return{manipulators:this._manipulators}}}function P(t,r,e){const{horizontalFieldOfView:o,verticalFieldOfView:n}=r,s=I(t),l=a(i((s?n:o)/2,0,15)),c=S(-l/2,l/2,s?1:Math.max(Math.sin(a(90-n/2)),.1));return[y(e,c),c]}function S(t,r,e,a=10){R(a>1,"createArcPolylineGeometry() needs at least 2 for numVertices");const i=r-t;if(i<=0||e<=0){const t=.01;return[b(0,0,t),b(0,0,-t)]}const o=[],n=i/a;for(let s=0;s<a;s++){let i=t+s*n;s===a-1&&(i=r);const l=Math.cos(i)*e,c=Math.sin(i)*e,u=b(l-e,0,c);o.push(u)}return o}function D(t){switch(t){case"left":return 0;case"bottom":return 1;case"right":return 2;case"top":return 3}}function F(t){return D(t)*G}function I(t){return"left"===t||"right"===t}function C(t){return"left"===t?"right":"right"===t?"left":"top"===t?"bottom":"top"}function z(t,{observerRenderSpace:r,targetRenderSpace:e,tiltedUpVector:a,rightVector:i,farDistanceRenderSpace:o}){const n=g(L,e,r),s=I(t)?i:a,l=_(B,s,o);return v(r,n,l)}const G=Math.PI/2,k=f(),L=M(),B=M(),H={top:M(),bottom:M(),left:M(),right:M()};export{x as FieldOfViewManipulation,S as createArcPolylineVertices,C as flipSide,I as isSideHorizontal,F as sideToRad};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/*
|
|
2
|
+
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
|
+
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
|
+
*/
|
|
5
|
+
import s from"../../core/Error.js";const i={"area-measurement":()=>import("./analysis/AreaMeasurementAnalysisView3D.js"),dimension:()=>import("./analysis/DimensionAnalysisView3D.js"),"direct-line-measurement":()=>import("./analysis/DirectLineMeasurementAnalysisView3D.js"),"elevation-profile":()=>import("./analysis/ElevationProfileAnalysisView3D.js"),"line-of-sight":()=>import("./analysis/LineOfSightAnalysisView3D.js"),slice:()=>import("./analysis/SliceAnalysisView3D.js"),viewshed:()=>import("./analysis/ViewshedAnalysisView3D.js"),"volume-measurement":()=>import("./analysis/VolumeMeasurementAnalysisView3D.js")};function e(e){const n=i[e.type];if(!n)throw new s("analysis-view-module-import-utils:analysis-not-supported",`Analysis "${e.type}" is not supported`);return n()}export{e as importAnalysisViewModule};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{__decorate as o}from"tslib";import r from"../../../core/Accessor.js";import"../../../core/has.js";import{destroyMaybe as t}from"../../../core/maybe.js";import{watch as e,initial as i,syncAndInitial as n}from"../../../core/reactiveUtils.js";import{property as a}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/Logger.js";import"../../../core/RandomLCG.js";import{subclass as s}from"../../../core/accessorSupport/decorators/subclass.js";import{DoubleClickZoom as d}from"./handlers/DoubleClickZoom.js";import{DragRotate as m}from"./handlers/DragRotate.js";import{DragZoom as p}from"./handlers/DragZoom.js";import{GamepadNavigation as c}from"./handlers/GamepadNavigation.js";import{KeyboardNavigation as g}from"./handlers/KeyboardNavigation.js";import{MouseWheelZoom as u}from"./handlers/MouseWheelZoom.js";import{PinchAndPanNavigation as l}from"./handlers/PinchAndPanNavigation.js";import{PointerDownCancelAnimation as h}from"./handlers/PointerDownCancelAnimation.js";import{TwoFingerTilt as w}from"./handlers/TwoFingerTilt.js";import{BrowserEventSource as
|
|
5
|
+
import{__decorate as o}from"tslib";import r from"../../../core/Accessor.js";import"../../../core/has.js";import{destroyMaybe as t}from"../../../core/maybe.js";import{watch as e,initial as i,syncAndInitial as n}from"../../../core/reactiveUtils.js";import{property as a}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/Logger.js";import"../../../core/RandomLCG.js";import{subclass as s}from"../../../core/accessorSupport/decorators/subclass.js";import{DoubleClickZoom as d}from"./handlers/DoubleClickZoom.js";import{DragRotate as m}from"./handlers/DragRotate.js";import{DragZoom as p}from"./handlers/DragZoom.js";import{GamepadNavigation as c}from"./handlers/GamepadNavigation.js";import{KeyboardNavigation as g}from"./handlers/KeyboardNavigation.js";import{MouseWheelZoom as u}from"./handlers/MouseWheelZoom.js";import{PinchAndPanNavigation as l}from"./handlers/PinchAndPanNavigation.js";import{PointerDownCancelAnimation as h}from"./handlers/PointerDownCancelAnimation.js";import{TwoFingerTilt as w}from"./handlers/TwoFingerTilt.js";import{BrowserEventSource as f}from"../../input/BrowserEventSource.js";import{InputManager as v,ViewEventPriorities as y}from"../../input/InputManager.js";import{PreventContextMenu as _}from"../../input/handlers/PreventContextMenu.js";import{getPointerActions as D}from"../../input/handlers/support.js";import{Drag as j}from"../../input/recognizers/Drag.js";import{ImmediateDoubleClick as A}from"../../input/recognizers/ImmediateDoubleClick.js";import{PointerClickHoldAndDrag as P}from"../../input/recognizers/PointerClickHoldAndDrag.js";import{SingleAndDoubleClick as M}from"../../input/recognizers/SingleAndDoubleClick.js";import{VerticalTwoFingerDrag as b}from"../../input/recognizers/VerticalTwoFingerDrag.js";let T=class extends r{constructor(){super(...arguments),this.mode="default",this._updateMode=({mode:o,dragPrimary:r,dragSecondary:t,dragTertiary:e})=>{"pro"===o&&(t="zoom",e="pan"===r?"rotate":"pan");const i={dragPrimary:r,dragSecondary:t,dragTertiary:e};this._modeDragPan&&(this._modeDragPan.pointerActions=D("pan",i)),this._modeDragRotate&&(this._modeDragRotate.pointerActions=D("rotate",i)),this._modeDragZoom&&(this._modeDragZoom.pointerActions=D("zoom",i))}}destroy(){this.disconnect()}get primaryDragAction(){return this.view.navigation.actionMap.dragPrimary}set primaryDragAction(o){const{actionMap:r}=this.view.navigation;r.dragPrimary=o,r.dragSecondary="pan"===o?"rotate":"pan"}get updating(){return!!this._inputManager?.updating}get latestPointerInfo(){return this._inputManager?.latestPointerInfo}get multiTouchActive(){return this._inputManager?.multiTouchActive??!1}disconnect(){this.removeAllHandles(),this.view.viewEvents.disconnect(),this._modeDragPan=null,this._modeDragRotate=null,this._modeDragZoom=null,this._modeKeyboardNavigation=null,this._inputManager=t(this._inputManager),this._source=t(this._source)}connect(){const o=this.view;this._source=new f(this.view.surface,o.input);const r=[new A,new P,new M,new j(this.view.navigation),new b],t=new v({eventSource:this._source,recognizers:r});this._inputManager=t,t.installHandlers("prevent-context-menu",[new _],y.INTERNAL);const a={fov:"Shift",pan:{left:"ArrowLeft",right:"ArrowRight",forward:"ArrowUp",backward:"ArrowDown",up:["u","U"],down:["j","J"]},lookAround:{headingLeft:["a","A"],headingRight:["d","D"],tiltUp:["w","W"],tiltDown:["s","S"],modifier:"b"},zoom:{zoomIn:["+","="],zoomOut:["-","_"]},reset:{heading:["n","N"],tilt:["p","P"]}};this._modeDragPan=new l(o,["primary"]),this._modeDragRotate=new m(o,["secondary"],0),this._modeDragZoom=new p(o,["tertiary"],a.fov),this._modeKeyboardNavigation=new g(o,a),t.installHandlers("navigation",[new h(o),new d(o),new c(o),new u(o,a.fov),new m(o,["primary"],1,[a.lookAround.modifier]),new m(o,["secondary"],0,[a.lookAround.modifier]),new l(o,["tertiary"],[a.lookAround.modifier]),this._modeDragRotate,this._modeDragZoom,this._modeDragPan,this._modeKeyboardNavigation,new w(o)],y.INTERNAL),this.view.viewEvents.connect(t),this.addHandles([e(()=>this.view.navigation?.browserTouchPanEnabled,o=>{this._source.browserTouchPanningEnabled=!o},i),e(()=>{const{actionMap:o}=this.view.navigation,{dragPrimary:r,dragSecondary:t,dragTertiary:e}=o;return{mode:this.mode,dragPrimary:r,dragSecondary:t,dragTertiary:e}},this._updateMode,n)])}isModifierKeyDown(o){return this._inputManager?.isModifierKeyDown(o)??!1}get test(){}};o([a()],T.prototype,"view",void 0),o([a({type:["default","pro"]})],T.prototype,"mode",void 0),o([a({readOnly:!0})],T.prototype,"updating",null),o([a()],T.prototype,"latestPointerInfo",null),o([a()],T.prototype,"multiTouchActive",null),o([a()],T.prototype,"_inputManager",void 0),T=o([s("esri.views.3d.input.SceneInputManager")],T);const S=T;export{S as default};
|