@arcgis/core 4.26.0-next.20230221 → 4.26.0
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/arcade/treeAnalysis.js +1 -1
- package/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/0923c0641ca9d9a52efc.js +1 -0
- package/assets/esri/core/workers/chunks/{985ffb4dfa8e598c94b5.js → 0d0bca75414f15371baf.js} +1 -1
- package/assets/esri/core/workers/chunks/253a3e9ce0521a005134.js +1 -0
- package/assets/esri/core/workers/chunks/{5b2bd5829b3831bf9bce.js → 636b4e080d701d5856c7.js} +1 -1
- package/assets/esri/core/workers/chunks/{c6265aea465769ff758b.js → 995ea389fb778b25d927.js} +1 -1
- package/assets/esri/core/workers/chunks/{5d946cee3dc0e7311f98.js → aa864f9ad6b9a92ab328.js} +1 -1
- package/assets/esri/core/workers/chunks/{173febea598431b4e444.js → f3b59aa3b33e3ee70bec.js} +1 -1
- package/assets/esri/core/workers/chunks/{37893e24e4eead6dcec9.js → fd03ba4613f8973f8c86.js} +1 -1
- package/config.js +1 -1
- package/layers/support/layerUtils.js +1 -1
- package/layers/support/lazyLayerLoader.js +1 -1
- package/package.json +1 -1
- package/smartMapping/heuristics/clusterMinSize.js +1 -1
- package/support/revision.js +1 -1
- package/views/2d/interactive/editingTools/ControlPointsTransformTool.js +1 -1
- package/views/2d/interactive/editingTools/TransformTool.js +1 -1
- package/views/2d/layers/imagery/ImageryTileView2D.js +1 -1
- package/assets/esri/core/workers/chunks/52a06c5eb51ea1d79000.js +0 -1
- package/assets/esri/core/workers/chunks/a7d2caa47df34a66445a.js +0 -1
package/config.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.26/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import"./core/has.js";import{deepMerge as e}from"./core/object.js";
|
|
5
|
+
import"./core/has.js";import{deepMerge as e}from"./core/object.js";const s={analysisTheme:{accentColor:[255,128,0],textColor:"white"},apiKey:void 0,applicationUrl:globalThis.location?.href,assetsPath:"",fontsUrl:"https://static.arcgis.com/fonts",geometryServiceUrl:"https://utility.arcgisonline.com/arcgis/rest/services/Geometry/GeometryServer",geoRSSServiceUrl:"https://utility.arcgis.com/sharing/rss",kmlServiceUrl:"https://utility.arcgis.com/sharing/kml",userPrivilegesApplied:!1,portalUrl:"https://www.arcgis.com",routeServiceUrl:"https://route-api.arcgis.com/arcgis/rest/services/World/Route/NAServer/Route_World",workers:{loaderConfig:{has:{},paths:{},map:{},packages:[]}},request:{crossOriginNoCorsDomains:null,httpsDomains:["arcgis.com","arcgisonline.com","esrikr.com","premiumservices.blackbridge.com","esripremium.accuweather.com","gbm.digitalglobe.com","firstlook.digitalglobe.com","msi.digitalglobe.com"],interceptors:[],maxUrlLength:2e3,priority:"high",proxyRules:[],proxyUrl:null,timeout:6e4,trustedServers:[],useIdentity:!0},log:{interceptors:[],level:null}};if(globalThis.esriConfig&&(e(s,globalThis.esriConfig,!0),delete s.has),!s.assetsPath){{const e="4.26.0";s.assetsPath=`https://js.arcgis.com/${e.slice(0,-2)}/@arcgis/core/assets`}s.defaultAssetsPath=s.assetsPath}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.26/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{id as e}from"../../kernel.js";import t from"../../request.js";import{isSome as n}from"../../core/maybe.js";function r(e){const t=e?.type;return"imagery-tile"===t||"tile"===t||"open-street-map"===t||"vector-tile"===t||"web-tile"===t||"wmts"===t}function i(e){const t=e?.type;return"base-tile"===t||"tile"===t||"elevation"===t||"imagery-tile"===t||"base-elevation"===t||"open-street-map"===t||"wcs"===t||"web-tile"===t||"wmts"===t||"vector-tile"===t}function s(e){return null!=e&&"type"in e&&"group"===e.type}const a={Point:"SceneLayer","3DObject":"SceneLayer",IntegratedMesh:"IntegratedMeshLayer",PointCloud:"PointCloudLayer",Building:"BuildingSceneLayer"};function u(e){const t=e?.type;return"building-scene"===t||"integrated-mesh"===t||"point-cloud"===t||"scene"===t}function c(e){return"voxel"===e?.type}function o(e){return"imagery-tile"===e?.type}function l(e){return null!=e&&null!=e.parent&&"declaredClass"in e.parent&&"esri.Basemap"===e.parent.declaredClass&&e.parent.baseLayers.includes(e)}function f(e){return"feature"===e?.type&&!e.url&&"memory"===e.source?.type}function
|
|
5
|
+
import{id as e}from"../../kernel.js";import t from"../../request.js";import{isSome as n}from"../../core/maybe.js";function r(e){const t=e?.type;return"imagery-tile"===t||"tile"===t||"open-street-map"===t||"vector-tile"===t||"web-tile"===t||"wmts"===t}function i(e){const t=e?.type;return"base-tile"===t||"tile"===t||"elevation"===t||"imagery-tile"===t||"base-elevation"===t||"open-street-map"===t||"wcs"===t||"web-tile"===t||"wmts"===t||"vector-tile"===t}function s(e){return null!=e&&"type"in e&&"group"===e.type}const a={Point:"SceneLayer","3DObject":"SceneLayer",IntegratedMesh:"IntegratedMeshLayer",PointCloud:"PointCloudLayer",Building:"BuildingSceneLayer"};function u(e){const t=e?.type;return"building-scene"===t||"integrated-mesh"===t||"point-cloud"===t||"scene"===t}function c(e){return"voxel"===e?.type}function o(e){return"imagery-tile"===e?.type}function l(e){return null!=e&&null!=e.parent&&"declaredClass"in e.parent&&"esri.Basemap"===e.parent.declaredClass&&e.parent.baseLayers.includes(e)}function f(e){return"feature"===e?.type&&!e.url&&"memory"===e.source?.type}function y(e){return"feature"===e?.type&&"feature-layer"===e.source?.type}function p(e){const t=/[:;]/,n=[];let r=!1;if(e&&(e.forEach(((e,i)=>{n.push([i,e]),!r&&t.test(e)&&(r=!0)})),n.length>0)){let e;if(r){const t={};n.forEach((e=>{t[e[0]]=e[1]})),e=JSON.stringify(t)}else{const t=[];n.forEach((e=>{t.push(e[0]+":"+e[1])})),e=t.join(";")}return e}return null}function g(e){if(!e)return;const t=[];return e.forEach(((e,n)=>{t.push('"'+n+'":'+JSON.stringify(e))})),t.length?"{"+t.join(",")+"}":void 0}function d(e){if(e.activeLayer){const t=e.activeLayer.tileMatrixSet;if(t)return t;const n=e.activeLayer.tileMatrixSets;if(n)return n}return null}async function b(r,i){const s=e?.findServerInfo(r);if(null!=s?.currentVersion)return s.owningSystemUrl||null;const a=r.toLowerCase().indexOf("/rest/services");if(-1===a)return null;const u=`${r.substring(0,a)}/rest/info`,c=n(i)?i.signal:null,{data:o}=await t(u,{query:{f:"json"},responseType:"json",signal:c});return o?.owningSystemUrl||null}function m(e){if(!("capabilities"in e))return!1;switch(e.type){case"csv":case"feature":case"geojson":case"imagery":case"knowledge-graph-sublayer":case"ogc-feature":case"oriented-imagery":case"scene":case"subtype-group":case"subtype-sublayer":case"wfs":return!0;default:return!1}}function v(e){return m(e)?"effectiveCapabilities"in e?e.effectiveCapabilities:e.capabilities:null}function h(e){if(!("editingEnabled"in e))return!1;switch(e.type){case"csv":case"feature":case"geojson":case"oriented-imagery":case"scene":case"subtype-group":case"subtype-sublayer":return!0;default:return!1}}function w(e){return!!h(e)&&("effectiveEditingEnabled"in e?e.effectiveEditingEnabled:e.editingEnabled)}export{w as getEffectiveEditingEnabled,v as getEffectiveLayerCapabilities,b as getOwningPortalUrl,d as getTileMaxtrixSetFromActiveLayer,l as isBaseLayer,r as isBasemapSupportedLayer,f as isFeatureCollectionLayer,y as isFeatureServiceLayer,s as isGroupLayer,o as isImageryTileLayer,u as isSceneServiceLayer,i as isTiledLayer,c as isVoxelLayer,a as sceneServiceLayerTypeToClassName,p as serializeLayerDefinitions,g as serializeTimeOptions};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.26/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
const a={BingMapsLayer:async()=>(await import("../BingMapsLayer.js")).default,BuildingSceneLayer:async()=>(await import("../BuildingSceneLayer.js")).default,CSVLayer:async()=>(await import("../CSVLayer.js")).default,DimensionLayer:async()=>(await import("../DimensionLayer.js")).default,ElevationLayer:async()=>(await import("../ElevationLayer.js")).default,FeatureLayer:async()=>(await import("../FeatureLayer.js")).default,
|
|
5
|
+
const a={BingMapsLayer:async()=>(await import("../BingMapsLayer.js")).default,BuildingSceneLayer:async()=>(await import("../BuildingSceneLayer.js")).default,CSVLayer:async()=>(await import("../CSVLayer.js")).default,DimensionLayer:async()=>(await import("../DimensionLayer.js")).default,ElevationLayer:async()=>(await import("../ElevationLayer.js")).default,FeatureLayer:async()=>(await import("../FeatureLayer.js")).default,GeoJSONLayer:async()=>(await import("../GeoJSONLayer.js")).default,GeoRSSLayer:async()=>(await import("../GeoRSSLayer.js")).default,GroupLayer:async()=>(await import("../GroupLayer.js")).default,ImageryLayer:async()=>(await import("../ImageryLayer.js")).default,ImageryTileLayer:async()=>(await import("../ImageryTileLayer.js")).default,IntegratedMeshLayer:async()=>(await import("../IntegratedMeshLayer.js")).default,KMLLayer:async()=>(await import("../KMLLayer.js")).default,LineOfSightLayer:async()=>(await import("../LineOfSightLayer.js")).default,MapImageLayer:async()=>(await import("../MapImageLayer.js")).default,MapNotesLayer:async()=>(await import("../MapNotesLayer.js")).default,MediaLayer:async()=>(await import("../MediaLayer.js")).default,OGCFeatureLayer:async()=>(await import("../OGCFeatureLayer.js")).default,OpenStreetMapLayer:async()=>(await import("../OpenStreetMapLayer.js")).default,OrientedImageryLayer:async()=>(await import("../OrientedImageryLayer.js")).default,PointCloudLayer:async()=>(await import("../PointCloudLayer.js")).default,RouteLayer:async()=>(await import("../RouteLayer.js")).default,SceneLayer:async()=>(await import("../SceneLayer.js")).default,StreamLayer:async()=>(await import("../StreamLayer.js")).default,SubtypeGroupLayer:async()=>(await import("../SubtypeGroupLayer.js")).default,TileLayer:async()=>(await import("../TileLayer.js")).default,UnknownLayer:async()=>(await import("../UnknownLayer.js")).default,UnsupportedLayer:async()=>(await import("../UnsupportedLayer.js")).default,VectorTileLayer:async()=>(await import("../VectorTileLayer.js")).default,VoxelLayer:async()=>(await import("../VoxelLayer.js")).default,WFSLayer:async()=>(await import("../WFSLayer.js")).default,WMSLayer:async()=>(await import("../WMSLayer.js")).default,WMTSLayer:async()=>(await import("../WMTSLayer.js")).default,WebTileLayer:async()=>(await import("../WebTileLayer.js")).default};export{a as layerLookupMap};
|
package/package.json
CHANGED
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.26/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{px2pt as t}from"../../core/screenUtils.js";import{getTextBounds as e}from"../../views/2d/support/engineHelpers.js";async function n(n,o){await o.when();const r=n.clone();r.text="
|
|
5
|
+
import{px2pt as t}from"../../core/screenUtils.js";import{getTextBounds as e}from"../../views/2d/support/engineHelpers.js";async function n(n,o){await o.when();const r=n.clone();r.text="999";const s=await e(r,o);return t(s.width)}export{n as default};
|
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.26/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
const
|
|
5
|
+
const b="20230222",d="f17172bab03d767d6c0b1299b23ed7d4aba5edea";export{b as buildDate,d as commitHash};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.26/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as t}from"../../../../chunks/tslib.es6.js";import e from"../../../../Color.js";import i from"../../../../Graphic.js";import"../../../../symbols.js";import{getAccentColor as o}from"../../../../core/analysisThemeUtils.js";import{isNone as r,unwrap as s,destroyMaybe as a}from"../../../../core/maybe.js";import{watch as n}from"../../../../core/reactiveUtils.js";import{property as h}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/accessorSupport/ensureType.js";import"../../../../core/arrayUtils.js";import{subclass as c}from"../../../../core/accessorSupport/decorators/subclass.js";import{project as l}from"../../../../geometry/projection.js";import{isValid as p}from"../../../../geometry/support/spatialReferenceUtils.js";import d from"../../../../layers/GraphicsLayer.js";import{applyCIMSymbolColor as m}from"../../../../symbols/support/cimSymbolUtils.js";import{ViewingMode as y}from"../../../ViewingMode.js";import{DragManipulation as _}from"./manipulations/DragManipulation.js";import{primaryKey as g}from"../../../input/keys.js";import{InteractiveToolBase as f}from"../../../interactive/InteractiveToolBase.js";import{EditGeometryOperations as u}from"../../../interactive/editGeometry/EditGeometryOperations.js";import{AccumulationBehaviour as P}from"../../../interactive/editGeometry/interfaces.js";import v from"../../../../symbols/CIMSymbol.js";const S={up:"ArrowUp",down:"ArrowDown",left:"ArrowLeft",right:"ArrowRight",toggleOpacity:"t",shift:"Shift",primaryKey:g},k=1,b=10,G=new e("#009AF2");let M=class extends f{constructor(t){super(t),this._isOpacityToggled=!1,this._isModifierActive=!1,this._factor=1,this._initialControlPoints=null,this._graphicsLayer=new d({internal:!0,listMode:"hide",visible:!1,effect:"drop-shadow(0px, 0px, 3px)"}),this._undoStack=[],this._redoStack=[],this._sharedUndoStack=[],this._sharedRedoStack=[],this._highlightHandle=null,this.activeHandle=0}initialize(){const{view:t,mediaElement:e}=this;if(r(e.georeference))return;const a=e.georeference;"control-points"!==a.type||r(a.coords)||(this._georeference=a,this._initialControlPoints=s(this._georeference.controlPoints),this._controlPointEditGeometryOperations=s(this._georeference.controlPoints).map((({mapPoint:e})=>u.fromGeometry(l(e,t.spatialReference),y.Local))),this._controlPointGraphics=this._controlPointEditGeometryOperations.map(((t,e)=>new i({symbol:new v({data:{type:"CIMSymbolReference",symbol:{type:"CIMPointSymbol",symbolLayers:[{type:"CIMVectorMarker",enable:!0,colorLocked:!0,anchorPoint:{x:0,y:-15.75},anchorPointUnits:"Absolute",dominantSizeAxis3D:"Y",size:9,billboardMode3D:"FaceNearPlane",frame:{xmin:0,ymin:0,xmax:84.3,ymax:84.3},markerGraphics:[{type:"CIMMarkerGraphic",geometry:{rings:[[[83.2,32.5],[84.3,40.7],[83.8,48.9],[81.7,56.9],[78.1,64.3],[73,70.9],[66.9,76.4],[59.7,80.5],[51.9,83.2],[43.7,84.3],[35.4,83.8],[27.4,81.7],[20,78],[13.4,73],[7.9,66.8],[3.8,59.7],[1.1,51.9],[0,43.7],[.5,35.4],[2.6,27.4],[6.3,20],[11.3,13.4],[17.5,7.9],[24.7,3.8],[32.5,1.1],[39.8,.1],[47.1,.3],[54.3,1.8],[61.1,4.5],[67.4,8.4],[72.9,13.3],[77.4,19.1],[80.9,25.5],[83.2,32.5]]]},symbol:{type:"CIMPolygonSymbol",symbolLayers:[{type:"CIMSolidFill",enable:!0,color:[255,255,255,255]}]}}],scaleSymbolsProportionally:!0,respectFrame:!0,clippingPath:{type:"CIMClippingPath",clippingType:"Intersect",path:{rings:[[[0,0],[84.3,0],[84.3,84.3],[0,84.3],[0,0]]]}},rotation:0},{type:"CIMVectorMarker",enable:!0,anchorPoint:{x:0,y:-11.25},anchorPointUnits:"Absolute",dominantSizeAxis3D:"Y",size:22.5,billboardMode3D:"FaceNearPlane",frame:{xmin:0,ymin:0,xmax:197.7,ymax:294.7},markerGraphics:[{type:"CIMMarkerGraphic",geometry:{rings:[[[98.9,0],[119.4,23.2],[139.4,49.3],[156.8,75.2],[171.2,100.8],[182.4,125.3],[190.6,148.8],[195.7,171.4],[197.7,192.9],[197.7,195.8],[197.7,200.3],[197.6,202.5],[197.5,204.8],[197.3,207.1],[197,209.4],[196.7,211.7],[196.4,214.1],[196,216.4],[195.5,218.7],[195,221.1],[194.4,223.4],[193.7,225.8],[193,228.1],[192.2,230.5],[191.4,232.8],[190.5,235.1],[189.5,237.5],[188.5,239.7],[187.4,242],[186.2,244.3],[185,246.5],[183.7,248.7],[182.4,250.9],[181,253.1],[179.5,255.2],[178,257.3],[176.4,259.4],[174.7,261.4],[173.1,263.3],[171.3,265.3],[169.5,267.2],[167.7,269],[165.8,270.8],[163.9,272.5],[161.9,274.2],[159.9,275.8],[157.8,277.4],[155.7,278.9],[153.6,280.4],[151.4,281.7],[149.2,283.1],[147,284.4],[144.8,285.6],[142.5,286.7],[140.3,287.8],[138,288.8],[135.7,289.8],[133.4,290.7],[131,291.5],[128.7,292.3],[126.4,293],[124,293.6],[121.7,294.2],[119.4,294.7],[117,295.2],[114.7,295.6],[112.4,296],[110.1,296.3],[107.8,296.5],[105.5,296.7],[103.3,296.8],[101.1,296.9],[98.8,296.9],[83.1,295.7],[67.8,292],[53.3,285.9],[39.9,277.5],[28.1,267.2],[18,255.1],[10,241.5],[4.2,226.9],[.9,211.5],[0,195.8],[.1,192.9],[2.1,171.4],[7.2,148.8],[15.4,125.3],[26.6,100.8],[41,75.2],[58.4,49.3],[78.4,23.2],[98.9,0]]]},symbol:{type:"CIMPolygonSymbol",symbolLayers:[{type:"CIMSolidFill",enable:!0,color:e===this.activeHandle?G.toArray():o().toArray()}]}}],scaleSymbolsProportionally:!0,respectFrame:!0,clippingPath:{type:"CIMClippingPath",clippingType:"Intersect",path:{rings:[[[0,0],[197.7,0],[197.7,294.7],[0,294.7],[0,0]]]}},rotation:0}],haloSize:1,scaleX:1,angleAlignment:"Display",angle:0}}}),geometry:t.data.geometry}))),this._graphicsLayer.graphics.addMany([...this._controlPointGraphics]),this._controlPointManipulations=this._controlPointGraphics.map((e=>new _({tool:this,view:t,graphic:e}))),this.addHandles([...this._controlPointManipulations.map(((t,e)=>t.createDragPipeline(this._getInfo.bind(this,e),((t,i)=>{"start"===t.action&&(this._undoStack.push(e),this._redoStack=[],this._sharedUndoStack.push({tool:this,operation:i}),this._sharedRedoStack.length=0),this.updateGraphics()})))),n((()=>this.view.scale),(()=>this.active?this.updateGraphics():null))]),this._controlPointManipulations.forEach(((t,e)=>{const i=t=>{this.addHandles([t.events.on(["click","grab-changed"],(t=>this.updateActiveHandle(e)))])};t.forEachManipulator(i)})),this.addHandles([t.on("key-down",(i=>{t.activeTool===this&&(i.key!==S.shift||i.repeat||(this._isModifierActive=!0,i.stopPropagation()),i.key!==S.toggleOpacity||i.repeat||(e.opacity*=this._isOpacityToggled?2:.5,this._isOpacityToggled=!this._isOpacityToggled,i.stopPropagation()),i.key!==S.primaryKey||i.repeat||(this._factor=b,i.stopPropagation()),this._isModifierActive&&(i.key===S.up&&(this._move(0,this._factor),i.stopPropagation()),i.key===S.down&&(this._move(0,-this._factor),i.stopPropagation()),i.key===S.left&&(this._move(-this._factor,0),i.stopPropagation()),i.key===S.right&&(this._move(this._factor,0),i.stopPropagation())))})),t.on("key-up",(e=>{t.activeTool===this&&(e.key===S.shift&&(this._isModifierActive=!1,e.stopPropagation()),e.key===S.primaryKey&&(this._factor=k,e.stopPropagation()))}))]),t.map.addMany([this._graphicsLayer]),t.focus(),this.visible=!1,this.finishToolCreation())}destroy(){const{map:t}=this.view;this._controlPointManipulations.forEach((t=>t.destroy())),this._controlPointEditGeometryOperations.forEach((t=>t.destroy())),t.removeMany([this._graphicsLayer]),this._graphicsLayer.removeAll(),this._graphicsLayer=a(this._graphicsLayer),this._georeference=null,this._controlPointGraphics=null,this._controlPointManipulations=null,this._graphicsLayer=null,this._controlPointEditGeometryOperations=null,this._undoStack=null,this._redoStack=null,this._initialControlPoints=null,this._sharedUndoStack=null,this._sharedRedoStack=null}get _hasValidSpatialReference(){return p(this.view.spatialReference)}onActivate(){this.visible=!0}onDeactivate(){this.visible=!1}onShow(){this._graphicsLayer.visible=!0}onHide(){this._graphicsLayer.visible=!1}canUndo(){const t=this._undoStack[this._undoStack.length-1];return null!=t&&this._controlPointEditGeometryOperations[t].canUndo}canRedo(){const t=this._redoStack[this._redoStack.length-1];return null!=t&&this._controlPointEditGeometryOperations[t].canRedo}undo(){if(this._undoStack.length>0){const t=this._undoStack.pop();this._controlPointEditGeometryOperations[t].undo(),this.updateGraphics(),this._redoStack.push(t)}}redo(){if(this._redoStack.length>0){const t=this._redoStack.pop();this._controlPointEditGeometryOperations[t].redo(),this.updateGraphics(),this._undoStack.push(t)}}refresh(){const{mediaElement:t}=this;if(r(t.georeference))return;const e=t.georeference;"control-points"!==e.type||r(e.coords)||(this._georeference=e,s(this._georeference.controlPoints).forEach((({mapPoint:t},e)=>{const i=this._controlPointEditGeometryOperations[e],o=i.data.components[0].vertices[0];i.setVertexPosition(o,i.data.coordinateHelper.pointToVector(t))})),this.updateGraphics())}reset(){this._georeference.controlPoints=this._initialControlPoints,this.refresh(),this._sharedUndoStack.length=0,this._sharedRedoStack.length=0}updateGraphics(){const t=this._georeference,e=s(t.controlPoints),i=s(e[0].mapPoint).spatialReference,o=this._hasValidSpatialReference;this._georeference.controlPoints=this._controlPointEditGeometryOperations.map(((r,a)=>{const n=r.data.geometry;return this._controlPointGraphics[a].geometry=n,{mapPoint:l(n,i),sourcePoint:o?s(e[a]).sourcePoint:t.toSource(n)}}))}updateActiveHandle(t){if(this.activeHandle===t)return;const e=s(this._controlPointGraphics[this.activeHandle].symbol).clone();m(e,o()),this._controlPointGraphics[this.activeHandle].symbol=e;const i=s(this._controlPointGraphics[t].symbol).clone();m(i,G),this._controlPointGraphics[t].symbol=i,this.activeHandle=t,this.view.surface===document.activeElement&&this.highlightActiveHandle()}async highlightActiveHandle(){this.removeHighlightActiveHandle();const t=await this.view.whenLayerView(this._graphicsLayer);this._highlightHandle=t.highlight(this._controlPointGraphics[this.activeHandle])}removeHighlightActiveHandle(){this._highlightHandle&&this._highlightHandle.remove()}setSharedUndoStack(t){this._sharedUndoStack=t}setSharedRedoStack(t){this._sharedRedoStack=t}_getInfo(t){return{editGeometryOperations:this._controlPointEditGeometryOperations[t],constraints:this._hasValidSpatialReference?null:{xmin:0,ymin:0,xmax:this._georeference.width,ymax:this._georeference.height}}}_move(t,e){const i=this._controlPointEditGeometryOperations[this.activeHandle],o=[];for(const s of i.data.components)o.push(...s.vertices);const r=i.moveVertices(o,t*this.view.resolution,e*this.view.resolution,0,P.NEW_STEP);this._sharedUndoStack.push({tool:this,operation:r}),this._sharedRedoStack.length=0,this.updateGraphics()}};t([h()],M.prototype,"_hasValidSpatialReference",null),t([h()],M.prototype,"activeHandle",void 0),t([h({constructOnly:!0,nonNullable:!0})],M.prototype,"mediaElement",void 0),t([h({constructOnly:!0})],M.prototype,"view",void 0),M=t([c("esri.views.2d.interactive.editingTools.ControlPointsTransformTool")],M);export{M as ControlPointsTransformTool,S as KEYS};
|
|
5
|
+
import{_ as t}from"../../../../chunks/tslib.es6.js";import e from"../../../../Color.js";import i from"../../../../Graphic.js";import"../../../../symbols.js";import{getAccentColor as o}from"../../../../core/analysisThemeUtils.js";import{destroyMaybe as r,isNone as s,unwrap as a}from"../../../../core/maybe.js";import{watch as n}from"../../../../core/reactiveUtils.js";import{property as c}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/accessorSupport/ensureType.js";import"../../../../core/arrayUtils.js";import{subclass as h}from"../../../../core/accessorSupport/decorators/subclass.js";import{project as l,initializeProjection as p}from"../../../../geometry/projection.js";import{isValid as d}from"../../../../geometry/support/spatialReferenceUtils.js";import m from"../../../../layers/GraphicsLayer.js";import{applyCIMSymbolColor as y}from"../../../../symbols/support/cimSymbolUtils.js";import{ViewingMode as _}from"../../../ViewingMode.js";import{DragManipulation as g}from"./manipulations/DragManipulation.js";import{primaryKey as f}from"../../../input/keys.js";import{InteractiveToolBase as u}from"../../../interactive/InteractiveToolBase.js";import{EditGeometryOperations as P}from"../../../interactive/editGeometry/EditGeometryOperations.js";import{AccumulationBehaviour as v}from"../../../interactive/editGeometry/interfaces.js";import S from"../../../../symbols/CIMSymbol.js";const k={up:"ArrowUp",down:"ArrowDown",left:"ArrowLeft",right:"ArrowRight",toggleOpacity:"t",shift:"Shift",primaryKey:f},b=1,G=10,M=new e("#009AF2");let w=class extends u{constructor(t){super(t),this._isOpacityToggled=!1,this._isModifierActive=!1,this._factor=1,this._initialControlPoints=null,this._graphicsLayer=new m({internal:!0,listMode:"hide",visible:!1,effect:"drop-shadow(0px, 0px, 3px)"}),this._undoStack=[],this._redoStack=[],this._sharedUndoStack=[],this._sharedRedoStack=[],this._highlightHandle=null,this.activeHandle=0}initialize(){this._initialize()}destroy(){const{map:t}=this.view;this._controlPointManipulations.forEach((t=>t.destroy())),this._controlPointEditGeometryOperations.forEach((t=>t.destroy())),t.removeMany([this._graphicsLayer]),this._graphicsLayer.removeAll(),this._graphicsLayer=r(this._graphicsLayer),this._georeference=null,this._controlPointGraphics=null,this._controlPointManipulations=null,this._graphicsLayer=null,this._controlPointEditGeometryOperations=null,this._undoStack=null,this._redoStack=null,this._initialControlPoints=null,this._sharedUndoStack=null,this._sharedRedoStack=null}get _hasValidSpatialReference(){return d(this.view.spatialReference)}onActivate(){this.visible=!0}onDeactivate(){this.visible=!1}onShow(){this._graphicsLayer.visible=!0}onHide(){this._graphicsLayer.visible=!1}canUndo(){const t=this._undoStack[this._undoStack.length-1];return null!=t&&this._controlPointEditGeometryOperations[t].canUndo}canRedo(){const t=this._redoStack[this._redoStack.length-1];return null!=t&&this._controlPointEditGeometryOperations[t].canRedo}undo(){if(this._undoStack.length>0){const t=this._undoStack.pop();this._controlPointEditGeometryOperations[t].undo(),this.updateGraphics(),this._redoStack.push(t)}}redo(){if(this._redoStack.length>0){const t=this._redoStack.pop();this._controlPointEditGeometryOperations[t].redo(),this.updateGraphics(),this._undoStack.push(t)}}refresh(){const{mediaElement:t}=this;if(s(t.georeference))return;const e=t.georeference;"control-points"!==e.type||s(e.coords)||(this._georeference=e,a(this._georeference.controlPoints).forEach((({mapPoint:t},e)=>{const i=this._controlPointEditGeometryOperations[e],o=i.data.components[0].vertices[0];i.setVertexPosition(o,i.data.coordinateHelper.pointToVector(t))})),this.updateGraphics())}reset(){this._georeference.controlPoints=this._initialControlPoints,this.refresh(),this._sharedUndoStack.length=0,this._sharedRedoStack.length=0}updateGraphics(){const t=this._georeference,e=a(t.controlPoints),i=a(e[0].mapPoint).spatialReference,o=this._hasValidSpatialReference;this._georeference.controlPoints=this._controlPointEditGeometryOperations.map(((r,s)=>{const n=r.data.geometry;return this._controlPointGraphics[s].geometry=n,{mapPoint:l(n,i),sourcePoint:o?a(e[s]).sourcePoint:t.toSource(n)}}))}updateActiveHandle(t){if(this.activeHandle===t)return;const e=a(this._controlPointGraphics[this.activeHandle].symbol).clone();y(e,o()),this._controlPointGraphics[this.activeHandle].symbol=e;const i=a(this._controlPointGraphics[t].symbol).clone();y(i,M),this._controlPointGraphics[t].symbol=i,this.activeHandle=t,this.view.surface===document.activeElement&&this.highlightActiveHandle()}async highlightActiveHandle(){this.removeHighlightActiveHandle();const t=await this.view.whenLayerView(this._graphicsLayer);this._highlightHandle=t.highlight(this._controlPointGraphics[this.activeHandle])}removeHighlightActiveHandle(){this._highlightHandle&&this._highlightHandle.remove()}setSharedUndoStack(t){this._sharedUndoStack=t}setSharedRedoStack(t){this._sharedRedoStack=t}async _initialize(){const{view:t,mediaElement:e}=this;if(s(e.georeference))return;const r=e.georeference;"control-points"!==r.type||s(r.coords)||(this._georeference=r,this._initialControlPoints=a(this._georeference.controlPoints),t.map.addMany([this._graphicsLayer]),t.focus(),this.visible=!1,this.finishToolCreation(),await this._loadProjectionEngine(),this._controlPointEditGeometryOperations=a(this._georeference.controlPoints).map((({mapPoint:e})=>P.fromGeometry(l(e,t.spatialReference),_.Local))),this._controlPointGraphics=this._controlPointEditGeometryOperations.map(((t,e)=>new i({symbol:new S({data:{type:"CIMSymbolReference",symbol:{type:"CIMPointSymbol",symbolLayers:[{type:"CIMVectorMarker",enable:!0,colorLocked:!0,anchorPoint:{x:0,y:-15.75},anchorPointUnits:"Absolute",dominantSizeAxis3D:"Y",size:9,billboardMode3D:"FaceNearPlane",frame:{xmin:0,ymin:0,xmax:84.3,ymax:84.3},markerGraphics:[{type:"CIMMarkerGraphic",geometry:{rings:[[[83.2,32.5],[84.3,40.7],[83.8,48.9],[81.7,56.9],[78.1,64.3],[73,70.9],[66.9,76.4],[59.7,80.5],[51.9,83.2],[43.7,84.3],[35.4,83.8],[27.4,81.7],[20,78],[13.4,73],[7.9,66.8],[3.8,59.7],[1.1,51.9],[0,43.7],[.5,35.4],[2.6,27.4],[6.3,20],[11.3,13.4],[17.5,7.9],[24.7,3.8],[32.5,1.1],[39.8,.1],[47.1,.3],[54.3,1.8],[61.1,4.5],[67.4,8.4],[72.9,13.3],[77.4,19.1],[80.9,25.5],[83.2,32.5]]]},symbol:{type:"CIMPolygonSymbol",symbolLayers:[{type:"CIMSolidFill",enable:!0,color:[255,255,255,255]}]}}],scaleSymbolsProportionally:!0,respectFrame:!0,clippingPath:{type:"CIMClippingPath",clippingType:"Intersect",path:{rings:[[[0,0],[84.3,0],[84.3,84.3],[0,84.3],[0,0]]]}},rotation:0},{type:"CIMVectorMarker",enable:!0,anchorPoint:{x:0,y:-11.25},anchorPointUnits:"Absolute",dominantSizeAxis3D:"Y",size:22.5,billboardMode3D:"FaceNearPlane",frame:{xmin:0,ymin:0,xmax:197.7,ymax:294.7},markerGraphics:[{type:"CIMMarkerGraphic",geometry:{rings:[[[98.9,0],[119.4,23.2],[139.4,49.3],[156.8,75.2],[171.2,100.8],[182.4,125.3],[190.6,148.8],[195.7,171.4],[197.7,192.9],[197.7,195.8],[197.7,200.3],[197.6,202.5],[197.5,204.8],[197.3,207.1],[197,209.4],[196.7,211.7],[196.4,214.1],[196,216.4],[195.5,218.7],[195,221.1],[194.4,223.4],[193.7,225.8],[193,228.1],[192.2,230.5],[191.4,232.8],[190.5,235.1],[189.5,237.5],[188.5,239.7],[187.4,242],[186.2,244.3],[185,246.5],[183.7,248.7],[182.4,250.9],[181,253.1],[179.5,255.2],[178,257.3],[176.4,259.4],[174.7,261.4],[173.1,263.3],[171.3,265.3],[169.5,267.2],[167.7,269],[165.8,270.8],[163.9,272.5],[161.9,274.2],[159.9,275.8],[157.8,277.4],[155.7,278.9],[153.6,280.4],[151.4,281.7],[149.2,283.1],[147,284.4],[144.8,285.6],[142.5,286.7],[140.3,287.8],[138,288.8],[135.7,289.8],[133.4,290.7],[131,291.5],[128.7,292.3],[126.4,293],[124,293.6],[121.7,294.2],[119.4,294.7],[117,295.2],[114.7,295.6],[112.4,296],[110.1,296.3],[107.8,296.5],[105.5,296.7],[103.3,296.8],[101.1,296.9],[98.8,296.9],[83.1,295.7],[67.8,292],[53.3,285.9],[39.9,277.5],[28.1,267.2],[18,255.1],[10,241.5],[4.2,226.9],[.9,211.5],[0,195.8],[.1,192.9],[2.1,171.4],[7.2,148.8],[15.4,125.3],[26.6,100.8],[41,75.2],[58.4,49.3],[78.4,23.2],[98.9,0]]]},symbol:{type:"CIMPolygonSymbol",symbolLayers:[{type:"CIMSolidFill",enable:!0,color:e===this.activeHandle?M.toArray():o().toArray()}]}}],scaleSymbolsProportionally:!0,respectFrame:!0,clippingPath:{type:"CIMClippingPath",clippingType:"Intersect",path:{rings:[[[0,0],[197.7,0],[197.7,294.7],[0,294.7],[0,0]]]}},rotation:0}],haloSize:1,scaleX:1,angleAlignment:"Display",angle:0}}}),geometry:t.data.geometry}))),this._graphicsLayer.graphics.addMany([...this._controlPointGraphics]),this._controlPointManipulations=this._controlPointGraphics.map((e=>new g({tool:this,view:t,graphic:e}))),this.addHandles([...this._controlPointManipulations.map(((t,e)=>t.createDragPipeline(this._getInfo.bind(this,e),((t,i)=>{"start"===t.action&&(this._undoStack.push(e),this._redoStack=[],this._sharedUndoStack.push({tool:this,operation:i}),this._sharedRedoStack.length=0),this.updateGraphics()})))),n((()=>this.view.scale),(()=>this.active?this.updateGraphics():null))]),this._controlPointManipulations.forEach(((t,e)=>{const i=t=>{this.addHandles([t.events.on(["click","grab-changed"],(t=>this.updateActiveHandle(e)))])};t.forEachManipulator(i)})),this.addHandles([t.on("key-down",(i=>{t.activeTool===this&&(i.key!==k.shift||i.repeat||(this._isModifierActive=!0,i.stopPropagation()),i.key!==k.toggleOpacity||i.repeat||(e.opacity*=this._isOpacityToggled?2:.5,this._isOpacityToggled=!this._isOpacityToggled,i.stopPropagation()),i.key!==k.primaryKey||i.repeat||(this._factor=G,i.stopPropagation()),this._isModifierActive&&(i.key===k.up&&(this._move(0,this._factor),i.stopPropagation()),i.key===k.down&&(this._move(0,-this._factor),i.stopPropagation()),i.key===k.left&&(this._move(-this._factor,0),i.stopPropagation()),i.key===k.right&&(this._move(this._factor,0),i.stopPropagation())))})),t.on("key-up",(e=>{t.activeTool===this&&(e.key===k.shift&&(this._isModifierActive=!1,e.stopPropagation()),e.key===k.primaryKey&&(this._factor=b,e.stopPropagation()))}))]))}async _loadProjectionEngine(){const t=a(a(this._georeference.controlPoints)[0].mapPoint);return p(t.spatialReference,this.view.spatialReference)}_getInfo(t){return{editGeometryOperations:this._controlPointEditGeometryOperations[t],constraints:this._hasValidSpatialReference?null:{xmin:0,ymin:0,xmax:this._georeference.width,ymax:this._georeference.height}}}_move(t,e){const i=this._controlPointEditGeometryOperations[this.activeHandle],o=[];for(const s of i.data.components)o.push(...s.vertices);const r=i.moveVertices(o,t*this.view.resolution,e*this.view.resolution,0,v.NEW_STEP);this._sharedUndoStack.push({tool:this,operation:r}),this._sharedRedoStack.length=0,this.updateGraphics()}};t([c()],w.prototype,"_hasValidSpatialReference",null),t([c()],w.prototype,"activeHandle",void 0),t([c({constructOnly:!0,nonNullable:!0})],w.prototype,"mediaElement",void 0),t([c({constructOnly:!0})],w.prototype,"view",void 0),w=t([h("esri.views.2d.interactive.editingTools.ControlPointsTransformTool")],w);export{w as ControlPointsTransformTool,k as KEYS};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.26/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as t}from"../../../../chunks/tslib.es6.js";import"../../../../geometry.js";import e from"../../../../Graphic.js";import"../../../../symbols.js";import{getAccentColor as i,getContrastColor as s}from"../../../../core/analysisThemeUtils.js";import{unwrap as o,isSome as r,destroyMaybe as a}from"../../../../core/maybe.js";import{watch as n}from"../../../../core/reactiveUtils.js";import{getMetersPerUnitForSR as h}from"../../../../core/unitUtils.js";import{property as p}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/accessorSupport/ensureType.js";import"../../../../core/arrayUtils.js";import{subclass as c}from"../../../../core/accessorSupport/decorators/subclass.js";import{a as l,f as _}from"../../../../chunks/vec2.js";import{a as m,U as d}from"../../../../chunks/vec2f64.js";import{g as y,l as u,n as g,a as f,h as v,b as G}from"../../../../chunks/vec3.js";import{c as w}from"../../../../chunks/vec3f64.js";import{project as R}from"../../../../geometry/projection.js";import{a as b,c as k}from"../../../../chunks/boundedPlane.js";import{equals as j}from"../../../../geometry/support/spatialReferenceUtils.js";import P from"../../../../layers/GraphicsLayer.js";import{ViewingMode as A}from"../../../ViewingMode.js";import{DragManipulation as C}from"./manipulations/DragManipulation.js";import{RotateManipulation as S}from"./manipulations/RotateManipulation.js";import{ScaleManipulation as M}from"./manipulations/ScaleManipulation.js";import{PreserveAspectRatio as T,SnapRotation as O}from"./manipulations/utils.js";import{primaryKey as U}from"../../../input/keys.js";import{InteractiveToolBase as D}from"../../../interactive/InteractiveToolBase.js";import{EditGeometry as x}from"../../../interactive/editGeometry/EditGeometry.js";import{EditGeometryOperations as E}from"../../../interactive/editGeometry/EditGeometryOperations.js";import{AccumulationBehaviour as L}from"../../../interactive/editGeometry/interfaces.js";import{AccumulationType as B}from"../../../interactive/editGeometry/operations/UpdateVertices.js";import{calculateOrientedBounds as H}from"../../../interactive/editGeometry/support/editPlaneUtils.js";import{findFirstGraphicHit as V}from"../../../support/hitTestSelectUtils.js";import{createScreenPointFromEvent as I}from"../../../support/screenUtils.js";import K from"../../../../symbols/SimpleFillSymbol.js";import N from"../../../../symbols/SimpleMarkerSymbol.js";import z from"../../../../geometry/Polygon.js";import W from"../../../../geometry/Point.js";const q={up:"ArrowUp",down:"ArrowDown",left:"ArrowLeft",right:"ArrowRight",plus:"+",minus:"-",toggleOpacity:"t",shift:"Shift",primaryKey:U},F=80,J=10,Q=30,X=[[1,1],[1,-1],[-1,-1],[-1,1],[1,0],[0,-1],[-1,0],[0,1]],Y=1,Z=10;let $=class extends D{constructor(t){super(t),this._initialControlPoints=null,this._initialGeometry=null,this._graphic=null,this._planeCache=b(),this._displayPlaneCache=b(),this._mainAxisCache=m(),this._rotationHandleCache=w(),this._cornerA=w(),this._cornerB=w(),this._cornerC=w(),this._cornerD=w(),this._avgAB=w(),this._avgBC=w(),this._avgCD=w(),this._avgDA=w(),this._preserveAspectRatio=new T,this._snapRotation=new O,this._graphicsLayer=new P({internal:!0,listMode:"hide",visible:!1}),this._sharedUndoStack=[],this._sharedRedoStack=[],this._isOpacityToggled=!1,this._isModifierActive=!1,this._factor=1,this.preserveAspectRatio=null,this.snapRotation=null}initialize(){const{view:t,target:a}=this;if("georeference"in a){const t=o(a.georeference);this._graphic=new e({geometry:o(t.coords)}),this._initialControlPoints="control-points"===t.type?t.controlPoints:null}else this._graphic=a,this._initialGeometry=o(a.geometry);const h=this._graphic.geometry;this._editGeometryOperations=E.fromGeometry(R(h,t.spatialReference),A.Local),this._backgroundGraphic=new e({symbol:new K({color:"transparent",outline:{type:"simple-line",color:i(),width:2}}),geometry:this._backgroundGraphicGeometry}),this._rotateGraphic=new e({symbol:new N({color:s(),outline:{type:"simple-line",color:i(),width:1}}),geometry:this._rotateGraphicGeometry}),this._scaleGraphics=this._scaleGraphicGeometries.map((t=>new e({symbol:new N({size:6,style:"square",color:s(),outline:{type:"simple-line",color:i(),width:1}}),geometry:t}))),this._graphicsLayer.graphics.addMany([this._backgroundGraphic,this._rotateGraphic,...this._scaleGraphics]),this._dragManipulation=new C({tool:this,view:t,graphic:this._graphic}),this._rotateManipulation=new S({tool:this,view:t,graphic:this._rotateGraphic,snapRotation:this._snapRotation}),this._scaleManipulations=this._scaleGraphics.map(((e,i)=>new M({tool:this,view:t,graphic:e,direction:X[i],preserveAspectRatio:this._preserveAspectRatio}))),this.addHandles([this._dragManipulation.createDragPipeline(this._getInfo.bind(this),this._updateGraphics.bind(this)),this._rotateManipulation.createDragPipeline(this._getInfo.bind(this),this._updateGraphics.bind(this)),...this._scaleManipulations.map((t=>t.createDragPipeline(this._getInfo.bind(this),this._updateGraphics.bind(this)))),n((()=>this.view.scale),(()=>this.active?this.updateGraphics():null)),t.on("click",(async e=>{if(null!=t.activeTool&&t.activeTool!==this)return;const i=I(e),s=[];t.map.allLayers.forEach((t=>{"vector-tile"!==t.type&&"imagery"!==t.type||s.push(t)}));const o=await this.view.hitTest(i,{exclude:s}),n=o.results;if(0===n.length)t.activeTool=null;else{const e=V(o.results),i="georeference"in a,s=n.map((t=>"media"===t.type?t.element:null)).filter(Boolean),h=[...this._graphicsLayer.graphics,i?null:a].filter(Boolean);i&&s.includes(a)||r(e)&&h.includes(e.graphic)?null==t.activeTool&&(t.activeTool=this):t.activeTool=null}}))]);const p=t=>{this.addHandles(t.events.on("grab-changed",(t=>{"georeference"in a&&("start"===t.action?a.opacity*=.5:"end"===t.action&&(a.opacity*=2))})))};this._dragManipulation.forEachManipulator(p),this._rotateManipulation.forEachManipulator(p),this._scaleManipulations.forEach((t=>t.forEachManipulator(p))),this.addHandles([t.on("key-down",(e=>{t.activeTool===this&&(e.key!==q.shift||e.repeat||(null==this.preserveAspectRatio&&(this._preserveAspectRatio.enabled=!this._preserveAspectRatio.enabled),null==this.snapRotation&&(this._snapRotation.enabled=!this._snapRotation.enabled),this._isModifierActive=!0,e.stopPropagation()),e.key!==q.toggleOpacity||e.repeat||("georeference"in a&&(a.opacity*=this._isOpacityToggled?2:.5,this._isOpacityToggled=!this._isOpacityToggled),e.stopPropagation()),e.key!==q.primaryKey||e.repeat||(this._factor=Z,e.stopPropagation()),this._isModifierActive&&(e.key===q.plus&&(this._scale(this._factor),e.stopPropagation()),e.key===q.minus&&(this._scale(-this._factor),e.stopPropagation()),e.key===q.up&&(this._move(0,this._factor),e.stopPropagation()),e.key===q.down&&(this._move(0,-this._factor),e.stopPropagation()),e.key===q.left&&(this._move(-this._factor,0),e.stopPropagation()),e.key===q.right&&(this._move(this._factor,0),e.stopPropagation())))})),t.on("key-up",(e=>{t.activeTool===this&&(e.key===q.shift&&(null==this.preserveAspectRatio&&(this._preserveAspectRatio.enabled=!this._preserveAspectRatio.enabled),null==this.snapRotation&&(this._snapRotation.enabled=!this._snapRotation.enabled),this._isModifierActive=!1,e.stopPropagation()),e.key===q.primaryKey&&(this._factor=Y,e.stopPropagation()))}))]),t.map.addMany([this._graphicsLayer]),t.focus(),this.visible=!1,this.finishToolCreation()}destroy(){const{map:t}=this.view;this._dragManipulation.destroy(),this._rotateManipulation.destroy(),this._scaleManipulations.forEach((t=>t.destroy())),this._editGeometryOperations.destroy(),t.removeMany([this._graphicsLayer]),this._graphicsLayer.removeAll(),this._graphicsLayer=a(this._graphicsLayer),this._initialControlPoints=null,this._initialGeometry=null,this._graphic=null,this._preserveAspectRatio=null,this._snapRotation=null,this._planeCache=null,this._displayPlaneCache=null,this._rotationHandleCache=null,this._mainAxisCache=null,this._cornerA=null,this._cornerB=null,this._cornerC=null,this._cornerD=null,this._avgAB=null,this._avgBC=null,this._avgCD=null,this._avgDA=null,this._sharedUndoStack=null,this._sharedRedoStack=null}get _plane(){const t=this._graphic.geometry;if(!r(t))return null;const e=this._editGeometryOperations.data,i=e.components[0].edges[0],s=l(this._mainAxisCache,i.leftVertex.pos,i.rightVertex.pos);_(s,s);let o=F*this.view.resolution;const a=this.view.spatialReference;return j(a,t.spatialReference)&&(o*=h(a)/h(t.spatialReference)),H(s,e,o,this._planeCache)}get _displayPlane(){const t=this._plane;if(!t)return null;const e=this._displayPlaneCache;k(t,e);const i=J*this.view.resolution;return y(e.basis1,e.basis1,1+i/u(e.basis1)),y(e.basis2,e.basis2,1+i/u(e.basis2)),e}get _backgroundGraphicGeometry(){const t=this._displayPlane;if(!t)return null;const e=this.view.spatialReference;return this._updateDisplayPlaneConrers(t),new z({spatialReference:e,rings:[[this._cornerA,this._cornerB,this._cornerC,this._cornerD,this._cornerA]]})}get _rotateGraphicGeometry(){const t=this._plane;if(!t)return null;const e=this._rotationHandleCache;return g(e,t.basis1),y(e,e,Q*this.view.resolution),f(e,e,t.origin),f(e,e,t.basis1),new W({x:e[0],y:e[1],spatialReference:this.view.spatialReference})}get _scaleGraphicGeometries(){const t=this._displayPlane;if(!t)return[];const e=this.view.spatialReference;this._updateDisplayPlaneConrers(t);const{_cornerA:i,_cornerB:s,_cornerC:o,_cornerD:r}=this,a=v(this._avgAB,i,s,.5),n=v(this._avgBC,s,o,.5),h=v(this._avgCD,o,r,.5),p=v(this._avgDA,r,i,.5);return[new W({x:i[0],y:i[1],spatialReference:e}),new W({x:s[0],y:s[1],spatialReference:e}),new W({x:o[0],y:o[1],spatialReference:e}),new W({x:r[0],y:r[1],spatialReference:e}),new W({x:a[0],y:a[1],spatialReference:e}),new W({x:n[0],y:n[1],spatialReference:e}),new W({x:h[0],y:h[1],spatialReference:e}),new W({x:p[0],y:p[1],spatialReference:e})]}onActivate(){this.visible=!0}onDeactivate(){this.visible=!1}onShow(){this._graphicsLayer.visible=!0}onHide(){this._graphicsLayer.visible=!1}canUndo(){return this._editGeometryOperations.canUndo}canRedo(){return this._editGeometryOperations.canRedo}undo(){this._editGeometryOperations.undo(),this.updateGraphics()}redo(){this._editGeometryOperations.redo(),this.updateGraphics()}refresh(){const{view:t,target:e}=this,i="georeference"in e?o(o(e.georeference).coords):e.geometry,s=this._editGeometryOperations,r=s.data.components[0].vertices,a=x.fromGeometry(R(i,t.spatialReference),A.Local).components[0].vertices;r.forEach(((t,e)=>{s.setVertexPosition(t,a[e].pos)})),this.updateGraphics()}reset(){const{target:t}=this;if("georeference"in t){const e=o(t.georeference);"control-points"===e.type&&(e.controlPoints=this._initialControlPoints)}else t.geometry=this._initialGeometry;this.refresh(),this._sharedUndoStack.length=0,this._sharedRedoStack.length=0}updateGraphics(){const t=this._editGeometryOperations.data.geometry;if("georeference"in this.target){o(this.target.georeference).coords=t}this._graphic.geometry=t,this._backgroundGraphic.geometry=this._backgroundGraphicGeometry,this._rotateGraphic.geometry=this._rotateGraphicGeometry,this._scaleGraphicGeometries.forEach(((t,e)=>{this._scaleGraphics[e].geometry=t}))}setSharedUndoStack(t){this._sharedUndoStack=t}setSharedRedoStack(t){this._sharedRedoStack=t}_updateDisplayPlaneConrers(t){const{basis1:e,basis2:i,origin:s}=t,o=this._cornerA;f(o,s,e),f(o,o,i);const r=this._cornerB;f(r,s,e),G(r,r,i);const a=this._cornerC;G(a,s,e),G(a,a,i);const n=this._cornerD;G(n,s,e),f(n,n,i)}_getInfo(){return{editGeometryOperations:this._editGeometryOperations,plane:this._plane,displayPlane:this._displayPlane}}_updateGraphics(t,e){"start"===t.action&&(this._sharedUndoStack.push({tool:this,operation:e}),this._sharedRedoStack.length=0),this.updateGraphics()}_scale(t){const e=this._editGeometryOperations,i=[];for(const a of e.data.components)i.push(...a.vertices);const s=e.data.geometry.extent?.width,o=(s+t*this.view.resolution)/s,r=e.scaleVertices(i,this._plane.origin,d,o,o,L.NEW_STEP,B.REPLACE);this._sharedUndoStack.push({tool:this,operation:r}),this._sharedRedoStack.length=0,this.updateGraphics()}_move(t,e){const i=this._editGeometryOperations,s=[];for(const r of i.data.components)s.push(...r.vertices);const o=i.moveVertices(s,t*this.view.resolution,e*this.view.resolution,0,L.NEW_STEP);this._sharedUndoStack.push({tool:this,operation:o}),this._sharedRedoStack.length=0,this.updateGraphics()}};t([p()],$.prototype,"_plane",null),t([p()],$.prototype,"_backgroundGraphicGeometry",null),t([p()],$.prototype,"_rotateGraphicGeometry",null),t([p()],$.prototype,"_scaleGraphicGeometries",null),t([p()],$.prototype,"preserveAspectRatio",void 0),t([p()],$.prototype,"snapRotation",void 0),t([p({constructOnly:!0,nonNullable:!0})],$.prototype,"target",void 0),t([p({constructOnly:!0})],$.prototype,"view",void 0),$=t([c("esri.views.2d.interactive.editingTools.TransformTool")],$);export{q as KEYS,$ as TransformTool};
|
|
5
|
+
import{_ as t}from"../../../../chunks/tslib.es6.js";import"../../../../geometry.js";import e from"../../../../Graphic.js";import"../../../../symbols.js";import{getAccentColor as i,getContrastColor as s}from"../../../../core/analysisThemeUtils.js";import{destroyMaybe as o,isSome as r,unwrap as a}from"../../../../core/maybe.js";import{watch as n}from"../../../../core/reactiveUtils.js";import{getMetersPerUnitForSR as h}from"../../../../core/unitUtils.js";import{property as c}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/accessorSupport/ensureType.js";import"../../../../core/arrayUtils.js";import{subclass as p}from"../../../../core/accessorSupport/decorators/subclass.js";import{a as l,f as _}from"../../../../chunks/vec2.js";import{a as m,U as d}from"../../../../chunks/vec2f64.js";import{g as y,l as u,n as g,a as f,h as v,b as G}from"../../../../chunks/vec3.js";import{c as w}from"../../../../chunks/vec3f64.js";import{project as R,initializeProjection as b}from"../../../../geometry/projection.js";import{a as k,c as j}from"../../../../chunks/boundedPlane.js";import{equals as P}from"../../../../geometry/support/spatialReferenceUtils.js";import A from"../../../../layers/GraphicsLayer.js";import{ViewingMode as C}from"../../../ViewingMode.js";import{DragManipulation as S}from"./manipulations/DragManipulation.js";import{RotateManipulation as M}from"./manipulations/RotateManipulation.js";import{ScaleManipulation as T}from"./manipulations/ScaleManipulation.js";import{PreserveAspectRatio as O,SnapRotation as U}from"./manipulations/utils.js";import{primaryKey as D}from"../../../input/keys.js";import{InteractiveToolBase as x}from"../../../interactive/InteractiveToolBase.js";import{EditGeometry as E}from"../../../interactive/editGeometry/EditGeometry.js";import{EditGeometryOperations as L}from"../../../interactive/editGeometry/EditGeometryOperations.js";import{AccumulationBehaviour as B}from"../../../interactive/editGeometry/interfaces.js";import{AccumulationType as H}from"../../../interactive/editGeometry/operations/UpdateVertices.js";import{calculateOrientedBounds as V}from"../../../interactive/editGeometry/support/editPlaneUtils.js";import{findFirstGraphicHit as I}from"../../../support/hitTestSelectUtils.js";import{createScreenPointFromEvent as z}from"../../../support/screenUtils.js";import K from"../../../../geometry/Polygon.js";import N from"../../../../geometry/Point.js";import W from"../../../../symbols/SimpleFillSymbol.js";import q from"../../../../symbols/SimpleMarkerSymbol.js";const F={up:"ArrowUp",down:"ArrowDown",left:"ArrowLeft",right:"ArrowRight",plus:"+",minus:"-",toggleOpacity:"t",shift:"Shift",primaryKey:D},J=80,Q=10,X=30,Y=[[1,1],[1,-1],[-1,-1],[-1,1],[1,0],[0,-1],[-1,0],[0,1]],Z=1,$=10;let tt=class extends x{constructor(t){super(t),this._initialControlPoints=null,this._initialGeometry=null,this._graphic=null,this._planeCache=k(),this._displayPlaneCache=k(),this._mainAxisCache=m(),this._rotationHandleCache=w(),this._cornerA=w(),this._cornerB=w(),this._cornerC=w(),this._cornerD=w(),this._avgAB=w(),this._avgBC=w(),this._avgCD=w(),this._avgDA=w(),this._preserveAspectRatio=new O,this._snapRotation=new U,this._graphicsLayer=new A({internal:!0,listMode:"hide",visible:!1}),this._sharedUndoStack=[],this._sharedRedoStack=[],this._isOpacityToggled=!1,this._isModifierActive=!1,this._factor=1,this.preserveAspectRatio=null,this.snapRotation=null}initialize(){this._initialize()}destroy(){const{map:t}=this.view;this._dragManipulation.destroy(),this._rotateManipulation.destroy(),this._scaleManipulations.forEach((t=>t.destroy())),this._editGeometryOperations.destroy(),t.removeMany([this._graphicsLayer]),this._graphicsLayer.removeAll(),this._graphicsLayer=o(this._graphicsLayer),this._initialControlPoints=null,this._initialGeometry=null,this._graphic=null,this._preserveAspectRatio=null,this._snapRotation=null,this._planeCache=null,this._displayPlaneCache=null,this._rotationHandleCache=null,this._mainAxisCache=null,this._cornerA=null,this._cornerB=null,this._cornerC=null,this._cornerD=null,this._avgAB=null,this._avgBC=null,this._avgCD=null,this._avgDA=null,this._sharedUndoStack=null,this._sharedRedoStack=null}get _plane(){const t=this._graphic.geometry;if(!r(t))return null;const e=this._editGeometryOperations.data,i=e.components[0].edges[0],s=l(this._mainAxisCache,i.leftVertex.pos,i.rightVertex.pos);_(s,s);let o=J*this.view.resolution;const a=this.view.spatialReference;return P(a,t.spatialReference)&&(o*=h(a)/h(t.spatialReference)),V(s,e,o,this._planeCache)}get _displayPlane(){const t=this._plane;if(!t)return null;const e=this._displayPlaneCache;j(t,e);const i=Q*this.view.resolution;return y(e.basis1,e.basis1,1+i/u(e.basis1)),y(e.basis2,e.basis2,1+i/u(e.basis2)),e}get _backgroundGraphicGeometry(){const t=this._displayPlane;if(!t)return null;const e=this.view.spatialReference;return this._updateDisplayPlaneConrers(t),new K({spatialReference:e,rings:[[this._cornerA,this._cornerB,this._cornerC,this._cornerD,this._cornerA]]})}get _rotateGraphicGeometry(){const t=this._plane;if(!t)return null;const e=this._rotationHandleCache;return g(e,t.basis1),y(e,e,X*this.view.resolution),f(e,e,t.origin),f(e,e,t.basis1),new N({x:e[0],y:e[1],spatialReference:this.view.spatialReference})}get _scaleGraphicGeometries(){const t=this._displayPlane;if(!t)return[];const e=this.view.spatialReference;this._updateDisplayPlaneConrers(t);const{_cornerA:i,_cornerB:s,_cornerC:o,_cornerD:r}=this,a=v(this._avgAB,i,s,.5),n=v(this._avgBC,s,o,.5),h=v(this._avgCD,o,r,.5),c=v(this._avgDA,r,i,.5);return[new N({x:i[0],y:i[1],spatialReference:e}),new N({x:s[0],y:s[1],spatialReference:e}),new N({x:o[0],y:o[1],spatialReference:e}),new N({x:r[0],y:r[1],spatialReference:e}),new N({x:a[0],y:a[1],spatialReference:e}),new N({x:n[0],y:n[1],spatialReference:e}),new N({x:h[0],y:h[1],spatialReference:e}),new N({x:c[0],y:c[1],spatialReference:e})]}onActivate(){this.visible=!0}onDeactivate(){this.visible=!1}onShow(){this._graphicsLayer.visible=!0}onHide(){this._graphicsLayer.visible=!1}canUndo(){return this._editGeometryOperations.canUndo}canRedo(){return this._editGeometryOperations.canRedo}undo(){this._editGeometryOperations.undo(),this.updateGraphics()}redo(){this._editGeometryOperations.redo(),this.updateGraphics()}refresh(){const{view:t,target:e}=this,i="georeference"in e?a(a(e.georeference).coords):e.geometry,s=this._editGeometryOperations,o=s.data.components[0].vertices,r=E.fromGeometry(R(i,t.spatialReference),C.Local).components[0].vertices;o.forEach(((t,e)=>{s.setVertexPosition(t,r[e].pos)})),this.updateGraphics()}reset(){const{target:t}=this;if("georeference"in t){const e=a(t.georeference);"control-points"===e.type&&(e.controlPoints=this._initialControlPoints)}else t.geometry=this._initialGeometry;this.refresh(),this._sharedUndoStack.length=0,this._sharedRedoStack.length=0}updateGraphics(){const t=this._editGeometryOperations.data.geometry;if("georeference"in this.target){a(this.target.georeference).coords=t}this._graphic.geometry=t,this._backgroundGraphic.geometry=this._backgroundGraphicGeometry,this._rotateGraphic.geometry=this._rotateGraphicGeometry,this._scaleGraphicGeometries.forEach(((t,e)=>{this._scaleGraphics[e].geometry=t}))}setSharedUndoStack(t){this._sharedUndoStack=t}setSharedRedoStack(t){this._sharedRedoStack=t}async _initialize(){const{view:t,target:o}=this;if("georeference"in o){const t=a(o.georeference);this._graphic=new e({geometry:a(t.coords)}),this._initialControlPoints="control-points"===t.type?t.controlPoints:null}else this._graphic=o,this._initialGeometry=a(o.geometry);t.map.addMany([this._graphicsLayer]),t.focus(),this.visible=!1,this.finishToolCreation(),await this._loadProjectionEngine(),this._editGeometryOperations=L.fromGeometry(R(this._graphic.geometry,t.spatialReference),C.Local),this._backgroundGraphic=new e({symbol:new W({color:"transparent",outline:{type:"simple-line",color:i(),width:2}}),geometry:this._backgroundGraphicGeometry}),this._rotateGraphic=new e({symbol:new q({color:s(),outline:{type:"simple-line",color:i(),width:1}}),geometry:this._rotateGraphicGeometry}),this._scaleGraphics=this._scaleGraphicGeometries.map((t=>new e({symbol:new q({size:6,style:"square",color:s(),outline:{type:"simple-line",color:i(),width:1}}),geometry:t}))),this._graphicsLayer.graphics.addMany([this._backgroundGraphic,this._rotateGraphic,...this._scaleGraphics]),this._dragManipulation=new S({tool:this,view:t,graphic:this._graphic}),this._rotateManipulation=new M({tool:this,view:t,graphic:this._rotateGraphic,snapRotation:this._snapRotation}),this._scaleManipulations=this._scaleGraphics.map(((e,i)=>new T({tool:this,view:t,graphic:e,direction:Y[i],preserveAspectRatio:this._preserveAspectRatio}))),this.addHandles([this._dragManipulation.createDragPipeline(this._getInfo.bind(this),this._updateGraphics.bind(this)),this._rotateManipulation.createDragPipeline(this._getInfo.bind(this),this._updateGraphics.bind(this)),...this._scaleManipulations.map((t=>t.createDragPipeline(this._getInfo.bind(this),this._updateGraphics.bind(this)))),n((()=>this.view.scale),(()=>this.active?this.updateGraphics():null)),t.on("click",(async e=>{if(null!=t.activeTool&&t.activeTool!==this)return;const i=z(e),s=[];t.map.allLayers.forEach((t=>{"vector-tile"!==t.type&&"imagery"!==t.type||s.push(t)}));const a=await this.view.hitTest(i,{exclude:s}),n=a.results;if(0===n.length)t.activeTool=null;else{const e=I(a.results),i="georeference"in o,s=n.map((t=>"media"===t.type?t.element:null)).filter(Boolean),h=[...this._graphicsLayer.graphics,i?null:o].filter(Boolean);i&&s.includes(o)||r(e)&&h.includes(e.graphic)?null==t.activeTool&&(t.activeTool=this):t.activeTool=null}}))]);const h=t=>{this.addHandles(t.events.on("grab-changed",(t=>{"georeference"in o&&("start"===t.action?o.opacity*=.5:"end"===t.action&&(o.opacity*=2))})))};this._dragManipulation.forEachManipulator(h),this._rotateManipulation.forEachManipulator(h),this._scaleManipulations.forEach((t=>t.forEachManipulator(h))),this.addHandles([t.on("key-down",(e=>{t.activeTool===this&&(e.key!==F.shift||e.repeat||(null==this.preserveAspectRatio&&(this._preserveAspectRatio.enabled=!this._preserveAspectRatio.enabled),null==this.snapRotation&&(this._snapRotation.enabled=!this._snapRotation.enabled),this._isModifierActive=!0,e.stopPropagation()),e.key!==F.toggleOpacity||e.repeat||("georeference"in o&&(o.opacity*=this._isOpacityToggled?2:.5,this._isOpacityToggled=!this._isOpacityToggled),e.stopPropagation()),e.key!==F.primaryKey||e.repeat||(this._factor=$,e.stopPropagation()),this._isModifierActive&&(e.key===F.plus&&(this._scale(this._factor),e.stopPropagation()),e.key===F.minus&&(this._scale(-this._factor),e.stopPropagation()),e.key===F.up&&(this._move(0,this._factor),e.stopPropagation()),e.key===F.down&&(this._move(0,-this._factor),e.stopPropagation()),e.key===F.left&&(this._move(-this._factor,0),e.stopPropagation()),e.key===F.right&&(this._move(this._factor,0),e.stopPropagation())))})),t.on("key-up",(e=>{t.activeTool===this&&(e.key===F.shift&&(null==this.preserveAspectRatio&&(this._preserveAspectRatio.enabled=!this._preserveAspectRatio.enabled),null==this.snapRotation&&(this._snapRotation.enabled=!this._snapRotation.enabled),this._isModifierActive=!1,e.stopPropagation()),e.key===F.primaryKey&&(this._factor=Z,e.stopPropagation()))}))])}async _loadProjectionEngine(){const t=a(this._graphic.geometry);return b(t.spatialReference,this.view.spatialReference)}_updateDisplayPlaneConrers(t){const{basis1:e,basis2:i,origin:s}=t,o=this._cornerA;f(o,s,e),f(o,o,i);const r=this._cornerB;f(r,s,e),G(r,r,i);const a=this._cornerC;G(a,s,e),G(a,a,i);const n=this._cornerD;G(n,s,e),f(n,n,i)}_getInfo(){return{editGeometryOperations:this._editGeometryOperations,plane:this._plane,displayPlane:this._displayPlane}}_updateGraphics(t,e){"start"===t.action&&(this._sharedUndoStack.push({tool:this,operation:e}),this._sharedRedoStack.length=0),this.updateGraphics()}_scale(t){const e=this._editGeometryOperations,i=[];for(const a of e.data.components)i.push(...a.vertices);const s=e.data.geometry.extent?.width,o=(s+t*this.view.resolution)/s,r=e.scaleVertices(i,this._plane.origin,d,o,o,B.NEW_STEP,H.REPLACE);this._sharedUndoStack.push({tool:this,operation:r}),this._sharedRedoStack.length=0,this.updateGraphics()}_move(t,e){const i=this._editGeometryOperations,s=[];for(const r of i.data.components)s.push(...r.vertices);const o=i.moveVertices(s,t*this.view.resolution,e*this.view.resolution,0,B.NEW_STEP);this._sharedUndoStack.push({tool:this,operation:o}),this._sharedRedoStack.length=0,this.updateGraphics()}};t([c()],tt.prototype,"_plane",null),t([c()],tt.prototype,"_backgroundGraphicGeometry",null),t([c()],tt.prototype,"_rotateGraphicGeometry",null),t([c()],tt.prototype,"_scaleGraphicGeometries",null),t([c()],tt.prototype,"preserveAspectRatio",void 0),t([c()],tt.prototype,"snapRotation",void 0),t([c({constructOnly:!0,nonNullable:!0})],tt.prototype,"target",void 0),t([c({constructOnly:!0})],tt.prototype,"view",void 0),tt=t([p("esri.views.2d.interactive.editingTools.TransformTool")],tt);export{F as KEYS,tt as TransformTool};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.26/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../../../chunks/tslib.es6.js";import{isSome as r}from"../../../../core/maybe.js";import{property as t}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/accessorSupport/ensureType.js";import"../../../../core/arrayUtils.js";import{subclass as s}from"../../../../core/accessorSupport/decorators/subclass.js";import{RasterTileContainer as i}from"../../engine/imagery/RasterTileContainer.js";import{BaseImageryTileSubView2D as o}from"./BaseImageryTileSubView2D.js";import{canUseMajorityInterpolationOnDataSource as a}from"../support/util.js";let n=class extends o{constructor(){super(...arguments),this.type="raster"}attach(){super.attach(),this.container=new i(this._tileInfoView),this.container.isCustomTilingScheme=this._isCustomTilingScheme,this.updateRasterFunctionParameters()}detach(){super.detach(),this.container.removeAllChildren(),this.container=null}canUseWebGLForProcessing(){return this.useWebGLForProcessing&&this.layer.symbolizer.canRenderInWebGL&&!("majority"===this.layer.interpolation&&a(this.layer))}fetchTile(e,r){return this.layer.fetchTile(e.level,e.row,e.col,r)}updateRasterFunctionParameters(){const{raster:e,type:r}=this.layer,{container:t}=this;if("Function"!==e.datasetFormat||"wcs"===r)return t.rasterFunctionChain=null,t.children.forEach((e=>{const{bitmap:r}=e;r&&(r.suspended=!0,r.processed=!1,r.projected&&(r.invalidateTexture(),r.rasterTexture=null))})),void(this._rasterFunctionState="na");const{rasterFunction:
|
|
5
|
+
import{_ as e}from"../../../../chunks/tslib.es6.js";import{isSome as r}from"../../../../core/maybe.js";import{property as t}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/accessorSupport/ensureType.js";import"../../../../core/arrayUtils.js";import{subclass as s}from"../../../../core/accessorSupport/decorators/subclass.js";import{RasterTileContainer as i}from"../../engine/imagery/RasterTileContainer.js";import{BaseImageryTileSubView2D as o}from"./BaseImageryTileSubView2D.js";import{canUseMajorityInterpolationOnDataSource as a}from"../support/util.js";let n=class extends o{constructor(){super(...arguments),this.type="raster"}attach(){super.attach(),this.container=new i(this._tileInfoView),this.container.isCustomTilingScheme=this._isCustomTilingScheme,this.updateRasterFunctionParameters()}detach(){super.detach(),this.container.removeAllChildren(),this.container=null}canUseWebGLForProcessing(){return this.useWebGLForProcessing&&this.layer.symbolizer.canRenderInWebGL&&!("majority"===this.layer.interpolation&&a(this.layer))}fetchTile(e,r){return this.layer.fetchTile(e.level,e.row,e.col,r)}updateRasterFunctionParameters(){const{raster:e,type:r}=this.layer,{container:t}=this;if("Function"!==e.datasetFormat||"wcs"===r)return t.rasterFunctionChain=null,t.children.forEach((e=>{const{bitmap:r}=e;r&&(r.suspended=!0,r.processed=!1,r.projected&&(r.invalidateTexture(),r.rasterTexture=null))})),void(this._rasterFunctionState="na");const s=this._rasterFunctionState,{rasterFunction:i,primaryRasters:o}=e,a=i.supportsGPU&&(!o||o.rasters.length<=1),n=a?i.getFlatWebGLFunctionChain():null,{renderer:l}=this.layer,c=!a||!n?.functions.length||"raster-stretch"===l.type&&l.dynamicRangeAdjustment||!this.canUseWebGLForProcessing();t.rasterFunctionChain=c?null:n;const u=null==i?"na":t.rasterFunctionChain?"gpu":"cpu";t.children.forEach((e=>{const{bitmap:r}=e;r&&(r.suspended=s!==u,r.processed=!1,r.processedTexture=null)})),this._rasterFunctionState=u}async updateTileSource(e,t){const s=this._getBandIds(),i=this._getLayerInterpolation(),o=this.canUseWebGLForProcessing(),{source:a,globalSymbolizerParams:n,suspended:l,coords:c,resolution:u}=t,p=this.layerView.hasTilingEffects?n:t.symbolizerParams,{bitmap:d}=e;if([d.x,d.y]=c,d.resolution=u,a&&r(a)&&r(a.pixelBlock)){const e={extent:a.extent,pixelBlock:a.pixelBlock};if(d.rawPixelData=e,o)d.source=a.pixelBlock,d.isRendereredSource=!1;else{const r=await this.layer.applyRenderer(e,"stretch"===n?.type?n:void 0);d.source=r,d.isRendereredSource=!0}d.symbolizerParameters=o?p:null,o?d.transformGrid||(d.transformGrid=a.transformGrid):d.transformGrid=null}else{const e=this.createEmptyTilePixelBlock();d.source=e,d.symbolizerParameters=o?p:null,d.transformGrid=null}d.bandIds=o?s:null,d.width=this._tileInfoView.tileInfo.size[0],d.height=this._tileInfoView.tileInfo.size[1],d.interpolation=i,d.suspended=l,d.invalidateTexture()}async updateTileSymbolizerParameters(e,t){const{local:s,global:i}=t,o=this._getBandIds(),a=this._getLayerInterpolation(),n=this.canUseWebGLForProcessing(),{bitmap:l}=e,{rawPixelData:c}=l;!n&&r(c)?(l.source=await this.layer.applyRenderer(c,"stretch"===i?.type?i:void 0),l.isRendereredSource=!0):(l.isRendereredSource&&r(c)&&(l.source=c.pixelBlock),l.isRendereredSource=!1),l.symbolizerParameters=n?this.layerView.hasTilingEffects?i:s:null,l.bandIds=n?o:null,l.interpolation=a,l.suspended=!1}_getLayerInterpolation(){const e=this.layer.renderer.type;if("raster-colormap"===e||"unique-value"===e||"class-breaks"===e)return"nearest";const{interpolation:r}=this.layer,{renderer:t}=this.layer;return"raster-stretch"===t.type&&null!=t.colorRamp?"bilinear"===r||"cubic"===r?"bilinear":"nearest":r}};e([t()],n.prototype,"container",void 0),e([t()],n.prototype,"layer",void 0),e([t()],n.prototype,"type",void 0),n=e([s("esri.views.2d.layers.imagery.ImageryTileView2D")],n);const l=n;export{l as default};
|