@arcgis/core 4.30.0-next.20240521 → 4.30.0-next.20240522
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/WebMap.js +1 -1
- package/assets/components/assets/icon/developerCredentials16.json +1 -0
- package/assets/components/assets/icon/developerCredentials24.json +1 -0
- package/assets/components/assets/icon/developerCredentials32.json +1 -0
- package/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/01927419855947110cc1.js.LICENSE.txt +1 -1
- package/assets/esri/core/workers/chunks/158c05b16372d8ed33ea.js.LICENSE.txt +1 -1
- package/assets/esri/core/workers/chunks/190913c221964292333b.js.LICENSE.txt +1 -1
- package/assets/esri/core/workers/chunks/4268373bf374b2a6252a.js.LICENSE.txt +1 -1
- package/assets/esri/core/workers/chunks/59b193d42e8abf9d4088.js.LICENSE.txt +1 -1
- package/assets/esri/core/workers/chunks/{eac4ec8c410eaf9e621c.js → 606f8b907166190a8b65.js} +2 -2
- package/assets/esri/core/workers/chunks/{eac4ec8c410eaf9e621c.js.LICENSE.txt → 606f8b907166190a8b65.js.LICENSE.txt} +1 -1
- package/assets/esri/core/workers/chunks/{3716015ccf0888c0a21d.js → 724f221680849db03104.js} +1 -1
- package/assets/esri/core/workers/chunks/88c7d84a1fde246ca71f.js +1 -0
- package/assets/esri/core/workers/chunks/9b04a666726b5d2ff3c5.js.LICENSE.txt +1 -1
- package/assets/esri/core/workers/chunks/9c75837b7e75f0f38dc0.js.LICENSE.txt +1 -1
- package/assets/esri/core/workers/chunks/{bd0545bb100b3393fd85.js → bbec62f8792520993909.js} +1 -1
- package/assets/esri/core/workers/chunks/{4f3a87586e334c52d0bf.js → caffbaa8b0a67d117f34.js} +1 -1
- package/assets/esri/core/workers/chunks/dde183c6bb1710ff16df.js.LICENSE.txt +1 -1
- package/assets/esri/images/portal/knowledgegraphlayer16.png +0 -0
- package/assets/esri/themes/dark/main.css +1 -1
- package/assets/esri/themes/light/main.css +1 -1
- package/assets/esri/themes/light/view.css +1 -1
- package/chunks/LineSeries.js +1 -1
- package/chunks/Theme.js +1 -1
- package/chunks/Tooltip.js +1 -1
- package/chunks/chartUtilsAm5.js +1 -1
- package/interfaces.d.ts +12 -4
- package/layers/ImageryTileLayer.js +1 -1
- package/layers/support/editableLayers.js +1 -1
- package/package.json +2 -2
- package/portal/PortalItem.js +1 -1
- package/rest/knowledgeGraph/wasmInterface/updateToWasmEncodedFactories.js +1 -1
- package/support/revision.js +1 -1
- package/views/2d/GoToManager.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/labels/LabelMeshWriter.js +1 -1
- package/views/3d/interactive/editingTools/ManipulatedObject3DGraphic.js +1 -1
- package/views/3d/interactive/editingTools/move/MoveTool3D.js +1 -1
- package/views/3d/interactive/editingTools/reshape/reshapeTooltipUtils.js +1 -1
- package/views/3d/interactive/editingTools/tooltipUtils3D.js +1 -1
- package/views/3d/interactive/editingTools/transform/ScaleRotateMeshAdapter.js +1 -1
- package/views/3d/interactive/editingTools/transform/ScaleRotateTransform.js +1 -1
- package/views/3d/interactive/editingTools/transform/TransformTool3D.js +1 -1
- package/views/3d/interactive/editingTools/undoRecords.js +5 -0
- package/views/interactive/tooltip/tooltipCommonUtils.js +1 -1
- package/views/layers/ImageryTileLayerView.js +1 -1
- package/widgets/DirectionalPad/DirectionalPadViewModel.js +1 -1
- package/widgets/FeatureTable/support/FeatureStore.js +1 -1
- package/widgets/LayerList/ListItemPanel.js +1 -1
- package/widgets/LayerList/support/layerListUtils.js +1 -1
- package/widgets/Sketch/SketchViewModel.js +1 -1
- package/widgets/UtilityNetworkAssociations/UtilityNetworkAssociationsViewModel.js +1 -1
- package/assets/esri/core/workers/chunks/0753c636c2801f067235.js +0 -1
- package/views/3d/interactive/editingTools/transform/undoRecords.js +0 -5
package/interfaces.d.ts
CHANGED
|
@@ -9982,7 +9982,7 @@ declare namespace __esri {
|
|
|
9982
9982
|
*/
|
|
9983
9983
|
constructor(properties?: BaseDynamicLayerProperties);
|
|
9984
9984
|
/**
|
|
9985
|
-
* Adds a promise to the layer's
|
|
9985
|
+
* Adds a promise to the layer's loadable chain.
|
|
9986
9986
|
*
|
|
9987
9987
|
* [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-BaseDynamicLayer.html#addResolvingPromise)
|
|
9988
9988
|
*/
|
|
@@ -10059,7 +10059,7 @@ declare namespace __esri {
|
|
|
10059
10059
|
*/
|
|
10060
10060
|
constructor(properties?: BaseElevationLayerProperties);
|
|
10061
10061
|
/**
|
|
10062
|
-
* Adds a promise to the layer's
|
|
10062
|
+
* Adds a promise to the layer's loadable chain.
|
|
10063
10063
|
*
|
|
10064
10064
|
* [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-BaseElevationLayer.html#addResolvingPromise)
|
|
10065
10065
|
*/
|
|
@@ -10231,7 +10231,7 @@ declare namespace __esri {
|
|
|
10231
10231
|
*/
|
|
10232
10232
|
constructor(properties?: BaseTileLayerProperties);
|
|
10233
10233
|
/**
|
|
10234
|
-
* Adds a
|
|
10234
|
+
* Adds a Promise to the layer's loadable chain.
|
|
10235
10235
|
*
|
|
10236
10236
|
* [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-BaseTileLayer.html#addResolvingPromise)
|
|
10237
10237
|
*/
|
|
@@ -23737,7 +23737,15 @@ declare namespace __esri {
|
|
|
23737
23737
|
*
|
|
23738
23738
|
* [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-support-arcadeUtils.html#getExpressionsFromLayer)
|
|
23739
23739
|
*/
|
|
23740
|
-
getExpressionsFromLayer(layer:
|
|
23740
|
+
getExpressionsFromLayer(layer: | CSVLayer
|
|
23741
|
+
| FeatureLayer
|
|
23742
|
+
| GeoJSONLayer
|
|
23743
|
+
| Sublayer
|
|
23744
|
+
| OGCFeatureLayer
|
|
23745
|
+
| SceneLayer
|
|
23746
|
+
| WFSLayer
|
|
23747
|
+
| OrientedImageryLayer
|
|
23748
|
+
| CatalogFootprintLayer): arcadeUtilsExpressionInfo[];
|
|
23741
23749
|
}
|
|
23742
23750
|
|
|
23743
23751
|
export const arcadeUtils: arcadeUtils;
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.30/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../chunks/tslib.es6.js";import t from"../PopupTemplate.js";import{ClonableMixin as r}from"../core/Clonable.js";import s from"../core/Error.js";import i from"../core/Logger.js";import{MultiOriginJSONMixin as o}from"../core/MultiOriginJSONSupport.js";import{debounce as a,throwIfAbortError as n}from"../core/promiseUtils.js";import{watch as l}from"../core/reactiveUtils.js";import{property as p}from"../core/accessorSupport/decorators/property.js";import{ensureClass as c,Integer as m}from"../core/accessorSupport/ensureType.js";import"../core/RandomLCG.js";import"../core/has.js";import{enumeration as u}from"../core/accessorSupport/decorators/enumeration.js";import{subclass as h}from"../core/accessorSupport/decorators/subclass.js";import d from"./Layer.js";import{ArcGISService as y}from"./mixins/ArcGISService.js";import{BlendLayer as f}from"./mixins/BlendLayer.js";import{CustomParametersMixin as g}from"./mixins/CustomParametersMixin.js";import{ImageryTileMixin as v}from"./mixins/ImageryTileMixin.js";import{OperationalLayer as w}from"./mixins/OperationalLayer.js";import{PortalLayer as R}from"./mixins/PortalLayer.js";import{RefreshableLayer as S}from"./mixins/RefreshableLayer.js";import{ScaleRangeLayer as j}from"./mixins/ScaleRangeLayer.js";import{TemporalLayer as F}from"./mixins/TemporalLayer.js";import{legendEnabled as b}from"./support/commonProperties.js";import _ from"./support/Field.js";import{interpolationKebab as O}from"./support/rasterEnums.js";import P from"./support/RasterFunction.js";import
|
|
5
|
+
import{_ as e}from"../chunks/tslib.es6.js";import t from"../PopupTemplate.js";import{ClonableMixin as r}from"../core/Clonable.js";import s from"../core/Error.js";import i from"../core/Logger.js";import{MultiOriginJSONMixin as o}from"../core/MultiOriginJSONSupport.js";import{debounce as a,throwIfAbortError as n}from"../core/promiseUtils.js";import{watch as l}from"../core/reactiveUtils.js";import{property as p}from"../core/accessorSupport/decorators/property.js";import{ensureClass as c,Integer as m}from"../core/accessorSupport/ensureType.js";import"../core/RandomLCG.js";import"../core/has.js";import{enumeration as u}from"../core/accessorSupport/decorators/enumeration.js";import{subclass as h}from"../core/accessorSupport/decorators/subclass.js";import d from"./Layer.js";import{ArcGISService as y}from"./mixins/ArcGISService.js";import{BlendLayer as f}from"./mixins/BlendLayer.js";import{CustomParametersMixin as g}from"./mixins/CustomParametersMixin.js";import{ImageryTileMixin as v}from"./mixins/ImageryTileMixin.js";import{OperationalLayer as w}from"./mixins/OperationalLayer.js";import{PortalLayer as R}from"./mixins/PortalLayer.js";import{RefreshableLayer as S}from"./mixins/RefreshableLayer.js";import{ScaleRangeLayer as j}from"./mixins/ScaleRangeLayer.js";import{TemporalLayer as F}from"./mixins/TemporalLayer.js";import{legendEnabled as b}from"./support/commonProperties.js";import _ from"./support/Field.js";import{interpolationKebab as O}from"./support/rasterEnums.js";import P from"./support/RasterFunction.js";import I from"./support/rasterDatasets/FunctionRaster.js";import x from"./support/rasterDatasets/RasterFactory.js";import{getPrimaryRasterUrls as T,create as L}from"./support/rasterFunctions/rasterFunctionHelper.js";import{createPopupTemplate as N}from"../support/popupUtils.js";import{SaveOperationType as J}from"../webdoc/interfaces.js";let C=class extends(f(j(w(R(g(v(F(y(S(o(r(d)))))))))))){constructor(...e){super(...e),this._primaryRasters=[],this.bandIds=null,this.interpolation=null,this.legendEnabled=!0,this.isReference=null,this.listMode="show",this.sourceJSON=null,this.version=null,this.type="imagery-tile",this.operationalLayerType="ArcGISTiledImageServiceLayer",this.popupEnabled=!0,this.popupTemplate=null,this.fields=null,this.source=void 0,this._debouncedSaveOperations=a((async(e,t,r)=>{const{save:s,saveAs:i}=await import("./save/imageryUtils.js");switch(e){case J.SAVE:return s(this,t);case J.SAVE_AS:return i(this,r,t)}}))}normalizeCtorArgs(e,t){return"string"==typeof e?{url:e,...t}:e}load(e){const t=null!=e?e.signal:null;return this.addResolvingPromise(this.loadFromPortal({supportedTypes:["Image Service"]},e).catch(n).then((()=>this._openRaster(t)))),Promise.resolve(this)}get defaultPopupTemplate(){return this.createPopupTemplate()}get rasterFields(){const e=[new _({name:"Raster.ServicePixelValue",alias:"Pixel Value",domain:null,editable:!1,length:50,type:"string"}),new _({name:"Raster.ServicePixelValue.Raw",alias:"Raw Pixel Value",domain:null,editable:!1,length:50,type:"string"})],t=this.raster?.rasterInfo??this.serviceRasterInfo,r=t?.attributeTable,s=null!=r?r.fields:null,i="Raster.";if(s){const t=s.filter((e=>"oid"!==e.type&&"value"!==e.name.toLowerCase())).map((e=>{const t=e.clone();return t.name=i+e.name,t}));e.push(...t)}const o=t?.dataType,a=t?.multidimensionalInfo;if(("vector-magdir"===o||"vector-uv"===o)&&null!=a){const t=a.variables[0].unit?.trim(),r="Magnitude"+(t?` (${t})`:"");e.push(new _({name:"Raster.Magnitude",alias:r,domain:null,editable:!1,type:"double"})),e.push(new _({name:"Raster.Direction",alias:"Direction (°)",domain:null,editable:!1,type:"double"}))}return e}createPopupTemplate(e){const{rasterFields:t}=this,r=new Set(t.map((({name:e})=>e)).filter((e=>"raster.servicepixelvalue.raw"!==e.toLowerCase())));return N({fields:t,title:this.title},{...e,visibleFieldNames:r})}async generateRasterInfo(e,t){if(e=c(P,e),await this.load(),!e||"none"===e.functionName?.toLowerCase())return this.serviceRasterInfo;try{const{rasterInfo:r}=await this._openFunctionRaster(e,t);return r}catch(r){if(r instanceof s)throw r;throw new s("imagery-tile-layer","the given raster function is not supported")}}async save(e){return this._debouncedSaveOperations(J.SAVE,e)}async saveAs(e,t){return this._debouncedSaveOperations(J.SAVE_AS,t,e)}write(e,t){const r=this._primaryRasters[0]??this.raster;if(this.loaded?"RasterTileServer"===r.datasetFormat&&("Raster"===r.tileType||"Map"===r.tileType):this.url&&/\/ImageServer(\/|\/?$)/i.test(this.url))return super.write(e,t);if(t?.messages){const e=`${t.origin}/${t.layerContainerType||"operational-layers"}`;t.messages.push(new s("layer:unsupported",`Layers (${this.title}, ${this.id}) of type '${this.declaredClass}' are not supported in the context of '${e}'`,{layer:this}))}return null}async _openRaster(e){let t=!1;if(this.raster)await this._openFromRaster(this.raster,e),t="Function"===this.raster.datasetFormat;else{const{url:t,rasterFunction:r,source:i}=this;if(!t&&!i)throw new s("imagery-tile-layer:open","missing url or source parameter");i?await this._openFromSource(i,e):r?await this._openFromUrlWithRasterFunction(t,r,e):await this._openFromUrl(t,e)}const r=this.raster.rasterInfo;if(!r)throw new s("imagery-tile-layer:load","cannot load resources on "+this.url);if(this._set("serviceRasterInfo",t?r:this._primaryRasters[0].rasterInfo),this._set("spatialReference",r.spatialReference),this.sourceJSON=this.sourceJSON||this.raster.sourceJSON,null!=this.sourceJSON){const e="Map"===this.raster.tileType&&null!=this.sourceJSON.minLOD&&null!=this.sourceJSON.maxLOD?this.sourceJSON:{...this.sourceJSON,minScale:0,maxScale:0};this.read(e,{origin:"service"})}else this.read({tileInfo:this.serviceRasterInfo?.storageInfo.tileInfo.toJSON()},{origin:"service"});this.title||(this.title=this.raster.datasetName),"Map"===this.raster.tileType&&(this.popupEnabled=!1),this._configDefaultSettings(),this.addHandles(l((()=>this.customParameters),(e=>{this.raster&&(this.raster.ioConfig.customFetchParameters=e)})))}async _openFromRaster(e,t){e.rasterInfo||await e.open({signal:t}),this._primaryRasters="Function"===e.datasetFormat?e.primaryRasters.rasters:[e],this.url||(this.url=this._primaryRasters[0].url)}async _openFromUrlWithRasterFunction(e,t,r){const i=[e];t&&T(t.toJSON(),i);const o=await Promise.all(i.map((e=>x.open({url:e,sourceJSON:this.sourceJSON,ioConfig:{sampling:"closest",...this.ioConfig,customFetchParameters:this.customParameters},signal:r})))),a=o.findIndex((e=>null==e));if(a>-1)throw new s("imagery-tile-layer:open",`cannot open raster: ${i[a]}`);return this._primaryRasters=o,this._initializeWithFunctionRaster(t)}async _openFromUrl(e,t){const r=await x.open({url:e,sourceJSON:this.sourceJSON,ioConfig:{sampling:"closest",...this.ioConfig,customFetchParameters:this.customParameters},signal:t});if(null==r)throw new s("imagery-tile-layer:open",`cannot open raster: ${e}`);this._primaryRasters=[r],this.raster=r}async _openFromSource(e,t){const r="the tiled imagery data source is not supported",i="coverage"===e.type?.toLowerCase()?"CovJSON":e.extent&&e.pixelBlock?"MEMORY":null;if(!i)throw new s("imagery-tile-layer:open",r);"MEMORY"===i&&(e={extent:e.extent,pixelBlocks:[e.pixelBlock]});const o=await x.open({url:"",source:e,datasetFormat:i,ioConfig:{sampling:"closest",...this.ioConfig,customFetchParameters:this.customParameters},signal:t});if(null==o)throw new s("imagery-tile-layer:open",r);this._primaryRasters=[o],this.rasterFunction?await this._initializeWithFunctionRaster(this.rasterFunction):this.raster=o}async _openFunctionRaster(e,t){const r={raster:this._primaryRasters[0]};this._primaryRasters.length>1&&this._primaryRasters.forEach((e=>r[e.url]=e));const s=L(e.functionDefinition?.toJSON()??e.toJSON(),r),i=new I({rasterFunction:s});return await i.open(t),i}async _initializeWithFunctionRaster(e,t){try{this.raster=await this._openFunctionRaster(e,t)}catch(r){r instanceof s&&i.getLogger(this).error("imagery-tile-layer:open",r.message),i.getLogger(this).warn("imagery-tile-layer:open","the raster function cannot be applied and is removed"),this._set("rasterFunction",null),this.raster=this._primaryRasters[0]}}};e([p({clonable:!1})],C.prototype,"_primaryRasters",void 0),e([p({type:[m],json:{write:{overridePolicy(){return{enabled:!this.loaded||"Raster"===this.raster.tileType||"0,1,2"!==this.bandIds?.join(",")}}}}})],C.prototype,"bandIds",void 0),e([p({json:{write:{overridePolicy(){return{enabled:!this.loaded||"Raster"===this.raster.tileType||"bilinear"!==this.interpolation}}}}}),u(O)],C.prototype,"interpolation",void 0),e([p(b)],C.prototype,"legendEnabled",void 0),e([p({type:Boolean,json:{read:!1,write:{enabled:!0,overridePolicy:()=>({enabled:!1})}}})],C.prototype,"isReference",void 0),e([p({type:["show","hide"]})],C.prototype,"listMode",void 0),e([p({json:{read:!0,write:!0}})],C.prototype,"blendMode",void 0),e([p()],C.prototype,"sourceJSON",void 0),e([p({readOnly:!0,json:{origins:{service:{read:{source:"currentVersion"}}}}})],C.prototype,"version",void 0),e([p({readOnly:!0,json:{read:!1}})],C.prototype,"type",void 0),e([p({type:["ArcGISTiledImageServiceLayer"]})],C.prototype,"operationalLayerType",void 0),e([p({type:Boolean,value:!0,json:{read:{source:"disablePopup",reader:(e,t)=>!t.disablePopup},write:{target:"disablePopup",overridePolicy(){return{enabled:!this.loaded||"Raster"===this.raster.tileType}},writer(e,t,r){t[r]=!e}}}})],C.prototype,"popupEnabled",void 0),e([p({type:t,json:{read:{source:"popupInfo"},write:{target:"popupInfo",overridePolicy(){return{enabled:!this.loaded||"Raster"===this.raster.tileType}}}}})],C.prototype,"popupTemplate",void 0),e([p({readOnly:!0})],C.prototype,"defaultPopupTemplate",null),e([p({readOnly:!0,type:[_]})],C.prototype,"fields",void 0),e([p({readOnly:!0,type:[_]})],C.prototype,"rasterFields",null),e([p({constructOnly:!0})],C.prototype,"source",void 0),C=e([h("esri.layers.ImageryTileLayer")],C);const M=C;export{M as default};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.30/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{getEffectiveLayerCapabilities as
|
|
5
|
+
import{isLayerFromCatalog as t}from"../catalog/catalogUtils.js";import{getEffectiveLayerCapabilities as o,getEffectiveEditingEnabled as i}from"./layerUtils.js";function n(t){return"object"==typeof t&&null!=t&&"loaded"in t&&!0===t.loaded&&"type"in t}function e(e){return!(!n(e)||!o(e)?.operations?.supportsEditing||"editingEnabled"in e&&!i(e)||t(e))}export{e as isEditableLayer};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@arcgis/core",
|
|
3
|
-
"version": "4.30.0-next.
|
|
3
|
+
"version": "4.30.0-next.20240522",
|
|
4
4
|
"homepage": "https://js.arcgis.com",
|
|
5
5
|
"description": "ArcGIS Maps SDK for JavaScript: A complete 2D and 3D mapping and data visualization API",
|
|
6
6
|
"keywords": [
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
"dependencies": {
|
|
28
28
|
"@esri/arcgis-html-sanitizer": "~4.0.0",
|
|
29
29
|
"@esri/calcite-colors": "~6.1.0",
|
|
30
|
-
"@esri/calcite-components": "^2.8.
|
|
30
|
+
"@esri/calcite-components": "^2.8.3",
|
|
31
31
|
"@vaadin/grid": "~24.3.13",
|
|
32
32
|
"@zip.js/zip.js": "~2.7.44",
|
|
33
33
|
"luxon": "~3.4.4",
|
package/portal/PortalItem.js
CHANGED
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.30/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../chunks/tslib.es6.js";import{getAssetUrl as t}from"../assets.js";import i from"../core/Error.js";import{JSONSupportMixin as r}from"../core/JSONSupport.js";import{clone as o,fixJson as s}from"../core/lang.js";import a from"../core/Loadable.js";import{isDataProtocol as n,makeAbsolute as l}from"../core/urlUtils.js";import{property as p}from"../core/accessorSupport/decorators/property.js";import{ensureClass as c}from"../core/accessorSupport/ensureType.js";import{reader as d}from"../core/accessorSupport/decorators/reader.js";import{subclass as u}from"../core/accessorSupport/decorators/subclass.js";import m from"../geometry/Extent.js";import h from"./Portal.js";import g from"./PortalItemResource.js";import y from"./PortalRating.js";import{a as v}from"../chunks/persistableUrlUtils.js";var w;const f=new Set(["3DTiles Service","CSV","Feature Collection","Feature Service","Feed","GeoJson","Group Layer","Image Service","KML","Map Service","Media Layer","Scene Service","Stream Service","Vector Tile Service","WFS","WMS","WMTS"]),b=new Set(["KML","GeoJson","CSV"]);let k=w=class extends(r(a)){static from(e){return c(w,e)}constructor(e){super(e),this.access=null,this.accessInformation=null,this.apiKey=null,this.applicationProxies=null,this.avgRating=null,this.categories=null,this.created=null,this.culture=null,this.description=null,this.extent=null,this.groupCategories=null,this.id=null,this.isOrgItem=!1,this.itemControl=null,this.licenseInfo=null,this.modified=null,this.name=null,this.numComments=null,this.numRatings=null,this.numViews=null,this.owner=null,this.ownerFolder=null,this.portal=null,this.screenshots=null,this.size=null,this.snippet=null,this.sourceJSON=null,this.sourceUrl=null,this.spatialReference=null,this.tags=null,this.title=null,this.type=null,this.typeKeywords=null,this.url=null}destroy(){this.portal=null}get displayName(){const e=this.type,t=this.typeKeywords||[];let i=e;return"Feature Service"===e||"Feature Collection"===e?i=t.includes("Table")?"Table":t.includes("Route Layer")?"Route Layer":t.includes("Markup")?"Markup":"Feature Layer":"Image Service"===e?i=t.includes("Elevation 3D Layer")?"Elevation Layer":t.includes("Tiled Imagery")?"Tiled Imagery Layer":"Imagery Layer":"Scene Service"===e?i="Scene Layer":"Video Service"===e?i="Video Layer":"Scene Package"===e?i="Scene Layer Package":"Stream Service"===e?i="Feature Layer":"Geoprocessing Service"===e?i=t.includes("Web Tool")?"Tool":"Geoprocessing Service":"Geoenrichment Service"===e?i="GeoEnrichment Service":"Geocoding Service"===e?i="Locator":"Microsoft Powerpoint"===e?i="Microsoft PowerPoint":"GeoJson"===e?i="GeoJSON":"Globe Service"===e?i="Globe Layer":"Vector Tile Service"===e?i="Tile Layer":"netCDF"===e?i="NetCDF":"Map Service"===e?i=t.includes("Spatiotemporal")||!t.includes("Hosted Service")&&!t.includes("Tiled")||t.includes("Relational")?"Map Image Layer":"Tile Layer":e?.toLowerCase().includes("add in")?i=e.replaceAll(/(add in)/gi,"Add-In"):"datastore catalog service"===e?i="Big Data File Share":"Compact Tile Package"===e?i="Tile Package (tpkx)":"Raster function template"===e?i="Raster Function Template":"OGCFeatureServer"===e?i="OGC Feature Layer":"web mapping application"===e&&t.includes("configurableApp")?i="Instant App":"Insights Page"===e?i="Insights Report":"Excalibur Imagery Project"===e?i="Excalibur Project":"3DTiles Service"===e?i="3D tiles layer":"3DTiles Package"===e&&(i="3D tiles package"),i}readExtent(e){return e&&e.length?new m(e[0][0],e[0][1],e[1][0],e[1][1]):null}get iconUrl(){const e=this.type?.toLowerCase()||"",i=this.typeKeywords||[],r="esri/images/portal/",o="16";let s,a=!1,n=!1,l=!1,p=!1,c=!1,d=!1,u=!1,m=!1;return e.indexOf("service")>0||"feature collection"===e||"kml"===e||"wms"===e||"wmts"===e||"wfs"===e?(a=i.includes("Hosted Service"),"feature service"===e||"feature collection"===e||"kml"===e||"wfs"===e?(n=i.includes("Table"),l=i.includes("Route Layer"),p=i.includes("Markup"),c=i.includes("Spatiotemporal"),d=i.includes("UtilityNetwork"),s=c&&n?"spatiotemporaltable":n?"table":l?"routelayer":p?"markup":c?"spatiotemporal":d?"utilitynetwork":a?"featureshosted":"features"):"map service"===e||"wms"===e||"wmts"===e?(c=i.includes("Spatiotemporal"),u=i.includes("Relational"),s=c||u?"mapimages":a||i.includes("Tiled")||"wmts"===e?"maptiles":"mapimages"):s="scene service"===e?i.includes("Line")?"sceneweblayerline":i.includes("3DObject")?"sceneweblayermultipatch":i.includes("Point")?"sceneweblayerpoint":i.includes("IntegratedMesh")?"sceneweblayermesh":i.includes("PointCloud")?"sceneweblayerpointcloud":i.includes("Polygon")?"sceneweblayerpolygon":i.includes("Building")?"sceneweblayerbuilding":i.includes("Voxel")?"sceneweblayervoxel":"sceneweblayer":"image service"===e?i.includes("Elevation 3D Layer")?"elevationlayer":i.includes("Tiled Imagery")?"tiledimagerylayer":"imagery":"stream service"===e?"streamlayer":"vector tile service"===e?"vectortile":"datastore catalog service"===e?"datastorecollection":"geocoding service"===e?"geocodeservice":"video service"===e?i.includes("Live Stream")?"livestreamvideolayer":"videolayer":"geoprocessing service"===e?i.includes("Web Tool")?"tool":"layers":"geodata service"===e?"geodataservice":"3dtiles service"===e?i.includes("3DObject")?"3dobjecttileslayer":i.includes("IntegratedMesh")?"integratedmeshtileslayer":"3dtileslayer":"layers"):"web map"===e||"cityengine web scene"===e?s="maps":"web scene"===e?s=i.includes("ViewingMode-Local")?"webscenelocal":"websceneglobal":"web mapping application"===e&&i.includes("configurableApp")?s="instantapps":"web mapping application"===e||"mobile application"===e||"application"===e||"operation view"===e||"desktop application"===e?s="apps":"map document"===e||"map package"===e||"published map"===e||"scene document"===e||"globe document"===e||"basemap package"===e||"mobile basemap package"===e||"mobile map package"===e||"project package"===e||"project template"===e||"pro map"===e||"layout"===e||"layer"===e&&i.includes("ArcGIS Pro")||"explorer map"===e&&i.indexOf("Explorer Document")?s="mapsgray":"service definition"===e||"shapefile"===e||"cad drawing"===e||"geojson"===e||"netcdf"===e||"administrative report"===e?s="datafiles":"360 vr experience"===e?s="360vr":"explorer add in"===e||"desktop add in"===e||"windows viewer add in"===e||"windows viewer configuration"===e?s="appsgray":"arcgis pro add in"===e||"arcgis pro configuration"===e?s="addindesktop":"pdf"===e?s="pdf":"microsoft word"===e?s="word":"microsoft excel"===e?s="excel":"microsoft powerpoint"===e?s="ppt":"rule package"===e||"file geodatabase"===e||"sqlite geodatabase"===e||"csv collection"===e||"kml collection"===e||"windows mobile package"===e||"map template"===e||"desktop application template"===e||"gml"===e||"arcpad package"===e||"code sample"===e||"document link"===e||"earth configuration"===e||"operations dashboard add in"===e||"rules package"===e||"workflow manager package"===e||"explorer map"===e&&i.includes("Explorer Mapping Application")||i.includes("Document")?s="datafilesgray":"network analysis service"===e||"geoprocessing service"===e||"geodata service"===e||"geometry service"===e||"geoprocessing package"===e||"locator package"===e||"geoprocessing sample"===e||"workflow manager service"===e?s="toolsgray":"layer"===e||"layer package"===e||"explorer layer"===e?s="layersgray":"analysis model"===e?s="analysismodel":"scene package"===e?s="scenepackage":"3dtiles package"===e?s="3dtileslayerpackage":"3dtiles service"===e?s="3dtileslayer":"mobile scene package"===e?s="mobilescenepackage":"tile package"===e||"compact tile package"===e?s="tilepackage":"task file"===e?s="taskfile":"report template"===e?s="report-template":"statistical data collection"===e?s="statisticaldatacollection":"insights workbook"===e?s="workbook":"insights model"===e?s="insightsmodel":"insights page"===e?s="insightspage":"insights theme"===e?s="insightstheme":"hub initiative"===e?s="hubinitiative":"hub page"===e?s="hubpage":"hub site application"===e?s="hubsite":"hub event"===e?s="hubevent":"hub project"===e?s="hubproject":"relational database connection"===e?s="relationaldatabaseconnection":"big data file share"===e?s="datastorecollection":"image collection"===e?s="imagecollection":"desktop style"===e?s="desktopstyle":"style"===e?s=i.includes("Dictionary")?"dictionarystyle":"style":"dashboard"===e?s="dashboard":"raster function template"===e?s="rasterprocessingtemplate":"vector tile package"===e?s="vectortilepackage":"ortho mapping project"===e?s="orthomappingproject":"ortho mapping template"===e?s="orthomappingtemplate":"solution"===e?s="solutions":"geopackage"===e?s="geopackage":"deep learning package"===e?s="deeplearningpackage":"real time analytic"===e?s="realtimeanalytics":"big data analytic"===e?s="bigdataanalytics":"feed"===e?s="feed":"excalibur imagery project"===e?s="excaliburimageryproject":"notebook"===e?s="notebook":"storymap"===e?s="storymap":"survey123 add in"===e?s="survey123addin":"mission"===e?s="mission":"mission report"===e?s="missionreport":"mission template"===e?s="missiontemplate":"quickcapture project"===e?s="quickcaptureproject":"pro report"===e?s="proreport":"pro report template"===e?s="proreporttemplate":"urban model"===e?s="urbanmodel":"web experience"===e?s="experiencebuilder":"web experience template"===e?s="webexperiencetemplate":"experience builder widget"===e?s="experiencebuilderwidget":"experience builder widget package"===e?s="experiencebuilderwidgetpackage":"workflow"===e?s="workflow":"kernel gateway connection"===e?s="kernelgatewayconnection":"insights script"===e?s="insightsscript":"hub initiative template"===e?s="hubinitiativetemplate":"storymap theme"===e?s="storymaptheme":"knowledge graph"===e?s="knowledgegraph":"knowledge studio project"===e?s="knowledgestudio":"native application"===e?s="nativeapp":"native application installer"===e?s="nativeappinstaller":"web link chart"===e?s="linkchart":"knowledge graph web investigation"===e?s="investigation":"ogcfeatureserver"===e?s="features":"pro project"===e?s="proproject":"insights workbook package"===e?s="insightsworkbookpackage":"apache parquet"===e?s="apacheparquet":"notebook code snippet library"===e?s="notebookcodesnippets":"suitability model"===e?s="suitabilitymodel":"esri classifier definition"===e?s="classifierdefinition":"esri classification schema"===e?s="classificationschema":"insights data engineering workbook"===e?s="dataengineeringworkbook":"insights data engineering model"===e?s="dataengineeringmodel":"deep learning studio project"===e?s="deeplearningproject":"discussion"===e?s="discussion":"allsource project"===e?s="allsourceproject":"api key"===e?s="apikey":"data pipeline"===e?s="datapipelines":"group layer"===e?(m=i.includes("Map"),s=m?"layergroup2d":"layergroup"):s="media layer"===e?"onlinemedialayer":"form"===e?i.includes("Survey123")?"survey":"datafilesgray":"csv"===e?"csv":"image"===e?"image":"maps",s?t(r+s+o+".png"):null}get isLayer(){return null!=this.type&&f.has(this.type)}get itemCdnUrl(){return v(this.itemUrl)}get itemPageUrl(){const e=this.portal?.itemPageUrl;return e&&this.id?`${e}?id=${this.id}`:null}get itemUrl(){const e=this.portal?.restUrl;return e&&this.id?`${e}/content/items/${this.id}`:null}get thumbnailUrl(){const e=this.itemUrl,t=this.thumbnail;return e&&t?this.portal?.normalizeUrl(`${e}/info/${t}?f=json`)??null:null}get userItemUrl(){const e=this.portal?.restUrl;if(!e)return null;const t=this.owner||this.portal?.user?.username;if(!t)return null;return`${e}/content/users/${this.ownerFolder?`${t}/${this.ownerFolder}`:t}/items/${this.id}`}load(e){const t=this.portal??(this.portal=h.getDefault()),i=t.load(e).then((()=>this.sourceJSON?this.sourceJSON:this.id&&this.itemUrl?t.request(this.itemUrl,{signal:null!=e?e.signal:null,query:{token:this.apiKey}}):{})).then((e=>{this.sourceJSON=e,this.read(e)}));return this.addResolvingPromise(i),Promise.resolve(this)}async addRating(e){const t={method:"post",query:{}};return e instanceof y&&(e=e.rating),null==e||isNaN(e)||"number"!=typeof e||(t.query.rating=e),this.portal?(await this.portal.request(this.itemUrl+"/addRating",t),new y({rating:e,created:new Date})):null}clone(){const e={access:this.access,accessInformation:this.accessInformation,applicationProxies:o(this.applicationProxies),avgRating:this.avgRating,categories:o(this.categories),created:o(this.created),culture:this.culture,description:this.description,extent:o(this.extent),groupCategories:o(this.groupCategories),id:this.id,itemControl:this.itemControl,licenseInfo:this.licenseInfo,modified:o(this.modified),name:this.name,numComments:this.numComments,numRatings:this.numRatings,numViews:this.numViews,owner:this.owner,ownerFolder:this.ownerFolder,portal:this.portal,screenshots:o(this.screenshots),size:this.size,snippet:this.snippet,sourceUrl:this.sourceUrl,spatialReference:this.spatialReference,tags:o(this.tags),thumbnail:this.thumbnail,title:this.title,type:this.type,typeKeywords:o(this.typeKeywords),url:this.url};this.loaded&&(e.loadStatus="loaded");const t=new w({sourceJSON:this.sourceJSON}).set(e);return t._set("isOrgItem",this.isOrgItem),t}createPostQuery(){const e=this.toJSON();for(const i of["tags","typeKeywords","categories"])e[i]=e[i]?.join(", ");const{extent:t}=e;return t&&(e.extent=JSON.stringify(t)),e}async deleteRating(){await this.portal.request(this.itemUrl+"/deleteRating",{method:"post"})}fetchData(e="json",t){return this.portal.request(this.itemUrl+"/data",{responseType:e,...t,query:{token:this.apiKey}})}async fetchRating(e){const t=await this.portal.request(this.itemUrl+"/rating",{query:{token:this.apiKey},...e});return null!=t.rating?(t.created=new Date(t.created),new y(t)):null}fetchRelatedItems(e,t){return this.portal.requestToTypedArray(this.itemUrl+"/relatedItems",{query:{...e,token:this.apiKey},...t},w)}getThumbnailUrl(e){let t=this.thumbnailUrl;return t&&e&&(t+=`&w=${e}`),t}reload(){return this.portal.request(this.itemUrl??"",{cacheBust:!0,query:{token:this.apiKey}}).then((e=>(this.sourceJSON=e,this.read(e),this)))}update(e){return this.id?this.load().then((()=>this.portal.signIn())).then((()=>{const t=e?.data,i={method:"post"};i.query=this.createPostQuery();for(const e in i.query)null===i.query[e]&&(i.query[e]="");return i.query.clearEmptyFields=!0,null!=t&&("string"==typeof t?i.query.text=t:"object"==typeof t&&(i.query.text=JSON.stringify(t))),this.portal.request(`${this.userItemUrl}/update`,i).then((()=>this.reload()))})):Promise.reject(new i("portal:item-does-not-exist","The item does not exist yet and cannot be updated"))}async copy(e){if(!this.id)throw new i("portal:item-does-not-exist","The item does not exist yet");await this.load();const{portal:t,itemUrl:r}=this;await t.signIn();const{copyResources:o,folder:s,tags:a,title:n}=e||{},l={method:"post",query:{copyPrivateResources:"all"===o,folder:"string"==typeof s?s:s?.id,includeResources:!!o,tags:a?.join(","),title:n}},{itemId:p}=await t.request(`${r}/copy`,l);return new w({id:p,portal:t})}updateThumbnail(e){return this.id?this.load().then((()=>this.portal.signIn())).then((()=>{const t=e.thumbnail,i=e.filename,r={method:"post"};if("string"==typeof t)n(t)?r.query={data:t}:r.query={url:l(t)},null!=i&&(r.query.filename=i);else{const e=new FormData;null!=i?e.append("file",t,i):e.append("file",t),r.body=e}return this.portal.request(`${this.userItemUrl}/updateThumbnail`,r).then((()=>this.reload()))})):Promise.reject(new i("portal:item-does-not-exist","The item does not exist yet and cannot be updated"))}async fetchResources(e={},t){const{fetchResources:i}=await import("./support/resourceUtils.js");return i(this,e,t)}async addResource(e,t,i){const{addOrUpdateResources:r}=await import("./support/resourceUtils.js");return e.portalItem=this,await r(this,[{resource:e,content:t,compress:i?.compress,access:i?.access}],"add",i),e}async removeResource(e,t){const{removeResource:r}=await import("./support/resourceUtils.js");if(e.portalItem&&e.portalItem.itemUrl!==this.itemUrl)throw new i("removeresource:portal-item-mismatch","The portal item associated with the provided resource does not match the item");return r(this,e,t)}async removeAllResources(e){const{removeAllResources:t}=await import("./support/resourceUtils.js");return t(this,e)}resourceFromPath(e){return new g({portalItem:this,path:e})}toJSON(){const e=this.extent,t={accessInformation:this.accessInformation,categories:o(this.categories),created:this.created?.getTime(),description:this.description,extent:e&&[[e.xmin,e.ymin],[e.xmax,e.ymax]],id:this.id,isOrgItem:this.isOrgItem,licenseInfo:this.licenseInfo,modified:this.modified?.getTime(),name:this.name,owner:this.owner,ownerFolder:this.ownerFolder,snippet:this.snippet,sourceUrl:this.sourceUrl,spatialReference:this.spatialReference,tags:o(this.tags),thumbnail:this.thumbnail,title:this.title,type:this.type,typeKeywords:o(this.typeKeywords),url:this.url};return s(t)}static fromJSON(e){if(!e)return null;if(e.declaredClass)throw new Error("JSON object is already hydrated");return new w({sourceJSON:e})}_getPostQuery(){const e=this.toJSON();for(const t in e)"tags"===t&&null!==e[t]&&(e[t]=e[t].join(", ")),"typeKeywords"===t&&null!==e[t]&&(e[t]=e[t].join(", ")),"extent"===t&&e[t]&&(e[t]=JSON.stringify(e[t]));return e}};e([p({type:["private","shared","org","public"]})],k.prototype,"access",void 0),e([p()],k.prototype,"accessInformation",void 0),e([p({type:String})],k.prototype,"apiKey",void 0),e([p({json:{read:{source:"appProxies"}}})],k.prototype,"applicationProxies",void 0),e([p()],k.prototype,"avgRating",void 0),e([p()],k.prototype,"categories",void 0),e([p({type:Date})],k.prototype,"created",void 0),e([p()],k.prototype,"culture",void 0),e([p()],k.prototype,"description",void 0),e([p({readOnly:!0})],k.prototype,"displayName",null),e([p({type:m})],k.prototype,"extent",void 0),e([d("extent")],k.prototype,"readExtent",null),e([p()],k.prototype,"groupCategories",void 0),e([p({readOnly:!0})],k.prototype,"iconUrl",null),e([p()],k.prototype,"id",void 0),e([p({readOnly:!0})],k.prototype,"isLayer",null),e([p({type:Boolean,readOnly:!0})],k.prototype,"isOrgItem",void 0),e([p()],k.prototype,"itemControl",void 0),e([p({readOnly:!0})],k.prototype,"itemPageUrl",null),e([p({readOnly:!0})],k.prototype,"itemUrl",null),e([p()],k.prototype,"licenseInfo",void 0),e([p({type:Date})],k.prototype,"modified",void 0),e([p()],k.prototype,"name",void 0),e([p()],k.prototype,"numComments",void 0),e([p()],k.prototype,"numRatings",void 0),e([p()],k.prototype,"numViews",void 0),e([p()],k.prototype,"owner",void 0),e([p()],k.prototype,"ownerFolder",void 0),e([p({type:h})],k.prototype,"portal",void 0),e([p()],k.prototype,"screenshots",void 0),e([p()],k.prototype,"size",void 0),e([p()],k.prototype,"snippet",void 0),e([p()],k.prototype,"sourceJSON",void 0),e([p({type:String})],k.prototype,"sourceUrl",void 0),e([p({type:String})],k.prototype,"spatialReference",void 0),e([p()],k.prototype,"tags",void 0),e([p()],k.prototype,"thumbnail",void 0),e([p({readOnly:!0})],k.prototype,"thumbnailUrl",null),e([p()],k.prototype,"title",void 0),e([p()],k.prototype,"type",void 0),e([p()],k.prototype,"typeKeywords",void 0),e([p({type:String,json:{read(e,t){if(b.has(t.type)){const t=this.portal?.restUrl;e||=t&&this.id?`${t}/content/items/${this.id}/data`:null}return e}}})],k.prototype,"url",void 0),e([p({readOnly:!0})],k.prototype,"userItemUrl",null),k=w=e([u("esri.portal.PortalItem")],k);const S=k;export{S as default};
|
|
5
|
+
import{_ as e}from"../chunks/tslib.es6.js";import{getAssetUrl as t}from"../assets.js";import i from"../core/Error.js";import{JSONSupportMixin as r}from"../core/JSONSupport.js";import{clone as o,fixJson as s}from"../core/lang.js";import a from"../core/Loadable.js";import{isDataProtocol as n,makeAbsolute as l}from"../core/urlUtils.js";import{property as p}from"../core/accessorSupport/decorators/property.js";import{ensureClass as c}from"../core/accessorSupport/ensureType.js";import{reader as d}from"../core/accessorSupport/decorators/reader.js";import{subclass as u}from"../core/accessorSupport/decorators/subclass.js";import m from"../geometry/Extent.js";import h from"./Portal.js";import g from"./PortalItemResource.js";import y from"./PortalRating.js";import{a as w}from"../chunks/persistableUrlUtils.js";var v;const f=new Set(["3DTiles Service","CSV","Feature Collection","Feature Service","Feed","GeoJson","Group Layer","Image Service","KML","Map Service","Media Layer","Scene Service","Stream Service","Vector Tile Service","WFS","WMS","WMTS"]),b=new Set(["KML","GeoJson","CSV"]);let k=v=class extends(r(a)){static from(e){return c(v,e)}constructor(e){super(e),this.access=null,this.accessInformation=null,this.apiKey=null,this.applicationProxies=null,this.avgRating=null,this.categories=null,this.created=null,this.culture=null,this.description=null,this.extent=null,this.groupCategories=null,this.id=null,this.isOrgItem=!1,this.itemControl=null,this.licenseInfo=null,this.modified=null,this.name=null,this.numComments=null,this.numRatings=null,this.numViews=null,this.owner=null,this.ownerFolder=null,this.portal=null,this.screenshots=null,this.size=null,this.snippet=null,this.sourceJSON=null,this.sourceUrl=null,this.spatialReference=null,this.tags=null,this.title=null,this.type=null,this.typeKeywords=null,this.url=null}destroy(){this.portal=null}get displayName(){const e=this.type,t=this.typeKeywords||[];let i=e;return"Feature Service"===e||"Feature Collection"===e?i=t.includes("Table")?"Table":t.includes("Route Layer")?"Route Layer":t.includes("Markup")?"Markup":"Feature Layer":"Image Service"===e?i=t.includes("Elevation 3D Layer")?"Elevation Layer":t.includes("Tiled Imagery")?"Tiled Imagery Layer":"Imagery Layer":"Scene Service"===e?i="Scene Layer":"Video Service"===e?i="Video Layer":"Scene Package"===e?i="Scene Layer Package":"Stream Service"===e?i="Feature Layer":"Geoprocessing Service"===e?i=t.includes("Web Tool")?"Tool":"Geoprocessing Service":"Geoenrichment Service"===e?i="GeoEnrichment Service":"Geocoding Service"===e?i="Locator":"Microsoft Powerpoint"===e?i="Microsoft PowerPoint":"GeoJson"===e?i="GeoJSON":"Globe Service"===e?i="Globe Layer":"Vector Tile Service"===e?i="Tile Layer":"netCDF"===e?i="NetCDF":"Map Service"===e?i=t.includes("Spatiotemporal")||!t.includes("Hosted Service")&&!t.includes("Tiled")||t.includes("Relational")?"Map Image Layer":"Tile Layer":e?.toLowerCase().includes("add in")?i=e.replaceAll(/(add in)/gi,"Add-In"):"datastore catalog service"===e?i="Big Data File Share":"Compact Tile Package"===e?i="Tile Package (tpkx)":"Raster function template"===e?i="Raster Function Template":"OGCFeatureServer"===e?i="OGC Feature Layer":"web mapping application"===e&&t.includes("configurableApp")?i="Instant App":"Insights Page"===e?i="Insights Report":"Excalibur Imagery Project"===e?i="Excalibur Project":"3DTiles Service"===e?i="3D tiles layer":"3DTiles Package"===e&&(i="3D tiles package"),i}readExtent(e){return e&&e.length?new m(e[0][0],e[0][1],e[1][0],e[1][1]):null}get iconUrl(){const e=this.type?.toLowerCase()||"",i=this.typeKeywords||[],r="esri/images/portal/",o="16";let s,a=!1,n=!1,l=!1,p=!1,c=!1,d=!1,u=!1,m=!1;return e.indexOf("service")>0||"feature collection"===e||"kml"===e||"wms"===e||"wmts"===e||"wfs"===e?(a=i.includes("Hosted Service"),"feature service"===e||"feature collection"===e||"kml"===e||"wfs"===e?(n=i.includes("Table"),l=i.includes("Route Layer"),p=i.includes("Markup"),c=i.includes("Spatiotemporal"),d=i.includes("UtilityNetwork"),s=c&&n?"spatiotemporaltable":n?"table":l?"routelayer":p?"markup":c?"spatiotemporal":d?"utilitynetwork":a?"featureshosted":"features"):"map service"===e||"wms"===e||"wmts"===e?(c=i.includes("Spatiotemporal"),u=i.includes("Relational"),s=c||u?"mapimages":a||i.includes("Tiled")||"wmts"===e?"maptiles":"mapimages"):s="scene service"===e?i.includes("Line")?"sceneweblayerline":i.includes("3DObject")?"sceneweblayermultipatch":i.includes("Point")?"sceneweblayerpoint":i.includes("IntegratedMesh")?"sceneweblayermesh":i.includes("PointCloud")?"sceneweblayerpointcloud":i.includes("Polygon")?"sceneweblayerpolygon":i.includes("Building")?"sceneweblayerbuilding":i.includes("Voxel")?"sceneweblayervoxel":"sceneweblayer":"image service"===e?i.includes("Elevation 3D Layer")?"elevationlayer":i.includes("Tiled Imagery")?"tiledimagerylayer":"imagery":"stream service"===e?"streamlayer":"vector tile service"===e?"vectortile":"datastore catalog service"===e?"datastorecollection":"geocoding service"===e?"geocodeservice":"video service"===e?i.includes("Live Stream")?"livestreamvideolayer":"videolayer":"geoprocessing service"===e?i.includes("Web Tool")?"tool":"layers":"geodata service"===e?"geodataservice":"3dtiles service"===e?i.includes("3DObject")?"3dobjecttileslayer":i.includes("IntegratedMesh")?"integratedmeshtileslayer":"3dtileslayer":"layers"):"web map"===e||"cityengine web scene"===e?s="maps":"web scene"===e?s=i.includes("ViewingMode-Local")?"webscenelocal":"websceneglobal":"web mapping application"===e&&i.includes("configurableApp")?s="instantapps":"web mapping application"===e||"mobile application"===e||"application"===e||"operation view"===e||"desktop application"===e?s="apps":"map document"===e||"map package"===e||"published map"===e||"scene document"===e||"globe document"===e||"basemap package"===e||"mobile basemap package"===e||"mobile map package"===e||"project package"===e||"project template"===e||"pro map"===e||"layout"===e||"layer"===e&&i.includes("ArcGIS Pro")||"explorer map"===e&&i.indexOf("Explorer Document")?s="mapsgray":"service definition"===e||"shapefile"===e||"cad drawing"===e||"geojson"===e||"netcdf"===e||"administrative report"===e?s="datafiles":"360 vr experience"===e?s="360vr":"explorer add in"===e||"desktop add in"===e||"windows viewer add in"===e||"windows viewer configuration"===e?s="appsgray":"arcgis pro add in"===e||"arcgis pro configuration"===e?s="addindesktop":"pdf"===e?s="pdf":"microsoft word"===e?s="word":"microsoft excel"===e?s="excel":"microsoft powerpoint"===e?s="ppt":"rule package"===e||"file geodatabase"===e||"sqlite geodatabase"===e||"csv collection"===e||"kml collection"===e||"windows mobile package"===e||"map template"===e||"desktop application template"===e||"gml"===e||"arcpad package"===e||"code sample"===e||"document link"===e||"earth configuration"===e||"operations dashboard add in"===e||"rules package"===e||"workflow manager package"===e||"explorer map"===e&&i.includes("Explorer Mapping Application")||i.includes("Document")?s="datafilesgray":"network analysis service"===e||"geoprocessing service"===e||"geodata service"===e||"geometry service"===e||"geoprocessing package"===e||"locator package"===e||"geoprocessing sample"===e||"workflow manager service"===e?s="toolsgray":"layer"===e||"layer package"===e||"explorer layer"===e?s="layersgray":"analysis model"===e?s="analysismodel":"scene package"===e?s="scenepackage":"3dtiles package"===e?s="3dtileslayerpackage":"3dtiles service"===e?s="3dtileslayer":"mobile scene package"===e?s="mobilescenepackage":"tile package"===e||"compact tile package"===e?s="tilepackage":"task file"===e?s="taskfile":"report template"===e?s="report-template":"statistical data collection"===e?s="statisticaldatacollection":"insights workbook"===e?s="workbook":"insights model"===e?s="insightsmodel":"insights page"===e?s="insightspage":"insights theme"===e?s="insightstheme":"hub initiative"===e?s="hubinitiative":"hub page"===e?s="hubpage":"hub site application"===e?s="hubsite":"hub event"===e?s="hubevent":"hub project"===e?s="hubproject":"relational database connection"===e?s="relationaldatabaseconnection":"big data file share"===e?s="datastorecollection":"image collection"===e?s="imagecollection":"desktop style"===e?s="desktopstyle":"style"===e?s=i.includes("Dictionary")?"dictionarystyle":"style":"dashboard"===e?s="dashboard":"raster function template"===e?s="rasterprocessingtemplate":"vector tile package"===e?s="vectortilepackage":"ortho mapping project"===e?s="orthomappingproject":"ortho mapping template"===e?s="orthomappingtemplate":"solution"===e?s="solutions":"geopackage"===e?s="geopackage":"deep learning package"===e?s="deeplearningpackage":"real time analytic"===e?s="realtimeanalytics":"big data analytic"===e?s="bigdataanalytics":"feed"===e?s="feed":"excalibur imagery project"===e?s="excaliburimageryproject":"notebook"===e?s="notebook":"storymap"===e?s="storymap":"survey123 add in"===e?s="survey123addin":"mission"===e?s="mission":"mission report"===e?s="missionreport":"mission template"===e?s="missiontemplate":"quickcapture project"===e?s="quickcaptureproject":"pro report"===e?s="proreport":"pro report template"===e?s="proreporttemplate":"urban model"===e?s="urbanmodel":"web experience"===e?s="experiencebuilder":"web experience template"===e?s="webexperiencetemplate":"experience builder widget"===e?s="experiencebuilderwidget":"experience builder widget package"===e?s="experiencebuilderwidgetpackage":"workflow"===e?s="workflow":"kernel gateway connection"===e?s="kernelgatewayconnection":"insights script"===e?s="insightsscript":"hub initiative template"===e?s="hubinitiativetemplate":"storymap theme"===e?s="storymaptheme":"knowledge graph"===e?s="knowledgegraph":"knowledge graph layer"===e?s="knowledgegraphlayer":"knowledge studio project"===e?s="knowledgestudio":"native application"===e?s="nativeapp":"native application installer"===e?s="nativeappinstaller":"web link chart"===e?s="linkchart":"knowledge graph web investigation"===e?s="investigation":"ogcfeatureserver"===e?s="features":"pro project"===e?s="proproject":"insights workbook package"===e?s="insightsworkbookpackage":"apache parquet"===e?s="apacheparquet":"notebook code snippet library"===e?s="notebookcodesnippets":"suitability model"===e?s="suitabilitymodel":"esri classifier definition"===e?s="classifierdefinition":"esri classification schema"===e?s="classificationschema":"insights data engineering workbook"===e?s="dataengineeringworkbook":"insights data engineering model"===e?s="dataengineeringmodel":"deep learning studio project"===e?s="deeplearningproject":"discussion"===e?s="discussion":"allsource project"===e?s="allsourceproject":"api key"===e?s="apikey":"data pipeline"===e?s="datapipelines":"group layer"===e?(m=i.includes("Map"),s=m?"layergroup2d":"layergroup"):s="media layer"===e?"onlinemedialayer":"form"===e?i.includes("Survey123")?"survey":"datafilesgray":"csv"===e?"csv":"image"===e?"image":"maps",s?t(r+s+o+".png"):null}get isLayer(){return null!=this.type&&f.has(this.type)}get itemCdnUrl(){return w(this.itemUrl)}get itemPageUrl(){const e=this.portal?.itemPageUrl;return e&&this.id?`${e}?id=${this.id}`:null}get itemUrl(){const e=this.portal?.restUrl;return e&&this.id?`${e}/content/items/${this.id}`:null}get thumbnailUrl(){const e=this.itemUrl,t=this.thumbnail;return e&&t?this.portal?.normalizeUrl(`${e}/info/${t}?f=json`)??null:null}get userItemUrl(){const e=this.portal?.restUrl;if(!e)return null;const t=this.owner||this.portal?.user?.username;if(!t)return null;return`${e}/content/users/${this.ownerFolder?`${t}/${this.ownerFolder}`:t}/items/${this.id}`}load(e){const t=this.portal??(this.portal=h.getDefault()),i=t.load(e).then((()=>this.sourceJSON?this.sourceJSON:this.id&&this.itemUrl?t.request(this.itemUrl,{signal:null!=e?e.signal:null,query:{token:this.apiKey}}):{})).then((e=>{this.sourceJSON=e,this.read(e)}));return this.addResolvingPromise(i),Promise.resolve(this)}async addRating(e){const t={method:"post",query:{}};return e instanceof y&&(e=e.rating),null==e||isNaN(e)||"number"!=typeof e||(t.query.rating=e),this.portal?(await this.portal.request(this.itemUrl+"/addRating",t),new y({rating:e,created:new Date})):null}clone(){const e={access:this.access,accessInformation:this.accessInformation,applicationProxies:o(this.applicationProxies),avgRating:this.avgRating,categories:o(this.categories),created:o(this.created),culture:this.culture,description:this.description,extent:o(this.extent),groupCategories:o(this.groupCategories),id:this.id,itemControl:this.itemControl,licenseInfo:this.licenseInfo,modified:o(this.modified),name:this.name,numComments:this.numComments,numRatings:this.numRatings,numViews:this.numViews,owner:this.owner,ownerFolder:this.ownerFolder,portal:this.portal,screenshots:o(this.screenshots),size:this.size,snippet:this.snippet,sourceUrl:this.sourceUrl,spatialReference:this.spatialReference,tags:o(this.tags),thumbnail:this.thumbnail,title:this.title,type:this.type,typeKeywords:o(this.typeKeywords),url:this.url};this.loaded&&(e.loadStatus="loaded");const t=new v({sourceJSON:this.sourceJSON}).set(e);return t._set("isOrgItem",this.isOrgItem),t}createPostQuery(){const e=this.toJSON();for(const i of["tags","typeKeywords","categories"])e[i]=e[i]?.join(", ");const{extent:t}=e;return t&&(e.extent=JSON.stringify(t)),e}async deleteRating(){await this.portal.request(this.itemUrl+"/deleteRating",{method:"post"})}fetchData(e="json",t){return this.portal.request(this.itemUrl+"/data",{responseType:e,...t,query:{token:this.apiKey}})}async fetchRating(e){const t=await this.portal.request(this.itemUrl+"/rating",{query:{token:this.apiKey},...e});return null!=t.rating?(t.created=new Date(t.created),new y(t)):null}fetchRelatedItems(e,t){return this.portal.requestToTypedArray(this.itemUrl+"/relatedItems",{query:{...e,token:this.apiKey},...t},v)}getThumbnailUrl(e){let t=this.thumbnailUrl;return t&&e&&(t+=`&w=${e}`),t}reload(){return this.portal.request(this.itemUrl??"",{cacheBust:!0,query:{token:this.apiKey}}).then((e=>(this.sourceJSON=e,this.read(e),this)))}update(e){return this.id?this.load().then((()=>this.portal.signIn())).then((()=>{const t=e?.data,i={method:"post"};i.query=this.createPostQuery();for(const e in i.query)null===i.query[e]&&(i.query[e]="");return i.query.clearEmptyFields=!0,null!=t&&("string"==typeof t?i.query.text=t:"object"==typeof t&&(i.query.text=JSON.stringify(t))),this.portal.request(`${this.userItemUrl}/update`,i).then((()=>this.reload()))})):Promise.reject(new i("portal:item-does-not-exist","The item does not exist yet and cannot be updated"))}async copy(e){if(!this.id)throw new i("portal:item-does-not-exist","The item does not exist yet");await this.load();const{portal:t,itemUrl:r}=this;await t.signIn();const{copyResources:o,folder:s,tags:a,title:n}=e||{},l={method:"post",query:{copyPrivateResources:"all"===o,folder:"string"==typeof s?s:s?.id,includeResources:!!o,tags:a?.join(","),title:n}},{itemId:p}=await t.request(`${r}/copy`,l);return new v({id:p,portal:t})}updateThumbnail(e){return this.id?this.load().then((()=>this.portal.signIn())).then((()=>{const t=e.thumbnail,i=e.filename,r={method:"post"};if("string"==typeof t)n(t)?r.query={data:t}:r.query={url:l(t)},null!=i&&(r.query.filename=i);else{const e=new FormData;null!=i?e.append("file",t,i):e.append("file",t),r.body=e}return this.portal.request(`${this.userItemUrl}/updateThumbnail`,r).then((()=>this.reload()))})):Promise.reject(new i("portal:item-does-not-exist","The item does not exist yet and cannot be updated"))}async fetchResources(e={},t){const{fetchResources:i}=await import("./support/resourceUtils.js");return i(this,e,t)}async addResource(e,t,i){const{addOrUpdateResources:r}=await import("./support/resourceUtils.js");return e.portalItem=this,await r(this,[{resource:e,content:t,compress:i?.compress,access:i?.access}],"add",i),e}async removeResource(e,t){const{removeResource:r}=await import("./support/resourceUtils.js");if(e.portalItem&&e.portalItem.itemUrl!==this.itemUrl)throw new i("removeresource:portal-item-mismatch","The portal item associated with the provided resource does not match the item");return r(this,e,t)}async removeAllResources(e){const{removeAllResources:t}=await import("./support/resourceUtils.js");return t(this,e)}resourceFromPath(e){return new g({portalItem:this,path:e})}toJSON(){const e=this.extent,t={accessInformation:this.accessInformation,categories:o(this.categories),created:this.created?.getTime(),description:this.description,extent:e&&[[e.xmin,e.ymin],[e.xmax,e.ymax]],id:this.id,isOrgItem:this.isOrgItem,licenseInfo:this.licenseInfo,modified:this.modified?.getTime(),name:this.name,owner:this.owner,ownerFolder:this.ownerFolder,snippet:this.snippet,sourceUrl:this.sourceUrl,spatialReference:this.spatialReference,tags:o(this.tags),thumbnail:this.thumbnail,title:this.title,type:this.type,typeKeywords:o(this.typeKeywords),url:this.url};return s(t)}static fromJSON(e){if(!e)return null;if(e.declaredClass)throw new Error("JSON object is already hydrated");return new v({sourceJSON:e})}_getPostQuery(){const e=this.toJSON();for(const t in e)"tags"===t&&null!==e[t]&&(e[t]=e[t].join(", ")),"typeKeywords"===t&&null!==e[t]&&(e[t]=e[t].join(", ")),"extent"===t&&e[t]&&(e[t]=JSON.stringify(e[t]));return e}};e([p({type:["private","shared","org","public"]})],k.prototype,"access",void 0),e([p()],k.prototype,"accessInformation",void 0),e([p({type:String})],k.prototype,"apiKey",void 0),e([p({json:{read:{source:"appProxies"}}})],k.prototype,"applicationProxies",void 0),e([p()],k.prototype,"avgRating",void 0),e([p()],k.prototype,"categories",void 0),e([p({type:Date})],k.prototype,"created",void 0),e([p()],k.prototype,"culture",void 0),e([p()],k.prototype,"description",void 0),e([p({readOnly:!0})],k.prototype,"displayName",null),e([p({type:m})],k.prototype,"extent",void 0),e([d("extent")],k.prototype,"readExtent",null),e([p()],k.prototype,"groupCategories",void 0),e([p({readOnly:!0})],k.prototype,"iconUrl",null),e([p()],k.prototype,"id",void 0),e([p({readOnly:!0})],k.prototype,"isLayer",null),e([p({type:Boolean,readOnly:!0})],k.prototype,"isOrgItem",void 0),e([p()],k.prototype,"itemControl",void 0),e([p({readOnly:!0})],k.prototype,"itemPageUrl",null),e([p({readOnly:!0})],k.prototype,"itemUrl",null),e([p()],k.prototype,"licenseInfo",void 0),e([p({type:Date})],k.prototype,"modified",void 0),e([p()],k.prototype,"name",void 0),e([p()],k.prototype,"numComments",void 0),e([p()],k.prototype,"numRatings",void 0),e([p()],k.prototype,"numViews",void 0),e([p()],k.prototype,"owner",void 0),e([p()],k.prototype,"ownerFolder",void 0),e([p({type:h})],k.prototype,"portal",void 0),e([p()],k.prototype,"screenshots",void 0),e([p()],k.prototype,"size",void 0),e([p()],k.prototype,"snippet",void 0),e([p()],k.prototype,"sourceJSON",void 0),e([p({type:String})],k.prototype,"sourceUrl",void 0),e([p({type:String})],k.prototype,"spatialReference",void 0),e([p()],k.prototype,"tags",void 0),e([p()],k.prototype,"thumbnail",void 0),e([p({readOnly:!0})],k.prototype,"thumbnailUrl",null),e([p()],k.prototype,"title",void 0),e([p()],k.prototype,"type",void 0),e([p()],k.prototype,"typeKeywords",void 0),e([p({type:String,json:{read(e,t){if(b.has(t.type)){const t=this.portal?.restUrl;e||=t&&this.id?`${t}/content/items/${this.id}/data`:null}return e}}})],k.prototype,"url",void 0),e([p({readOnly:!0})],k.prototype,"userItemUrl",null),k=v=e([u("esri.portal.PortalItem")],k);const S=k;export{S as default};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.30/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import"../../../geometry.js";import e from"../../../core/Error.js";import t from"../Entity.js";import o from"../Relationship.js";import{geometryToWasm as i}from"./queryToWasmEncodedFactories.js";import n from"../../../geometry/Geometry.js";function r(i,n){if(!i.typeName)throw new e("knowledge-graph:no-type-name","You must indicate the entity/relationship named object type to apply edits");if(i instanceof t){const e=new n.EntityValue;e.deleteLater(),e.type_name=i.typeName;for(const[t,o]of Object.entries(i.properties))e.set_key_value(t,a(o,n));return i.id&&e.set_id(i.id),e}if(i instanceof o){const e=new n.RelationshipValue;e.deleteLater(),e.type_name=i.typeName;for(const[t,o]of Object.entries(i.properties))e.set_key_value(t,a(o,n));return i.id&&e.set_id(i.id),i.originId&&i.destinationId&&e.set_related_entity_ids(i.originId,i.destinationId),e}throw new e("knowledge-graph:applyEdits-encoding-failure","Could not determine the type of a named graph object passed to the encoder")}function s(e){return{xy_resolution:e.xyResolution,x_false_origin:e.xFalseOrigin,y_false_origin:e.yFalseOrigin,z_resolution:e.zResolution,z_false_origin:e.zFalseOrigin,m_resolution:e.mResolution,m_false_origin:e.mFalseOrigin}}function a(e,t){return null==e?
|
|
5
|
+
import"../../../geometry.js";import e from"../../../core/Error.js";import t from"../Entity.js";import o from"../Relationship.js";import{geometryToWasm as i}from"./queryToWasmEncodedFactories.js";import n from"../../../geometry/Geometry.js";function r(i,n){if(!i.typeName)throw new e("knowledge-graph:no-type-name","You must indicate the entity/relationship named object type to apply edits");if(i instanceof t){const e=new n.EntityValue;e.deleteLater(),e.type_name=i.typeName;for(const[t,o]of Object.entries(i.properties))e.set_key_value(t,a(o,n));return i.id&&e.set_id(i.id),e}if(i instanceof o){const e=new n.RelationshipValue;e.deleteLater(),e.type_name=i.typeName;for(const[t,o]of Object.entries(i.properties))e.set_key_value(t,a(o,n));return i.id&&e.set_id(i.id),i.originId&&i.destinationId&&e.set_related_entity_ids(i.originId,i.destinationId),e}throw new e("knowledge-graph:applyEdits-encoding-failure","Could not determine the type of a named graph object passed to the encoder")}function s(e){return{xy_resolution:e.xyResolution,x_false_origin:e.xFalseOrigin,y_false_origin:e.yFalseOrigin,z_resolution:e.zResolution,z_false_origin:e.zFalseOrigin,m_resolution:e.mResolution,m_false_origin:e.mFalseOrigin}}function a(e,t){return null==e?null:"object"!=typeof e||e instanceof Date?e:e instanceof n?i(e,t):null}export{s as inputQuantizationParametersToWasmFormat,r as namedObjectToWasm};
|
package/support/revision.js
CHANGED
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.30/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
const
|
|
5
|
+
const b="20240522",d="ab380e56c0b0b9629846ef339ddb0852a0377d69";export{b as buildDate,d as commitHash};
|
package/views/2d/GoToManager.js
CHANGED
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.30/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as t}from"../../chunks/tslib.es6.js";import{prefersReducedMotion as o}from"../../core/a11yUtils.js";import e from"../../core/Accessor.js";import i from"../../core/Error.js";import r from"../../core/Logger.js";import{throwIfAborted as s,whenOrAbort as a}from"../../core/promiseUtils.js";import{whenOnce as n}from"../../core/reactiveUtils.js";import{property as c}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/RandomLCG.js";import{subclass as m}from"../../core/accessorSupport/decorators/subclass.js";import p from"../ViewAnimation.js";import{create as l}from"./viewpointUtils.js";let h=class extends e{constructor(t){super(t),this._gotoTask=null}destroy(){this._gotoTask=null}async goTo(t,e){if(!t)return void r.getLogger(this).error("#goTo()","target cannot be null or undefined");const i=new p;this.view.animation=i,await n((()=>this.view.ready),e);const s={...e,animate
|
|
5
|
+
import{_ as t}from"../../chunks/tslib.es6.js";import{prefersReducedMotion as o}from"../../core/a11yUtils.js";import e from"../../core/Accessor.js";import i from"../../core/Error.js";import r from"../../core/Logger.js";import{throwIfAborted as s,whenOrAbort as a}from"../../core/promiseUtils.js";import{whenOnce as n}from"../../core/reactiveUtils.js";import{property as c}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/RandomLCG.js";import{subclass as m}from"../../core/accessorSupport/decorators/subclass.js";import p from"../ViewAnimation.js";import{create as l}from"./viewpointUtils.js";let h=class extends e{constructor(t){super(t),this._gotoTask=null}destroy(){this._gotoTask=null}async goTo(t,e){if(!t)return void r.getLogger(this).error("#goTo()","target cannot be null or undefined");const i=new p;this.view.animation=i,await n((()=>this.view.ready),e);const s={...e,animate:e?.animate??!o(),animationMode:e?.animationMode??"auto"},{extent:a,spatialReference:c,size:m,viewpoint:h,constraints:g,padding:w,allLayerViews:d}=this.view,u=l(t,{extent:a,spatialReference:c,size:m,viewpoint:h,constraints:g,padding:w,allLayerViews:d,pickClosestTarget:e?.pickClosestTarget??!0});return i?.update(u),this._gotoTask={},s.animate?this._gotoAnimated(u,s):this._gotoImmediate(u,s)}_gotoImmediate(t,o){const e=this._gotoTask,r=this.view.animation,a=t.then((t=>{if(s(o),e!==this._gotoTask)throw new i("view:goto-interrupted","Goto was interrupted");this.view.viewpoint=r.target=t,r.finish()}));return this._cancellableGoTo(e,r,a,o)}_gotoAnimated(t,o){const e=this._gotoTask,r=this.view.animation;if(!r)return Promise.resolve();const a=t.then((t=>{if(s(o),e!==this._gotoTask)throw new i("view:goto-interrupted","Goto was interrupted");return r.update(t),this.view.animationManager.animate(r,this.view.viewpoint,o),r.when().then((()=>{}),(()=>{}))}));return this._cancellableGoTo(e,r,a,o)}_cancellableGoTo(t,o,e,i){const r=()=>t===this._gotoTask;return a(e,i).finally((()=>{r()&&(o.done||o.stop())}))}};t([c({constructOnly:!0})],h.prototype,"view",void 0),h=t([m("esri.views.2d.GoToManager")],h);export{h as GoToManager};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.30/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{memoize as e}from"../../../../../../../core/MapUtils.js";import{pt2px as t}from"../../../../../../../core/screenUtils.js";import{fromRotation as i}from"../../../../../../../core/libs/gl-matrix-2/math/mat2d.js";import{create as s}from"../../../../../../../core/libs/gl-matrix-2/factories/mat2df32.js";import{set as r,sub as o,normalize as n,add as a,scale as l}from"../../../../../../../core/libs/gl-matrix-2/math/vec2.js";import{create as c}from"../../../../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{generalizeOptimizedGeometry as h,convertToGeometry as m}from"../../../../../../../layers/graphics/featureConversionUtils.js";import u from"../../../../../../../layers/graphics/OptimizedGeometry.js";import{getXAnchorDirection as d,getYAnchorDirection as f}from"../../../alignmentUtils.js";import{getDisplayIdTexel as g}from"../../../DisplayId.js";import p from"../../../collisions/BoundingBox.js";import{LabelMetric as _}from"../../../collisions/LabelMetric.js";import{smoothPaths as x,pathDivide as y}from"../../../mesh/templates/segmentUtils.js";import{getMinMaxZoom as v,processColorInput as P}from"../fill/meshWriterUtils.js";import{TextMeshWriter as M,maxLabelZoom as b}from"../text/TextMeshWriter.js";const w=1,L=0,B=128,S=e((e=>{let t=0;if(0===e)return 1/0;for(;!(e%2);)t++,e/=2;return t}));class I extends M{constructor(){super(...arguments),this._zoomLevel=0}_write(e,t,i,s){if(this._zoomLevel=s||0,null!=i)throw new Error("InternalError: EffectGeometry not support for LabelMeshWriter");switch(t.geometryType){case"esriGeometryPoint":{const i=t.readXForDisplay(),s=t.readYForDisplay();return this._writePoint(e,i,s,t)}case"esriGeometryEnvelope":case"esriGeometryPolygon":case"esriGeometryMultipoint":{const i=t.readCentroidForDisplay();if(!i)return;const[s,r]=i.coords;return this._writePoint(e,s,r,t)}case"esriGeometryPolyline":this._writeLines(e,t)}}_writePoint(e,t,i,s){const r=this._getShaping();if(!r)return;let o=this._getPointReferenceBounds();o||(o={offsetX:0,offsetY:0,size:0});const n=r.boundsT,a=d(this.evaluatedMeshParams.horizontalAlignment),l=f(this.evaluatedMeshParams.verticalAlignment),c=this.evaluatedMeshParams.scaleInfo?.maxScale??0,h=this.evaluatedMeshParams.scaleInfo?.minScale??0,m=g(s.getDisplayId());e.metricStart(new _(m,t,i,a,l,c,h,o)),e.metricBoxWrite(n),this._writeGlyphs(e,s.getDisplayId(),t,i,r,0,o),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:s}=this.evaluatedMeshParams,r=this.evaluatedMeshParams.repeatLabelDistance||128,o=this._getShaping("middle");if(!o)return;const n=(e,t,i,s)=>this._placeSubdivGlyphs(e,t,i,s),a=(o.bounds.width+r)/(1<<w);this._current={out:e,id:t.getDisplayId(),shaping:o,zoomRange:v(i,this.getTileInfo()),referenceBounds:this._getPointReferenceBounds()||{offsetX:0,offsetY:0,size:0},offsetDirection:null},this._verticalPlacement="bottom"===s?"above":"top"===s?"below":null,this._verticalPlacement?this._writeAboveAndBelowAlong(t,n,a):this._writeCenterAlong(t,n,a)}_writeAboveAndBelowAlong(e,i,s){const{repeatLabel:r,fontSize:o}=this.evaluatedMeshParams,{shaping:n}=this._current,a=t(o),l=e.readGeometryForDisplay();if(!l)return;const c=new u;h(c,l,!1,!1,"esriGeometryPolyline",1);const d=A(new u,c,a),f=A(new u,c,-a),g=m(f,"esriGeometryPolyline",!1,!1),p=m(d,"esriGeometryPolyline",!1,!1),_=x(p.paths,n.bounds.width),v=x(g.paths,n.bounds.width);this._current.offsetDirection="above";for(const t of _)y(t,s,i,!!r);this._current.offsetDirection="below";for(const t of v)y(t,s,i,!!r)}_writeCenterAlong(e,t,i){const{repeatLabel:s}=this.evaluatedMeshParams,{shaping:r}=this._current,o=x(e.readLegacyGeometryForDisplay().paths,r.bounds.width);for(const n of o)y(n,i,t,!!s)}_placeSubdivGlyphs(e,t,i,s){const{allowOverrun:r,labelPosition:o,repeatLabelDistance:n}=this.evaluatedMeshParams,a=this._current.zoomRange[0],l=S(t),c=this._current.shaping.bounds.width/(1<<w),h=Math.sqrt(n||B)/(1<<w),m=Math.min(i,s-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+w-d),g=this._zoomLevel-f,p=this._current.shaping.bounds.width/2*2**g;this._current.shaping.isMultiline?0===t&&this._placeStraight(e,f):r&&g<0?this._placeStraightAlong(e,a):"parallel"===o?this._placeStraightAlong(e,f):"curved"===o&&this._placeCurved(e,f,p)}_placeStraight(e,t){const{out:i,id:s,shaping:r,referenceBounds:o}=this._current,{x:n,y:a}=e,l=g(s),c=this.evaluatedMeshParams.scaleInfo?.maxScale??0,h=this.evaluatedMeshParams.scaleInfo?.minScale??0;i.metricStart(new _(l,e.x,e.y,0,0,c,h,null)),i.metricBoxWrite(r.boundsT);const m=e.angle*(180/Math.PI)%360,u=(e.angle*(180/Math.PI)+180)%360;this._writeGlyphs(i,s,n,a,r,0,o,{clipAngle:m,mapAligned:!0,isLineLabel:!0,minZoom:t}),this._writeGlyphs(i,s,n,a,r,0,o,{clipAngle:u,mapAligned:!0,isLineLabel:!0,minZoom:t}),i.metricEnd()}_placeCurved(e,t,i){const{out:s,id:r}=this._current,o=e.clone(),n=e.angle*(180/Math.PI)%360,a=(e.angle*(180/Math.PI)+180)%360,l=g(r),c=this.evaluatedMeshParams.scaleInfo?.maxScale??0,h=this.evaluatedMeshParams.scaleInfo?.minScale??0;s.metricStart(new _(l,e.x,e.y,0,0,c,h,null)),this._verticalPlacement&&this._verticalPlacement!==this._current.offsetDirection||(this._placeFirst(o,t,1,n),this._placeBack(e,o,t,i,1,n),this._placeForward(e,o,t,i,1,n)),this._verticalPlacement&&this._verticalPlacement===this._current.offsetDirection||(this._placeFirst(o,t,0,a),this._placeBack(e,o,t,i,0,a),this._placeForward(e,o,t,i,0,a)),s.metricEnd()}_placeStraightAlong(e,t){const{out:r,id:o,shaping:n,zoomRange:a,referenceBounds:l}=this._current,{boxBorderLineColor:c,boxBackgroundColor:h}=this.evaluatedMeshParams,m=e.clone(),u=e.angle*(180/Math.PI)%360,d=(e.angle*(180/Math.PI)+180)%360;if(n.glyphs.length>0&&(c||h)){const c=Math.max(t,a[0],0),h=Math.min(b,a[1]),m=i(s(),-e.angle),[f,g]=n.shapeBackground(m),p={minZoom:c,maxZoom:h,clipAngle:u,mapAligned:!0,isLineLabel:!0};this._verticalPlacement&&this._verticalPlacement!==this._current.offsetDirection||(r.recordStart(this.instanceId,this.attributeLayout,n.glyphs[0].textureBinding),this._writeTextBox(r,o,e.x,e.y,g,l,p),r.recordEnd()),this._verticalPlacement&&this._verticalPlacement===this._current.offsetDirection||(p.clipAngle=d,r.recordStart(this.instanceId,this.attributeLayout,n.glyphs[0].textureBinding),this._writeTextBox(r,o,e.x,e.y,g,l,p),r.recordEnd())}const f=g(o),p=this.evaluatedMeshParams.scaleInfo?.maxScale??0,x=this.evaluatedMeshParams.scaleInfo?.minScale??0;r.metricStart(new _(f,e.x,e.y,0,0,p,x,null)),this._verticalPlacement&&this._verticalPlacement!==this._current.offsetDirection||this._placeFirst(m,t,1,u,!0),this._verticalPlacement&&this._verticalPlacement===this._current.offsetDirection||this._placeFirst(m,t,0,d,!0),r.metricEnd()}_placeBack(e,t,i,s,r,o){const n=e.clone();let a=e.backwardLength+L;for(;n.prev()&&!(a>=s);)this._placeOnSegment(n,t,a,i,-1,r,o),a+=n.length+L}_placeForward(e,t,i,s,r,o){const n=e.clone();let a=e.remainingLength+L;for(;n.next()&&!(a>=s);)this._placeOnSegment(n,t,a,i,1,r,o),a+=n.length+L}_placeFirst(e,t,i,s,r=!1){const o=e,{out:n,id:a,shaping:l,zoomRange:c,referenceBounds:h}=this._current,m=l.glyphs;for(const u of m){const m=u.x>l.bounds.x?i:1-i,d=m*e.remainingLength+(1-m)*e.backwardLength,f=Math.abs(u.x+u.width/2-l.bounds.x),g=Math.max(0,this._zoomLevel+Math.log2(f/(d+L))),p=Math.max(t,r?0:g);u.maxZoom=Math.min(c[1],b),u.angle=e.angle+(1-i)*Math.PI,u.minZoom=Math.max(c[0],p),this._writeLineGlyph(n,a,o.x,o.y,l.bounds,u,s,h,!0),i&&this._isVisible(u.minZoom,u.maxZoom)&&n.metricBoxWrite(u.bounds)}}_placeOnSegment(e,t,i,s,r,o,n){const{out:a,id:l,shaping:c,referenceBounds:h}=this._current,m=c.glyphs,u=e.dx/e.length,d=e.dy/e.length,f={x:e.x+i*-r*u,y:e.y+i*-r*d};for(const g of m){const m=g.x>c.bounds.x?o:1-o;if(!(m&&1===r||!m&&-1===r))continue;const u=Math.abs(g.x+g.width/2-c.bounds.x),d=Math.max(0,this._zoomLevel+Math.log2(u/i)-.1),_=Math.max(s,this._zoomLevel+Math.log2(u/(i+e.length+L)));if(0!==d&&(g.angle=e.angle+(1-o)*Math.PI,g.minZoom=_,g.maxZoom=d,this._writeLineGlyph(a,l,f.x,f.y,c.bounds,g,n,h,!0),o&&this._isVisible(g.minZoom,g.maxZoom))){const i=g.bounds,s=e.x-t.x,r=e.y-t.y,o=new p(i.center[0]+s,i.center[1]+r,i.width,i.height);a.metricBoxWrite(o)}}}_writeLineGlyph(e,t,i,s,r,o,n,a,l){const c=i+r.x,h=s+r.y,m=2*(this.evaluatedMeshParams.minPixelBuffer?this.evaluatedMeshParams.minPixelBuffer/this._textMeshTransformProps.fontSize:1),u=Math.max(r.width,r.height)*m;e.recordStart(this.instanceId,this.attributeLayout,o.textureBinding),e.recordBounds(c,h,u,u);const{texcoords:d,offsets:f}=o,g=this._textMeshTransformProps.fontSize;this._writeQuad(e,t,i,s,{texcoords:d,offsets:f,fontSize:g,color:P(this.evaluatedMeshParams.color),isBackground:!1,referenceBounds:a,minZoom:Math.max(this._current.zoomRange[0],o.minZoom),maxZoom:Math.min(this._current.zoomRange[1],o.maxZoom),clipAngle:n,mapAligned:l,isLineLabel:!0}),e.recordEnd()}_isVisible(e,t){const i=this._zoomLevel;return e<=i&&i<=t}}function A(e,t,i){const{coords:s,lengths:h}=t,m=c(),u=c(),d=c(),f=c(),g=c(),p=c(),_=2;let x=0;for(let c=0;c<h.length;c++){const t=h[c];for(let c=0;c<t;c++){const h=_*(c+x-1),y=_*(c+x),v=_*(c+x+1);c>0?r(m,s[h],s[h+1]):r(m,0,0),r(u,s[y],s[y+1]),c<t-1?r(d,s[v],s[v+1]):r(d,0,0),0===c?r(f,0,0):(o(f,u,m),n(f,f),r(f,f[1],-f[0])),c===t-1?r(g,0,0):(o(g,d,u),n(g,g),r(g,g[1],-g[0])),a(p,f,g),n(p,p);const P=p[0]*g[0]+p[1]*g[1];0!==P&&l(p,p,P),l(p,p,i),e.coords.push(u[0]+p[0],u[1]+p[1])}e.lengths.push(t),x+=t}return e}export{I as LabelMeshWriter};
|
|
5
|
+
import{memoize as e}from"../../../../../../../core/MapUtils.js";import{pt2px as t}from"../../../../../../../core/screenUtils.js";import{fromRotation as i,translate as s}from"../../../../../../../core/libs/gl-matrix-2/math/mat2d.js";import{create as r}from"../../../../../../../core/libs/gl-matrix-2/factories/mat2df32.js";import{set as o,sub as n,normalize as a,add as l,scale as h}from"../../../../../../../core/libs/gl-matrix-2/math/vec2.js";import{fromValues as c}from"../../../../../../../core/libs/gl-matrix-2/factories/vec2f32.js";import{create as m}from"../../../../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{generalizeOptimizedGeometry as d,convertToGeometry as u}from"../../../../../../../layers/graphics/featureConversionUtils.js";import f from"../../../../../../../layers/graphics/OptimizedGeometry.js";import{getXAnchorDirection as g,getYAnchorDirection as p}from"../../../alignmentUtils.js";import{getDisplayIdTexel as _}from"../../../DisplayId.js";import x from"../../../collisions/BoundingBox.js";import{LabelMetric as y}from"../../../collisions/LabelMetric.js";import{smoothPaths as v,pathDivide as M}from"../../../mesh/templates/segmentUtils.js";import{getMinMaxZoom as P,processColorInput as b}from"../fill/meshWriterUtils.js";import{TextMeshWriter as w,maxLabelZoom as B}from"../text/TextMeshWriter.js";const L=1,S=0,I=128,A=e((e=>{let t=0;if(0===e)return 1/0;for(;!(e%2);)t++,e/=2;return t}));class z extends w{constructor(){super(...arguments),this._zoomLevel=0}_write(e,t,i,s){if(this._zoomLevel=s||0,null!=i)throw new Error("InternalError: EffectGeometry not support for LabelMeshWriter");switch(t.geometryType){case"esriGeometryPoint":{const i=t.readXForDisplay(),s=t.readYForDisplay();return this._writePoint(e,i,s,t)}case"esriGeometryEnvelope":case"esriGeometryPolygon":case"esriGeometryMultipoint":{const i=t.readCentroidForDisplay();if(!i)return;const[s,r]=i.coords;return this._writePoint(e,s,r,t)}case"esriGeometryPolyline":this._writeLines(e,t)}}_writePoint(e,t,i,s){const r=this._getShaping();if(!r)return;let o=this._getPointReferenceBounds();o||(o={offsetX:0,offsetY:0,size:0});const n=r.boundsT,a=g(this.evaluatedMeshParams.horizontalAlignment),l=p(this.evaluatedMeshParams.verticalAlignment),h=this.evaluatedMeshParams.scaleInfo?.maxScale??0,c=this.evaluatedMeshParams.scaleInfo?.minScale??0,m=_(s.getDisplayId());e.metricStart(new y(m,t,i,a,l,h,c,o)),e.metricBoxWrite(n),this._writeGlyphs(e,s.getDisplayId(),t,i,r,0,o),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:s}=this.evaluatedMeshParams,r=this.evaluatedMeshParams.repeatLabelDistance||128,o=this._getShaping("middle");if(!o)return;const n=(e,t,i,s)=>this._placeSubdivGlyphs(e,t,i,s),a=(o.bounds.width+r)/(1<<L);this._current={out:e,id:t.getDisplayId(),shaping:o,zoomRange:P(i,this.getTileInfo()),referenceBounds:this._getPointReferenceBounds()||{offsetX:0,offsetY:0,size:0},offsetDirection:null},this._verticalPlacement="bottom"===s?"above":"top"===s?"below":null,this._verticalPlacement?this._writeAboveAndBelowAlong(t,n,a):this._writeCenterAlong(t,n,a)}_writeAboveAndBelowAlong(e,i,s){const{repeatLabel:r,fontSize:o}=this.evaluatedMeshParams,{shaping:n}=this._current,a=t(o),l=e.readGeometryForDisplay();if(!l)return;const h=new f;d(h,l,!1,!1,"esriGeometryPolyline",1);const c=D(new f,h,a),m=D(new f,h,-a),g=u(m,"esriGeometryPolyline",!1,!1),p=u(c,"esriGeometryPolyline",!1,!1),_=v(p.paths,n.bounds.width),x=v(g.paths,n.bounds.width);this._current.offsetDirection="above";for(const t of _)M(t,s,i,!!r);this._current.offsetDirection="below";for(const t of x)M(t,s,i,!!r)}_writeCenterAlong(e,t,i){const{repeatLabel:s}=this.evaluatedMeshParams,{shaping:r}=this._current,o=v(e.readLegacyGeometryForDisplay().paths,r.bounds.width);for(const n of o)M(n,i,t,!!s)}_placeSubdivGlyphs(e,t,i,s){const{allowOverrun:r,labelPosition:o,repeatLabelDistance:n}=this.evaluatedMeshParams,a=this._current.zoomRange[0],l=A(t),h=this._current.shaping.bounds.width/(1<<L),c=Math.sqrt(n||I)/(1<<L),m=Math.min(i,s-i),d=this._current.shaping.isMultiline?B:Math.log2(m/(c+h/2)),u=0===t?d:Math.min(l,d),f=Math.max(a,this._zoomLevel+L-u),g=this._zoomLevel-f,p=this._current.shaping.bounds.width/2*2**g;this._current.shaping.isMultiline?0===t&&this._placeStraight(e,f):r&&g<0?this._placeStraightAlong(e,a):"parallel"===o?this._placeStraightAlong(e,f):"curved"===o&&this._placeCurved(e,f,p)}_placeStraight(e,t){const{out:i,id:s,shaping:r,referenceBounds:o}=this._current,{x:n,y:a}=e,l=_(s),h=this.evaluatedMeshParams.scaleInfo?.maxScale??0,c=this.evaluatedMeshParams.scaleInfo?.minScale??0;i.metricStart(new y(l,e.x,e.y,0,0,h,c,null)),i.metricBoxWrite(r.boundsT);const m=e.angle*(180/Math.PI)%360,d=(e.angle*(180/Math.PI)+180)%360;this._writeGlyphs(i,s,n,a,r,0,o,{clipAngle:m,mapAligned:!0,isLineLabel:!0,minZoom:t}),this._writeGlyphs(i,s,n,a,r,0,o,{clipAngle:d,mapAligned:!0,isLineLabel:!0,minZoom:t}),i.metricEnd()}_placeCurved(e,t,i){const{out:s,id:r}=this._current,o=e.clone(),n=e.angle*(180/Math.PI)%360,a=(e.angle*(180/Math.PI)+180)%360,l=_(r),h=this.evaluatedMeshParams.scaleInfo?.maxScale??0,c=this.evaluatedMeshParams.scaleInfo?.minScale??0;s.metricStart(new y(l,e.x,e.y,0,0,h,c,null)),this._verticalPlacement&&this._verticalPlacement!==this._current.offsetDirection||(this._placeFirst(o,t,1,n),this._placeBack(e,o,t,i,1,n),this._placeForward(e,o,t,i,1,n)),this._verticalPlacement&&this._verticalPlacement===this._current.offsetDirection||(this._placeFirst(o,t,0,a),this._placeBack(e,o,t,i,0,a),this._placeForward(e,o,t,i,0,a)),s.metricEnd()}_placeStraightAlong(e,o){const{out:n,id:a,shaping:l,zoomRange:h,referenceBounds:m}=this._current,{boxBorderLineColor:d,boxBackgroundColor:u}=this.evaluatedMeshParams,f=e.clone(),g=e.angle*(180/Math.PI)%360,p=(e.angle*(180/Math.PI)+180)%360;if(l.glyphs.length>0&&!(!d&&!u)){const d=Math.max(o,h[0],0),u=Math.min(B,h[1]),f=i(r(),-e.angle),_={minZoom:d,maxZoom:u,clipAngle:g,mapAligned:!0,isLineLabel:!0},x=t(this.evaluatedMeshParams.offsetX),y=t(this.evaluatedMeshParams.offsetY);if(!this._verticalPlacement||this._verticalPlacement===this._current.offsetDirection){const t=c(x,-1*y),[i,o]=l.shapeBackground(s(r(),f,t));n.recordStart(this.instanceId,this.attributeLayout,l.glyphs[0].textureBinding);const h=2*Math.max(i.width,i.height);n.recordBounds(e.x+i.x,e.y+i.y,h,h),this._writeTextBox(n,a,e.x,e.y,o,m,_),n.recordEnd()}if(!this._verticalPlacement||this._verticalPlacement!==this._current.offsetDirection){const t=c(x,y),[i,o]=l.shapeBackground(s(r(),f,t));_.clipAngle=p,n.recordStart(this.instanceId,this.attributeLayout,l.glyphs[0].textureBinding);const h=2*Math.max(i.width,i.height);n.recordBounds(e.x+i.x,e.y+i.y,h,h),this._writeTextBox(n,a,e.x,e.y,o,m,_),n.recordEnd()}}const x=_(a),v=this.evaluatedMeshParams.scaleInfo?.maxScale??0,M=this.evaluatedMeshParams.scaleInfo?.minScale??0;n.metricStart(new y(x,e.x,e.y,0,0,v,M,null)),this._verticalPlacement&&this._verticalPlacement!==this._current.offsetDirection||this._placeFirst(f,o,1,g,!0),this._verticalPlacement&&this._verticalPlacement===this._current.offsetDirection||this._placeFirst(f,o,0,p,!0),n.metricEnd()}_placeBack(e,t,i,s,r,o){const n=e.clone();let a=e.backwardLength+S;for(;n.prev()&&!(a>=s);)this._placeOnSegment(n,t,a,i,-1,r,o),a+=n.length+S}_placeForward(e,t,i,s,r,o){const n=e.clone();let a=e.remainingLength+S;for(;n.next()&&!(a>=s);)this._placeOnSegment(n,t,a,i,1,r,o),a+=n.length+S}_placeFirst(e,t,i,s,r=!1){const{out:o,id:n,shaping:a,zoomRange:l,referenceBounds:h}=this._current,c=a.glyphs;for(const m of c){const c=m.x>a.bounds.x?i:1-i,d=c*e.remainingLength+(1-c)*e.backwardLength,u=Math.abs(m.x+m.width/2-a.bounds.x),f=Math.max(0,this._zoomLevel+Math.log2(u/(d+S))),g=Math.max(t,r?0:f);m.maxZoom=Math.min(l[1],B),m.angle=e.angle+(1-i)*Math.PI,m.minZoom=Math.max(l[0],g),this._writeLineGlyph(o,n,e.x,e.y,a.bounds,m,s,h,!0),i&&this._isVisible(m.minZoom,m.maxZoom)&&o.metricBoxWrite(m.bounds)}}_placeOnSegment(e,t,i,s,r,o,n){const{out:a,id:l,shaping:h,referenceBounds:c}=this._current,m=h.glyphs,d=e.dx/e.length,u=e.dy/e.length,f={x:e.x+i*-r*d,y:e.y+i*-r*u};for(const g of m){const m=g.x>h.bounds.x?o:1-o;if(!(m&&1===r||!m&&-1===r))continue;const d=Math.abs(g.x+g.width/2-h.bounds.x),u=Math.max(0,this._zoomLevel+Math.log2(d/i)-.1),p=Math.max(s,this._zoomLevel+Math.log2(d/(i+e.length+S)));if(0!==u&&(g.angle=e.angle+(1-o)*Math.PI,g.minZoom=p,g.maxZoom=u,this._writeLineGlyph(a,l,f.x,f.y,h.bounds,g,n,c,!0),o&&this._isVisible(g.minZoom,g.maxZoom))){const i=g.bounds,s=e.x-t.x,r=e.y-t.y,o=new x(i.center[0]+s,i.center[1]+r,i.width,i.height);a.metricBoxWrite(o)}}}_writeLineGlyph(e,t,i,s,r,o,n,a,l){const h=i+r.x,c=s+r.y,m=2*(this.evaluatedMeshParams.minPixelBuffer?this.evaluatedMeshParams.minPixelBuffer/this._textMeshTransformProps.fontSize:1),d=Math.max(r.width,r.height)*m;e.recordStart(this.instanceId,this.attributeLayout,o.textureBinding),e.recordBounds(h,c,d,d);const{texcoords:u,offsets:f}=o,g=this._textMeshTransformProps.fontSize;this._writeQuad(e,t,i,s,{texcoords:u,offsets:f,fontSize:g,color:b(this.evaluatedMeshParams.color),isBackground:!1,referenceBounds:a,minZoom:Math.max(this._current.zoomRange[0],o.minZoom),maxZoom:Math.min(this._current.zoomRange[1],o.maxZoom),clipAngle:n,mapAligned:l,isLineLabel:!0}),e.recordEnd()}_isVisible(e,t){const i=this._zoomLevel;return e<=i&&i<=t}}function D(e,t,i){const{coords:s,lengths:r}=t,c=m(),d=m(),u=m(),f=m(),g=m(),p=m(),_=2;let x=0;for(let m=0;m<r.length;m++){const t=r[m];for(let r=0;r<t;r++){const m=_*(r+x-1),y=_*(r+x),v=_*(r+x+1);r>0?o(c,s[m],s[m+1]):o(c,0,0),o(d,s[y],s[y+1]),r<t-1?o(u,s[v],s[v+1]):o(u,0,0),0===r?o(f,0,0):(n(f,d,c),a(f,f),o(f,f[1],-f[0])),r===t-1?o(g,0,0):(n(g,u,d),a(g,g),o(g,g[1],-g[0])),l(p,f,g),a(p,p);const M=p[0]*g[0]+p[1]*g[1];0!==M&&h(p,p,M),h(p,p,i),e.coords.push(d[0]+p[0],d[1]+p[1])}e.lengths.push(t),x+=t}return e}export{z as LabelMeshWriter};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.30/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as t}from"../../../../chunks/tslib.es6.js";import e from"../../../../core/Evented.js";import{destroyMaybe as i}from"../../../../core/maybe.js";import{initial as r}from"../../../../core/reactiveUtils.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{UpdatingHandles as a}from"../../../../core/support/UpdatingHandles.js";import{MeshTransformUpdateAction as p}from"../../../../layers/graphics/sources/interfaces.js";import{getGraphicEffectiveElevationInfo as n}from"../../../../support/elevationInfoUtils.js";import{getGraphicAttachmentOrigin as c}from"../manipulatorUtils.js";import{
|
|
5
|
+
import{_ as t}from"../../../../chunks/tslib.es6.js";import e from"../../../../core/Evented.js";import{destroyMaybe as i}from"../../../../core/maybe.js";import{initial as r}from"../../../../core/reactiveUtils.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{UpdatingHandles as a}from"../../../../core/support/UpdatingHandles.js";import{MeshTransformUpdateAction as p}from"../../../../layers/graphics/sources/interfaces.js";import{getGraphicEffectiveElevationInfo as n}from"../../../../support/elevationInfoUtils.js";import{getGraphicAttachmentOrigin as c}from"../manipulatorUtils.js";import{createGraphicGeometryUndoRecord as h}from"./undoRecords.js";import{GraphicState as d}from"../../layers/graphics/GraphicState.js";import{GraphicManipulator as m}from"../../../interactive/GraphicManipulator.js";import{EditGeometryOperations as g}from"../../../interactive/editGeometry/EditGeometryOperations.js";const l=Symbol();let u=class extends e.EventedAccessor{get operations(){return this._operations}get updating(){return this._updatingHandles.updating}get elevationInfo(){return n(this.graphic)}get visible(){return this._graphicState.displaying}get isDraped(){return this._graphicState.isDraped}get origin(){return c(this.view,this.graphic)}constructor(t){super(t),this._updatingHandles=new a}destroy(){this._operations=i(this._operations),this._updatingHandles.destroy()}initialize(){this._graphicState=new d({graphic:this.graphic}),this._graphicState.on("changed",(()=>this.emit("committed"))),this.addHandles(this.view.trackGraphicState(this._graphicState)),this.addHandles(this._updatingHandles.add((()=>this.graphic.geometry),(t=>{const e=this._operations?.data.geometry;if(t!==e){if(!t||"multipoint"===t?.type||"extent"===t?.type)return i(this._operations),this.removeHandles(l),void(this._operations=null);if(this._operations?.trySetGeometry(t))this.emit("modified-externally");else{i(this._operations),this.removeHandles(l);const e=g.fromGeometry(t,this.view.state.viewingMode);this._operations=e,this.addHandles(e.data.on("change",(()=>this.graphic.geometry=e.data.geometry)),l)}}}),r))}createManipulator(t){return new m({view:this.view,graphic:this.graphic,...t})}maskOccludee(){return this.view.maskOccludee(this.graphic)}endInteraction(){const t=this.graphic.geometry;"mesh"===t?.type&&this.graphic.notifyMeshTransformChanged({action:p.UpdateFastLocalOrigin})}toMap(t){return this.view.toMap(t,{include:[this.graphic]})}createUndoRecord(){const{graphic:{geometry:t}}=this;return h(t)}};t([o({constructOnly:!0})],u.prototype,"view",void 0),t([o({constructOnly:!0})],u.prototype,"graphic",void 0),t([o()],u.prototype,"_operations",void 0),t([o()],u.prototype,"operations",null),t([o()],u.prototype,"updating",null),u=t([s("esri.views.3d.interactive.editingTools.ManipulatedObject3DGraphic")],u);export{u as ManipulatedObject3DGraphic};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.30/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as t}from"../../../../../chunks/tslib.es6.js";import o from"../../../../../core/Collection.js";import e from"../../../../../core/Evented.js";import{makeHandle as i}from"../../../../../core/handleUtils.js";import{destroyMaybe as n}from"../../../../../core/maybe.js";import{zeroMeters as s,scale as a}from"../../../../../core/quantityUtils.js";import{watch as l,syncAndInitial as r}from"../../../../../core/reactiveUtils.js";import{property as p}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/has.js";import"../../../../../core/Logger.js";import"../../../../../core/RandomLCG.js";import{subclass as c}from"../../../../../core/accessorSupport/decorators/subclass.js";import{UpdatingHandles as h}from"../../../../../core/support/UpdatingHandles.js";import{makeDehydratedPoint as m}from"../../../../../layers/graphics/dehydratedPoint.js";import{getConvertedElevation as u}from"../../../../../support/elevationInfoUtils.js";import{SnappingVisualizer3D as d}from"../../SnappingVisualizer3D.js";import{orientation as f}from"../geometryUtils.js";import{SupportedObjectResult as v}from"../isSupportedObjectUtils.js";import{manipulatedObjectGeometry as g}from"../manipulatedObjectUtils.js";import{canMoveZOperations as _}from"../manipulatorUtils.js";import{meshTransformFastUpdateHandles as j}from"../meshFastUpdateUtils.js";import{connectTooltipToManipulatedObject as M}from"../tooltipUtils3D.js";import{createVisualElements as b}from"../visualElementUtils.js";import{discRadius as y}from"../manipulations/config.js";import{ManipulationType as T,MoveManipulation as w}from"../manipulations/MoveManipulation.js";import{axisConstrainedDragSign as I}from"../manipulations/moveUtils.js";import{MoveXYObjectManipulation as S}from"../manipulations/MoveXYObjectManipulation.js";import{isSupportedObject as O}from"./isSupportedObject.js";import{OutlineVisualElement as x}from"../../visualElements/OutlineVisualElement.js";import{dragManipulatedObjectMany as E,resetManipulatedObjectMany as P}from"../../../../interactive/dragEventPipeline.js";import{InteractiveToolBase as k}from"../../../../interactive/InteractiveToolBase.js";import{EditGeometryOperations as H}from"../../../../interactive/editGeometry/EditGeometryOperations.js";import U from"../../../../interactive/sketch/SketchOptions.js";import{SnappingContext as X}from"../../../../interactive/snapping/SnappingContext.js";import{createSnapDragEventPipelineStep as Y}from"../../../../interactive/snapping/SnappingDragPipelineStep.js";import{Tooltip as z}from"../../../../interactive/tooltip/Tooltip.js";import{enterInputModeIfAvailable as A}from"../../../../interactive/tooltip/tooltipCommonUtils.js";import{MovePointTooltipInfo as D}from"../../../../interactive/tooltip/infos/MovePointTooltipInfo.js";import{TranslateTooltipInfo as R}from"../../../../interactive/tooltip/infos/TranslateTooltipInfo.js";import{TranslateXYTooltipInfo as Z}from"../../../../interactive/tooltip/infos/TranslateXYTooltipInfo.js";import{TranslateZTooltipInfo as C}from"../../../../interactive/tooltip/infos/TranslateZTooltipInfo.js";import{autoDistanceBetweenPoints2D as F}from"../../../../support/automaticLengthMeasurementUtils.js";import{verticalSignedDistanceBetweenPoints as G}from"../../../../support/euclideanLengthMeasurementUtils.js";class V{constructor(t){this.objects=t,this.type="move-start"}}class L{constructor(t,o,e){this.dx=t,this.dy=o,this.objects=e,this.type="move"}}class N{constructor(t){this.objects=t,this.type="move-stop"}}const q=Symbol("manipulators"),B=Symbol("tooltips");let J=class extends k{constructor(t){super(t),this._infos=new Map,this.events=new e,this.objects=new o,this.enableZ=!0,this.sketchOptions=new U,this.type="move-3d",this._latestTooltipInfo=null,this._translateTooltipInfo=null,this._translateXYTooltipInfo=null,this._translateZTooltipInfo=null,this._updatingHandles=new h,this._moveManipulation=null}initialize(){const{view:t}=this;this.tooltip=new z({view:t}),this.addHandles([this.objects.on("change",(t=>{t.removed.forEach((t=>this.removeHandles(t))),this._updateObjectInfos(t),this._setupFastTransformUpdates(t.added),this._refreshManipulators()})),this.objects.on("after-changes",(()=>this._connectTooltips()))]);const o=this.objects.toArray();this._updateObjectInfos({added:o,removed:[]}),this._setupFastTransformUpdates(o),this._refreshManipulators(),this._connectTooltips(),this.finishToolCreation()}destroy(){this.tooltip=n(this.tooltip),this._moveManipulation=n(this._moveManipulation),this._set("view",null),this._updatingHandles.destroy()}onInputEvent(t){if(!this.destroyed&&!A(t,this.tooltip))return super.onInputEvent(t)}get updating(){return this._updatingHandles.updating}get _shouldShowMovePointTooltip(){const{objects:t}=this;if(1!==t.length)return!1;const o=g(t.at(0))?.type;return"point"===o||"mesh"===o}get activeTooltipInfo(){return this._shouldShowMovePointTooltip?this._movePointTooltipInfo:this._latestTooltipInfo}reset(){}_updateObjectInfos({added:t,removed:o}){for(const e of t){if(O(e)!==v.SUPPORTED)continue;const t=new K(e);this._infos.set(e,t)}for(const e of o)this._infos.delete(e)}_setupFastTransformUpdates(t){for(const o of t){const t=this._infos.get(o);this.addHandles(j(t.object),o)}}_refreshManipulators(){if(this.removeHandles(q),this._moveManipulation=n(this._moveManipulation),this.manipulators.removeAll(),0===this._infos.size)return;const t=Array.from(this._infos.values());this._createManipulators(t),this._createVisualElements(t),this._updateMoveManipulation(t)}_createManipulators(t){for(const o of t){const e=o.object;o.manipulationXY=new S({tool:this,view:this.view,object:e}),o.manipulationXY.forEachManipulator((t=>{this.addHandles([t.events.on("immediate-click",(t=>{this.events.emit("immediate-click",{...t,object:e}),t.stopPropagation()})),t.events.on("grab-changed",(({action:t})=>{"start"===t?this._showTooltip(T.XY):this._hideTooltip()}))],q)})),this.addHandles(o.manipulationXY.createDragPipeline(((o,e,i,n)=>this._buildDragEventPipeline(t,T.XY,o,e,i,n))),q)}this._createMoveManipulation(t)}_createMoveManipulation(t){const o=new w({tool:this,view:this.view,snapToScene:!1,xyAvailable:!0,xyAxisAvailable:!0,zAvailable:!0,radius:1===t.length?w.radiusForSymbol(t[0].object.graphic?.symbol):y});this._moveManipulation=o,o.elevationInfo={mode:"absolute-height",offset:0},o.forEachManipulator((t=>{this.addHandles(t.events.on("immediate-click",(e=>{const i=this.objects.at(0);!o.zManipulation.hasManipulator(t)&&1===this.objects.length&&i&&this.events.emit("immediate-click",{...e,object:i}),e.stopPropagation()})),q)}));const e=t=>o=>{this.addHandles([o.events.on("focus-changed",(({action:o})=>{"focus"===o?this._showTooltip(t):this._hideTooltip()})),o.events.on("grab-changed",(()=>{this._latestTooltipInfo&&(this._latestTooltipInfo.distance=s)}))],q)};this._moveManipulation.xyManipulation.forEachManipulator(e(T.XY)),this._moveManipulation.xyAxisManipulation.forEachManipulator(e(T.XY_AXIS)),this._moveManipulation.zManipulation.forEachManipulator(e(T.Z));const i=()=>this._updateMoveManipulation(t);for(const s of t)this.addHandles([s.object.on("committed",i),l((()=>s.object.visible),i)],q);const n=t[t.length-1];this.addHandles(n.object.on("committed",(()=>this._updateMoveManipulationAngle(n))),q);const{object:a}=n,{operations:r}=a;if(r){const e=a.graphic;this.addHandles(o.createDragPipeline(((o,e,i,n,s)=>this._buildDragEventPipeline(t,o,e,i,n,s)),a.elevationInfo,r.data.spatialReference,e),q)}this._updateMoveManipulationAngle(n)}_createVisualElements(t){for(const o of t){const e=o.object,n=b({view:this.view,object:e,forEachManipulator:t=>{o.manipulationXY?.forEachManipulator(t),this._moveManipulation?.forEachManipulator(t)},onManipulatorsChanged:()=>i()});null!=n&&(o.geometryRepresentation=n.visualElement,o.geometryRepresentation instanceof x&&this.addHandles([o.geometryRepresentation.events.on("attachment-origin-changed",(()=>{o.object.isDraped||this._updateMoveManipulation(t)})),l((()=>o.object.isDraped),(()=>this._updateMoveManipulation(t)))],q),this.addHandles(n,q))}}_updateMoveManipulationAngle(t){this._moveManipulation&&(this._moveManipulation.angle=f(g(t.object)))}_updateMoveManipulation(t){const o=m(0,0,0,this.view.spatialReference);let e=0,i=!1;const n=this._moveManipulation;if(n){for(const n of t){if(!n.object.visible)continue;this.enableZ&&_(n.object.operations,n.object.elevationInfo)&&(i=!0);const t=n.geometryRepresentation instanceof x&&!n.object.isDraped?n.geometryRepresentation.attachmentOrigin:n.object.origin;if(null!=t){const{x:i,y:n,z:s}=t;o.x+=i,o.y+=n,s&&(o.z??=0,o.z+=s),e++}}e>0?(o.x/=e,o.y/=e,o.z??=0,o.z/=e,n.location=o,n.xyManipulation.available=!0,n.xyAxisManipulation.available=!0,n.zManipulation.available=i):n.available=!1}}_buildDragEventPipeline(t,o,e,i,n,s){const a=[],l=[];let r=null,p=null;const c=()=>{for(const t of a)t.dragging=!1;a.length=0,l.length=0,r=null,p=null,this._moveManipulation&&(this._moveManipulation.interactive=!0)};if(1===t.length&&o===T.XY){const o=t[0].object;({steps:i,cancel:n}=this._buildSnappingPipelineSteps(o,o.elevationInfo,i,n,s))}return n=n.next((t=>p?.(t))).next((()=>(l.length&&this.events.emit("move-stop",new N(l)),this.destroyed||c(),null))),{steps:i=i.next((o=>{if("start"===o.action){a.length=0,l.length=0;for(const o of t)o.dragging||!o.manipulationXY?.hasManipulator(e)&&o.manipulationXY?.grabbing||(a.push(o),l.push(o.object),o.dragging=!0);if(0!==l.length&&(this._moveManipulation&&(this._moveManipulation.interactive=!1),r=E(l),p=P(l),this.events.emit("move-start",new V(l)),this.destroyed))return null}return 0!==l.length?o:null})).next((t=>r?.(t))).next((t=>(this._updateMoveTooltip(o,t),t))).next((t=>{switch(t.action){case"start":case"update":if(t.translationX||t.translationY||t.translationZ){const o=this.view.toScreen(t.mapStart),e=this.view.toScreen(t.mapEnd),i=e.x-o.x,n=e.y-o.y;if(this.events.emit("move",new L(i,n,l)),this.destroyed)return null}break;case"end":if(this.events.emit("move-stop",new N(l)),this.destroyed)return null;c()}return null})),cancel:n}}_connectTooltips(){let t;if(this.removeHandles(B),this._shouldShowMovePointTooltip){const o=this.objects.at(0),{events:e}=this;this._movePointTooltipInfo??=new D({viewType:this.view.type,sketchOptions:this.sketchOptions});const i={onMoveStart:()=>{e.emit("record-undo",{objects:[o]}),e.emit("move-start",new V([o]))},onMove:()=>e.emit("move",new L(0,0,[o])),onMoveStop:()=>e.emit("move-stop",new N([o]))};t=M(this.tooltip,o,(()=>({sketchOptions:this.sketchOptions,activeTooltipInfo:this._movePointTooltipInfo,callbacks:i})))}else t=l((()=>this.sketchOptions.tooltips.effectiveEnabled?this._latestTooltipInfo:null),(t=>{this.tooltip.info=t}),r);this.addHandles(t,B)}_showTooltip(t){this._shouldShowMovePointTooltip||this._updateMoveTooltip(t)}_hideTooltip(){this._shouldShowMovePointTooltip||(this.tooltip?.clear(),this._latestTooltipInfo=null)}_updateMoveTooltip(t,o){if(this._shouldShowMovePointTooltip)return;const{sketchOptions:e}=this;switch(t){case T.XY:this._latestTooltipInfo=this._translateTooltipInfo??=new R({sketchOptions:e}),Q(this._latestTooltipInfo,o,((t,o)=>F(t,o)));break;case T.XY_AXIS:this._latestTooltipInfo=this._translateXYTooltipInfo??=new Z({sketchOptions:e}),Q(this._latestTooltipInfo,o,((t,e)=>a(F(t,e),I(o))));break;case T.Z:this._latestTooltipInfo=this._translateZTooltipInfo??=new C({sketchOptions:e}),Q(this._latestTooltipInfo,o,G)}this._latestTooltipInfo.sketchOptions=e}_buildSnappingPipelineSteps(t,o,e,i,n){const s=g(t);if(null==s||"point"!==s.type&&"mesh"!==s.type)return{steps:e,cancel:i};const a=("point"===s.type?s:s.anchor).clone(),l=new X({elevationInfo:o,pointer:n,editGeometryOperations:H.fromGeometry(a,this.view.state.viewingMode),visualizer:new d,excludeFeature:t.graphic}),r=this.snappingManager,{snappingStep:p,cancelSnapping:c}=Y({snappingContext:l,snappingManager:r,updatingHandles:this._updatingHandles});return i=i.next(c),{steps:e=e.next((o=>{a.z=u(this.view,a,t.elevationInfo,{mode:"absolute-height",offset:0});return{...o,snapOrigin:l.coordinateHelper.pointToVector(a)}})).next(...p),cancel:i}}};t([p({constructOnly:!0,nonNullable:!0})],J.prototype,"view",void 0),t([p()],J.prototype,"objects",void 0),t([p({constructOnly:!0,nonNullable:!0})],J.prototype,"enableZ",void 0),t([p({constructOnly:!0,type:U})],J.prototype,"sketchOptions",void 0),t([p({constructOnly:!0})],J.prototype,"snappingManager",void 0),t([p()],J.prototype,"type",void 0),t([p()],J.prototype,"updating",null),t([p()],J.prototype,"_latestTooltipInfo",void 0),t([p()],J.prototype,"_shouldShowMovePointTooltip",null),t([p()],J.prototype,"activeTooltipInfo",null),J=t([c("esri.views.3d.interactive.editingTools.move.MoveTool3D")],J);class K{constructor(t){this.object=t,this.geometryRepresentation=null,this.manipulationXY=null,this.dragging=!1}}function Q(t,o,e){if(null==o||"end"===o.action)return void(t.distance=s);const{mapStart:i,mapEnd:n}=o,a=e(i,n);t.distance=null!=a?a:s}export{L as MoveEvent,V as MoveStartEvent,N as MoveStopEvent,J as MoveTool3D};
|
|
5
|
+
import{_ as t}from"../../../../../chunks/tslib.es6.js";import{isSome as o}from"../../../../../core/arrayUtils.js";import e from"../../../../../core/Collection.js";import i from"../../../../../core/Evented.js";import{makeHandle as n}from"../../../../../core/handleUtils.js";import{destroyMaybe as s}from"../../../../../core/maybe.js";import{zeroMeters as a,scale as l}from"../../../../../core/quantityUtils.js";import{watch as r,syncAndInitial as p}from"../../../../../core/reactiveUtils.js";import{property as c}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/has.js";import"../../../../../core/Logger.js";import{subclass as h}from"../../../../../core/accessorSupport/decorators/subclass.js";import{UpdatingHandles as m}from"../../../../../core/support/UpdatingHandles.js";import{makeDehydratedPoint as u}from"../../../../../layers/graphics/dehydratedPoint.js";import{getConvertedElevation as d}from"../../../../../support/elevationInfoUtils.js";import{SnappingVisualizer3D as f}from"../../SnappingVisualizer3D.js";import{orientation as v}from"../geometryUtils.js";import{SupportedObjectResult as _}from"../isSupportedObjectUtils.js";import{manipulatedObjectGeometry as g}from"../manipulatedObjectUtils.js";import{canMoveZOperations as j}from"../manipulatorUtils.js";import{meshTransformFastUpdateHandles as M}from"../meshFastUpdateUtils.js";import{connectTooltipToManipulatedObject as b}from"../tooltipUtils3D.js";import{createVisualElements as y}from"../visualElementUtils.js";import{discRadius as T}from"../manipulations/config.js";import{ManipulationType as w,MoveManipulation as I}from"../manipulations/MoveManipulation.js";import{axisConstrainedDragSign as S}from"../manipulations/moveUtils.js";import{MoveXYObjectManipulation as O}from"../manipulations/MoveXYObjectManipulation.js";import{isSupportedObject as x}from"./isSupportedObject.js";import{OutlineVisualElement as E}from"../../visualElements/OutlineVisualElement.js";import{dragManipulatedObjectMany as U,resetManipulatedObjectMany as P}from"../../../../interactive/dragEventPipeline.js";import{InteractiveToolBase as k}from"../../../../interactive/InteractiveToolBase.js";import{EditGeometryOperations as H}from"../../../../interactive/editGeometry/EditGeometryOperations.js";import X from"../../../../interactive/sketch/SketchOptions.js";import{SnappingContext as Y}from"../../../../interactive/snapping/SnappingContext.js";import{createSnapDragEventPipelineStep as A}from"../../../../interactive/snapping/SnappingDragPipelineStep.js";import{Tooltip as z}from"../../../../interactive/tooltip/Tooltip.js";import{enterInputModeIfAvailable as D}from"../../../../interactive/tooltip/tooltipCommonUtils.js";import{MovePointTooltipInfo as R}from"../../../../interactive/tooltip/infos/MovePointTooltipInfo.js";import{TranslateTooltipInfo as Z}from"../../../../interactive/tooltip/infos/TranslateTooltipInfo.js";import{TranslateXYTooltipInfo as C}from"../../../../interactive/tooltip/infos/TranslateXYTooltipInfo.js";import{TranslateZTooltipInfo as F}from"../../../../interactive/tooltip/infos/TranslateZTooltipInfo.js";import{autoDistanceBetweenPoints2D as V}from"../../../../support/automaticLengthMeasurementUtils.js";import{verticalSignedDistanceBetweenPoints as G}from"../../../../support/euclideanLengthMeasurementUtils.js";class L{constructor(t){this.objects=t,this.type="move-start"}}class N{constructor(t,o,e){this.dx=t,this.dy=o,this.objects=e,this.type="move"}}class q{constructor(t){this.objects=t,this.type="move-stop"}}const B=Symbol("manipulators"),J=Symbol("tooltips");let K=class extends k{constructor(t){super(t),this._infos=new Map,this.events=new i,this.objects=new e,this.enableZ=!0,this.sketchOptions=new X,this.type="move-3d",this._latestTooltipInfo=null,this._translateTooltipInfo=null,this._translateXYTooltipInfo=null,this._translateZTooltipInfo=null,this._updatingHandles=new m,this._moveManipulation=null}initialize(){const{view:t}=this;this.tooltip=new z({view:t}),this.addHandles([this.objects.on("change",(t=>{t.removed.forEach((t=>this.removeHandles(t))),this._updateObjectInfos(t),this._setupFastTransformUpdates(t.added),this._refreshManipulators()})),this.objects.on("change",(()=>this._connectTooltips()))]);const o=this.objects.toArray();this._updateObjectInfos({added:o,removed:[]}),this._setupFastTransformUpdates(o),this._refreshManipulators(),this._connectTooltips(),this.finishToolCreation()}destroy(){this.tooltip=s(this.tooltip),this._moveManipulation=s(this._moveManipulation),this._set("view",null),this._updatingHandles.destroy()}onInputEvent(t){if(!this.destroyed&&!D(t,this.tooltip))return super.onInputEvent(t)}get updating(){return this._updatingHandles.updating}get _shouldShowMovePointTooltip(){const{objects:t}=this;if(1!==t.length)return!1;const o=g(t.at(0))?.type;return"point"===o||"mesh"===o}get activeTooltipInfo(){return this._shouldShowMovePointTooltip?this._movePointTooltipInfo:this._latestTooltipInfo}reset(){}_updateObjectInfos({added:t,removed:o}){for(const e of t){if(x(e)!==_.SUPPORTED)continue;const t=new Q(e);this._infos.set(e,t)}for(const e of o)this._infos.delete(e)}_setupFastTransformUpdates(t){for(const o of t){const t=this._infos.get(o);this.addHandles(M(t.object),o)}}_refreshManipulators(){if(this.removeHandles(B),this._moveManipulation=s(this._moveManipulation),this.manipulators.removeAll(),0===this._infos.size)return;const t=Array.from(this._infos.values());this._createManipulators(t),this._createVisualElements(t),this._updateMoveManipulation(t)}_createManipulators(t){for(const o of t){const e=o.object;o.manipulationXY=new O({tool:this,view:this.view,object:e}),o.manipulationXY.forEachManipulator((t=>{this.addHandles([t.events.on("immediate-click",(t=>{this.events.emit("immediate-click",{...t,object:e}),t.stopPropagation()})),t.events.on("grab-changed",(({action:t})=>{"start"===t?this._showTooltip(w.XY):this._hideTooltip()}))],B)})),this.addHandles(o.manipulationXY.createDragPipeline(((o,e,i,n)=>this._buildDragEventPipeline(t,w.XY,o,e,i,n))),B)}this._createMoveManipulation(t)}_createMoveManipulation(t){const o=new I({tool:this,view:this.view,snapToScene:!1,xyAvailable:!0,xyAxisAvailable:!0,zAvailable:!0,radius:1===t.length?I.radiusForSymbol(t[0].object.graphic?.symbol):T});this._moveManipulation=o,o.elevationInfo={mode:"absolute-height",offset:0},o.forEachManipulator((t=>{this.addHandles(t.events.on("immediate-click",(e=>{const i=this.objects.at(0);!o.zManipulation.hasManipulator(t)&&1===this.objects.length&&i&&this.events.emit("immediate-click",{...e,object:i}),e.stopPropagation()})),B)}));const e=t=>o=>{this.addHandles([o.events.on("focus-changed",(({action:o})=>{"focus"===o?this._showTooltip(t):this._hideTooltip()})),o.events.on("grab-changed",(()=>{this._latestTooltipInfo&&(this._latestTooltipInfo.distance=a)}))],B)};this._moveManipulation.xyManipulation.forEachManipulator(e(w.XY)),this._moveManipulation.xyAxisManipulation.forEachManipulator(e(w.XY_AXIS)),this._moveManipulation.zManipulation.forEachManipulator(e(w.Z));const i=()=>this._updateMoveManipulation(t);for(const a of t)this.addHandles([a.object.on("committed",i),r((()=>a.object.visible),i)],B);const n=t[t.length-1];this.addHandles(n.object.on("committed",(()=>this._updateMoveManipulationAngle(n))),B);const{object:s}=n,{operations:l}=s;if(l){const e=s.graphic;this.addHandles(o.createDragPipeline(((o,e,i,n,s)=>this._buildDragEventPipeline(t,o,e,i,n,s)),s.elevationInfo,l.data.spatialReference,e),B)}this._updateMoveManipulationAngle(n)}_createVisualElements(t){for(const o of t){const e=o.object,i=y({view:this.view,object:e,forEachManipulator:t=>{o.manipulationXY?.forEachManipulator(t),this._moveManipulation?.forEachManipulator(t)},onManipulatorsChanged:()=>n()});null!=i&&(o.geometryRepresentation=i.visualElement,o.geometryRepresentation instanceof E&&this.addHandles([o.geometryRepresentation.events.on("attachment-origin-changed",(()=>{o.object.isDraped||this._updateMoveManipulation(t)})),r((()=>o.object.isDraped),(()=>this._updateMoveManipulation(t)))],B),this.addHandles(i,B))}}_updateMoveManipulationAngle(t){this._moveManipulation&&(this._moveManipulation.angle=v(g(t.object)))}_updateMoveManipulation(t){const o=u(0,0,0,this.view.spatialReference);let e=0,i=!1;const n=this._moveManipulation;if(n){for(const n of t){if(!n.object.visible)continue;this.enableZ&&j(n.object.operations,n.object.elevationInfo)&&(i=!0);const t=n.geometryRepresentation instanceof E&&!n.object.isDraped?n.geometryRepresentation.attachmentOrigin:n.object.origin;if(null!=t){const{x:i,y:n,z:s}=t;o.x+=i,o.y+=n,s&&(o.z??=0,o.z+=s),e++}}e>0?(o.x/=e,o.y/=e,o.z??=0,o.z/=e,n.location=o,n.xyManipulation.available=!0,n.xyAxisManipulation.available=!0,n.zManipulation.available=i):n.available=!1}}_buildDragEventPipeline(t,o,e,i,n,s){const a=[],l=[];let r=null,p=null;const c=()=>{for(const t of a)t.dragging=!1;a.length=0,l.length=0,r=null,p=null,this._moveManipulation&&(this._moveManipulation.interactive=!0)};if(1===t.length&&o===w.XY){const o=t[0].object;({steps:i,cancel:n}=this._buildSnappingPipelineSteps(o,o.elevationInfo,i,n,s))}return n=n.next((t=>p?.(t))).next((()=>(l.length&&this.events.emit("move-stop",new q(l)),this.destroyed||c(),null))),{steps:i=i.next((o=>{if("start"===o.action){a.length=0,l.length=0;for(const o of t)o.dragging||!o.manipulationXY?.hasManipulator(e)&&o.manipulationXY?.grabbing||(a.push(o),l.push(o.object),o.dragging=!0);if(0!==l.length&&(this._moveManipulation&&(this._moveManipulation.interactive=!1),r=U(l),p=P(l),this._emitRecordUndo(),this.events.emit("move-start",new L(l)),this.destroyed))return null}return 0!==l.length?o:null})).next((t=>r?.(t))).next((t=>(this._updateMoveTooltip(o,t),t))).next((t=>{switch(t.action){case"start":case"update":if(t.translationX||t.translationY||t.translationZ){const o=this.view.toScreen(t.mapStart),e=this.view.toScreen(t.mapEnd),i=e.x-o.x,n=e.y-o.y;if(this.events.emit("move",new N(i,n,l)),this.destroyed)return null}break;case"end":if(this.events.emit("move-stop",new q(l)),this.destroyed)return null;c()}return null})),cancel:n}}_connectTooltips(){let t;if(this.removeHandles(J),this._shouldShowMovePointTooltip){const o=this.objects.at(0),{events:e}=this;this._movePointTooltipInfo??=new R({viewType:this.view.type,sketchOptions:this.sketchOptions});const i={onMoveStart:()=>{this._emitRecordUndo(),e.emit("move-start",new L([o]))},onMove:()=>e.emit("move",new N(0,0,[o])),onMoveStop:()=>e.emit("move-stop",new q([o]))};t=b(this.tooltip,o,(()=>({sketchOptions:this.sketchOptions,activeTooltipInfo:this._movePointTooltipInfo,callbacks:i})))}else t=r((()=>this.sketchOptions.tooltips.effectiveEnabled?this._latestTooltipInfo:null),(t=>{this.tooltip.info=t}),p);this.addHandles(t,J)}_showTooltip(t){this._shouldShowMovePointTooltip||this._updateMoveTooltip(t)}_hideTooltip(){this._shouldShowMovePointTooltip||(this.tooltip?.clear(),this._latestTooltipInfo=null)}_updateMoveTooltip(t,o){if(this._shouldShowMovePointTooltip)return;const{sketchOptions:e}=this;switch(t){case w.XY:this._latestTooltipInfo=this._translateTooltipInfo??=new Z({sketchOptions:e}),W(this._latestTooltipInfo,o,((t,o)=>V(t,o)));break;case w.XY_AXIS:this._latestTooltipInfo=this._translateXYTooltipInfo??=new C({sketchOptions:e}),W(this._latestTooltipInfo,o,((t,e)=>l(V(t,e),S(o))));break;case w.Z:this._latestTooltipInfo=this._translateZTooltipInfo??=new F({sketchOptions:e}),W(this._latestTooltipInfo,o,G)}this._latestTooltipInfo.sketchOptions=e}_emitRecordUndo(){const t=this.objects.toArray().map((t=>t.createUndoRecord?.())).filter(o);t.length>0&&this.events.emit("record-undo",{updates:t})}_buildSnappingPipelineSteps(t,o,e,i,n){const s=g(t);if(null==s||"point"!==s.type&&"mesh"!==s.type)return{steps:e,cancel:i};const a=("point"===s.type?s:s.anchor).clone(),l=new Y({elevationInfo:o,pointer:n,editGeometryOperations:H.fromGeometry(a,this.view.state.viewingMode),visualizer:new f,excludeFeature:t.graphic}),r=this.snappingManager,{snappingStep:p,cancelSnapping:c}=A({snappingContext:l,snappingManager:r,updatingHandles:this._updatingHandles});return i=i.next(c),{steps:e=e.next((o=>{a.z=d(this.view,a,t.elevationInfo,{mode:"absolute-height",offset:0});return{...o,snapOrigin:l.coordinateHelper.pointToVector(a)}})).next(...p),cancel:i}}};t([c({constructOnly:!0,nonNullable:!0})],K.prototype,"view",void 0),t([c()],K.prototype,"objects",void 0),t([c({constructOnly:!0,nonNullable:!0})],K.prototype,"enableZ",void 0),t([c({constructOnly:!0,type:X})],K.prototype,"sketchOptions",void 0),t([c({constructOnly:!0})],K.prototype,"snappingManager",void 0),t([c()],K.prototype,"type",void 0),t([c()],K.prototype,"updating",null),t([c()],K.prototype,"_latestTooltipInfo",void 0),t([c()],K.prototype,"_shouldShowMovePointTooltip",null),t([c()],K.prototype,"activeTooltipInfo",null),K=t([h("esri.views.3d.interactive.editingTools.move.MoveTool3D")],K);class Q{constructor(t){this.object=t,this.geometryRepresentation=null,this.manipulationXY=null,this.dragging=!1}}function W(t,o,e){if(null==o||"end"===o.action)return void(t.distance=a);const{mapStart:i,mapEnd:n}=o,s=e(i,n);t.distance=null!=s?s:a}export{N as MoveEvent,L as MoveStartEvent,q as MoveStopEvent,K as MoveTool3D};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.30/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{handlesGroup as t}from"../../../../../core/handleUtils.js";import{zeroMeters as e,createLength as o,scale as
|
|
5
|
+
import{handlesGroup as t}from"../../../../../core/handleUtils.js";import{zeroMeters as e,createLength as o,scale as i}from"../../../../../core/quantityUtils.js";import{watch as n,syncAndInitial as s,sync as r}from"../../../../../core/reactiveUtils.js";import{getMetersPerUnitForSR as a}from"../../../../../core/unitUtils.js";import{projectPoint as p}from"../../../../../geometry/support/plane.js";import{sv3d as l}from"../../../../../geometry/support/vectorStacks.js";import{manipulatedObjectGeometry as c}from"../manipulatedObjectUtils.js";import{updateXYZFromTooltipInfo as m,updateTooltipInfoFromManipulatedObject as f,updateElevationFromPoint as u}from"../tooltipUtils3D.js";import{ManipulationType as y}from"../manipulations/MoveManipulation.js";import{axisConstrainedDragSign as v}from"../manipulations/moveUtils.js";import{AccumulationBehavior as d}from"../../../../interactive/editGeometry/interfaces.js";import{connectPasteEvent as h,getXYZDeltasFromTooltipInfo as T}from"../../../../interactive/tooltip/tooltipCommonUtils.js";import{MovePointTooltipInfo as k}from"../../../../interactive/tooltip/infos/MovePointTooltipInfo.js";import{ReshapeEdgeOffsetTooltipInfo as g}from"../../../../interactive/tooltip/infos/ReshapeEdgeOffsetTooltipInfo.js";import{SelectedVertexTooltipInfo as j}from"../../../../interactive/tooltip/infos/SelectedVertexTooltipInfo.js";import{TranslateTooltipInfo as I}from"../../../../interactive/tooltip/infos/TranslateTooltipInfo.js";import{TranslateXYTooltipInfo as O}from"../../../../interactive/tooltip/infos/TranslateXYTooltipInfo.js";import{TranslateZTooltipInfo as w}from"../../../../interactive/tooltip/infos/TranslateZTooltipInfo.js";import{autoArea2D as b}from"../../../../support/automaticAreaMeasurementUtils.js";import{autoLength2D as x,autoDistanceBetweenPoints2D as U}from"../../../../support/automaticLengthMeasurementUtils.js";import{verticalSignedDistanceBetweenPoints as M}from"../../../../support/euclideanLengthMeasurementUtils.js";import{geodesicDistance as L}from"../../../../support/geodesicLengthMeasurementUtils.js";function S(t,e){const o=e?.type;return{edgeOffset:new g({sketchOptions:t,viewType:o}),movePoint:new k({sketchOptions:t,viewType:o}),selectedVertex:new j({sketchOptions:t,viewType:o}),translate:new I({sketchOptions:t,viewType:o}),translateXY:new O({sketchOptions:t,viewType:o}),translateZ:new w({sketchOptions:t,viewType:o})}}function X(e,o,i){function a(){const t=i(),e=t.sketchOptions.tooltips.effectiveEnabled?t.activeTooltipInfo:null;return{...t,activeTooltipInfo:e}}let p=!1;function l(t){p=!0,V(o,t),e.info=t.activeTooltipInfo,p=!1}return t([n(a,l,s),n((()=>{const t=a(),{activeTooltipInfo:e}=t;if(e&&"key"in e)return{context:t,activeTooltipInfo:e,key:e.key,geometry:c(o)}}),((t,e)=>{t&&!p&&e&&e.key!==t.key&&E(t.activeTooltipInfo,o,t.context)}),r),o.on("committed",(()=>l(a()))),h(e)])}function E(t,e,{selectedVertexManipulatorInfo:o,callbacks:i}){const n=c(e);switch(n?.type){case"mesh":"move-point"===t.type&&m(t,n.origin,e,i);break;case"point":"move-point"===t.type&&m(t,n,e,i);break;case"polyline":case"polygon":"selected-vertex"===t.type&&R(t,o,e,i)}}function R(t,e,o,i){if("vertex"!==e?.type)return;const{dx:n,dy:s,dz:r}=T(t,e.manipulator.location);0===n&&0===s&&0===r||(i.onReshapeStart?.(),o.operations?.moveVertices([e.handle],n,s,r,d.NEW_STEP),i.onReshape?.(),i.onReshapeStop?.())}function V(t,{activeTooltipInfo:e,selectedVertexManipulatorInfo:o,sketchOptions:i}){if(e)switch(e.sketchOptions=i,e?.type){case"move-point":f(e,t);break;case"selected-vertex":Y(e,o,t)}}function Y(t,e,o){if(!t||"selected-vertex"!==t.type)return;const i=e?.manipulator.location;t.setLocationFromPoint(i),u(t,i,o);const n=o.operations?.data.geometry;switch(n?.type){case"polygon":t.geometryType="polygon",t.totalLength.visible=!1,t.area.actual=b(n);break;case"polyline":t.geometryType="polyline",t.totalLength.actual=x(n),t.area.visible=!1}}function Z(t,e,{sketchOptions:o,tooltipInfos:n}){let s=null;switch(t){case y.XY:s=n.translate,P(s,e,((t,e)=>U(t,e)));break;case y.XY_AXIS:s=n.translateXY,P(s,e,((t,o)=>i(U(t,o),v(e))));break;case y.Z:s=n.translateZ,P(s,e,M)}return s.sketchOptions=o,s}function P(t,o,i){if(null!=o&&"end"!==o.action){const{mapStart:n,mapEnd:s}=o,r=i(n,s);t.distance=null!=r?r:e}else t.distance=e}function A(t,o,{sketchOptions:i,tooltipInfos:n}){const s=n.edgeOffset;if(s.distance=e,null!=o&&"end"!==o.action){const e=t.operations,{mapEnd:i,signedDistance:n,operation:r}=o;if(null!=n&&null!=e){const o=e.data.coordinateHelper,a=n*r.selectedArrow;s.distance=D(t.isDraped,a,i,r.plane,o)}}const r=t.operations?.data.geometry;return s.area="polygon"===r?.type?b(r):null,s.totalLength="polyline"===r?.type?x(r):null,s.sketchOptions=i,s}function D(t,e,i,n,s){if(t){const t=s.toXYZ(s.pointToVector(i)),r=p(n,t,l.get()),a=L(r,t,s.spatialReference);if(null!=a)return o(a.value*Math.sign(e),a.unit)}return o(e*a(i.spatialReference),"meters")}export{X as connectTooltipToManipulatedObject,S as createTooltipInfos,A as getUpdatedEdgeOffsetTooltipInfo,Z as getUpdatedTranslateObjectTooltipInfo};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.30/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{handlesGroup as t}from"../../../../core/handleUtils.js";import{watch as o,syncAndInitial as e,sync as
|
|
5
|
+
import{handlesGroup as t}from"../../../../core/handleUtils.js";import{watch as o,syncAndInitial as e,sync as i}from"../../../../core/reactiveUtils.js";import{manipulatedObjectGeometry as n}from"./manipulatedObjectUtils.js";import{AccumulationBehavior as r}from"../../../interactive/editGeometry/interfaces.js";import{connectPasteEvent as s,updateMeshTransformFromTooltipInfo as c,getXYZDeltasFromTooltipInfo as a,updateTooltipInfoFromMeshTransform as l}from"../../../interactive/tooltip/tooltipCommonUtils.js";import{elevationFromPoint as p}from"../../../support/euclideanLengthMeasurementUtils.js";function m(r,c,a){function l(){const t=a(),o=t.sketchOptions.tooltips.effectiveEnabled?t.activeTooltipInfo:null;return{...t,activeTooltipInfo:o}}let p=!1;function m({activeTooltipInfo:t,sketchOptions:o}){p=!0,t&&(t.sketchOptions=o,v(t,c)),r.info=t,p=!1}return t([o(l,m,e),o((()=>{const t=l(),{activeTooltipInfo:o}=t;if(o)return{context:t,activeTooltipInfo:o,key:o.key,geometry:n(c)}}),((t,o)=>{t&&!p&&o&&o.key!==t.key&&f(t.activeTooltipInfo,c,t.context)}),i),c.on("committed",(()=>m(l()))),s(r)])}function f(t,o,{callbacks:e}){const i=n(o);switch(i?.type){case"mesh":u(t,i.origin,o,e),"orientation"in t&&"scale"in t&&c(t,i,e);break;case"point":u(t,i,o,e)}}function u(t,o,e,i){const{dx:n,dy:s,dz:c}=a(t,o);0===n&&0===s&&0===c||(i.onMoveStart?.(),e.operations?.move(n,s,c,r.NEW_STEP),i.onMove?.(n,s,c),i.onMoveStop?.())}function v(t,o){const e=n(o);if(!t||!e||"mesh"!==e.type&&"point"!==e.type)return;const i="mesh"===e.type,r=i?e.origin:e;t.setLocationFromPoint(r),y(t,r,o),"transform-mesh"===t.type&&i&&l(t,e),t.clearInputValues()}function y(t,o,e){t.elevation.actual=p(o),t.elevation.visible=!!e.operations?.data.coordinateHelper.hasZ(),t.elevation.readOnly=!1,t.elevation.showAsZ=!0}export{m as connectTooltipToManipulatedObject,y as updateElevationFromPoint,v as updateTooltipInfoFromManipulatedObject,u as updateXYZFromTooltipInfo};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.30/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as t}from"../../../../../chunks/tslib.es6.js";import e from"../../../../../core/Accessor.js";import{deg2rad as o,rad2deg as i}from"../../../../../core/mathUtils.js";import{when as r,sync as n}from"../../../../../core/reactiveUtils.js";import{property as s}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/has.js";import"../../../../../core/Logger.js";import"../../../../../core/RandomLCG.js";import{subclass as a}from"../../../../../core/accessorSupport/decorators/subclass.js";import{axis as l,angle as c}from"../../../../../geometry/support/axisAngleDegrees.js";
|
|
5
|
+
import{_ as t}from"../../../../../chunks/tslib.es6.js";import e from"../../../../../core/Accessor.js";import{deg2rad as o,rad2deg as i}from"../../../../../core/mathUtils.js";import{when as r,sync as n}from"../../../../../core/reactiveUtils.js";import{property as s}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/has.js";import"../../../../../core/Logger.js";import"../../../../../core/RandomLCG.js";import{subclass as a}from"../../../../../core/accessorSupport/decorators/subclass.js";import{axis as l,angle as c}from"../../../../../geometry/support/axisAngleDegrees.js";let p=class extends e{constructor(t){super(t),this._interactionState=null}initialize(){this.addHandles([r((()=>{const t=this._interactionState;return t&&t.angle!==t.previousAngle?{interactionState:t,angle:t.state.angle}:null}),(({interactionState:t})=>{this._updateMeshRotation(t)}),n),r((()=>{const t=this._interactionState;return t&&t.scale!==t.previousScale?{interactionState:t,scale:t.state.scale}:null}),(({interactionState:t})=>{this._updateMeshSize(t)}),n)])}get initialAngle(){return this._interactionState?.initialAngle??0}get angle(){const t=this.geometry.transform;if(null==t)return this._interactionState?.angle??0;const e=l(t.rotation)[2];return Math.abs(e)>.999999?o(c(t.rotation))*Math.sign(e):0}get angleClockwise(){return-this.angle}get relativeAngle(){return this.angle-this.initialAngle}get relativeAngleClockwise(){return-this.relativeAngle}get scale(){return this._interactionState?.scale??1}startInteraction(){const t=new g({angle:this.angle});this._interactionState=t;const e=()=>{this._interactionState=null};return{state:t,done:e,cancel:()=>{t.cancel(),e()}}}createUndoRecord(){return this.object.createUndoRecord()}_updateMeshRotation(t){const{angle:e,previousAngle:o}=t;t.previousAngle=e;const r=i(e-o);this.geometry.rotate(0,0,r,{origin:this.geometry.anchor})}_updateMeshSize(t){const{scale:e,previousScale:o}=t;t.previousScale=e;const i=e/o,r=this.geometry.anchor;this.geometry.scale(i,{origin:r})}};t([s({constructOnly:!0})],p.prototype,"object",void 0),t([s({constructOnly:!0})],p.prototype,"geometry",void 0),t([s({constructOnly:!0})],p.prototype,"viewingMode",void 0),t([s()],p.prototype,"initialAngle",null),t([s()],p.prototype,"angle",null),t([s()],p.prototype,"angleClockwise",null),t([s()],p.prototype,"relativeAngle",null),t([s()],p.prototype,"relativeAngleClockwise",null),t([s()],p.prototype,"scale",null),t([s()],p.prototype,"_interactionState",void 0),p=t([a("esri.views.3d.interactive.editingTools.transform.ScaleRotateMeshAdapter")],p);let g=class extends e{get state(){const{angle:t,scale:e}=this;return{angle:t,scale:e}}constructor(t){super(t),this.angle=0,this.initialAngle=0,this.previousAngle=0,this.previousScale=1,this.scale=1,this.initialAngle=t.angle,this.previousAngle=t.angle}cancel(){this.angle=this.initialAngle,this.scale=1}};t([s()],g.prototype,"angle",void 0),t([s()],g.prototype,"initialAngle",void 0),t([s()],g.prototype,"previousAngle",void 0),t([s()],g.prototype,"previousScale",void 0),t([s()],g.prototype,"scale",void 0),t([s()],g.prototype,"state",null),g=t([a("esri.views.3d.interactive.editingTools.transform.ScaleRotateMeshAdapter.InteractionState")],g);export{p as ScaleRotateMeshAdapter};
|