@arcgis/core 4.31.0-next.20240521 → 4.31.0-next.20240523
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/{d7722531be4892293cb1.js → 00c49f6c84444e69f3a1.js} +1 -1
- package/assets/esri/core/workers/chunks/01927419855947110cc1.js.LICENSE.txt +1 -1
- package/assets/esri/core/workers/chunks/{df26d7d07fed1f124fc2.js → 0903b492782dca69eb48.js} +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/{2529a4b1e135223833f0.js → 2635ab64e75d4ec700a8.js} +1 -1
- package/assets/esri/core/workers/chunks/{f965644347007e3d68e2.js → 27dc94db9ed42b237ecb.js} +1 -1
- package/assets/esri/core/workers/chunks/36d620a9c051e451e6b3.js +1 -0
- package/assets/esri/core/workers/chunks/{0ae3ea7a73f3b5083968.js → 3a01cf7e3355f3c78378.js} +1 -1
- package/assets/esri/core/workers/chunks/4268373bf374b2a6252a.js.LICENSE.txt +1 -1
- package/assets/esri/core/workers/chunks/43e1c935452b489e422e.js +1 -0
- package/assets/esri/core/workers/chunks/{15212a82e283d6df2873.js → 4ae885f257660545ceeb.js} +1 -1
- package/assets/esri/core/workers/chunks/{4ea2ced4b5ea1c8a1cee.js → 4ba866a10711b6a8158f.js} +1 -1
- package/assets/esri/core/workers/chunks/50ee28a1944bde74a7c1.js +1 -0
- package/assets/esri/core/workers/chunks/59b193d42e8abf9d4088.js.LICENSE.txt +1 -1
- package/assets/esri/core/workers/chunks/{eafbe663f7a61d3222c5.js → 5efe1300a39ab9c7bbab.js} +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/{5349b0de83ae4be8afe2.js → 6c1ded9acf5c8be493ea.js} +1 -1
- package/assets/esri/core/workers/chunks/{46225ebc10a4398170b5.js → 712ba8ad69b1aab6f508.js} +1 -1
- package/assets/esri/core/workers/chunks/{7d210c2a5a135da2c37d.js → 7c68dc664c0b4cf2a46b.js} +1 -1
- package/assets/esri/core/workers/chunks/88c7d84a1fde246ca71f.js +1 -0
- package/assets/esri/core/workers/chunks/948867b3c17f6c0e753a.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/{9a217c5c55ce6fb1d3cd.js → a111eb0ae78a9f5be981.js} +1 -1
- package/assets/esri/core/workers/chunks/a6b138f330625d98f856.js +1 -0
- package/assets/esri/core/workers/chunks/{e4a0fd9e0f8887009b92.js → a8a19e5a7ae4ec16480a.js} +1 -1
- package/assets/esri/core/workers/chunks/{fcf0016d56df8a69f6c1.js → aa198e898b46c6e89d0b.js} +1 -1
- package/assets/esri/core/workers/chunks/{04faa3bf4ef5a6f0ccb4.js → b3de9bc3e75476b0a7e9.js} +1 -1
- package/assets/esri/core/workers/chunks/b61e458ef5021adba1cb.js +1 -0
- package/assets/esri/core/workers/chunks/{bd0545bb100b3393fd85.js → bbec62f8792520993909.js} +1 -1
- package/assets/esri/core/workers/chunks/bf6e75cc75d3bdfb70cb.js +1 -0
- package/assets/esri/core/workers/chunks/{5acac4616c53a95cc48f.js → c0c8e1a709648e1305c6.js} +1 -1
- package/assets/esri/core/workers/chunks/{4f3a87586e334c52d0bf.js → caffbaa8b0a67d117f34.js} +1 -1
- package/assets/esri/core/workers/chunks/{7b4ed96554722be59ae2.js → d8140b5316e80d734155.js} +1 -1
- package/assets/esri/core/workers/chunks/dde183c6bb1710ff16df.js.LICENSE.txt +1 -1
- package/assets/esri/core/workers/chunks/e3711bc5b100b64cac3a.js +1 -0
- package/assets/esri/core/workers/chunks/{2d5d66cee7c3ec992bcd.js → e93e59f6907fa4c1081c.js} +1 -1
- package/assets/esri/images/portal/knowledgegraphlayer16.png +0 -0
- package/assets/esri/themes/base/widgets/_FeatureTable.scss +15 -1
- package/assets/esri/themes/base/widgets/_Grid.scss +4 -1
- package/assets/esri/themes/dark/main.css +1 -1
- package/assets/esri/themes/light/main.css +1 -1
- package/assets/esri/themes/light/view.css +1 -1
- package/assets/esri/widgets/FeatureTable/t9n/FeatureTable.json +1 -1
- package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_en.json +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/core/sql/WhereClause.js +1 -1
- package/core/workers/InvokeHandler.js +1 -1
- package/core/workers/RemoteClient.js +1 -1
- package/interfaces.d.ts +568 -48
- package/layers/ImageryTileLayer.js +1 -1
- package/layers/LinkChartLayer.js +1 -1
- package/layers/knowledgeGraph/KnowledgeGraphLayerDataManager.js +1 -1
- package/layers/mixins/OperationalLayer.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/rest/print.js +1 -1
- package/rest/support/printTaskUtils.js +1 -1
- package/smartMapping/renderers/support/referenceSizeUtils.js +1 -1
- package/smartMapping/support/adapters/support/layerUtils.js +1 -1
- package/support/revision.js +1 -1
- package/symbols/cim/effects/EffectControlMeasureLine.js +1 -1
- package/views/2d/GoToManager.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/labels/LabelMeshWriter.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/mesh/utils.js +1 -1
- package/views/2d/layers/FeatureLayerView2D.js +1 -1
- package/views/2d/layers/features/FeaturePipelineWorker.js +1 -1
- package/views/2d/layers/features/PipelineConnectionHandlers.js +1 -1
- package/views/2d/layers/features/Processor.js +1 -1
- package/views/2d/layers/features/sources/FeatureSource.js +1 -1
- package/views/2d/layers/features/sources/FeatureSourceQueryInfo.js +1 -1
- package/views/2d/layers/features/sources/strategies/AFetchLoadStrategy.js +1 -1
- package/views/2d/layers/support/FeatureCommandQueue.js +1 -1
- package/views/3d/environment/SceneViewEnvironmentManager.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/SceneView.js +1 -1
- package/views/interactive/tooltip/tooltipCommonUtils.js +1 -1
- package/views/layers/ImageryTileLayerView.js +1 -1
- package/webdoc/support/SlideThumbnail.js +1 -1
- package/widgets/Bookmarks/BookmarksUserState.js +1 -1
- package/widgets/Bookmarks.js +1 -1
- package/widgets/CatalogLayerList/CatalogLayerListViewModel.d.ts +4 -0
- package/widgets/CatalogLayerList.d.ts +4 -0
- package/widgets/CatalogLayerList.js +1 -1
- package/widgets/DirectionalPad/DirectionalPadViewModel.js +1 -1
- package/widgets/Expand.js +1 -1
- package/widgets/FeatureForm/support/textManipulationUtils.js +1 -1
- package/widgets/FeatureTable/VisibleElements.js +1 -1
- package/widgets/FeatureTable/support/FeatureStore.js +1 -1
- package/widgets/FeatureTable.js +1 -1
- package/widgets/Features/FeaturesViewModel.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/widgets/VideoPlayer/components/SettingsButton.js +1 -1
- package/assets/esri/core/workers/chunks/0753c636c2801f067235.js +0 -1
- package/assets/esri/core/workers/chunks/50936725c9bd23b780ef.js +0 -1
- package/assets/esri/core/workers/chunks/5c8c5290b9fcb5a4468f.js +0 -1
- package/assets/esri/core/workers/chunks/7745209175eb744aee5c.js +0 -1
- package/assets/esri/core/workers/chunks/80b1b1e8f3f7b9d2ad20.js +0 -1
- package/assets/esri/core/workers/chunks/aa020d495f464eff0134.js +0 -1
- package/assets/esri/core/workers/chunks/bf2af659da8e33d3c8bf.js +0 -1
- package/assets/esri/core/workers/chunks/cbb3a56e4072cdf25a9d.js +0 -1
- package/assets/esri/core/workers/chunks/fb48e8e42379fdf8a094.js +0 -1
- package/views/3d/interactive/editingTools/transform/undoRecords.js +0 -5
- package/views/3d/support/MapCoordsHelper.js +0 -5
- package/widgets/Bookmarks/bookmarkUtils.js +0 -5
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.31/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import"../../../symbols.js";import e from"../../../core/Error.js";import{clone as r}from"../../../core/lang.js";import n from"../../../renderers/visualVariables/support/SizeStop.js";import{PlacementPolygonCenterMethod as
|
|
5
|
+
import"../../../symbols.js";import e from"../../../core/Error.js";import{clone as r}from"../../../core/lang.js";import n from"../../../renderers/visualVariables/support/SizeStop.js";import{PlacementPolygonCenterMethod as t}from"../../../symbols/cim/enums.js";import i from"../../../symbols/CIMSymbol.js";var o;function a(r){if(null!=r.minDataValue&&null!=r.maxDataValue&&null!=r.minSize&&null!=r.maxSize&&"number"==typeof r.minSize&&"number"==typeof r.maxSize)return[new n({value:r.minDataValue,size:r.minSize}),new n({value:r.maxDataValue,size:r.maxSize})];throw new e("create-reference-size-symbol","Invalid size variable")}function l(e){const{view:r,field:n,normalizationField:t,sizeStops:i,sizeByScaleEnabled:a}=e,{value:l,size:s}=i[0],{value:m,size:c}=i[1];let u,y=0;n&&(y=`$feature["${n}"]`,u=`\n if(!HasKey($feature, "${n}")){\n return null;\n }\n $feature["${n}"];\n `),t&&(y=`$feature["${n}"] / $feature["${t}"]`,u=`if(!HasValue($feature, "${n}") || !HasValue($feature, "${t}") || $feature["${t}"] <= 0){\n return 0;\n }\n $feature["${n}"];\n $feature["${t}"];`);const p={type:"CIMExpressionInfo",title:"Size in pixels of outer ring",expression:a?`\n var maxSize = ${c};\n var referenceScale = ${r.scale};\n return (maxSize * (referenceScale / $view.scale));\n `:`${c}`,returnType:"Default"},f={type:"CIMExpressionInfo",title:"Size in pixels of inner ring",expression:`\n ${u}\n var value = ${y};\n\n var referenceScale = ${r.scale};\n var referenceScaleRatio = ${a?"(referenceScale / $view.scale)":1};\n var maxSize = ${c} * referenceScaleRatio;\n var minSize = ${s} * referenceScaleRatio;\n\n var minDataValue = ${l};\n var maxDataValue = ${m};\n\n var ratio = Constrain(( value - minDataValue ) / ( maxDataValue - minDataValue ), 0, 1);\n\n var innerDotSize = Constrain(maxSize * ratio, minSize, maxSize);\n return innerDotSize;\n `,returnType:"Default"};return[{type:"CIMPrimitiveOverride",primitiveName:o.OuterRing,propertyName:"Size",valueExpressionInfo:p},{type:"CIMPrimitiveOverride",primitiveName:o.InnerDot,propertyName:"Size",valueExpressionInfo:f}]}function s(e){switch(e){case"circle":return{rings:[[[8.5,.2],[7.06,.33],[5.66,.7],[4.35,1.31],[3.16,2.14],[2.14,3.16],[1.31,4.35],[.7,5.66],[.33,7.06],[.2,8.5],[.33,9.94],[.7,11.34],[1.31,12.65],[2.14,13.84],[3.16,14.86],[4.35,15.69],[5.66,16.3],[7.06,16.67],[8.5,16.8],[9.94,16.67],[11.34,16.3],[12.65,15.69],[13.84,14.86],[14.86,13.84],[15.69,12.65],[16.3,11.34],[16.67,9.94],[16.8,8.5],[16.67,7.06],[16.3,5.66],[15.69,4.35],[14.86,3.16],[13.84,2.14],[12.65,1.31],[11.34,.7],[9.94,.33],[8.5,.2]]]};case"square":return{rings:[[[.5,.5],[.5,16.5],[16.5,16.5],[16.5,.5],[.5,.5]]]};case"diamond":return{rings:[[[8.5,.5],[.2,8.5],[8.5,16.5],[16.5,8.5],[8.5,.5]]]};case"hexagon-pointy":return{rings:[[[15.86,12.75],[15.86,4.25],[8.5,0],[1.14,4.25],[1.14,12.75],[8.5,17],[15.86,12.75]]]};case"hexagon-flat":return{rings:[[[12.75,15.86],[17,8.5],[12.75,1.14],[4.25,1.14],[0,8.5],[4.25,15.86],[12.75,15.86]]]}}}function m(e){const{type:r,color:n,colorLocked:i}=e;return{type:"CIMVectorMarker",enable:!0,colorLocked:!1,anchorPoint:{x:0,y:0},anchorPointUnits:"Relative",primitiveName:o.OuterRing,frame:{xmin:0,ymin:0,xmax:17,ymax:17},markerGraphics:[{type:"CIMMarkerGraphic",geometry:s(r),symbol:{type:"CIMPolygonSymbol",symbolLayers:[{type:"CIMSolidFill",enable:!0,color:n.toArray(),colorLocked:!!i,effects:[{type:"CIMGeometricEffectDonut",width:.75}]}]}}],scaleSymbolsProportionally:!1,respectFrame:!0,markerPlacement:{type:"CIMMarkerPlacementPolygonCenter",placePerPart:!1,method:t.OnPolygon,offsetX:0,offsetY:0,clipAtBoundary:!1},size:20}}function c(e){const{type:r,color:n}=e;return{type:"CIMVectorMarker",enable:!0,anchorPoint:{x:0,y:0},anchorPointUnits:"Relative",primitiveName:o.InnerDot,frame:{xmin:0,ymin:0,xmax:17,ymax:17},markerGraphics:[{type:"CIMMarkerGraphic",geometry:s(r),symbol:{type:"CIMPolygonSymbol",symbolLayers:[{type:"CIMSolidFill",enable:!0,color:n.toArray()}]}}],scaleSymbolsProportionally:!0,respectFrame:!0,markerPlacement:{type:"CIMMarkerPlacementPolygonCenter",placePerPart:!1,method:t.OnPolygon,offsetX:0,offsetY:0,clipAtBoundary:!1},size:10}}function u(e){const{primitiveOverrides:r}=e;return new i({data:{type:"CIMSymbolReference",symbol:{type:"CIMPolygonSymbol",symbolLayers:[m(e),c(e)]},primitiveOverrides:r}})}function y(e){return"CIMVectorMarker"===e?.type?e.markerGraphics?.[0]:void 0}function p(e){return"CIMPolygonSymbol"===e?.symbol?.type?e.symbol.symbolLayers?.[0]:void 0}function f(e,r){"CIMVectorMarker"===e?.type&&null!=r&&(e.size=r)}function v(e,r){const n=y(e);n&&null!=r&&(n.geometry=s(r))}function S(e,r){const n=p(y(e));n&&null!=r&&(n.color=r.toArray())}function z(e,r,n){const t=p(y(e));t&&null!=r&&n&&(t.colorLocked=r)}function d(e,n){const{outerRingSize:t,innerDotSize:i,type:a,color:l,colorLocked:s,primitiveOverrides:m}=n,c="CIMPolygonSymbol"===e.data.symbol?.type?e.data.symbol.symbolLayers:null;if(2===c?.length)for(const r of c){const e=r.primitiveName===o.OuterRing;f(r,e?t:i),v(r,a),S(r,l),z(r,s,e)}return null!=t&&null!=i&&(e.data.primitiveOverrides=null),void 0!==m&&(e.data.primitiveOverrides=r(m)),e}!function(e){e.OuterRing="reference-size-outer-ring",e.InnerDot="reference-size-inner-dot"}(o||(o={}));export{l as createPrimitiveOverrides,u as createReferenceSizeSymbol,a as getReferenceSizeStops,d as updateReferenceSizeSymbol};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.31/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import e from"../CSVLayerAdapter.js";import
|
|
5
|
+
import e from"../CSVLayerAdapter.js";import a from"../FeatureLayerAdapter.js";import r from"../FeatureLayerBinningAdapter.js";import t from"../InMemoryLayerAdapter.js";import y from"../LayerAdapter.js";import o from"../PointCloudLayerAdapter.js";import L from"../SceneLayerAdapter.js";import n from"../StreamLayerAdapter.js";var p;!function(e){e[e.CatalogLayer=0]="CatalogLayer",e[e.CatalogFootprintLayer=1]="CatalogFootprintLayer",e[e.CSVLayer=2]="CSVLayer",e[e.FeatureLayer=3]="FeatureLayer",e[e.GeoJSONLayer=4]="GeoJSONLayer",e[e.OGCFeatureLayer=5]="OGCFeatureLayer",e[e.OrientedImageryLayer=6]="OrientedImageryLayer",e[e.PointCloudLayer=7]="PointCloudLayer",e[e.SceneLayer=8]="SceneLayer",e[e.StreamLayer=9]="StreamLayer",e[e.WFSLayer=10]="WFSLayer"}(p||(p={}));const l={[p.CatalogLayer]:{adapter:a,type:"catalog",label:"CatalogLayer"},[p.CatalogFootprintLayer]:{adapter:a,type:"catalog-footprint",label:"CatalogFootprintLayer"},[p.CSVLayer]:{adapter:e,type:"csv",label:"CSVLayer"},[p.FeatureLayer]:{adapter:a,type:"feature",label:"FeatureLayer"},[p.GeoJSONLayer]:{adapter:a,type:"geojson",label:"GeoJSONLayer"},[p.OGCFeatureLayer]:{adapter:t,type:"ogc-feature",label:"OGCFeatureLayer"},[p.OrientedImageryLayer]:{adapter:a,type:"oriented-imagery",label:"OrientedImageryLayer"},[p.PointCloudLayer]:{adapter:o,type:"point-cloud",label:"PointCloudLayer"},[p.SceneLayer]:{adapter:L,type:"scene",label:"SceneLayer"},[p.StreamLayer]:{adapter:n,type:"stream",label:"StreamLayer"},[p.WFSLayer]:{adapter:a,type:"wfs",label:"WFSLayer"}},i=[p.CatalogLayer,p.CatalogFootprintLayer,p.CSVLayer,p.FeatureLayer,p.GeoJSONLayer,p.OGCFeatureLayer,p.OrientedImageryLayer,p.PointCloudLayer,p.SceneLayer,p.StreamLayer,p.WFSLayer],u=[p.CatalogFootprintLayer,p.CSVLayer,p.FeatureLayer,p.GeoJSONLayer,p.OGCFeatureLayer,p.OrientedImageryLayer,p.SceneLayer,p.StreamLayer,p.WFSLayer],m=[p.CSVLayer,p.FeatureLayer,p.GeoJSONLayer,p.OGCFeatureLayer,p.OrientedImageryLayer,p.StreamLayer,p.WFSLayer];function S(e){return e.map((e=>l[e].label))}function d(e){return e.map((e=>l[e].type))}function C(e,a=i,t){if(e instanceof y)return e;const o=F(e,a);return o?t?new r({layer:e}):new o({layer:e}):null}function F(e,a=i){let r=null;return a.some((a=>{const t=e.type===l[a].type;return t&&(r=l[a].adapter),t})),r}export{p as LayerType,m as binningCapableLayerTypes,C as createLayerAdapter,i as defaultSupportedLayerTypes,u as featureCapableLayerTypes,S as getLayerTypeLabels,d as getLayerTypes};
|
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.31/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
const
|
|
5
|
+
const a="20240523",e="29774ad4e6f1ea03ca9ea6eadb1155d34b9aaac8";export{a as buildDate,e 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.31/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{GeometryCursor as s}from"../../../geometry/GeometryCursor.js";import{collectMultipath as t}from"../../../geometry/geometryCursorCollectUtils.js";import{setId as i}from"../CIMCursor.js";import{GeometricEffectControlMeasureLineRule as h}from"../enums.js";class e{static local(){return null===e.instance&&(e.instance=new e),e.instance}execute(s,t,i,h,e){return new r(s,t,i)}}e.instance=null;class r{constructor(s,t,i){this._defaultPointSize=20,this._inputGeometries=s,this._geomUnitsPerPoint=i,this._rule=t.rule??h.FullGeometry,this._defaultSize=this._defaultPointSize*i}next(){let i;for(;i=this._inputGeometries.next();){const h=this._processGeom(t(i));if(h?.length)return s.fromJSONCIM({paths:h})}return null}_clone(s){return[s[0],s[1]]}_mid(s,t){return[(s[0]+t[0])/2,(s[1]+t[1])/2]}_mix(s,t,i,h){return[s[0]*t+i[0]*h,s[1]*t+i[1]*h]}_add(s,t){return[s[0]+t[0],s[1]+t[1]]}_add2(s,t,i){return[s[0]+t,s[1]+i]}_sub(s,t){return[s[0]-t[0],s[1]-t[1]]}_dist(s,t){return Math.sqrt((s[0]-t[0])*(s[0]-t[0])+(s[1]-t[1])*(s[1]-t[1]))}_norm(s){return Math.sqrt(s[0]*s[0]+s[1]*s[1])}_normalize(s,t=1){const i=t/this._norm(s);s[0]*=i,s[1]*=i}_leftPerpendicular(s){const t=-s[1],i=s[0];s[0]=t,s[1]=i}_leftPerp(s){return[-s[1],s[0]]}_rightPerpendicular(s){const t=s[1],i=-s[0];s[0]=t,s[1]=i}_rightPerp(s){return[s[1],-s[0]]}_dotProduct(s,t){return s[0]*t[0]+s[1]*t[1]}_crossProduct(s,t){return s[0]*t[1]-s[1]*t[0]}_rotateDirect(s,t,i){const h=s[0]*t-s[1]*i,e=s[0]*i+s[1]*t;s[0]=h,s[1]=e}_makeCtrlPt(s){const t=[s[0],s[1]];return i(t,1),t}_addAngledTicks(s,t,i,h){const e=this._sub(i,t);this._normalize(e);const r=this._crossProduct(e,this._sub(h,t));let _;_=r>0?this._rightPerp(e):this._leftPerp(e);const c=Math.abs(r)/2,u=[];u.push([t[0]+(_[0]-e[0])*c,t[1]+(_[1]-e[1])*c]),u.push(t),u.push(i),u.push([i[0]+(_[0]+e[0])*c,i[1]+(_[1]+e[1])*c]),s.push(u)}_addBezier2(s,t,i,h,e){if(0==e--)return void s.push(h);const r=this._mid(t,i),_=this._mid(i,h),c=this._mid(r,_);this._addBezier2(s,t,r,c,e),this._addBezier2(s,c,_,h,e)}_addBezier3(s,t,i,h,e,r){if(0==r--)return void s.push(e);const _=this._mid(t,i),c=this._mid(i,h),u=this._mid(h,e),o=this._mid(_,c),n=this._mid(c,u),a=this._mid(o,n);this._addBezier3(s,t,_,o,a,r),this._addBezier3(s,a,n,u,e,r)}_add90DegArc(s,t,i,h,e){const r=e??this._crossProduct(this._sub(i,t),this._sub(h,t))>0,_=this._mid(t,i),c=this._sub(_,t);r?this._leftPerpendicular(c):this._rightPerpendicular(c),_[0]+=c[0],_[1]+=c[1],this._addBezier3(s,t,this._mix(t,.33333,_,.66667),this._mix(i,.33333,_,.66667),i,4)}_addArrow(s,t,i){const h=t[0],e=t[1],r=t[t.length-1],_=this._sub(h,e),c=this._norm(_);this._normalize(_);const u=Math.abs(this._crossProduct(_,this._sub(r,e)));let o=this._dotProduct(_,this._sub(r,e));o<.05*c?o=.05*c:o>.95*c&&(o=.95*c);const n=.5*u,a=this._leftPerp(_),p=[e[0]+_[0]*o,e[1]+_[1]*o],d=t.length-1,l=[];l.push(i?[-a[0],-a[1]]:a);let b=[-_[0],-_[1]];for(let P=1;P<d-1;P++){const s=this._sub(t[P+1],t[P]);this._normalize(s);const i=this._dotProduct(s,b),h=this._crossProduct(s,b),e=Math.sqrt((1+i)/2),r=this._sub(s,b);this._normalize(r),r[0]/=e,r[1]/=e,l.push(h<0?[-r[0],-r[1]]:r),b=s}l.push(this._rightPerp(b));for(let P=l.length-1;P>0;P--)s.push([t[P][0]+l[P][0]*n,t[P][1]+l[P][1]*n]);s.push([p[0]+l[0][0]*n,p[1]+l[0][1]*n]),s.push([p[0]+l[0][0]*u,p[1]+l[0][1]*u]),s.push(h),s.push([p[0]-l[0][0]*u,p[1]-l[0][1]*u]),s.push([p[0]-l[0][0]*n,p[1]-l[0][1]*n]);for(let P=1;P<l.length;P++)s.push([t[P][0]-l[P][0]*n,t[P][1]-l[P][1]*n])}_cp2(s,t,i){return s.length>=2?s[1]:this._add2(s[0],t*this._defaultSize,i*this._defaultSize)}_cp3(s,t,i,h){if(s.length>=3)return s[2];const e=this._mix(s[0],1-i,t,i),r=this._sub(t,s[0]);return this._normalize(r),this._rightPerpendicular(r),[e[0]+r[0]*h*this._defaultSize,e[1]+r[1]*h*this._defaultSize]}_arrowPath(s){if(s.length>2)return s;const t=s[0],i=this._cp2(s,-4,0),h=this._sub(t,i);this._normalize(h);const e=this._rightPerp(h);return[t,i,[t[0]+(e[0]-h[0])*this._defaultSize,t[1]+(e[1]-h[1])*this._defaultSize]]}_arrowLastSeg(s){const t=s[0],i=this._cp2(s,-4,0);let h;if(s.length>=3)h=s[s.length-1];else{const s=this._sub(t,i);this._normalize(s);const e=this._rightPerp(s);h=[t[0]+(e[0]-s[0])*this._defaultSize,t[1]+(e[1]-s[1])*this._defaultSize]}return[i,h]}_processGeom(s){if(!s)return null;const t=[];for(const e of s){if(!e||0===e.length)continue;const s=e.length;let r=e[0];switch(this._rule){case h.PerpendicularFromFirstSegment:{const s=this._cp2(e,0,-1),i=this._cp3(e,s,.5,4),h=[];h.push(i),h.push(this._mid(r,s)),t.push(h);break}case h.ReversedFirstSegment:{const s=this._cp2(e,0,-1);t.push([s,r]);break}case h.PerpendicularToSecondSegment:{const s=this._cp2(e,-4,1),i=this._cp3(e,s,.882353,-1.94),h=[];h.push(this._mid(s,i)),h.push(r),t.push(h);break}case h.SecondSegmentWithTicks:{const s=this._cp2(e,-4,1),i=this._cp3(e,s,.882353,-1.94),h=this._sub(i,s);let _;_=this._crossProduct(h,this._sub(r,s))>0?this._rightPerp(h):this._leftPerp(h);const c=[];c.push([s[0]+(_[0]-h[0])/3,s[1]+(_[1]-h[1])/3]),c.push(s),c.push(i),c.push([i[0]+(_[0]+h[0])/3,i[1]+(_[1]+h[1])/3]),t.push(c);break}case h.DoublePerpendicular:{const s=this._cp2(e,0,-1),i=this._cp3(e,s,.5,3),h=this._mid(r,s),_=this._sub(h,i);this._normalize(_);const c=this._crossProduct(_,this._sub(r,i));this._leftPerpendicular(_);const u=[];u.push(r),u.push([i[0]+_[0]*c,i[1]+_[1]*c]),t.push(u);const o=[];o.push([i[0]-_[0]*c,i[1]-_[1]*c]),o.push(s),t.push(o);break}case h.OppositeToFirstSegment:{const s=this._cp2(e,0,-1),i=this._cp3(e,s,.5,3),h=this._mid(r,s),_=this._sub(h,i);this._normalize(_);const c=this._crossProduct(_,this._sub(r,i));this._leftPerpendicular(_);const u=[];u.push([i[0]+_[0]*c,i[1]+_[1]*c]),u.push([i[0]-_[0]*c,i[1]-_[1]*c]),t.push(u);break}case h.TriplePerpendicular:{const s=this._cp2(e,0,-1),i=this._cp3(e,s,.5,4),h=this._mid(r,s),_=this._sub(h,i);this._normalize(_);const c=this._crossProduct(_,this._sub(r,i));this._leftPerpendicular(_);const u=[];u.push([i[0]+_[0]*c*.8,i[1]+_[1]*c*.8]),u.push([h[0]+.8*(r[0]-h[0]),h[1]+.8*(r[1]-h[1])]),t.push(u),t.push([i,h]);const o=[];o.push([i[0]-_[0]*c*.8,i[1]-_[1]*c*.8]),o.push([h[0]+.8*(s[0]-h[0]),h[1]+.8*(s[1]-h[1])]),t.push(o);break}case h.HalfCircleFirstSegment:{const s=this._cp2(e,0,-1),i=this._cp3(e,s,.5,4),h=this._mid(r,s);let _=this._sub(s,r);const c=Math.cos(Math.PI/18),u=Math.sin(Math.PI/18),o=Math.sqrt((1+c)/2),n=Math.sqrt((1-c)/2),a=[];let p;this._crossProduct(_,this._sub(i,r))>0?(a.push(r),_=this._sub(r,h),p=s):(a.push(s),_=this._sub(s,h),p=r),this._rotateDirect(_,o,n),_[0]/=o,_[1]/=o;for(let t=1;t<=18;t++)a.push(this._add(h,_)),this._rotateDirect(_,c,u);a.push(p),t.push(a);break}case h.HalfCircleSecondSegment:{const s=this._cp2(e,0,-1),i=this._cp3(e,s,1,-1);let h=this._sub(r,s);this._normalize(h);const _=this._crossProduct(h,this._sub(i,s))/2;this._leftPerpendicular(h);const c=[s[0]+h[0]*_,s[1]+h[1]*_];h=this._sub(s,c);const u=Math.cos(Math.PI/18);let o=Math.sin(Math.PI/18);_>0&&(o=-o);const n=[s];for(let t=1;t<=18;t++)this._rotateDirect(h,u,o),n.push(this._add(c,h));t.push(n);break}case h.HalfCircleExtended:{const i=this._cp2(e,0,-2),h=this._cp3(e,i,1,-1);let _;if(s>=4)_=e[3];else{const s=this._sub(r,i);_=this._add(h,s)}const c=this._dist(i,h)/2/.75,u=this._sub(i,r);this._normalize(u,c);const o=this._sub(h,_);this._normalize(o,c);const n=[_,h];t.push(n);const a=[this._clone(h)];this._addBezier3(a,h,this._add(h,o),this._add(i,u),i,4),a.push(r),t.push(a);break}case h.OpenCircle:{const s=this._cp2(e,-2,0),i=this._sub(s,r),h=Math.cos(Math.PI/18),_=-Math.sin(Math.PI/18),c=[s];for(let t=1;t<=33;t++)this._rotateDirect(i,h,_),c.push(this._add(r,i));t.push(c);break}case h.CoverageEdgesWithTicks:{const i=this._cp2(e,0,-1);let h,_;if(s>=3)h=e[2];else{const s=this._sub(i,r),t=this._leftPerp(s);h=[r[0]+t[0]-.25*s[0],r[1]+t[1]-.25*s[1]]}if(s>=4)_=e[3];else{const s=this._mid(r,i),t=this._sub(r,i);this._normalize(t),this._leftPerpendicular(t);const e=this._crossProduct(t,this._sub(h,s));this._rightPerpendicular(t),_=[h[0]+t[0]*e*2,h[1]+t[1]*e*2]}const c=this._sub(i,r);let u,o;u=this._crossProduct(c,this._sub(h,r))>0?this._rightPerp(c):this._leftPerp(c),o=[],o.push(h),o.push(r),o.push([r[0]+(u[0]-c[0])/3,r[1]+(u[1]-c[1])/3]),t.push(o),u=this._crossProduct(c,this._sub(_,i))>0?this._rightPerp(c):this._leftPerp(c),o=[],o.push([i[0]+(u[0]+c[0])/3,i[1]+(u[1]+c[1])/3]),o.push(i),o.push(_),t.push(o);break}case h.GapExtentWithDoubleTicks:{const i=this._cp2(e,0,2),h=this._cp3(e,i,0,1);let _;if(s>=4)_=e[3];else{const s=this._sub(i,r);_=this._add(h,s)}this._addAngledTicks(t,r,i,this._mid(h,_)),this._addAngledTicks(t,h,_,this._mid(r,i));break}case h.GapExtentMidline:{const i=this._cp2(e,2,0),h=this._cp3(e,i,0,1);let _;if(s>=4)_=e[3];else{const s=this._sub(i,r);_=this._add(h,s)}const c=[];c.push(this._mid(r,h)),c.push(this._mid(i,_)),t.push(c);break}case h.Chevron:{const i=this._cp2(e,-1,-1);let h;if(s>=3)h=e[2];else{const s=this._sub(i,r);this._leftPerpendicular(s),h=this._add(r,s)}t.push([i,this._makeCtrlPt(r),h]);break}case h.PerpendicularWithArc:{const i=this._cp2(e,0,-2),h=this._cp3(e,i,.5,-1),_=this._sub(i,r),c=this._norm(_);_[0]/=c,_[1]/=c;const u=this._crossProduct(_,this._sub(h,r));let o=this._dotProduct(_,this._sub(h,r));o<.05*c?o=.05*c:o>.95*c&&(o=.95*c);const n=[r[0]+_[0]*o,r[1]+_[1]*o];let a=this._leftPerp(_),p=[];if(p.push([n[0]-a[0]*u,n[1]-a[1]*u]),p.push([n[0]+a[0]*u,n[1]+a[1]*u]),t.push(p),s>=4){const s=e[3];let i=this._dotProduct(_,this._sub(s,r));i<.1*c?i=.1*c:i>.9*c&&(i=.9*c);const h=[r[0]+_[0]*i,r[1]+_[1]*i],u=this._crossProduct(_,this._sub(s,r)),o=[];o.push([h[0]-a[0]*u,h[1]-a[1]*u]),o.push([h[0]+a[0]*u,h[1]+a[1]*u]),t.push(o)}const d=[i[0]+a[0]*u,i[1]+a[1]*u];a=this._sub(i,d);const l=Math.cos(Math.PI/18);let b=Math.sin(Math.PI/18);u<0&&(b=-b),p=[r,i];for(let s=1;s<=9;s++)this._rotateDirect(a,l,b),p.push(this._add(d,a));t.push(p);break}case h.ClosedHalfCircle:{const s=this._cp2(e,2,0),i=this._mid(r,s),h=this._sub(s,i),_=Math.cos(Math.PI/18),c=Math.sin(Math.PI/18),u=[r,s];for(let t=1;t<=18;t++)this._rotateDirect(h,_,c),u.push(this._add(i,h));t.push(u);break}case h.TripleParallelExtended:{const s=this._cp2(e,0,-2),h=this._cp3(e,s,1,-2),_=this._mid(r,s),c=this._sub(h,s);this._normalize(c);const u=Math.abs(this._crossProduct(c,this._sub(_,s)))/2,o=this._dist(s,h),n=[s,r];n.push([r[0]+c[0]*o*.5,r[1]+c[1]*o*.5]),t.push(n);const a=[];a.push([_[0]-c[0]*u,_[1]-c[1]*u]),a.push([_[0]+c[0]*o*.375,_[1]+c[1]*o*.375]),i(a[a.length-1],1),a.push([_[0]+c[0]*o*.75,_[1]+c[1]*o*.75]),t.push(a);const p=[s,h];t.push(p);break}case h.ParallelWithTicks:{const s=this._cp2(e,3,0),i=this._cp3(e,s,.5,-1),h=this._sub(i,s);this._normalize(h);const _=this._crossProduct(h,this._sub(i,r));this._leftPerpendicular(h),this._addAngledTicks(t,r,s,i),this._addAngledTicks(t,this._mix(r,1,h,_),this._mix(s,1,h,_),this._mid(r,s));break}case h.Parallel:{const s=this._cp2(e,3,0),i=this._cp3(e,s,.5,-1),h=this._sub(s,r);this._normalize(h);const _=this._leftPerp(h),c=this._crossProduct(h,this._sub(i,r));let u=[r,s];t.push(u),u=[],u.push([r[0]+_[0]*c,r[1]+_[1]*c]),u.push([s[0]+_[0]*c,s[1]+_[1]*c]),t.push(u);break}case h.PerpendicularToFirstSegment:{const s=this._cp2(e,3,0),i=this._cp3(e,s,.5,-1),h=this._mid(r,s),_=this._sub(s,r);this._normalize(_);const c=this._crossProduct(_,this._sub(i,r));this._leftPerpendicular(_);const u=[];u.push([h[0]-_[0]*c*.25,h[1]-_[1]*c*.25]),u.push([h[0]+_[0]*c*1.25,h[1]+_[1]*c*1.25]),t.push(u);break}case h.ParallelOffset:{const s=this._cp2(e,3,0),i=this._cp3(e,s,.5,-1),h=this._sub(s,r);this._normalize(h);const _=this._crossProduct(h,this._sub(i,r));this._leftPerpendicular(h);const c=[];c.push([r[0]-h[0]*_,r[1]-h[1]*_]),c.push([s[0]-h[0]*_,s[1]-h[1]*_]),t.push(c);const u=[];u.push([r[0]+h[0]*_,r[1]+h[1]*_]),u.push([s[0]+h[0]*_,s[1]+h[1]*_]),t.push(u);break}case h.OffsetOpposite:{const s=this._cp2(e,3,0),i=this._cp3(e,s,.5,-1),h=this._sub(s,r);this._normalize(h);const _=this._crossProduct(h,this._sub(i,r));this._leftPerpendicular(h);const c=[];c.push([r[0]-h[0]*_,r[1]-h[1]*_]),c.push([s[0]-h[0]*_,s[1]-h[1]*_]),t.push(c);break}case h.OffsetSame:{const s=this._cp2(e,3,0),i=this._cp3(e,s,.5,-1),h=this._sub(s,r);this._normalize(h);const _=this._crossProduct(h,this._sub(i,r));this._leftPerpendicular(h);const c=[];c.push([r[0]+h[0]*_,r[1]+h[1]*_]),c.push([s[0]+h[0]*_,s[1]+h[1]*_]),t.push(c);break}case h.CircleWithArc:{let h=this._cp2(e,3,0);const _=this._cp3(e,h,.5,-1);let c,u;if(s>=4)c=e[3],u=this._crossProduct(this._sub(c,h),this._sub(_,h))>0;else{c=h,u=this._crossProduct(this._sub(c,r),this._sub(_,r))>0;const s=24*this._geomUnitsPerPoint,t=this._sub(c,r);this._normalize(t,s);const i=Math.sqrt(2)/2;this._rotateDirect(t,i,u?i:-i),h=this._add(r,t)}const o=this._sub(h,r),n=Math.cos(Math.PI/18),a=Math.sin(Math.PI/18),p=[h];for(let s=1;s<=36;s++)this._rotateDirect(o,n,a),p.push(this._add(r,o));this._add90DegArc(p,h,c,_,u),i(p[p.length-8],1),t.push(p);break}case h.DoubleJog:{let i,h=this._cp2(e,-3,1),_=this._cp3(e,h,-1,-.5);if(s>=4)i=e[3];else{const s=r;r=h,i=_;const t=this._dist(r,s),e=this._dist(i,s);let c=30*this._geomUnitsPerPoint;.5*t<c&&(c=.5*t),.5*e<c&&(c=.5*e),h=this._mix(r,c/t,s,(t-c)/t),_=this._mix(i,c/e,s,(e-c)/e)}const c=this._mid(r,h),u=this._mid(i,_),o=this._dist(r,h),n=this._dist(_,i);let a=Math.min(o,n)/8;a=Math.min(a,24*this._geomUnitsPerPoint);const p=Math.cos(Math.PI/4);let d=this._sub(r,h);this._normalize(d,a),this._crossProduct(d,this._sub(i,h))>0?this._rotateDirect(d,p,-p):this._rotateDirect(d,p,p);let l=[];l.push(h),l.push(this._add(c,d)),l.push(this._sub(c,d)),l.push(r),t.push(l),d=this._sub(i,_),this._normalize(d,a),this._crossProduct(d,this._sub(r,_))<0?this._rotateDirect(d,p,p):this._rotateDirect(d,p,-p),l=[],l.push(_),l.push(this._add(u,d)),l.push(this._sub(u,d)),l.push(i),t.push(l);break}case h.PerpendicularOffset:{const s=this._cp2(e,-4,1),i=this._cp3(e,s,.882353,-1.94),h=this._sub(i,s);this._crossProduct(h,this._sub(r,s))>0?this._rightPerpendicular(h):this._leftPerpendicular(h);const _=[h[0]/8,h[1]/8],c=this._sub(this._mid(s,i),_);t.push([c,r]);break}case h.LineExcludingLastSegment:{const s=this._arrowPath(e),i=[];let h=s.length-2;for(;h--;)i.push(s[h]);t.push(i);break}case h.MultivertexArrow:{const s=this._arrowPath(e),i=[];this._addArrow(i,s,!1),t.push(i);break}case h.CrossedArrow:{const s=this._arrowPath(e),i=[];this._addArrow(i,s,!0),t.push(i);break}case h.ChevronArrow:{const[s,i]=this._arrowLastSeg(e),h=10*this._geomUnitsPerPoint,_=this._sub(r,s),c=this._norm(_);this._normalize(_);const u=this._crossProduct(_,this._sub(i,s));let o=this._dotProduct(_,this._sub(i,s));o<.05*c?o=.05*c:o>.95*c-h&&(o=.95*c-h);const n=[s[0]+_[0]*o,s[1]+_[1]*o],a=this._leftPerp(_),p=[];p.push([n[0]+a[0]*u+_[0]*h,n[1]+a[1]*u+_[1]*h]),p.push(r),p.push([n[0]-a[0]*u+_[0]*h,n[1]-a[1]*u+_[1]*h]),t.push(p);break}case h.ChevronArrowOffset:{const[s,i]=this._arrowLastSeg(e),h=this._sub(r,s),_=this._norm(h);this._normalize(h);const c=this._crossProduct(h,this._sub(i,s));let u=this._dotProduct(h,this._sub(i,s));u<.05*_?u=.05*_:u>.95*_&&(u=.95*_);const o=[s[0]+h[0]*u,s[1]+h[1]*u];this._leftPerpendicular(h);const n=[];n.push([o[0]+h[0]*c*.5,o[1]+h[1]*c*.5]),n.push(this._mid(o,r)),n.push([o[0]-h[0]*c*.5,o[1]-h[1]*c*.5]),t.push(n);break}case h.PartialFirstSegment:{const[s,i]=this._arrowLastSeg(e),h=this._sub(r,s),_=this._norm(h);this._normalize(h);let c=this._dotProduct(h,this._sub(i,s));c<.05*_?c=.05*_:c>.95*_&&(c=.95*_);const u=[s[0]+h[0]*c,s[1]+h[1]*c];t.push([s,u]);break}case h.Arch:{const s=this._cp2(e,0,-1),i=this._cp3(e,s,.5,1),h=this._sub(r,s),_=this._mix(i,1,h,.55),c=this._mix(i,1,h,-.55),u=[r];this._addBezier2(u,r,_,i,4),this._addBezier2(u,i,c,s,4),t.push(u);break}case h.CurvedParallelTicks:{const s=this._cp2(e,-4,1),i=this._cp3(e,s,.882353,-1.94),h=this._sub(i,s);this._crossProduct(h,this._sub(r,s))>0?this._rightPerpendicular(h):this._leftPerpendicular(h);const _=[h[0]/8,h[1]/8],c=this._sub(this._mid(s,i),_),u=this._sub(this._mix(s,.75,i,.25),_),o=this._sub(this._mix(s,.25,i,.75),_),n=[s];this._addBezier2(n,s,u,c,3),this._addBezier2(n,c,o,i,3),t.push(n);for(let e=0;e<8;e++){const s=n[2*e+1],i=[this._clone(s)];i.push(this._add(s,[h[0]/4,h[1]/4])),t.push(i)}break}case h.Arc90Degrees:{const s=this._cp2(e,0,-1),i=this._cp3(e,s,.5,1),h=[s];this._add90DegArc(h,s,r,i),t.push(h);break}case h.TipWithPerpendicularAndTicks:{const[s,i]=this._arrowLastSeg(e),h=10*this._geomUnitsPerPoint,_=this._sub(r,s),c=this._norm(_);this._normalize(_);let u=this._crossProduct(_,this._sub(i,s)),o=this._dotProduct(_,this._sub(i,s));o<.05*c?o=.05*c:o>.95*c-h&&(o=.95*c-h);const n=this._leftPerp(_),a=[r[0]-_[0]*h,r[1]-_[1]*h],p=.5*Math.max(c-o-h,h);u=Math.abs(u);const d=[];d.push([a[0]+n[0]*(u+p)-_[0]*p,a[1]+n[1]*(u+p)-_[1]*p]),d.push([a[0]+n[0]*u,a[1]+n[1]*u]),d.push([a[0]-n[0]*u,a[1]-n[1]*u]),d.push([a[0]-n[0]*(u+p)-_[0]*p,a[1]-n[1]*(u+p)-_[1]*p]),t.push(d),t.push([a,r]);break}case h.FullGeometry:default:t.push(e)}}return t}}export{e as EffectControlMeasureLine};
|
|
5
|
+
import{GeometryCursor as s}from"../../../geometry/GeometryCursor.js";import{collectMultipath as t}from"../../../geometry/geometryCursorCollectUtils.js";import{setId as i}from"../CIMCursor.js";import{GeometricEffectControlMeasureLineRule as h}from"../enums.js";class e{static local(){return null===e.instance&&(e.instance=new e),e.instance}execute(s,t,i,h,e){return new r(s,t,i)}}e.instance=null;class r{constructor(s,t,i){this._defaultPointSize=20,this._inputGeometries=s,this._geomUnitsPerPoint=i,this._rule=t.rule??h.FullGeometry,this._defaultSize=this._defaultPointSize*i}next(){let i;for(;i=this._inputGeometries.next();){const h=this._processGeom(t(i));if(h?.length)return s.fromJSONCIM({paths:h})}return null}_clone(s){return[s[0],s[1]]}_mid(s,t){return[(s[0]+t[0])/2,(s[1]+t[1])/2]}_mix(s,t,i,h){return[s[0]*t+i[0]*h,s[1]*t+i[1]*h]}_add(s,t){return[s[0]+t[0],s[1]+t[1]]}_add2(s,t,i){return[s[0]+t,s[1]+i]}_sub(s,t){return[s[0]-t[0],s[1]-t[1]]}_dist(s,t){return Math.sqrt((s[0]-t[0])*(s[0]-t[0])+(s[1]-t[1])*(s[1]-t[1]))}_norm(s){return Math.sqrt(s[0]*s[0]+s[1]*s[1])}_normalize(s,t=1){const i=t/this._norm(s);s[0]*=i,s[1]*=i}_leftPerpendicular(s){const t=-s[1],i=s[0];s[0]=t,s[1]=i}_leftPerp(s){return[-s[1],s[0]]}_rightPerpendicular(s){const t=s[1],i=-s[0];s[0]=t,s[1]=i}_rightPerp(s){return[s[1],-s[0]]}_dotProduct(s,t){return s[0]*t[0]+s[1]*t[1]}_crossProduct(s,t){return s[0]*t[1]-s[1]*t[0]}_rotateDirect(s,t,i){const h=s[0]*t-s[1]*i,e=s[0]*i+s[1]*t;s[0]=h,s[1]=e}_makeCtrlPt(s){const t=[s[0],s[1]];return i(t,1),t}_addAngledTicks(s,t,i,h){const e=this._sub(i,t);this._normalize(e);const r=this._crossProduct(e,this._sub(h,t));let _;_=r>0?this._rightPerp(e):this._leftPerp(e);const c=Math.abs(r)/2,u=[];u.push([t[0]+(_[0]-e[0])*c,t[1]+(_[1]-e[1])*c]),u.push(t),u.push(i),u.push([i[0]+(_[0]+e[0])*c,i[1]+(_[1]+e[1])*c]),s.push(u)}_addBezier2(s,t,i,h,e){if(0==e--)return void s.push(h);const r=this._mid(t,i),_=this._mid(i,h),c=this._mid(r,_);this._addBezier2(s,t,r,c,e),this._addBezier2(s,c,_,h,e)}_addBezier3(s,t,i,h,e,r){if(0==r--)return void s.push(e);const _=this._mid(t,i),c=this._mid(i,h),u=this._mid(h,e),o=this._mid(_,c),n=this._mid(c,u),a=this._mid(o,n);this._addBezier3(s,t,_,o,a,r),this._addBezier3(s,a,n,u,e,r)}_add90DegArc(s,t,i,h,e){const r=e??this._crossProduct(this._sub(i,t),this._sub(h,t))>0,_=this._mid(t,i),c=this._sub(_,t);r?this._leftPerpendicular(c):this._rightPerpendicular(c),_[0]+=c[0],_[1]+=c[1],this._addBezier3(s,t,this._mix(t,.33333,_,.66667),this._mix(i,.33333,_,.66667),i,4)}_addArrow(s,t,i){const h=t[0],e=t[1],r=t[t.length-1],_=this._sub(h,e),c=this._norm(_);this._normalize(_);const u=Math.abs(this._crossProduct(_,this._sub(r,e)));let o=this._dotProduct(_,this._sub(r,e));o<.05*c?o=.05*c:o>.95*c&&(o=.95*c);const n=.5*u,a=this._leftPerp(_),p=[e[0]+_[0]*o,e[1]+_[1]*o],d=t.length-1,l=[];l.push(i?[-a[0],-a[1]]:a);let b=[-_[0],-_[1]];for(let P=1;P<d-1;P++){const s=this._sub(t[P+1],t[P]);this._normalize(s);const i=this._dotProduct(s,b),h=this._crossProduct(s,b),e=Math.sqrt((1+i)/2),r=this._sub(s,b);this._normalize(r),r[0]/=e,r[1]/=e,l.push(h<0?[-r[0],-r[1]]:r),b=s}l.push(this._rightPerp(b));for(let P=l.length-1;P>0;P--)s.push([t[P][0]+l[P][0]*n,t[P][1]+l[P][1]*n]);s.push([p[0]+l[0][0]*n,p[1]+l[0][1]*n]),s.push([p[0]+l[0][0]*u,p[1]+l[0][1]*u]),s.push(h),s.push([p[0]-l[0][0]*u,p[1]-l[0][1]*u]),s.push([p[0]-l[0][0]*n,p[1]-l[0][1]*n]);for(let P=1;P<l.length;P++)s.push([t[P][0]-l[P][0]*n,t[P][1]-l[P][1]*n])}_cp2(s,t,i){return s.length>=2?s[1]:this._add2(s[0],t*this._defaultSize,i*this._defaultSize)}_cp3(s,t,i,h){if(s.length>=3)return s[2];const e=this._mix(s[0],1-i,t,i),r=this._sub(t,s[0]);return this._normalize(r),this._rightPerpendicular(r),[e[0]+r[0]*h*this._defaultSize,e[1]+r[1]*h*this._defaultSize]}_arrowPath(s){if(s.length>2)return s;const t=s[0],i=this._cp2(s,-4,0),h=this._sub(t,i);this._normalize(h);const e=this._rightPerp(h);return[t,i,[t[0]+(e[0]-h[0])*this._defaultSize,t[1]+(e[1]-h[1])*this._defaultSize]]}_arrowLastSeg(s){const t=s[0],i=this._cp2(s,-4,0);let h;if(s.length>=3)h=s[s.length-1];else{const s=this._sub(t,i);this._normalize(s);const e=this._rightPerp(s);h=[t[0]+(e[0]-s[0])*this._defaultSize,t[1]+(e[1]-s[1])*this._defaultSize]}return[i,h]}_processGeom(s){if(!s)return null;const t=[];for(const e of s){if(!e||0===e.length)continue;const s=e.length;let r=e[0];switch(this._rule){case h.PerpendicularFromFirstSegment:{const s=this._cp2(e,0,-1),i=this._cp3(e,s,.5,4),h=[];h.push(i),h.push(this._mid(r,s)),t.push(h);break}case h.ReversedFirstSegment:{const s=this._cp2(e,0,-1);t.push([s,r]);break}case h.PerpendicularToSecondSegment:{if(e.length<3)return[];const s=this._cp2(e,-4,1),i=this._cp3(e,s,.882353,-1.94),h=[];h.push(this._mid(s,i)),h.push(r),t.push(h);break}case h.SecondSegmentWithTicks:{if(e.length<3)return[];const s=this._cp2(e,-4,1),i=this._cp3(e,s,.882353,-1.94),h=this._sub(i,s);let _;_=this._crossProduct(h,this._sub(r,s))>0?this._rightPerp(h):this._leftPerp(h);const c=[];c.push([s[0]+(_[0]-h[0])/3,s[1]+(_[1]-h[1])/3]),c.push(s),c.push(i),c.push([i[0]+(_[0]+h[0])/3,i[1]+(_[1]+h[1])/3]),t.push(c);break}case h.DoublePerpendicular:{const s=this._cp2(e,0,-1),i=this._cp3(e,s,.5,3),h=this._mid(r,s),_=this._sub(h,i);this._normalize(_);const c=this._crossProduct(_,this._sub(r,i));this._leftPerpendicular(_);const u=[];u.push(r),u.push([i[0]+_[0]*c,i[1]+_[1]*c]),t.push(u);const o=[];o.push([i[0]-_[0]*c,i[1]-_[1]*c]),o.push(s),t.push(o);break}case h.OppositeToFirstSegment:{const s=this._cp2(e,0,-1),i=this._cp3(e,s,.5,3),h=this._mid(r,s),_=this._sub(h,i);this._normalize(_);const c=this._crossProduct(_,this._sub(r,i));this._leftPerpendicular(_);const u=[];u.push([i[0]+_[0]*c,i[1]+_[1]*c]),u.push([i[0]-_[0]*c,i[1]-_[1]*c]),t.push(u);break}case h.TriplePerpendicular:{const s=this._cp2(e,0,-1),i=this._cp3(e,s,.5,4),h=this._mid(r,s),_=this._sub(h,i);this._normalize(_);const c=this._crossProduct(_,this._sub(r,i));this._leftPerpendicular(_);const u=[];u.push([i[0]+_[0]*c*.8,i[1]+_[1]*c*.8]),u.push([h[0]+.8*(r[0]-h[0]),h[1]+.8*(r[1]-h[1])]),t.push(u),t.push([i,h]);const o=[];o.push([i[0]-_[0]*c*.8,i[1]-_[1]*c*.8]),o.push([h[0]+.8*(s[0]-h[0]),h[1]+.8*(s[1]-h[1])]),t.push(o);break}case h.HalfCircleFirstSegment:{const s=this._cp2(e,0,-1),i=this._cp3(e,s,.5,4),h=this._mid(r,s);let _=this._sub(s,r);const c=Math.cos(Math.PI/18),u=Math.sin(Math.PI/18),o=Math.sqrt((1+c)/2),n=Math.sqrt((1-c)/2),a=[];let p;this._crossProduct(_,this._sub(i,r))>0?(a.push(r),_=this._sub(r,h),p=s):(a.push(s),_=this._sub(s,h),p=r),this._rotateDirect(_,o,n),_[0]/=o,_[1]/=o;for(let t=1;t<=18;t++)a.push(this._add(h,_)),this._rotateDirect(_,c,u);a.push(p),t.push(a);break}case h.HalfCircleSecondSegment:{const s=this._cp2(e,0,-1),i=this._cp3(e,s,1,-1);let h=this._sub(r,s);this._normalize(h);const _=this._crossProduct(h,this._sub(i,s))/2;this._leftPerpendicular(h);const c=[s[0]+h[0]*_,s[1]+h[1]*_];h=this._sub(s,c);const u=Math.cos(Math.PI/18);let o=Math.sin(Math.PI/18);_>0&&(o=-o);const n=[s];for(let t=1;t<=18;t++)this._rotateDirect(h,u,o),n.push(this._add(c,h));t.push(n);break}case h.HalfCircleExtended:{const i=this._cp2(e,0,-2),h=this._cp3(e,i,1,-1);let _;if(s>=4)_=e[3];else{const s=this._sub(r,i);_=this._add(h,s)}const c=this._dist(i,h)/2/.75,u=this._sub(i,r);this._normalize(u,c);const o=this._sub(h,_);this._normalize(o,c);const n=[_,h];t.push(n);const a=[this._clone(h)];this._addBezier3(a,h,this._add(h,o),this._add(i,u),i,4),a.push(r),t.push(a);break}case h.OpenCircle:{const s=this._cp2(e,-2,0),i=this._sub(s,r),h=Math.cos(Math.PI/18),_=-Math.sin(Math.PI/18),c=[s];for(let t=1;t<=33;t++)this._rotateDirect(i,h,_),c.push(this._add(r,i));t.push(c);break}case h.CoverageEdgesWithTicks:{const i=this._cp2(e,0,-1);let h,_;if(s>=3)h=e[2];else{const s=this._sub(i,r),t=this._leftPerp(s);h=[r[0]+t[0]-.25*s[0],r[1]+t[1]-.25*s[1]]}if(s>=4)_=e[3];else{const s=this._mid(r,i),t=this._sub(r,i);this._normalize(t),this._leftPerpendicular(t);const e=this._crossProduct(t,this._sub(h,s));this._rightPerpendicular(t),_=[h[0]+t[0]*e*2,h[1]+t[1]*e*2]}const c=this._sub(i,r);let u,o;u=this._crossProduct(c,this._sub(h,r))>0?this._rightPerp(c):this._leftPerp(c),o=[],o.push(h),o.push(r),o.push([r[0]+(u[0]-c[0])/3,r[1]+(u[1]-c[1])/3]),t.push(o),u=this._crossProduct(c,this._sub(_,i))>0?this._rightPerp(c):this._leftPerp(c),o=[],o.push([i[0]+(u[0]+c[0])/3,i[1]+(u[1]+c[1])/3]),o.push(i),o.push(_),t.push(o);break}case h.GapExtentWithDoubleTicks:{const i=this._cp2(e,0,2),h=this._cp3(e,i,0,1);let _;if(s>=4)_=e[3];else{const s=this._sub(i,r);_=this._add(h,s)}this._addAngledTicks(t,r,i,this._mid(h,_)),this._addAngledTicks(t,h,_,this._mid(r,i));break}case h.GapExtentMidline:{const i=this._cp2(e,2,0),h=this._cp3(e,i,0,1);let _;if(s>=4)_=e[3];else{const s=this._sub(i,r);_=this._add(h,s)}const c=[];c.push(this._mid(r,h)),c.push(this._mid(i,_)),t.push(c);break}case h.Chevron:{const i=this._cp2(e,-1,-1);let h;if(s>=3)h=e[2];else{const s=this._sub(i,r);this._leftPerpendicular(s),h=this._add(r,s)}t.push([i,this._makeCtrlPt(r),h]);break}case h.PerpendicularWithArc:{const i=this._cp2(e,0,-2),h=this._cp3(e,i,.5,-1),_=this._sub(i,r),c=this._norm(_);_[0]/=c,_[1]/=c;const u=this._crossProduct(_,this._sub(h,r));let o=this._dotProduct(_,this._sub(h,r));o<.05*c?o=.05*c:o>.95*c&&(o=.95*c);const n=[r[0]+_[0]*o,r[1]+_[1]*o];let a=this._leftPerp(_),p=[];if(p.push([n[0]-a[0]*u,n[1]-a[1]*u]),p.push([n[0]+a[0]*u,n[1]+a[1]*u]),t.push(p),s>=4){const s=e[3];let i=this._dotProduct(_,this._sub(s,r));i<.1*c?i=.1*c:i>.9*c&&(i=.9*c);const h=[r[0]+_[0]*i,r[1]+_[1]*i],u=this._crossProduct(_,this._sub(s,r)),o=[];o.push([h[0]-a[0]*u,h[1]-a[1]*u]),o.push([h[0]+a[0]*u,h[1]+a[1]*u]),t.push(o)}const d=[i[0]+a[0]*u,i[1]+a[1]*u];a=this._sub(i,d);const l=Math.cos(Math.PI/18);let b=Math.sin(Math.PI/18);u<0&&(b=-b),p=[r,i];for(let s=1;s<=9;s++)this._rotateDirect(a,l,b),p.push(this._add(d,a));t.push(p);break}case h.ClosedHalfCircle:{const s=this._cp2(e,2,0),i=this._mid(r,s),h=this._sub(s,i),_=Math.cos(Math.PI/18),c=Math.sin(Math.PI/18),u=[r,s];for(let t=1;t<=18;t++)this._rotateDirect(h,_,c),u.push(this._add(i,h));t.push(u);break}case h.TripleParallelExtended:{const s=this._cp2(e,0,-2),h=this._cp3(e,s,1,-2),_=this._mid(r,s),c=this._sub(h,s);this._normalize(c);const u=Math.abs(this._crossProduct(c,this._sub(_,s)))/2,o=this._dist(s,h),n=[s,r];n.push([r[0]+c[0]*o*.5,r[1]+c[1]*o*.5]),t.push(n);const a=[];a.push([_[0]-c[0]*u,_[1]-c[1]*u]),a.push([_[0]+c[0]*o*.375,_[1]+c[1]*o*.375]),i(a[a.length-1],1),a.push([_[0]+c[0]*o*.75,_[1]+c[1]*o*.75]),t.push(a);const p=[s,h];t.push(p);break}case h.ParallelWithTicks:{const s=this._cp2(e,3,0),i=this._cp3(e,s,.5,-1),h=this._sub(i,s);this._normalize(h);const _=this._crossProduct(h,this._sub(i,r));this._leftPerpendicular(h),this._addAngledTicks(t,r,s,i),this._addAngledTicks(t,this._mix(r,1,h,_),this._mix(s,1,h,_),this._mid(r,s));break}case h.Parallel:{const s=this._cp2(e,3,0),i=this._cp3(e,s,.5,-1),h=this._sub(s,r);this._normalize(h);const _=this._leftPerp(h),c=this._crossProduct(h,this._sub(i,r));let u=[r,s];t.push(u),u=[],u.push([r[0]+_[0]*c,r[1]+_[1]*c]),u.push([s[0]+_[0]*c,s[1]+_[1]*c]),t.push(u);break}case h.PerpendicularToFirstSegment:{const s=this._cp2(e,3,0),i=this._cp3(e,s,.5,-1),h=this._mid(r,s),_=this._sub(s,r);this._normalize(_);const c=this._crossProduct(_,this._sub(i,r));this._leftPerpendicular(_);const u=[];u.push([h[0]-_[0]*c*.25,h[1]-_[1]*c*.25]),u.push([h[0]+_[0]*c*1.25,h[1]+_[1]*c*1.25]),t.push(u);break}case h.ParallelOffset:{const s=this._cp2(e,3,0),i=this._cp3(e,s,.5,-1),h=this._sub(s,r);this._normalize(h);const _=this._crossProduct(h,this._sub(i,r));this._leftPerpendicular(h);const c=[];c.push([r[0]-h[0]*_,r[1]-h[1]*_]),c.push([s[0]-h[0]*_,s[1]-h[1]*_]),t.push(c);const u=[];u.push([r[0]+h[0]*_,r[1]+h[1]*_]),u.push([s[0]+h[0]*_,s[1]+h[1]*_]),t.push(u);break}case h.OffsetOpposite:{const s=this._cp2(e,3,0),i=this._cp3(e,s,.5,-1),h=this._sub(s,r);this._normalize(h);const _=this._crossProduct(h,this._sub(i,r));this._leftPerpendicular(h);const c=[];c.push([r[0]-h[0]*_,r[1]-h[1]*_]),c.push([s[0]-h[0]*_,s[1]-h[1]*_]),t.push(c);break}case h.OffsetSame:{const s=this._cp2(e,3,0),i=this._cp3(e,s,.5,-1),h=this._sub(s,r);this._normalize(h);const _=this._crossProduct(h,this._sub(i,r));this._leftPerpendicular(h);const c=[];c.push([r[0]+h[0]*_,r[1]+h[1]*_]),c.push([s[0]+h[0]*_,s[1]+h[1]*_]),t.push(c);break}case h.CircleWithArc:{let h=this._cp2(e,3,0);const _=this._cp3(e,h,.5,-1);let c,u;if(s>=4)c=e[3],u=this._crossProduct(this._sub(c,h),this._sub(_,h))>0;else{c=h,u=this._crossProduct(this._sub(c,r),this._sub(_,r))>0;const s=24*this._geomUnitsPerPoint,t=this._sub(c,r);this._normalize(t,s);const i=Math.sqrt(2)/2;this._rotateDirect(t,i,u?i:-i),h=this._add(r,t)}const o=this._sub(h,r),n=Math.cos(Math.PI/18),a=Math.sin(Math.PI/18),p=[h];for(let s=1;s<=36;s++)this._rotateDirect(o,n,a),p.push(this._add(r,o));this._add90DegArc(p,h,c,_,u),i(p[p.length-8],1),t.push(p);break}case h.DoubleJog:{let i,h=this._cp2(e,-3,1),_=this._cp3(e,h,-1,-.5);if(s>=4)i=e[3];else{const s=r;r=h,i=_;const t=this._dist(r,s),e=this._dist(i,s);let c=30*this._geomUnitsPerPoint;.5*t<c&&(c=.5*t),.5*e<c&&(c=.5*e),h=this._mix(r,c/t,s,(t-c)/t),_=this._mix(i,c/e,s,(e-c)/e)}const c=this._mid(r,h),u=this._mid(i,_),o=this._dist(r,h),n=this._dist(_,i);let a=Math.min(o,n)/8;a=Math.min(a,24*this._geomUnitsPerPoint);const p=Math.cos(Math.PI/4);let d=this._sub(r,h);this._normalize(d,a),this._crossProduct(d,this._sub(i,h))>0?this._rotateDirect(d,p,-p):this._rotateDirect(d,p,p);let l=[];l.push(h),l.push(this._add(c,d)),l.push(this._sub(c,d)),l.push(r),t.push(l),d=this._sub(i,_),this._normalize(d,a),this._crossProduct(d,this._sub(r,_))<0?this._rotateDirect(d,p,p):this._rotateDirect(d,p,-p),l=[],l.push(_),l.push(this._add(u,d)),l.push(this._sub(u,d)),l.push(i),t.push(l);break}case h.PerpendicularOffset:{const s=this._cp2(e,-4,1),i=this._cp3(e,s,.882353,-1.94),h=this._sub(i,s);this._crossProduct(h,this._sub(r,s))>0?this._rightPerpendicular(h):this._leftPerpendicular(h);const _=[h[0]/8,h[1]/8],c=this._sub(this._mid(s,i),_);t.push([c,r]);break}case h.LineExcludingLastSegment:{const s=this._arrowPath(e),i=[];let h=s.length-2;for(;h--;)i.push(s[h]);t.push(i);break}case h.MultivertexArrow:{const s=this._arrowPath(e),i=[];this._addArrow(i,s,!1),t.push(i);break}case h.CrossedArrow:{const s=this._arrowPath(e),i=[];this._addArrow(i,s,!0),t.push(i);break}case h.ChevronArrow:{const[s,i]=this._arrowLastSeg(e),h=10*this._geomUnitsPerPoint,_=this._sub(r,s),c=this._norm(_);this._normalize(_);const u=this._crossProduct(_,this._sub(i,s));let o=this._dotProduct(_,this._sub(i,s));o<.05*c?o=.05*c:o>.95*c-h&&(o=.95*c-h);const n=[s[0]+_[0]*o,s[1]+_[1]*o],a=this._leftPerp(_),p=[];p.push([n[0]+a[0]*u+_[0]*h,n[1]+a[1]*u+_[1]*h]),p.push(r),p.push([n[0]-a[0]*u+_[0]*h,n[1]-a[1]*u+_[1]*h]),t.push(p);break}case h.ChevronArrowOffset:{const[s,i]=this._arrowLastSeg(e),h=this._sub(r,s),_=this._norm(h);this._normalize(h);const c=this._crossProduct(h,this._sub(i,s));let u=this._dotProduct(h,this._sub(i,s));u<.05*_?u=.05*_:u>.95*_&&(u=.95*_);const o=[s[0]+h[0]*u,s[1]+h[1]*u];this._leftPerpendicular(h);const n=[];n.push([o[0]+h[0]*c*.5,o[1]+h[1]*c*.5]),n.push(this._mid(o,r)),n.push([o[0]-h[0]*c*.5,o[1]-h[1]*c*.5]),t.push(n);break}case h.PartialFirstSegment:{const[s,i]=this._arrowLastSeg(e),h=this._sub(r,s),_=this._norm(h);this._normalize(h);let c=this._dotProduct(h,this._sub(i,s));c<.05*_?c=.05*_:c>.95*_&&(c=.95*_);const u=[s[0]+h[0]*c,s[1]+h[1]*c];t.push([s,u]);break}case h.Arch:{const s=this._cp2(e,0,-1),i=this._cp3(e,s,.5,1),h=this._sub(r,s),_=this._mix(i,1,h,.55),c=this._mix(i,1,h,-.55),u=[r];this._addBezier2(u,r,_,i,4),this._addBezier2(u,i,c,s,4),t.push(u);break}case h.CurvedParallelTicks:{const s=this._cp2(e,-4,1),i=this._cp3(e,s,.882353,-1.94),h=this._sub(i,s);this._crossProduct(h,this._sub(r,s))>0?this._rightPerpendicular(h):this._leftPerpendicular(h);const _=[h[0]/8,h[1]/8],c=this._sub(this._mid(s,i),_),u=this._sub(this._mix(s,.75,i,.25),_),o=this._sub(this._mix(s,.25,i,.75),_),n=[s];this._addBezier2(n,s,u,c,3),this._addBezier2(n,c,o,i,3),t.push(n);for(let e=0;e<8;e++){const s=n[2*e+1],i=[this._clone(s)];i.push(this._add(s,[h[0]/4,h[1]/4])),t.push(i)}break}case h.Arc90Degrees:{const s=this._cp2(e,0,-1),i=this._cp3(e,s,.5,1),h=[s];this._add90DegArc(h,s,r,i),t.push(h);break}case h.TipWithPerpendicularAndTicks:{const[s,i]=this._arrowLastSeg(e),h=10*this._geomUnitsPerPoint,_=this._sub(r,s),c=this._norm(_);this._normalize(_);let u=this._crossProduct(_,this._sub(i,s)),o=this._dotProduct(_,this._sub(i,s));o<.05*c?o=.05*c:o>.95*c-h&&(o=.95*c-h);const n=this._leftPerp(_),a=[r[0]-_[0]*h,r[1]-_[1]*h],p=.5*Math.max(c-o-h,h);u=Math.abs(u);const d=[];d.push([a[0]+n[0]*(u+p)-_[0]*p,a[1]+n[1]*(u+p)-_[1]*p]),d.push([a[0]+n[0]*u,a[1]+n[1]*u]),d.push([a[0]-n[0]*u,a[1]-n[1]*u]),d.push([a[0]-n[0]*(u+p)-_[0]*p,a[1]-n[1]*(u+p)-_[1]*p]),t.push(d),t.push([a,r]);break}case h.FullGeometry:default:t.push(e)}}return t}}export{e as EffectControlMeasureLine};
|
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.31/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.31/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.31/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{numericHash as e}from"../../../../../../../core/string.js";function t(t){const o=t.map((({name:e,count:t,type:o})=>`${e}.${t}.${o}`)).join(",");return e(o)}function o(e,t,r,i,n,a,c){if(e.primitiveName===t)for(const o in e)if(o===r){let t=i?.readWithDefault(n,a,e[o]&&c);return"text"===e.type&&(t=t.toString()),void(e[o]=t)}if("type"in e&&null!=e.type)switch(e.type){case"CIMPointSymbol":case"CIMLineSymbol":case"CIMPolygonSymbol":if(e.symbolLayers)for(const
|
|
5
|
+
import{numericHash as e}from"../../../../../../../core/string.js";function t(t){const o=t.map((({name:e,count:t,type:o})=>`${e}.${t}.${o}`)).join(",");return e(o)}function o(e,t,r,i,n,a,c){if(e.primitiveName===t)for(const o in e)if(o===r){let t=i?.readWithDefault(n,a,e[o]&&c);return"text"===e.type&&(t=t.toString()),void(e[o]=t)}if("type"in e&&null!=e.type)switch(e.type){case"CIMPointSymbol":case"CIMLineSymbol":case"CIMPolygonSymbol":if(e.symbolLayers)for(const s of e.symbolLayers)o(s,t,r,i,n,a,c);break;case"CIMHatchFill":e.lineSymbol&&o(e.lineSymbol,t,r,i,n,a,c);break;case"CIMSolidStroke":case"CIMSolidFill":case"CIMVectorMarker":if("CIMVectorMarker"===e.type&&e.markerGraphics)for(const s of e.markerGraphics)o(s,t,r,i,n,a,c),o(s.symbol,t,r,i,n,a,c)}}const r=258;function i(e){const t=e.width;return null!=e.effects?r:Math.max(1.25*t,8)}export{o as applyComputedValue,i as getLineClippingMargin,t as vertexLayoutHash};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.31/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../AggregateGraphic.js";import"../../../geometry.js";import r from"../../../Graphic.js";import{isSome as i}from"../../../core/arrayUtils.js";import s from"../../../core/Collection.js";import{neverReached as a}from"../../../core/compilerUtils.js";import o from"../../../core/Error.js";import{makeHandle as n}from"../../../core/handleUtils.js";import has from"../../../core/has.js";import u from"../../../core/Logger.js";import{destroyMaybe as l}from"../../../core/maybe.js";import{deepEqual as h}from"../../../core/object.js";import{createAbortError as c,createResolver as p,throwIfNotAbortError as d,isAbortError as y}from"../../../core/promiseUtils.js";import{watch as g,initial as f}from"../../../core/reactiveUtils.js";import{property as m}from"../../../core/accessorSupport/decorators/property.js";import{subclass as w}from"../../../core/accessorSupport/decorators/subclass.js";import _ from"../../../layers/effects/FeatureEffectView.js";import{convertFromFeature as v}from"../../../layers/graphics/featureConversionUtils.js";import b from"../../../layers/support/FeatureFilter.js";import{packFields as F}from"../../../layers/support/fieldUtils.js";import{getEffectiveLayerCapabilities as A}from"../../../layers/support/layerUtils.js";import{combineTimeExtent as S}from"../../../layers/support/timeSupport.js";import E from"../../../rest/support/AggregateFeatureSet.js";import x from"../../../rest/support/FeatureSet.js";import j from"../../../rest/support/Query.js";import{getHighlightBits as V}from"../engine/highlightReasons.js";import{LayerView2DMixin as C}from"./LayerView2D.js";import{FeatureContainer as R}from"./features/FeatureContainer.js";import{createFeaturePipelineWorkerProxy as U}from"./features/FeaturePipelineWorkerProxy.js";import{FeatureSourceEventLog as k}from"./features/FeatureSourceEventLog.js";import{CatalogFootprintLayerAdapter as q}from"./features/layerAdapters/CatalogFootprintLayerAdapter.js";import{FeatureLayerAdapter as I}from"./features/layerAdapters/FeatureLayerAdapter.js";import{InMemoryLayerAdapter as Q}from"./features/layerAdapters/InMemoryLayerAdapter.js";import{KnowledgeGraphSublayerAdapter as O}from"./features/layerAdapters/KnowledgeGraphSublayerAdapter.js";import{OGCFeatureLayerAdapter as L}from"./features/layerAdapters/OGCFeatureLayerAdapter.js";import{OrientedImageryLayerAdapter as H}from"./features/layerAdapters/OrientedImageryLayerAdapter.js";import{StreamLayerAdapter as P}from"./features/layerAdapters/StreamLayerAdapter.js";import{SubtypeGroupLayerAdapter as W}from"./features/layerAdapters/SubtypeGroupLayerAdapter.js";import{createComplexSymbolInstances as T}from"./features/schema/processor/symbols/ComplexSymbolSchema.js";import D from"./support/FeatureCommandQueue.js";import{handleNoEngineError as M}from"./support/handleNoEngineError.js";import{HighlightCounter as N}from"./support/HighlightCounter.js";import{toJSONGeometryType as J}from"./support/util.js";import{FeatureTileSubscriptionManager as $}from"../tiling/FeatureTileSubscriptionManager.js";import G from"../../layers/FeatureLayerView.js";import z from"../../layers/LayerView.js";import B from"../../layers/RefreshableLayerView.js";import Z from"../../../geometry/Extent.js";function K(e,t){const r=new Set;return e&&e.forEach((e=>r.add(e))),t&&t.forEach((e=>r.add(e))),r.has("*")?["*"]:Array.from(r)}const X=4294967294;let Y=class extends(G(B(C(z)))){constructor(){super(...arguments),this._commandsQueue=new D({process:e=>{switch(e.type){case"edit-by-feature":case"edit-by-id":return this._doEdit(e);case"update":return this._doUpdate()}}}),this._visibilityOverrides=new Set,this._highlightCounter=new N,this._lastAvailableFields=[],this.eventLog=new k,this._sourceRefreshVersion=1,this._displayRefreshVersion=1,this._pipelineUpdating=!1,this._fields=null,this.featureEffectView=new _}destroy(){this._workerProxy?.destroy(),this._workerAttached.reject(c()),this._commandsQueue.destroy()}initialize(){this._workerAttached=p(),this.addResolvingPromise(this._initProxy()),this.featureEffectView.featureEffect=this.featureEffect,this.featureEffectView.endTransitions()}async _initProxy(){const e=this.layer;if("isTable"in e&&e.isTable)throw new o("featurelayerview:table-not-supported","table feature layer can't be displayed",{layer:e});if("mesh"===e.geometryType)throw new o("featurelayerview:geometry-type-not-supported",`Geometry type of ${e.geometryType} is not supported`,{layer:e});if(("feature"===e.type||"subtype-group"===e.type)&&!1===A(e)?.operations.supportsQuery)throw new o("featurelayerview:query-not-supported","layer view requires a layer with query capability",{layer:e});this._workerProxy&&this._workerProxy.destroy();const t=this._createClientOptions();this._workerProxy=await U(t)}async _attachProxy(){const e={service:await this.layerAdapter.createServiceOptions(this.view),tileInfoJSON:this.view.featuresTilingScheme.tileInfo.toJSON()};let t=[];Array.isArray(e.service.source)&&(t=e.service.source);try{await this._workerProxy.pipeline.onAttach(e,{transferList:t}),this._workerAttached.resolve()}catch(r){d(r)}this._workerAttached.reject()}async _detachProxy(){return this._workerProxy.pipeline.onDetach()}async getWorker(){return await this._workerAttached.promise,this._workerProxy}get hasAllFeatures(){return this.layer.visible&&this.eventLog.hasAllFeatures}get hasAllFeaturesInView(){return this.layer.visible&&this.eventLog.hasAllFeaturesInView}get hasFullGeometries(){return this.layer.visible&&this.eventLog.hasFullGeometries}get labelingCollisionInfos(){const e=this.layerAdapter.getLabelingDeconflictionInfo(this.view),t=this.layer.geometryType,r=!this.suspended;return e.map((({vvEvaluators:e,deconflictionEnabled:i})=>({container:this.featureContainer,vvEvaluators:e,deconflictionEnabled:i,geometryType:t,visible:r})))}get layerAdapter(){switch(this.layer.type){case"feature":return"memory"===this.layer.source.type?new Q(this.layer):new I(this.layer);case"geojson":case"csv":case"wfs":return new Q(this.layer);case"subtype-group":return new W(this.layer);case"ogc-feature":return new L(this.layer);case"stream":return new P(this.layer);case"oriented-imagery":return new H(this.layer);case"knowledge-graph-sublayer":return new O(this.layer);case"catalog-footprint":return new q(this.layer);default:a(this.layer)}return null}get timeExtent(){return S(this.layerAdapter.timeOptions,this.view?.timeExtent,this._get("timeExtent"))}getDisplayStatistics(e,t){return this.featureContainer?.getDisplayStatistics(e,t)}async queryHeatmapStatistics(e){return(await this.getWorker()).pipeline.queryHeatmapStatistics(e)}highlight(e,t="highlight"){let a;e instanceof r?a=[e.getObjectId()]:"number"==typeof e||"string"==typeof e?a=[e]:s.isCollection(e)&&e.length>0?a=e.map((e=>e?.getObjectId())).toArray():Array.isArray(e)&&e.length>0&&(a="number"==typeof e[0]||"string"==typeof e[0]?e:e.map((e=>e?.getObjectId())));const o=a?.filter(i);return o?.length?(this._addHighlights(o,t),n((()=>this._removeHighlights(o,t)))):n()}getHighlightIds(){return Array.from(this._highlightCounter.ids())}hasHighlight(){return!this._highlightCounter.empty}async hitTest(e,i){const s=await this.featureContainer.hitTest(i);if(0===s.length)return null;const a=await this.getWorker(),{features:o,aggregates:n}=await a.pipeline.getDisplayFeatures(s),u=this.featureContainer.getSortKeys(s),l=({displayId:e},{displayId:t})=>u.has(e)&&u.has(t)?u.get(e)-u.get(t):e-t;return o.sort(l).reverse(),n.sort(l).reverse(),[...n.map((r=>this._createGraphicHit(e,t.fromJSON(r)))),...o.map((t=>this._createGraphicHit(e,r.fromJSON(t))))]}async queryStatistics(){const e=await this.getWorker();return M(e.pipeline.queryStatistics(),{featureCount:0,ringCount:0,vertexCount:0})}async querySummaryStatistics(e,t,r){const i=await this.getWorker(),s={...t,scale:this.view.scale},a=i.features.executeQueryForSummaryStatistics(this._cleanUpQuery(e),s,r);return M(a,{})}async queryAggregateSummaryStatistics(e,t,r){const i={...t,scale:this.view.scale},s=(await this.getWorker()).aggregates.executeQueryForSummaryStatistics(this._cleanUpAggregateQuery(e),i,r);return M(s,{})}async queryUniqueValues(e,t,r){const i=await this.getWorker(),s={...t,scale:this.view.scale},a=i.features.executeQueryForUniqueValues(this._cleanUpQuery(e),s,r);return M(a,{uniqueValueInfos:[]})}async queryAggregateUniqueValues(e,t,r){const i=await this.getWorker(),s={...t,scale:this.view.scale},a=i.aggregates.executeQueryForUniqueValues(this._cleanUpAggregateQuery(e),s,r);return M(a,{uniqueValueInfos:[]})}async queryClassBreaks(e,t,r){const i=await this.getWorker(),s={...t,scale:this.view.scale},a=i.features.executeQueryForClassBreaks(this._cleanUpQuery(e),s,r);return M(a,{classBreakInfos:[]})}async queryAggregateClassBreaks(e,t,r){const i=await this.getWorker(),s={...t,scale:this.view.scale},a=i.aggregates.executeQueryForClassBreaks(this._cleanUpAggregateQuery(e),s,r);return M(a,{classBreakInfos:[]})}async queryHistogram(e,t,r){const i=await this.getWorker(),s={...t,scale:this.view.scale},a=i.features.executeQueryForHistogram(this._cleanUpQuery(e),s,r);return M(a,{bins:[],maxValue:null,minValue:null,normalizationTotal:null})}async queryAggregateHistogram(e,t,r){const i=await this.getWorker(),s={...t,scale:this.view.scale},a=i.aggregates.executeQueryForHistogram(this._cleanUpAggregateQuery(e),s,r);return M(a,{bins:[],maxValue:null,minValue:null,normalizationTotal:null})}queryFeatures(e,t){return this.queryFeaturesJSON(e,t).then((e=>{const t=x.fromJSON(e);return t.features.forEach((e=>this._setLayersForFeature(e))),t}))}async queryVisibleFeatures(e,t){const r=(await this.getWorker()).pipeline.queryVisibleFeatures(this._cleanUpQuery(e),t),i=await M(r,{features:[]}),s=x.fromJSON(i);return s.features.forEach((e=>this._setLayersForFeature(e))),s}async queryAggregates(e,t){const r=(await this.getWorker()).aggregates.executeQuery(this._cleanUpAggregateQuery(e),t),i=await M(r,{features:[]}),s=E.fromJSON(i);return s.features.forEach((e=>this._setLayersForFeature(e))),s}async queryAggregateIds(e,t){const r=(await this.getWorker()).aggregates.executeQueryForIds(this._cleanUpAggregateQuery(e),t);return M(r,[])}async queryAggregateCount(e,t){const r=(await this.getWorker()).aggregates.executeQueryForCount(this._cleanUpAggregateQuery(e),t);return M(r,0)}async queryAggregateJSON(e,t){const r=(await this.getWorker()).aggregates.executeQuery(this._cleanUpAggregateQuery(e),t);return M(r,{features:[]})}async queryFeaturesJSON(e,t){const r=(await this.getWorker()).features.executeQuery(this._cleanUpQuery(e),t);return M(r,{features:[]})}async queryObjectIds(e,t){const r=(await this.getWorker()).features.executeQueryForIds(this._cleanUpQuery(e),t);return M(r,[])}async queryFeatureCount(e,t){const r=(await this.getWorker()).features.executeQueryForCount(this._cleanUpQuery(e),t);return M(r,0)}async queryExtent(e,t){const r=(await this.getWorker()).features.executeQueryForExtent(this._cleanUpQuery(e),t),i=await M(r,{count:0,extent:null});return{count:i.count,extent:Z.fromJSON(i.extent)}}async getSampleFeatures(e){return(await this.getWorker()).pipeline.getSampleFeatures(e)}setVisibility(e,t){t?this._visibilityOverrides.delete(e):this._visibilityOverrides.add(e),this._update()}update(e){if(!this._subscriptionManager)return;const t=this._subscriptionManager.update(e);this.featureContainer.setVisibleTiles(t)}attach(){has("esri-2d-update-debug")&&console.debug("FeatureLayerView2D.attach"),this._updatingHandles.addPromise(this._workerAttached.promise),this._attachProxy(),this.featureContainer=new R(this),this.container.addChild(this.featureContainer),this.view.timeline.record(`${this.layer.title} (FeatureLayer) Attach`),this._subscriptionManager=new $({tileInfoView:this.view.featuresTilingScheme,updateSubscriptions:e=>{this.featureContainer.updateSubscriptions(e),this._updatingHandles.addPromise(this.getWorker().then((t=>t.pipeline.updateSubscriptions(e))))},isDone:e=>this.featureContainer.isDone(e)}),this.requestUpdate(),this.addAttachHandles([g((()=>JSON.stringify({displayRefreshVersion:this._displayRefreshVersion,timeExtent:this.timeExtent,clips:this.clips,filter:this.filter,featureEffect:this.featureEffect,sourceRefreshVersion:this._sourceRefreshVersion,timeZone:this.view.timeZone,effect:this.featureEffect,...this.layerAdapter.getUpdateHashProperties(this.view)})),(()=>this._update()),f),g((()=>this.updateSuspended),(e=>{e||(this._subscriptionManager.resume(),this.view.labelManager.requestUpdate())}))]),"stream"!==this.layer.type&&"catalog-footprint"!==this.layer.type&&this.addAttachHandles(this.layer.on("edits",(e=>this._edit(e))))}detach(){has("esri-2d-update-debug")&&console.debug("FeatureLayerView2D.detach"),this._detachProxy(),this._fields=null,this.featureContainer.destroy(),this._commandsQueue.clear(),this.container.removeAllChildren(),this._subscriptionManager=l(this._subscriptionManager),this._workerProxy.pipeline.onDetach(),this._workerAttached=p(),this._lastAvailableFields=[],this._lastSchema=null}viewChange(){this.requestUpdate()}moveEnd(){this.requestUpdate()}isUpdating(){const e="renderer"in this.layer&&null!=this.layer.renderer,t=this._commandsQueue.updateTracking.updating,r=null!=this._updatingRequiredFieldsPromise,i=this.featureContainer.updatingHandles.updating,s=this.updateRequested||e&&(t||r)||i||this._pipelineUpdating||this.dataUpdating;if(has("esri-2d-log-updating")){console.log(`Updating FLV2D (${this.layer.id}): ${s}\n -> updateRequested ${this.updateRequested}\n -> hasRenderer ${e}\n -> updatingRequiredFields ${r}\n -> hasPendingCommand ${t}\n -> dataUpdating ${this.dataUpdating}\n -> processing ${this._pipelineUpdating}\n -> updatingContainer ${i}\n`);for(const e of this.featureContainer.subscriptions())console.log(` -> Tile[${e.id}] Done: ${e.done}`)}return s}_createClientOptions(){const e=this;return{get container(){return e.featureContainer},setUpdating:e=>{this._set("_pipelineUpdating",e.pipeline),this._set("dataUpdating",e.data)},emitEvent:e=>{this.emit(e.name,e.event)},get eventLog(){return e.eventLog},fetch:t=>Promise.all(t.map((t=>e.view.stage.painter.textureManager.rasterizeItem(t)))),fetchDictionary:e=>Promise.all(e.map((e=>this._fetchDictionaryRequest(e))))}}async _fetchDictionaryRequest(e){try{if("subtype-group"===this.layer.type)throw new Error("InternalError: SubtypeGroupLayer does not support dictionary renderer");const t=this.layer.renderer;if(!t||"dictionary"!==t.type)throw new Error("InternalError: Expected layer to have a DictionaryRenderer");const r=this._lastSchema.processor.mesh.factory.symbology;if("dictionary"!==r.type)throw new Error("InternalError: Expected schema to be of type 'dictionary'");const i={cimAnalyzer:this.view.stage.cimAnalyzer,cimResourceManager:this.view.stage.painter.textureManager.resourceManager,store:this.featureContainer.instanceStore,scaleExpression:r.scaleExpression};this._fields||(this._fields=this.layer.fields.map((e=>e.toJSON())));const s=r.visualVariableUniforms,a=await t.getSymbolAsync(e.feature,{fields:this._fields});if(!a||!a.data)return{type:"dictionary-response",meshes:[]};return{type:"dictionary-response",meshes:await T(a.data,{uniforms:s,path:"renderer",schemaOptions:i})}}catch(t){return{type:"dictionary-response",meshes:[]}}}_cleanUpQuery(e){const t=j.from(e)||this.createQuery();return t.outSpatialReference||(t.outSpatialReference=this.view.spatialReference),t.toJSON()}_cleanUpAggregateQuery(e){const t=j.from(e)||this.createAggregateQuery();t.outSpatialReference||(t.outSpatialReference=this.view.spatialReference);const r=t.objectIds??[];for(const i of t.aggregateIds??[])r.push(i);return t.objectIds=r,t.aggregateIds=[],t.toJSON()}async _update(){return this._commandsQueue.push({type:"update"})}async _edit(e){if(this.updateSuspended)return void this._subscriptionManager.suspend();const t=this._getEffectiveEdit(e);return t?this._commandsQueue.push(t).catch(d):void 0}async doRefresh(e){this.attached&&(this.updateSuspended&&e||(e?this.incrementSourceRefreshVersion():this.incrementDisplayRefreshVersion()))}incrementSourceRefreshVersion(){this._sourceRefreshVersion=(this._sourceRefreshVersion+1)%X+1}incrementDisplayRefreshVersion(){this._displayRefreshVersion=(this._displayRefreshVersion+1)%X+1}_getEffectiveEdit(e){const t="globalIdField"in this.layer&&this.layer.globalIdField,r=e.deletedFeatures.some((e=>-1===e.objectId||!e.objectId)),i=t&&this.availableFields.includes(t);if(r&&!i)return u.getLogger(this).error(new o("mapview-apply-edits",`Editing the specified service requires the layer's globalIdField, ${t} to be included the layer's outFields for updates to be reflected on the map`)),null;const s=this.layer,a=e.historicMoment?.getTime()??null,n="layerId"in s&&e.editedFeatures?.find((e=>e.layerId===s.layerId));if(n){const e=!1,r=!1,i=J(this.layer.geometryType),{adds:s,deletes:o,updates:u}=n.editedFeatures,l=this.layer.objectIdField,h=s.map((t=>v(t,i,e,r))),c=u.map((t=>v(t.current,i,e,r)));return{type:"edit-by-feature",added:h,removed:o.map((e=>"attributes"in e?{globalId:t?e.attributes[t]:null,objectIdField:l?e.attributes[l]:null}:e)),updated:c,historicMoment:a}}return{type:"edit-by-id",added:e.addedFeatures,updated:e.updatedFeatures,removed:e.deletedFeatures,historicMoment:a}}async _doUpdate(){"featureReduction"in this.layer&&this.layer.featureReduction&&this.layer.featureReduction!==this._lastFeatureReduction&&(this.layer.featureReduction=this.layer.featureReduction?.clone(),this._lastFeatureReduction=this.layer.featureReduction);try{if(await this._updateRequiredFields(),this.destroyed||!this.layerAdapter?.hasRequiredSupport||!this._subscriptionManager)return;const e=this.featureContainer.instanceStore;this.featureContainer.attributeView.lockTextureUploads(),e.updateStart();const t=this.featureEffect,r={store:e,cimAnalyzer:this.view.stage.cimAnalyzer,cimResourceManager:this.view.stage.painter.textureManager.resourceManager,scaleExpression:void 0},i=this._createViewSchemaConfig(),s={source:this.layerAdapter.createSourceSchema(i,this._sourceRefreshVersion),processor:await this.layerAdapter.createProcessorSchema(r,i,this._displayRefreshVersion)},a=h(this._lastSchema?.source.mutable,s.source.mutable)||h(this._lastSchema?.processor,s.processor);if(!a)return this.featureContainer.requestRender(),this.featureContainer.attributeView.unlockTextureUploads(),e.updateEnd(),void(this.featureEffectView.featureEffect=t);this._lastSchema=s,this._fields=null;const o=Math.round(performance.now());has("esri-2d-update-debug")&&console.debug(`Id[${this.layer.uid}] Version[${o}] FeatureLayerView2D._doUpdate`,{changes:a});const n=await this.getWorker();await n.pipeline.updateSchema(s,o),e.updateEnd(),this.featureEffectView.featureEffect=t,this.featureEffectView.endTransitions(),this.featureContainer.attributeView.unlockTextureUploads(),this.featureContainer.swapRenderState(),this.featureContainer.requestRender(),has("esri-2d-update-debug")&&console.debug(`Version[${o}] FeatureLayerView2D.updateEnd`),this.requestUpdate()}catch(e){has("esri-2d-update-debug")&&console.error("Encountered an error during update",e)}}async _doEdit(e){const t=await this.getWorker();try{this.featureContainer.editStart(),await t.pipeline.onEdits(e),this.featureContainer.editEnd()}catch(r){y(r),0}}get hasFilter(){const e=this.layerAdapter.hasFilters?.(this.view)??!1;return null!=this.filter||null!=this.timeExtent||this._visibilityOverrides.size>0||e}_getEffectiveAvailableFields(e){const t=K(this._lastAvailableFields,e);return this._lastAvailableFields=t,F(this.layer.fieldsIndex,t)}_createViewSchemaConfig(){const e=[ee(this.view,this.layerAdapter,this.timeExtent,this._visibilityOverrides,this.filter),this.featureEffect?.filter?.toJSON()??null];return{availableFields:this._getEffectiveAvailableFields(this.availableFields),filters:e,scale:this.view.scale,timeZone:this.view.timeZone}}_addHighlights(e,t){this._highlightCounter.addReason(e,t),this._updateHighlights()}_removeHighlights(e,t){this._highlightCounter.deleteReason(e,t),this._updateHighlights()}async _updateHighlights(){const e=[];for(const i of this._highlightCounter.ids()){const t=this._highlightCounter.getHighlightReason(i),r=V(t);e.push({objectId:i,highlightFlags:r})}const t=await this.getWorker();if(this.destroyed)return;const r=t.pipeline.updateHighlight({highlights:e}).catch((e=>{y(e)||u.getLogger(this).error(e)}));this._updatingHandles.addPromise(r)}_setLayersForFeature(e){e.layer=e.sourceLayer=this.layer,this.layerAdapter.setGraphicOrigin&&this.layerAdapter.setGraphicOrigin(e)}_createGraphicHit(e,t){return this._setLayersForFeature(t),null!=t.geometry&&(t.geometry.spatialReference=this.view.spatialReference),{type:"graphic",graphic:t,layer:this.layer,mapPoint:e}}};function ee(e,t,r,i,s){s&&(s=s.clone());const a=null!=s?s.timeExtent:null,o=null!=r&&null!=a?r.intersection(a):r||a;o&&(s??=new b,s.timeExtent=o),s=t.addFilters?.(s,e)??s;let n=s?.toJSON()??null;return i.size&&(n??=(new b).toJSON(),n.hiddenIds=Array.from(i)),n}e([m()],Y.prototype,"_commandsQueue",void 0),e([m()],Y.prototype,"_sourceRefreshVersion",void 0),e([m()],Y.prototype,"_displayRefreshVersion",void 0),e([m({readOnly:!0})],Y.prototype,"_pipelineUpdating",void 0),e([m({readOnly:!0})],Y.prototype,"hasAllFeatures",null),e([m({readOnly:!0})],Y.prototype,"hasAllFeaturesInView",null),e([m({readOnly:!0})],Y.prototype,"hasFullGeometries",null),e([m()],Y.prototype,"featureEffectView",void 0),e([m()],Y.prototype,"labelingCollisionInfos",null),e([m()],Y.prototype,"layerAdapter",null),e([m({readOnly:!0})],Y.prototype,"timeExtent",null),e([m()],Y.prototype,"updating",void 0),Y=e([w("esri.views.2d.layers.FeatureLayerView2D")],Y);const te=Y;export{te as default};
|
|
5
|
+
import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../AggregateGraphic.js";import"../../../geometry.js";import r from"../../../Graphic.js";import{isSome as i}from"../../../core/arrayUtils.js";import s from"../../../core/Collection.js";import{neverReached as a}from"../../../core/compilerUtils.js";import o from"../../../core/Error.js";import{makeHandle as n}from"../../../core/handleUtils.js";import has from"../../../core/has.js";import u from"../../../core/Logger.js";import{destroyMaybe as l}from"../../../core/maybe.js";import{deepEqual as h}from"../../../core/object.js";import{createAbortError as c,createResolver as p,ignoreAbortErrors as d,throwIfNotAbortError as y,isAbortError as g}from"../../../core/promiseUtils.js";import{watch as f,initial as m}from"../../../core/reactiveUtils.js";import{property as w}from"../../../core/accessorSupport/decorators/property.js";import{subclass as _}from"../../../core/accessorSupport/decorators/subclass.js";import v from"../../../layers/effects/FeatureEffectView.js";import{convertFromFeature as b}from"../../../layers/graphics/featureConversionUtils.js";import F from"../../../layers/support/FeatureFilter.js";import{packFields as A}from"../../../layers/support/fieldUtils.js";import{getEffectiveLayerCapabilities as S}from"../../../layers/support/layerUtils.js";import{combineTimeExtent as E}from"../../../layers/support/timeSupport.js";import x from"../../../rest/support/AggregateFeatureSet.js";import j from"../../../rest/support/FeatureSet.js";import V from"../../../rest/support/Query.js";import{getHighlightBits as C}from"../engine/highlightReasons.js";import{LayerView2DMixin as R}from"./LayerView2D.js";import{FeatureContainer as U}from"./features/FeatureContainer.js";import{createFeaturePipelineWorkerProxy as k}from"./features/FeaturePipelineWorkerProxy.js";import{FeatureSourceEventLog as q}from"./features/FeatureSourceEventLog.js";import{CatalogFootprintLayerAdapter as I}from"./features/layerAdapters/CatalogFootprintLayerAdapter.js";import{FeatureLayerAdapter as Q}from"./features/layerAdapters/FeatureLayerAdapter.js";import{InMemoryLayerAdapter as O}from"./features/layerAdapters/InMemoryLayerAdapter.js";import{KnowledgeGraphSublayerAdapter as L}from"./features/layerAdapters/KnowledgeGraphSublayerAdapter.js";import{OGCFeatureLayerAdapter as H}from"./features/layerAdapters/OGCFeatureLayerAdapter.js";import{OrientedImageryLayerAdapter as P}from"./features/layerAdapters/OrientedImageryLayerAdapter.js";import{StreamLayerAdapter as W}from"./features/layerAdapters/StreamLayerAdapter.js";import{SubtypeGroupLayerAdapter as T}from"./features/layerAdapters/SubtypeGroupLayerAdapter.js";import{createComplexSymbolInstances as D}from"./features/schema/processor/symbols/ComplexSymbolSchema.js";import M from"./support/FeatureCommandQueue.js";import{handleNoEngineError as N}from"./support/handleNoEngineError.js";import{HighlightCounter as J}from"./support/HighlightCounter.js";import{toJSONGeometryType as $}from"./support/util.js";import{FeatureTileSubscriptionManager as G}from"../tiling/FeatureTileSubscriptionManager.js";import z from"../../layers/FeatureLayerView.js";import B from"../../layers/LayerView.js";import Z from"../../layers/RefreshableLayerView.js";import K from"../../../geometry/Extent.js";function X(e,t){const r=new Set;return e&&e.forEach((e=>r.add(e))),t&&t.forEach((e=>r.add(e))),r.has("*")?["*"]:Array.from(r)}const Y=4294967294;let ee=class extends(z(Z(R(B)))){constructor(){super(...arguments),this._commandsQueue=new M({process:e=>{switch(e.type){case"edit-by-feature":case"edit-by-id":return this._doEdit(e);case"update":return this._doUpdate()}}}),this._visibilityOverrides=new Set,this._highlightCounter=new J,this._lastAvailableFields=[],this.eventLog=new q,this._sourceRefreshVersion=1,this._displayRefreshVersion=1,this._pipelineUpdating=!1,this._fields=null,this.featureEffectView=new v}destroy(){this._workerProxy?.destroy(),this._workerAttached.reject(c()),this._commandsQueue.destroy()}initialize(){this._workerAttached=p(),d(this._workerAttached.promise),this.addResolvingPromise(this._initProxy()),this.featureEffectView.featureEffect=this.featureEffect,this.featureEffectView.endTransitions()}async _initProxy(){const e=this.layer;if("isTable"in e&&e.isTable)throw new o("featurelayerview:table-not-supported","table feature layer can't be displayed",{layer:e});if("mesh"===e.geometryType)throw new o("featurelayerview:geometry-type-not-supported",`Geometry type of ${e.geometryType} is not supported`,{layer:e});if(("feature"===e.type||"subtype-group"===e.type)&&!1===S(e)?.operations.supportsQuery)throw new o("featurelayerview:query-not-supported","layer view requires a layer with query capability",{layer:e});this._workerProxy&&this._workerProxy.destroy();const t=this._createClientOptions();this._workerProxy=await k(t)}async _attachProxy(){const e={service:await this.layerAdapter.createServiceOptions(this.view),tileInfoJSON:this.view.featuresTilingScheme.tileInfo.toJSON()};let t=[];Array.isArray(e.service.source)&&(t=e.service.source);try{await this._workerProxy.pipeline.onAttach(e,{transferList:t}),this._workerAttached.resolve()}catch(r){y(r)}this._workerAttached.reject()}async _detachProxy(){return this._workerProxy.pipeline.onDetach()}async getWorker(){try{await this._workerAttached.promise}catch(e){console.error("Throw abort")}return this._workerProxy}get hasAllFeatures(){return this.layer.visible&&this.eventLog.hasAllFeatures}get hasAllFeaturesInView(){return this.layer.visible&&this.eventLog.hasAllFeaturesInView}get hasFullGeometries(){return this.layer.visible&&this.eventLog.hasFullGeometries}get labelingCollisionInfos(){const e=this.layerAdapter.getLabelingDeconflictionInfo(this.view),t=this.layer.geometryType,r=!this.suspended;return e.map((({vvEvaluators:e,deconflictionEnabled:i})=>({container:this.featureContainer,vvEvaluators:e,deconflictionEnabled:i,geometryType:t,visible:r})))}get layerAdapter(){switch(this.layer.type){case"feature":return"memory"===this.layer.source.type?new O(this.layer):new Q(this.layer);case"geojson":case"csv":case"wfs":return new O(this.layer);case"subtype-group":return new T(this.layer);case"ogc-feature":return new H(this.layer);case"stream":return new W(this.layer);case"oriented-imagery":return new P(this.layer);case"knowledge-graph-sublayer":return new L(this.layer);case"catalog-footprint":return new I(this.layer);default:a(this.layer)}return null}get timeExtent(){return E(this.layerAdapter.timeOptions,this.view?.timeExtent,this._get("timeExtent"))}getDisplayStatistics(e,t){return this.featureContainer?.getDisplayStatistics(e,t)}async queryHeatmapStatistics(e){return(await this.getWorker()).pipeline.queryHeatmapStatistics(e)}highlight(e,t="highlight"){let a;e instanceof r?a=[e.getObjectId()]:"number"==typeof e||"string"==typeof e?a=[e]:s.isCollection(e)&&e.length>0?a=e.map((e=>e?.getObjectId())).toArray():Array.isArray(e)&&e.length>0&&(a="number"==typeof e[0]||"string"==typeof e[0]?e:e.map((e=>e?.getObjectId())));const o=a?.filter(i);return o?.length?(this._addHighlights(o,t),n((()=>this._removeHighlights(o,t)))):n()}getHighlightIds(){return Array.from(this._highlightCounter.ids())}hasHighlight(){return!this._highlightCounter.empty}async hitTest(e,i){const s=await this.featureContainer.hitTest(i);if(0===s.length)return null;const a=await this.getWorker(),{features:o,aggregates:n}=await a.pipeline.getDisplayFeatures(s),u=this.featureContainer.getSortKeys(s),l=({displayId:e},{displayId:t})=>u.has(e)&&u.has(t)?u.get(e)-u.get(t):e-t;return o.sort(l).reverse(),n.sort(l).reverse(),[...n.map((r=>this._createGraphicHit(e,t.fromJSON(r)))),...o.map((t=>this._createGraphicHit(e,r.fromJSON(t))))]}async queryStatistics(){const e=await this.getWorker();return N(e.pipeline.queryStatistics(),{featureCount:0,ringCount:0,vertexCount:0})}async querySummaryStatistics(e,t,r){const i=await this.getWorker(),s={...t,scale:this.view.scale},a=i.features.executeQueryForSummaryStatistics(this._cleanUpQuery(e),s,r);return N(a,{})}async queryAggregateSummaryStatistics(e,t,r){const i={...t,scale:this.view.scale},s=(await this.getWorker()).aggregates.executeQueryForSummaryStatistics(this._cleanUpAggregateQuery(e),i,r);return N(s,{})}async queryUniqueValues(e,t,r){const i=await this.getWorker(),s={...t,scale:this.view.scale},a=i.features.executeQueryForUniqueValues(this._cleanUpQuery(e),s,r);return N(a,{uniqueValueInfos:[]})}async queryAggregateUniqueValues(e,t,r){const i=await this.getWorker(),s={...t,scale:this.view.scale},a=i.aggregates.executeQueryForUniqueValues(this._cleanUpAggregateQuery(e),s,r);return N(a,{uniqueValueInfos:[]})}async queryClassBreaks(e,t,r){const i=await this.getWorker(),s={...t,scale:this.view.scale},a=i.features.executeQueryForClassBreaks(this._cleanUpQuery(e),s,r);return N(a,{classBreakInfos:[]})}async queryAggregateClassBreaks(e,t,r){const i=await this.getWorker(),s={...t,scale:this.view.scale},a=i.aggregates.executeQueryForClassBreaks(this._cleanUpAggregateQuery(e),s,r);return N(a,{classBreakInfos:[]})}async queryHistogram(e,t,r){const i=await this.getWorker(),s={...t,scale:this.view.scale},a=i.features.executeQueryForHistogram(this._cleanUpQuery(e),s,r);return N(a,{bins:[],maxValue:null,minValue:null,normalizationTotal:null})}async queryAggregateHistogram(e,t,r){const i=await this.getWorker(),s={...t,scale:this.view.scale},a=i.aggregates.executeQueryForHistogram(this._cleanUpAggregateQuery(e),s,r);return N(a,{bins:[],maxValue:null,minValue:null,normalizationTotal:null})}queryFeatures(e,t){return this.queryFeaturesJSON(e,t).then((e=>{const t=j.fromJSON(e);return t.features.forEach((e=>this._setLayersForFeature(e))),t}))}async queryVisibleFeatures(e,t){const r=(await this.getWorker()).pipeline.queryVisibleFeatures(this._cleanUpQuery(e),t),i=await N(r,{features:[]}),s=j.fromJSON(i);return s.features.forEach((e=>this._setLayersForFeature(e))),s}async queryAggregates(e,t){const r=(await this.getWorker()).aggregates.executeQuery(this._cleanUpAggregateQuery(e),t),i=await N(r,{features:[]}),s=x.fromJSON(i);return s.features.forEach((e=>this._setLayersForFeature(e))),s}async queryAggregateIds(e,t){const r=(await this.getWorker()).aggregates.executeQueryForIds(this._cleanUpAggregateQuery(e),t);return N(r,[])}async queryAggregateCount(e,t){const r=(await this.getWorker()).aggregates.executeQueryForCount(this._cleanUpAggregateQuery(e),t);return N(r,0)}async queryAggregateJSON(e,t){const r=(await this.getWorker()).aggregates.executeQuery(this._cleanUpAggregateQuery(e),t);return N(r,{features:[]})}async queryFeaturesJSON(e,t){const r=(await this.getWorker()).features.executeQuery(this._cleanUpQuery(e),t);return N(r,{features:[]})}async queryObjectIds(e,t){const r=(await this.getWorker()).features.executeQueryForIds(this._cleanUpQuery(e),t);return N(r,[])}async queryFeatureCount(e,t){const r=(await this.getWorker()).features.executeQueryForCount(this._cleanUpQuery(e),t);return N(r,0)}async queryExtent(e,t){const r=(await this.getWorker()).features.executeQueryForExtent(this._cleanUpQuery(e),t),i=await N(r,{count:0,extent:null});return{count:i.count,extent:K.fromJSON(i.extent)}}async getSampleFeatures(e){return(await this.getWorker()).pipeline.getSampleFeatures(e)}setVisibility(e,t){t?this._visibilityOverrides.delete(e):this._visibilityOverrides.add(e),this._update()}update(e){if(!this._subscriptionManager)return;const t=this._subscriptionManager.update(e);this.featureContainer.setVisibleTiles(t)}attach(){has("esri-2d-update-debug")&&console.debug("FeatureLayerView2D.attach"),d(this._updatingHandles.addPromise(this._workerAttached.promise)),d(this._attachProxy()),this.featureContainer=new U(this),this.container.addChild(this.featureContainer),this.view.timeline.record(`${this.layer.title} (FeatureLayer) Attach`),this._subscriptionManager=new G({tileInfoView:this.view.featuresTilingScheme,updateSubscriptions:e=>{this.featureContainer.updateSubscriptions(e),d(this._updatingHandles.addPromise(this.getWorker().then((t=>t.pipeline.updateSubscriptions(e)))))},isDone:e=>this.featureContainer.isDone(e)}),this.requestUpdate(),this.addAttachHandles([f((()=>JSON.stringify({displayRefreshVersion:this._displayRefreshVersion,timeExtent:this.timeExtent,clips:this.clips,filter:this.filter,featureEffect:this.featureEffect,sourceRefreshVersion:this._sourceRefreshVersion,timeZone:this.view.timeZone,effect:this.featureEffect,...this.layerAdapter.getUpdateHashProperties(this.view)})),(()=>this._update()),m),f((()=>this.updateSuspended),(e=>{e||(this._subscriptionManager.resume(),this.view.labelManager.requestUpdate())}))]),"stream"!==this.layer.type&&"catalog-footprint"!==this.layer.type&&this.addAttachHandles(this.layer.on("edits",(e=>this._edit(e))))}detach(){has("esri-2d-update-debug")&&console.debug("FeatureLayerView2D.detach"),this._detachProxy(),this._fields=null,this.featureContainer.destroy(),this._commandsQueue.clear(),this.container.removeAllChildren(),this._subscriptionManager=l(this._subscriptionManager),this._workerProxy.pipeline.onDetach(),this._workerAttached=p(),this._lastAvailableFields=[],this._lastSchema=null}viewChange(){this.requestUpdate()}moveEnd(){this.requestUpdate()}isUpdating(){const e="renderer"in this.layer&&null!=this.layer.renderer,t=this._commandsQueue.updateTracking.updating,r=null!=this._updatingRequiredFieldsPromise,i=this.featureContainer.updatingHandles.updating,s=this.updateRequested||e&&(t||r)||i||this._pipelineUpdating||this.dataUpdating;if(has("esri-2d-log-updating")){console.log(`Updating FLV2D (${this.layer.id}): ${s}\n -> updateRequested ${this.updateRequested}\n -> hasRenderer ${e}\n -> updatingRequiredFields ${r}\n -> hasPendingCommand ${t}\n -> dataUpdating ${this.dataUpdating}\n -> processing ${this._pipelineUpdating}\n -> updatingContainer ${i}\n`);for(const e of this.featureContainer.subscriptions())console.log(` -> Tile[${e.id}] Done: ${e.done}`)}return s}_createClientOptions(){const e=this;return{get container(){return e.featureContainer},setUpdating:e=>{this._set("_pipelineUpdating",e.pipeline),this._set("dataUpdating",e.data)},emitEvent:e=>{this.emit(e.name,e.event)},get eventLog(){return e.eventLog},fetch:t=>Promise.all(t.map((t=>e.view.stage.painter.textureManager.rasterizeItem(t)))),fetchDictionary:e=>Promise.all(e.map((e=>this._fetchDictionaryRequest(e))))}}async _fetchDictionaryRequest(e){try{if("subtype-group"===this.layer.type)throw new Error("InternalError: SubtypeGroupLayer does not support dictionary renderer");const t=this.layer.renderer;if(!t||"dictionary"!==t.type)throw new Error("InternalError: Expected layer to have a DictionaryRenderer");const r=this._lastSchema.processor.mesh.factory.symbology;if("dictionary"!==r.type)throw new Error("InternalError: Expected schema to be of type 'dictionary'");const i={cimAnalyzer:this.view.stage.cimAnalyzer,cimResourceManager:this.view.stage.painter.textureManager.resourceManager,store:this.featureContainer.instanceStore,scaleExpression:r.scaleExpression};this._fields||(this._fields=this.layer.fields.map((e=>e.toJSON())));const s=r.visualVariableUniforms,a=await t.getSymbolAsync(e.feature,{fields:this._fields});if(!a||!a.data)return{type:"dictionary-response",meshes:[]};return{type:"dictionary-response",meshes:await D(a.data,{uniforms:s,path:"renderer",schemaOptions:i})}}catch(t){return{type:"dictionary-response",meshes:[]}}}_cleanUpQuery(e){const t=V.from(e)||this.createQuery();return t.outSpatialReference||(t.outSpatialReference=this.view.spatialReference),t.toJSON()}_cleanUpAggregateQuery(e){const t=V.from(e)||this.createAggregateQuery();t.outSpatialReference||(t.outSpatialReference=this.view.spatialReference);const r=t.objectIds??[];for(const i of t.aggregateIds??[])r.push(i);return t.objectIds=r,t.aggregateIds=[],t.toJSON()}async _update(){return this._commandsQueue.push({type:"update"})}async _edit(e){if(this.updateSuspended)return void this._subscriptionManager.suspend();const t=this._getEffectiveEdit(e);return t?this._commandsQueue.push(t).catch(y):void 0}async doRefresh(e){this.attached&&(this.updateSuspended&&e||(e?this.incrementSourceRefreshVersion():this.incrementDisplayRefreshVersion()))}incrementSourceRefreshVersion(){this._sourceRefreshVersion=(this._sourceRefreshVersion+1)%Y+1}incrementDisplayRefreshVersion(){this._displayRefreshVersion=(this._displayRefreshVersion+1)%Y+1}_getEffectiveEdit(e){const t="globalIdField"in this.layer&&this.layer.globalIdField,r=e.deletedFeatures.some((e=>-1===e.objectId||!e.objectId)),i=t&&this.availableFields.includes(t);if(r&&!i)return u.getLogger(this).error(new o("mapview-apply-edits",`Editing the specified service requires the layer's globalIdField, ${t} to be included the layer's outFields for updates to be reflected on the map`)),null;const s=this.layer,a=e.historicMoment?.getTime()??null,n="layerId"in s&&e.editedFeatures?.find((e=>e.layerId===s.layerId));if(n){const e=!1,r=!1,i=$(this.layer.geometryType),{adds:s,deletes:o,updates:u}=n.editedFeatures,l=this.layer.objectIdField,h=s.map((t=>b(t,i,e,r))),c=u.map((t=>b(t.current,i,e,r)));return{type:"edit-by-feature",added:h,removed:o.map((e=>"attributes"in e?{globalId:t?e.attributes[t]:null,objectIdField:l?e.attributes[l]:null}:e)),updated:c,historicMoment:a}}return{type:"edit-by-id",added:e.addedFeatures,updated:e.updatedFeatures,removed:e.deletedFeatures,historicMoment:a}}async _doUpdate(){"featureReduction"in this.layer&&this.layer.featureReduction&&this.layer.featureReduction!==this._lastFeatureReduction&&(this.layer.featureReduction=this.layer.featureReduction?.clone(),this._lastFeatureReduction=this.layer.featureReduction);try{if(await this._updateRequiredFields(),this.destroyed||!this.layerAdapter?.hasRequiredSupport||!this._subscriptionManager)return;const e=this.featureContainer.instanceStore;this.featureContainer.attributeView.lockTextureUploads(),e.updateStart();const t=this.featureEffect,r={store:e,cimAnalyzer:this.view.stage.cimAnalyzer,cimResourceManager:this.view.stage.painter.textureManager.resourceManager,scaleExpression:void 0},i=this._createViewSchemaConfig(),s={source:this.layerAdapter.createSourceSchema(i,this._sourceRefreshVersion),processor:await this.layerAdapter.createProcessorSchema(r,i,this._displayRefreshVersion)},a=h(this._lastSchema?.source.mutable,s.source.mutable)||h(this._lastSchema?.processor,s.processor);if(!a)return this.featureContainer.requestRender(),this.featureContainer.attributeView.unlockTextureUploads(),e.updateEnd(),void(this.featureEffectView.featureEffect=t);this._lastSchema=s,this._fields=null;const o=Math.round(performance.now());has("esri-2d-update-debug")&&console.debug(`Id[${this.layer.uid}] Version[${o}] FeatureLayerView2D._doUpdate`,{changes:a});const n=await this.getWorker();await n.pipeline.updateSchema(s,o),e.updateEnd(),this.featureEffectView.featureEffect=t,this.featureEffectView.endTransitions(),this.featureContainer.attributeView.unlockTextureUploads(),this.featureContainer.swapRenderState(),this.featureContainer.requestRender(),has("esri-2d-update-debug")&&console.debug(`Version[${o}] FeatureLayerView2D.updateEnd`),this.requestUpdate()}catch(e){has("esri-2d-update-debug")&&console.error("Encountered an error during update",e)}}async _doEdit(e){const t=await this.getWorker();try{this.featureContainer.editStart(),await t.pipeline.onEdits(e),this.featureContainer.editEnd()}catch(r){g(r),0}}get hasFilter(){const e=this.layerAdapter.hasFilters?.(this.view)??!1;return null!=this.filter||null!=this.timeExtent||this._visibilityOverrides.size>0||e}_getEffectiveAvailableFields(e){const t=X(this._lastAvailableFields,e);return this._lastAvailableFields=t,A(this.layer.fieldsIndex,t)}_createViewSchemaConfig(){const e=[te(this.view,this.layerAdapter,this.timeExtent,this._visibilityOverrides,this.filter),this.featureEffect?.filter?.toJSON()??null];return{availableFields:this._getEffectiveAvailableFields(this.availableFields),filters:e,scale:this.view.scale,timeZone:this.view.timeZone}}_addHighlights(e,t){this._highlightCounter.addReason(e,t),this._updateHighlights()}_removeHighlights(e,t){this._highlightCounter.deleteReason(e,t),this._updateHighlights()}async _updateHighlights(){const e=[];for(const i of this._highlightCounter.ids()){const t=this._highlightCounter.getHighlightReason(i),r=C(t);e.push({objectId:i,highlightFlags:r})}const t=await this.getWorker();if(this.destroyed)return;const r=t.pipeline.updateHighlight({highlights:e}).catch((e=>{g(e)||u.getLogger(this).error(e)}));this._updatingHandles.addPromise(r)}_setLayersForFeature(e){e.layer=e.sourceLayer=this.layer,this.layerAdapter.setGraphicOrigin&&this.layerAdapter.setGraphicOrigin(e)}_createGraphicHit(e,t){return this._setLayersForFeature(t),null!=t.geometry&&(t.geometry.spatialReference=this.view.spatialReference),{type:"graphic",graphic:t,layer:this.layer,mapPoint:e}}};function te(e,t,r,i,s){s&&(s=s.clone());const a=null!=s?s.timeExtent:null,o=null!=r&&null!=a?r.intersection(a):r||a;o&&(s??=new F,s.timeExtent=o),s=t.addFilters?.(s,e)??s;let n=s?.toJSON()??null;return i.size&&(n??=(new F).toJSON(),n.hiddenIds=Array.from(i)),n}e([w()],ee.prototype,"_commandsQueue",void 0),e([w()],ee.prototype,"_sourceRefreshVersion",void 0),e([w()],ee.prototype,"_displayRefreshVersion",void 0),e([w({readOnly:!0})],ee.prototype,"_pipelineUpdating",void 0),e([w({readOnly:!0})],ee.prototype,"hasAllFeatures",null),e([w({readOnly:!0})],ee.prototype,"hasAllFeaturesInView",null),e([w({readOnly:!0})],ee.prototype,"hasFullGeometries",null),e([w()],ee.prototype,"featureEffectView",void 0),e([w()],ee.prototype,"labelingCollisionInfos",null),e([w()],ee.prototype,"layerAdapter",null),e([w({readOnly:!0})],ee.prototype,"timeExtent",null),e([w()],ee.prototype,"updating",void 0),ee=e([_("esri.views.2d.layers.FeatureLayerView2D")],ee);const re=ee;export{re 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.31/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import e from"../../../../core/Error.js";import{handlesGroup as t}from"../../../../core/handleUtils.js";import has from"../../../../core/has.js";import{nextTick as s}from"../../../../core/nextTick.js";import{throwIfNotAbortError as i,createResolver as r}from"../../../../core/promiseUtils.js";import
|
|
5
|
+
import e from"../../../../core/Error.js";import{handlesGroup as t}from"../../../../core/handleUtils.js";import has from"../../../../core/has.js";import{nextTick as s}from"../../../../core/nextTick.js";import{throwIfNotAbortError as i,createResolver as r,ignoreAbortErrors as o}from"../../../../core/promiseUtils.js";import n from"../../../../core/RandomLCG.js";import{watch as u}from"../../../../core/reactiveUtils.js";import{pt2px as a}from"../../../../core/screenUtils.js";import{ignoreConnectionErrors as d}from"../../../../core/workers/utils.js";import c from"../../../../layers/support/TileInfo.js";import p from"../../tiling/TileInfoView.js";import"../../tiling/TileKey.js";import"../../tiling/TileQueue.js";import"../../tiling/TileStrategy.js";import{tileSize as l}from"../../engine/webgl/definitions.js";import{PipelineConnectionHandlers as h}from"./PipelineConnectionHandlers.js";import g from"./Processor.js";import{FeatureSource as _}from"./sources/FeatureSource.js";import{FeatureTileSubscription as b}from"./sources/FeatureTileSubscription.js";import{Tile as f}from"./support/Tile.js";class m{constructor(e){this.inner=e,this.resolver=r()}}class y{constructor(){this._aggregateAdapter={getFeatureObjectIds:e=>this._processor.getFeatureObjectIdsForAggregate(e)},this._subscriptions=new Map,this._updateRequested=!1,this._updateSubscriptionRequests=[],this._updateHighlightRequests=[]}destroy(){this._subscriptions.clear(),this._processor.destroy(),this._source.destroy(),this._handles.remove(),this._updateLocalEditsRequest=null,this._tileInfoView=null}onAttach(e){has("esri-2d-update-debug")&&console.debug("Pipeline.onAttach");const s=this._connection,i=c.fromJSON(e.tileInfoJSON);this._tileInfoView=new p(i),this._source=new _(e.service,this._aggregateAdapter,this._subscriptions,(()=>this._requestUpdate()),s),this._processor=new g(s,this._source),this._handles=t([u((()=>this._source.updateTracking.updating),(()=>{this._requestUpdate(),o(this._connection.layerView.setUpdating({data:this._source.updateTracking.updating,pipeline:!0}))}))])}onDetach(){has("esri-2d-update-debug")&&console.debug("Pipeline.onDetach"),this.destroy()}set remoteClient(e){this._connection=new h(e)}get features(){const t=this._source?.queryEngine;if(!t)throw new e("no-queryEngine","No query engine defined");return t}get aggregates(){const t=this._processor?.aggregateQueryEngine;if(!t)throw new e("no-queryEngine","No aggregate query engine defined");return t}get processor(){return this._processor}get streamMessenger(){return this._source.streamMessenger}getDisplayFeatures(e){return this._processor.getDisplayFeatures(e)}async updateSchema(e,t){return has("esri-2d-update-debug")&&this._updateSchemaRequest&&console.error("InternalError: Schema already updating"),this._updateSchemaRequest=new m({schema:e,version:t}),this._requestUpdate(),this._updateSchemaRequest.resolver.promise}updateSubscriptions(e){const t=new m(e);return this._updateSubscriptionRequests.push(t),this._requestUpdate(),t.resolver.promise}updateHighlight(e){const t=new m(e);return this._updateHighlightRequests.push(t),this._requestUpdate(),t.resolver.promise}async onEdits(t){if(null!=this._updateLocalEditsRequest)throw new e("InternalError - Already processing an edit");this._updateLocalEditsRequest=new m(t);const s=this._updateLocalEditsRequest.resolver.promise;return this._requestUpdate(),s}queryStatistics(){return this._source.statistics.toJSON()}async queryVisibleFeatures(e,t){return this.features.executeQuery(e,t)}async queryHeatmapStatistics(e){const t=Math.round(a(e.radius));let s=Number.POSITIVE_INFINITY,i=Number.NEGATIVE_INFINITY;const r="string"==typeof e.fieldOffset,o=e.fieldOffset??0,n=Array.from(this._subscriptions.values()),u=this._source.chunks(),d=t**2,c=3/(Math.PI*d),p=2*t,h=Math.ceil(l/p);for(const a of n){const t=a.tile,n=new Float64Array(h*h);for(const s of u){const i=s.getTileReader(t);if(!i)continue;const u=i.getCursor();for(;u.next();){let t=1;if(null!=e.field){const s=u.readAttribute(e.field);t=r?-1*+s:+s+o}const s=u.readXForDisplay()/p,i=u.readYForDisplay()/p,a=Math.floor(s),l=Math.floor(i);if(a<0||l<0||a>=h||l>=h)continue;const g=((.5+a-s)*p)**2+((.5+l-i)*p)**2;if(g>d)continue;const _=t*(c*(1-g/d)**2);n[l+a*h]+=_}}for(let e=0;e<n.length;e++)s=Math.min(s,n[e]),i=Math.max(i,n[e])}return{max:i,min:s}}async getSampleFeatures(e){const t=this._source.chunks();if(t.reduce(((e,t)=>e+t.size()),0)<=e.minFeatureCount){if(!this._source.updateTracking.updating){const e=[];return this._source.store.forEachUnsafe((t=>e.push(t.readLegacyFeatureWorldSpace()))),e}return null}const s=new Set,i=[],r=t.map((e=>e.reader.getCursor())),o=new n,u=3*e.sampleSize;for(let n=0;n<u&&i.length<e.sampleSize;n++){const e=r[o.getIntRange(0,t.length-1)];if(0===e.getSize())continue;const n=o.getIntRange(0,e.getSize()-1);e.setIndex(n);const u=e.getObjectId();s.has(u)||(s.add(u),i.push(e.readLegacyFeatureWorldSpace()))}return i.length>=e.sampleSize?i:null}_requestUpdate(){this._updateRequested||(this._updateRequested=!0,s((()=>this._scheduleNextUpdate())))}_scheduleNextUpdate(){this._updateRequested&&(this._ongoingUpdate||(this._ongoingUpdate=d(this._doUpdate()).finally((()=>{this._ongoingUpdate=null,this._scheduleNextUpdate()})),this._updateRequested=!1))}_subscribe(e){const t=e.tileId;if(this._subscriptions.has(t)){const s=this._subscriptions.get(t);return void(s.paused&&(has("esri-2d-update-debug")&&console.debug(`Tile[${t}] Pipeline.resume`),s.resume(),s.version=e.version,this._source.onResume(s)))}has("esri-2d-update-debug")&&console.debug(`Tile[${t}] Pipeline.subscribe`);const s=new f(this._tileInfoView,t),i=new b(s,e.version);this._subscriptions.set(t,i),this._source.onSubscribe(i),this._processor.onSubscribe(i)}_unsubscribe(e){const t=this._subscriptions.get(e);t&&(has("esri-2d-update-debug")&&console.debug(`Tile[${e}] Pipeline.unsubscribe`),this._source.onUnsubscribe(t),this._processor.onUnsubscribe(t),this._subscriptions.delete(t.key.id),t.destroy())}_pauseSubscription(e){const t=this._subscriptions.get(e);t&&(has("esri-2d-update-debug")&&console.debug(`Tile[${e}] Pipeline.pause`),t.pause())}async _doUpdate(){if(has("esri-2d-update-debug")&&console.debug("Pipeline._doUpdateStart"),await this._connection.layerView.setUpdating({data:this._source.updateTracking.updating,pipeline:!0}),this._updateSubscriptionRequests.length){const e=this._updateSubscriptionRequests;this._updateSubscriptionRequests=[];for(const t of e)this._doUpdateSubscriptions(t.inner),t.resolver.resolve()}const e=this._updateSchemaRequest;if(this._updateSchemaRequest=null,null!=e){const{schema:t,version:s}=e.inner;await this._doUpdateSchema(t,s)}const t=this._updateLocalEditsRequest;if(this._updateLocalEditsRequest=null,null!=t){has("esri-2d-update-debug")&&console.debug("Pipeline.applyEditOverride",t.inner);const e=await this._source.getLocalEdit(t.inner);await this._processor.applyLocalEdit(e),this._source.applyLocalEdit(e),has("esri-2d-update-debug")&&console.debug("Pipeline.endEditOverride",t.inner)}if(this._updateHighlightRequests.length){const e=this._updateHighlightRequests;this._updateHighlightRequests=[];for(const t of e)this._processor.updateHighlight(t.inner),t.resolver.resolve()}const s=this._source.cleanupRemovedChunks();this._processor.removeChunks(s);try{this._subscriptions.size&&(has("esri-2d-update-debug")&&console.debug("Pipeline.updateChunksStart"),await this._processor.updateChunks(),has("esri-2d-update-debug")&&console.debug("Pipeline.updateChunksEnd"))}catch(r){i(r)}null!=t&&t.resolver.resolve(),null!=e&&e.resolver.resolve(),this._updateRequested?(has("esri-2d-update-debug")&&console.debug("Pipeline._doUpdateEnd [updateRequested=true]"),await this._connection.layerView.setUpdating({data:this._source.updateTracking.updating,pipeline:!0})):(has("esri-2d-update-debug")&&console.debug("Pipeline._doUpdateEnd [updateRequested=false, After flush]"),await this._connection.layerView.setUpdating({data:this._source.updateTracking.updating,pipeline:this._updateRequested}))}async _doUpdateSchema(e,t){has("esri-2d-update-debug")&&console.debug(`Version[${t}] Pipeline.updateStart`,{schema:e});const s={tileInfo:this._tileInfoView?.tileInfo},i=await this._source.update(e,t),r=Array.from(this._subscriptions.values());await this._processor.update(e,t,s,i,r),has("esri-2d-update-debug")&&console.debug(`Version[${t}] Pipeline.updateEnd`)}_doUpdateSubscriptions(e){has("esri-2d-update-debug")&&console.debug("Pipeline.updateSubscriptions",e);for(const t of e.subscribe)this._subscribe(t);for(const t of e.unsubscribe)this._unsubscribe(t);if(has("featurelayer-query-pausing-enabled"))for(const t of e.pause)this._pauseSubscription(t)}}export{y 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.31/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
class
|
|
5
|
+
import{ignoreConnectionErrors as e}from"../../../../core/workers/utils.js";class t{constructor(e){this._client=e,this.layerView=this._client.createInvokeProxy(""),this.container=this._client.createInvokeProxy("container"),this._eventLog=this._client.createInvokeProxy("eventLog")}onEvent(t){e(this._eventLog.onEvent(t))}}export{t as PipelineConnectionHandlers};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.31/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import has from"../../../../core/has.js";import{destroyMaybe as e}from"../../../../core/maybe.js";import{deepEqual as t}from"../../../../core/object.js";import{throwIfNotAbortError as s,throwIfAborted as r}from"../../../../core/promiseUtils.js";import{diff as i}from"../../../../core/accessorSupport/diffUtils.js";import a from"../../../../geometry/SpatialReference.js";import{MultiTileMeshData as
|
|
5
|
+
import has from"../../../../core/has.js";import{destroyMaybe as e}from"../../../../core/maybe.js";import{deepEqual as t}from"../../../../core/object.js";import{throwIfNotAbortError as s,throwIfAborted as r}from"../../../../core/promiseUtils.js";import{diff as i}from"../../../../core/accessorSupport/diffUtils.js";import{ignoreConnectionErrors as a}from"../../../../core/workers/utils.js";import o from"../../../../geometry/SpatialReference.js";import{MultiTileMeshData as n}from"../../engine/webgl/mesh/MultiTileMeshData.js";import{FeatureMeshFactory as c}from"../../engine/webgl/mesh/factories/FeatureMeshFactory.js";import{ResourceProxy as h}from"../../engine/webgl/mesh/factories/ResourceProxy.js";import{MeshWriterRegistry as u}from"../../engine/webgl/shaderGraph/techniques/mesh/MeshWriterRegistry.js";import{MatcherContext as p}from"../../engine/webgl/util/MatcherContext.js";import{ProcessorTileMessageQueue as g}from"./ProcessorTileMessageQueue.js";import{BinningStrategy as d}from"./processor/BinningStrategy.js";import{ClusterStrategy as y}from"./processor/ClusterStrategy.js";import{FeatureUpdateStrategy as _}from"./processor/FeatureUpdateStrategy.js";import{AttributeStore as l}from"./support/AttributeStore.js";import{ComputedAttributeStorage as m}from"./support/ComputedAttributeStorage.js";class f{constructor(e,t){this._connection=e,this._source=t,this._version=1,this._registry=new u,this._proxy=new h({fetch:(e,t)=>this._connection.layerView.fetch(e,t),fetchDictionary:(e,t)=>this._connection.layerView.fetchDictionary(e,t)}),this._attributeStore=new l({isLocal:!1,update:e=>a(this._connection.container.updateAttributeView(e))})}destroy(){this._proxy.destroy(),this._strategy?.destroy(),this._attributeStore.destroy()}get aggregateQueryEngine(){return this._strategy?.aggregateQueryEngine}getDisplayFeatures(e){return this._strategy?this._strategy.getDisplayFeatures(e):{features:[],aggregates:[]}}getFeatureObjectIdsForAggregate(e){return this._strategy?this._strategy.getFeatureObjectIdsForAggregate(e):[]}onSubscribe(e){this._strategy?.onSubscribe(e)}onUnsubscribe(e){this._strategy?.onUnsubscribe(e)}async update(e,s,r,a,n){const h=e.processor,u=t(this._schema?.storage,h.storage),g=t(this._schema?.mesh.properties,h.mesh.properties),d=t(this._schema?.mesh.factory,h.mesh.factory),y=t(this._schema?.mesh.strategy,h.mesh.strategy),_=g||d||y;if(!(u||_)&&!a)return;has("esri-2d-update-debug")&&console.debug(`Version[${this._version}] SymbolProcessor.update`,{changes:i(this._schema,h),schema:h}),this._schema=h;const l=o.fromJSON(this._source.service.outSpatialReference),f=new m({fields:this._source.metadata.fieldsIndex,spatialReference:l});if(await this._attributeStore.update(h.storage,f,this._source.metadata,l,s),this._strategy?.invalidateAttributeData(),!a&&!_)return;(y||g)&&await this._updateStrategy(h.mesh.strategy,l,n,h.mesh.properties.timeZone),this._updateSortKey(f,"sortKey"in h.mesh.properties?h.mesh.properties.sortKey:null);const b=new p(f,this._proxy,r,this._registry);return(d||"dictionary"===h.mesh.factory.symbology.type)&&(this._factory=await c.create(b,h.mesh.factory)),this._invalidate(),this._version=s,this._connection.container.updateRenderState(this._version)}async applyLocalEdit(e){if(!this._strategy)return;const t=this._strategy.applyLocalEdit(e);for await(const r of t)try{await this._process(r)}catch(s){}}async updateChunks(){await this._doUpdateChunks(),this._strategy?.afterUpdateChunks()}async removeChunks(e){this._strategy?.removeChunks(e),this._attributeStore.incrementDisplayIdGeneration()}updateHighlight({highlights:e}){if(!this._strategy)return void this._attributeStore.setHighlight(e.map((({objectId:e,highlightFlags:t})=>({objectId:e,highlightFlags:t,displayId:-1}))),e);const t=this._strategy.displayMap(e,(({objectId:e})=>e),((e,{highlightFlags:t},s)=>({objectId:s,displayId:e,highlightFlags:t})));this._attributeStore.setHighlight(t,e)}async _doUpdateChunks(){if(!this._strategy)return;const e=this._strategy.updateChunks(),t=[],r=new Map;for await(const a of e){let e=r.get(a.id);null==e&&(e=new g({concurrency:16,process:e=>this._process(e)}),r.set(a.id,e));const i=e.push(a).catch((e=>s(e)));t.push(i)}try{await Promise.all(t)}catch(i){}has("esri-2d-update-debug")&&console.log("SendUpdates"),this._attributeStore.sendUpdates(),has("esri-2d-update-debug")&&console.log("SendUpdates.await")}async _updateStrategy(e,t,s,r){switch(this._strategy?.destroy(),e.type){case"feature":this._strategy=new _(this._source,this._attributeStore,r);break;case"binning":this._strategy=await d.create(e,t,this._source,this._attributeStore,r);break;case"cluster":this._strategy=await y.create(this._connection,e,t,this._source,this._attributeStore,r)}for(const i of s)this._strategy.onSubscribe(i)}async _updateSortKey(t,s){if(this._sortInfo=e(this._sortInfo?.computed),null!=s){const e=s.byRenderer?null:await t.createComputedField(s);this._sortInfo={...s,computed:e}}}_invalidate(){this._strategy&&this._strategy.invalidate()}async _process(e){const t=e.subscription;if(has("esri-2d-update-debug")){const s=t.tile;console.debug(`Version[${this._version}] Tile[${s.key.id}, end=${e.end}] Processor._process`)}await this._fetchResources(e),r(t.signal);const s=await this._write(e,t.tile.createArcadeEvaluationOptions(this._schema?.mesh.properties.timeZone)),i=t.tile.tileInfoView.tileInfo.isWrappable,{message:a,transferList:o}=s.serialize(i),n={objectIdMap:null,inner:e.createMessage(a,this._version,this._attributeStore.epoch)};if(this._schema?.mesh.properties.returnMeshObjectId){n.objectIdMap={};const t=e.reader?.getCursor();if(t)for(;t.next();)n.objectIdMap[t.getDisplayId()]=t.getObjectId()}if(r(t.signal),await this._connection.container.onMessage(n,{signal:t.signal,transferList:o}),this._attributeStore.sendUpdates(),has("esri-2d-update-debug")){const s=t.tile;console.debug(`Version[${this._version}] Tile[${s.key.id}, end=${e.end}] Processor._process.await`)}}async _fetchResources(e){await this._fetchMatcherResources(e),await this._fetchWriterResources(e)}async _fetchMatcherResources(e){if(e.reader)return this._factory.enqueueMatcherRequests(this._proxy,e.reader)}async _fetchWriterResources(e){if(!e.reader)return;const t=e.reader.getCursor(),s=e.subscription.tile.createArcadeEvaluationOptions(this._schema.mesh.properties.timeZone);for(;t.next();)this._factory.enqueueWriterRequests(this._proxy,t,s);await this._proxy.fetchEnqueuedResources()}async _write(e,t){const s=e.subscription.tile,r=e.reader?.getCursor(),i=r?.getSize()??0,a=s.tileInfoView.tileInfo.isWrappable,o=new n(s.key,this._strategy.enablePixelBuffering,a,i);if(!r)return o;const c=s.createArcadeEvaluationOptions(this._schema.mesh.properties.timeZone);for(;r.next();){const e=this._getSortKeyValue(r,t);o.entityStart(r.getDisplayId(),e),this._factory.write(o,this._proxy,r,c,s.level),o.entityEnd()}return o}_getSortKeyValue(e,t){if(!this._sortInfo)return 0;const{computed:s,order:r,byRenderer:i}=this._sortInfo,a=i?this._factory.getSortKey(e,t):s?.read(e,t);return null==a||isNaN(a)?0:a*("asc"===r?-1:1)}}export{f 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.31/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import e from"../../../../../request.js";import has from"../../../../../core/has.js";import{ignoreAbortErrors as t,throwIfNotAbortError as s}from"../../../../../core/promiseUtils.js";import{diff as r,hasRootDiffOnly as a,hasRootDiff as i}from"../../../../../core/accessorSupport/diffUtils.js";import{OptimizedFeature as o}from"../../../../../layers/graphics/OptimizedFeature.js";import{QueryEngine as n}from"../../../../../layers/graphics/data/QueryEngine.js";import{executeQueryForCount as d}from"../../../../../rest/query/operations/query.js";import{FeatureStoreStatistics as h}from"../FeatureStoreStatistics.js";import{FeatureSourceQueryInfo as
|
|
5
|
+
import e from"../../../../../request.js";import has from"../../../../../core/has.js";import{ignoreAbortErrors as t,throwIfNotAbortError as s}from"../../../../../core/promiseUtils.js";import{diff as r,hasRootDiffOnly as a,hasRootDiff as i}from"../../../../../core/accessorSupport/diffUtils.js";import{OptimizedFeature as o}from"../../../../../layers/graphics/OptimizedFeature.js";import{QueryEngine as n}from"../../../../../layers/graphics/data/QueryEngine.js";import{executeQueryForCount as d}from"../../../../../rest/query/operations/query.js";import{FeatureStoreStatistics as h}from"../FeatureStoreStatistics.js";import{FeatureSourceQueryInfo as c}from"./FeatureSourceQueryInfo.js";import{StreamMessenger as u}from"./StreamMessenger.js";import{DrillDownTileLoadStrategy as l}from"./strategies/DrillDownTileLoadStrategy.js";import{PagedTileLoadStrategy as m}from"./strategies/PagedTileLoadStrategy.js";import{SnapshotLoadStrategy as p}from"./strategies/SnapshotLoadStrategy.js";import{StreamLoadStrategy as _}from"./strategies/StreamLoadStrategy.js";import{FeatureSourceChunkStore as g}from"./strategies/chunks/SourceChunkStore.js";import{FeatureMetadata as y}from"../support/FeatureMetadata.js";import{FeatureSetReaderJSON as f}from"../support/FeatureSetReaderJSON.js";import{UpdateTracking2D as v}from"../../support/UpdateTracking2D.js";class S{constructor(e,t,s,r,a){this.service=e,this._aggregateAdapter=t,this._subscriptions=s,this._onChange=r,this._connection=a,this._updateTracking=new v({debugName:"FeatureSource"}),this._didInvalidateData=!1,this._store=new g(this._onChange),this._metadata=new y(e.metadata)}destroy(){this._strategy?.destroy(),this._store.destroy(),this._streamMessenger?.destroy(),"memory"===this.service.type&&this.service.source.map((e=>e.close()))}get metadata(){if(!this._metadata)throw new Error("InternalError: Metadata not defined. Was update called?");return this._metadata}get store(){return this._store}get streamMessenger(){return null==this._streamMessenger&&this._initStreamMessenger(),this._streamMessenger}get statistics(){return h.from(this._store)}get updateTracking(){return this._updateTracking}get queryEngine(){if(!this._queryEngine){if(!this._schema)return null;const{dataFilter:e}=this._schema.mutable,t=this._schema.mutable.availableFields,s=this._metadata;this._queryEngine=new n({featureStore:this._store,fieldsIndex:s.fieldsIndex,geometryType:s.geometryType,objectIdField:s.objectIdField,hasM:!1,hasZ:!1,spatialReference:this.service.outSpatialReference,cacheSpatialQueries:!0,aggregateAdapter:this._aggregateAdapter,timeInfo:s.timeInfo,definitionExpression:e.definitionExpression,availableFields:t})}return this._queryEngine}get isStream(){return"stream"===this._schema.type}chunks(){return Array.from(this._store.chunks())}cleanupRemovedChunks(){return this._store.cleanupRemovedChunks()}onSubscribe(e){this._connection.onEvent({type:"subscribe",tile:e.tile.id});const t=this._strategy?.load(e);t&&(t.then((()=>this._connection.onEvent({type:"loaded",tile:e.tile.id}))).catch((t=>this._connection.onEvent({type:"error",tile:e.tile.id,error:t}))),this._updateTracking.addPromise(t))}onResume(e){this._updateTracking.addPromise(t(this._strategy?.load(e)))}onUnsubscribe(e){this._connection.onEvent({type:"unsubscribe",tile:e.tile.id}),this._strategy?.unload(e)}getLocalEdit(e){return this._updateTracking.addPromise(this._getGetLocalEdit(e))}applyLocalEdit(e){this._didInvalidateData=!0,this._store.applyLocalEdit(e,this.metadata)}async update(e,t){const s=e.source,o=r(this._schema?.mutable,s.mutable);if(!o)return!1;if(has("esri-2d-update-debug")&&console.debug(`Version[${t}] FeatureSource.update`,{changes:o}),this._schema=s,this._queryEngine?.destroy(),this._queryEngine=null,"feature-service"===this.service.type&&null!=this.service.queryMetadata.lastEditDate&&(this._lastEditDate=this.service.queryMetadata.lastEditDate),null==this._streamMessenger&&"stream"===this._schema.type&&this._initStreamMessenger(),a(o,"sourceRefreshVersion")&&this._strategy?.refresh)return await this._strategy.refresh(),!0;if("feature"===s.type&&a(o,"availableFields")){if(await this._queryLastEditDateChanged()||this._didInvalidateData)this._didInvalidateData=!1,await this._updateStrategy(t);else{this._connection.onEvent({type:"updateFieldsStart"});try{await this._strategy.updateFields(s.mutable.availableFields),this._connection.onEvent({type:"updateFieldsEnd"})}catch(n){this._connection.onEvent({type:"updateFieldsError",error:n})}}return!1}return!(!i(o,"dataFilter")&&!i(o,"sourceRefreshVersion"))&&(await this._updateStrategy(t),!0)}_initStreamMessenger(){null==this._streamMessenger&&(this._streamMessenger=new u(this._connection))}async _getGetLocalEdit(e){if(e.historicMoment&&"feature"===this._schema.type&&(this._schema.mutable.dataFilter.historicMoment=e.historicMoment,this._strategy.unsafeSetQueryHistoricMoment(new Date(e.historicMoment))),"edit-by-feature"===e.type){const t=[...e.added,...e.updated].map((e=>o.fromJSON(e,this.metadata.objectIdField)));return{reader:f.fromOptimizedFeatures(t,this.metadata),removed:this._resolveIdentifiers(e.removed)}}const t=this._resolveIdentifiers(e.removed);if(!e.updated.length&&!e.added.length)return{reader:f.empty(this.metadata),removed:t};const s=this._resolveIdentifiers([...e.added,...e.updated]);return{reader:await this._strategy.queryByObjectId(s),removed:t}}_resolveIdentifiers(e){const t=[],s=[];for(const r of e)null!=r.objectId&&-1!==r.objectId?s.push(r.objectId):t.push(r.globalId);if(t.length){const e=new Set(t),r=this.metadata.globalIdField;if(null==r)throw new Error("InternalError: Recieved an edit with globalIds, but not supported by the service");this._store.forEachUnsafe((t=>{const a=t.readAttribute(r);e.has(a)&&s.push(t.getObjectId())}))}return s}async _queryLastEditDateChanged(){if(null==this._lastEditDate)return!1;const t=this.service.source,s={...t.query,f:"json"},r=(await e(t.path,{query:s,responseType:"json"})).data.editingInfo.lastEditDate;return r!==this._lastEditDate&&(this._lastEditDate=r,!0)}async _createStrategy(){const e="isSourceHosted"in this.service&&this.service.isSourceHosted,t=Array.isArray(this.service.source),s=this.service.source&&"collection"in this.service.source,r=e||t||s;if("stream"===this._schema.type){const e=new _(this.service,this._schema.mutable.dataFilter,this._store,{outSR:this.service.outSpatialReference},this.metadata);return this._streamMessenger.strategy=e,e}const a=this.service,i=c.fromSchema(a,this._schema,this._metadata),o=await this._supportSnapshotMode(a,i);return o?new p(a,i,this._store,o.featureCount,this.metadata,this._connection):r?new m(a,i,this._store,this.metadata,this._connection):new l(a,i,this._store,this.metadata,this._connection)}async _updateStrategy(e){const t=await this._createStrategy();this._connection.onEvent({type:"updateStrategyStart",about:t.about});const r=!!this._strategy;this._store.clear(),this._strategy?.destroy(),this._strategy=t,has("esri-2d-update-debug")&&console.debug(`Version[${e}] FeatureSource.updateStrategy`,{strategy:t});const a=Array.from(this._subscriptions.values());if(!a.length)return void this._connection.onEvent({type:"updateStrategyEnd"});const i=Promise.all(a.map((e=>this._strategy.load(e).then((()=>this._connection.onEvent({type:"loaded",tile:e.tile.id}))).catch((t=>this._connection.onEvent({type:"error",tile:e.tile.id,error:t}))))));this._updateTracking.addPromise(i);try{r&&await i}catch(o){s(o)}this._connection.onEvent({type:"updateStrategyEnd"}),has("esri-2d-update-debug")&&console.debug(`Version[${e}] FeatureSource.updateStrategyEnd`,{strategy:t})}async _supportSnapshotMode(e,t){const{queryMetadata:s}=e,r=s.snapshotInfo;if(!r||!r.supportsSnapshotMinThreshold||!r.snapshotCountThresholds)return null;const a=e.source,i=t.createQuery();i.inner.orderByFields=[],i.inner.returnGeometry=!1;const o=(await d(a,i.inner,{query:i.customParameters})).data.count,{min:n,max:h}=r.snapshotCountThresholds;return o<=n||r.supportsSnapshotMaxThreshold&&o<h?{featureCount:o}:null}}export{S as FeatureSource};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.31/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import e from"../../../../../TimeExtent.js";import has from"../../../../../core/has.js";import{sqlAnd as t}from"../../../../../core/sql.js";import r from"../../../../../geometry/SpatialReference.js";import{isHostedAgolService as a}from"../../../../../layers/support/arcgisLayerUrl.js";import i from"../../../../../rest/support/Query.js";const o=4;function s(t,i,o){const s=t.orderByFields??o.objectIdField+" ASC",n=t.source,u={returnCentroid:!(null!==n&&"object"==typeof n&&"path"in n&&a(n.path))&&"esriGeometryPolygon"===o.geometryType,returnGeometry:!0,timeReferenceUnknownClient:o.timeReferenceUnknownClient??void 0,outSpatialReference:r.fromJSON(t.outSpatialReference),orderByFields:[s],where:i.mutable.dataFilter.definitionExpression??"1=1",outFields:i.mutable.availableFields};if("feature"===i.type){const{gdbVersion:t,historicMoment:r,timeExtent:a}=i.mutable.dataFilter;return{...u,gdbVersion:t,historicMoment:r?new Date(r):null,timeExtent:a?e.fromJSON(a):null,outFields:i.mutable.availableFields}}return u}class n{static fromSchema(e,t,r){const a="feature"===t.type?t.mutable.dataFilter.queryScaleRanges:[];return new n(s(e,t,r),a,r.subtypeField,t.mutable.dataFilter.customParameters,r.geometryType,e.queryMetadata)}constructor(e,t,r,a,i,o){this._queryParams=e,this._queryScaleRanges=t,this._subtypeField=r,this._customParameters=a,this._geometryType=i,this._queryMetadata=o}get pageSize(){if(null==this._queryMetadata)throw new Error("InternalError: Service does not support paged queries");const e=this._queryMetadata.supportsMaxRecordCountFactor?o:null,t=(this._queryMetadata.maxRecordCount??8e3)*(e??1);return Math.min(8e3,t)}updateHistoricMoment(e){this._queryParams.historicMoment=e}updateFields(e){this._queryParams.outFields=e}createPatchFieldsQuery(e,t){const r=e.clone();if("*"===this._queryParams.outFields[0]){if("*"===(r.outFields??[])[0])return null;r.outFields=this._queryParams.outFields}else{const e=new Set(this._queryParams.outFields),a=[];for(const r of e)t.hasField(r)||a.push(r);if(0===a.length)return null;r.outFields=a}return r.returnGeometry=!1,r.returnCentroid=!1,r.quantizationParameters=null,r.cacheHint=!0,{inner:r,customParameters:this._customParameters}}createQuery(e={}){if(!this._queryParams)throw new Error("InternalError: queryInfo should be defined");return{inner:new i({...this._queryParams,...e}),customParameters:this._customParameters}}createTileQuery(e,r){if(null==this._queryMetadata)throw new Error("InternalError: Service does not support tile queries");const a=this.createQuery(r),i=a.inner;if(this._queryScaleRanges.length){const r=this._queryScaleRanges.filter((t=>(!t.minScale||t.minScale>=e.maxScale)&&(!t.maxScale||t.maxScale<=e.minScale))).map((e=>e.subtypeCode));if(r.length){const e=`${this._subtypeField} IN (${r})`;i.where=t(i.where,e)}}
|
|
5
|
+
import e from"../../../../../TimeExtent.js";import has from"../../../../../core/has.js";import{sqlAnd as t}from"../../../../../core/sql.js";import r from"../../../../../geometry/SpatialReference.js";import{isHostedAgolService as a}from"../../../../../layers/support/arcgisLayerUrl.js";import i from"../../../../../rest/support/Query.js";const o=4;function s(t,i,o){const s=t.orderByFields??o.objectIdField+" ASC",n=t.source,u={returnCentroid:!(null!==n&&"object"==typeof n&&"path"in n&&a(n.path))&&"esriGeometryPolygon"===o.geometryType,returnGeometry:!0,timeReferenceUnknownClient:o.timeReferenceUnknownClient??void 0,outSpatialReference:r.fromJSON(t.outSpatialReference),orderByFields:[s],where:i.mutable.dataFilter.definitionExpression??"1=1",outFields:i.mutable.availableFields};if("feature"===i.type){const{gdbVersion:t,historicMoment:r,timeExtent:a}=i.mutable.dataFilter;return{...u,gdbVersion:t,historicMoment:r?new Date(r):null,timeExtent:a?e.fromJSON(a):null,outFields:i.mutable.availableFields}}return u}class n{static fromSchema(e,t,r){const a="feature"===t.type?t.mutable.dataFilter.queryScaleRanges:[];return new n(s(e,t,r),a,r.subtypeField,t.mutable.dataFilter.customParameters,r.geometryType,e.queryMetadata)}constructor(e,t,r,a,i,o){this._queryParams=e,this._queryScaleRanges=t,this._subtypeField=r,this._customParameters=a,this._geometryType=i,this._queryMetadata=o}get pageSize(){if(null==this._queryMetadata)throw new Error("InternalError: Service does not support paged queries");const e=this._queryMetadata.supportsMaxRecordCountFactor?o:null,t=(this._queryMetadata.maxRecordCount??8e3)*(e??1);return Math.min(8e3,t)}updateHistoricMoment(e){this._queryParams.historicMoment=e}updateFields(e){this._queryParams.outFields=e}createPatchFieldsQuery(e,t){if(!t.getSize())return null;const r=e.clone();if("*"===this._queryParams.outFields[0]){if("*"===(r.outFields??[])[0])return null;r.outFields=this._queryParams.outFields}else{const e=new Set(this._queryParams.outFields),a=[];for(const r of e)t.hasField(r)||a.push(r);if(0===a.length)return null;r.outFields=a}return r.returnGeometry=!1,r.returnCentroid=!1,r.quantizationParameters=null,r.cacheHint=!0,{inner:r,customParameters:this._customParameters}}createQuery(e={}){if(!this._queryParams)throw new Error("InternalError: queryInfo should be defined");return{inner:new i({...this._queryParams,...e}),customParameters:this._customParameters}}createTileQuery(e,r){if(null==this._queryMetadata)throw new Error("InternalError: Service does not support tile queries");const a=this.createQuery(r),i=a.inner;if(this._queryScaleRanges.length){const r=this._queryScaleRanges.filter((t=>(!t.minScale||t.minScale>=e.maxScale)&&(!t.maxScale||t.maxScale<=e.minScale))).map((e=>e.subtypeCode));if(r.length){const e=`${this._subtypeField} IN (${r})`;i.where=t(i.where,e)}}if(i.quantizationParameters=r.quantizationParameters??e.getQuantizationParameters(),i.resultType="tile",i.geometry=e.extent,this._queryMetadata.supportsQuantization?"esriGeometryPolyline"===this._geometryType&&(i.maxAllowableOffset=e.resolution*has("feature-polyline-generalization-factor")):"esriGeometryPolyline"!==this._geometryType&&"esriGeometryPolygon"!==this._geometryType||(i.maxAllowableOffset=e.resolution,"esriGeometryPolyline"===this._geometryType&&(i.maxAllowableOffset*=has("feature-polyline-generalization-factor"))),i.defaultSpatialReferenceEnabled=this._queryMetadata.supportsDefaultSpatialReference,i.compactGeometryEnabled=this._queryMetadata.supportsCompactGeometry,this._queryMetadata.supportsMaxRecordCountFactor&&(i.maxRecordCountFactor=o),has("esri-tiles-debug")){const t=e.id.replaceAll("/",".");a.customParameters=a.customParameters?{...a.customParameters,tileId:t}:{tileId:t}}return a}createPagedTileQuery(e,t){const r=this.pageSize;return this.createTileQuery(e,{start:r*t,num:r,returnExceededLimitFeatures:!0})}createPagedQuery(e){const t=this.pageSize;return this.createQuery({start:t*e,num:t,returnExceededLimitFeatures:!0,maxRecordCountFactor:o})}}export{n as FeatureSourceQueryInfo};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.31/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import e from"../../../../../../core/Error.js";import t from"../../../../../../rest/support/Query.js";import{ALoadStrategy as r}from"./ALoadStrategy.js";import{createQueryAdapter as s}from"./support/queryAdapters.js";import{FeatureSetReaderJSON as n}from"../../support/FeatureSetReaderJSON.js";import{QueueProcessor as o}from"../../../../../support/QueueProcessor.js";class i extends r{constructor(e,t,r,n,i){super(r),this._serviceInfo=e,this._queryInfo=t,this._metadata=n,this.
|
|
5
|
+
import e from"../../../../../../core/Error.js";import t from"../../../../../../rest/support/Query.js";import{ALoadStrategy as r}from"./ALoadStrategy.js";import{createQueryAdapter as s}from"./support/queryAdapters.js";import{FeatureSetReaderJSON as n}from"../../support/FeatureSetReaderJSON.js";import{QueueProcessor as o}from"../../../../../support/QueueProcessor.js";class i extends r{constructor(e,t,r,n,i){super(r),this._serviceInfo=e,this._queryInfo=t,this._metadata=n,this._connection=i,this._queue=new o({concurrency:16,process:async e=>{const t={signal:e.options?.signal,query:e.query.customParameters};return this._adapter.executeQuery(e.query.inner,t)}}),this._adapter=s(e,n)}unsafeSetQueryHistoricMoment(e){this._queryInfo.updateHistoricMoment(e)}async updateFields(r){this._queryInfo.updateFields(r);const s=Array.from(this._store.chunks()).map((async e=>{const r=t.fromJSON(e.queryInfo.queryJSON);if(r)try{return await this._tryUpdateFields(e.reader,r),null}catch(s){return s}})),n=(await Promise.all(s)).filter((e=>e));if(n.length)throw new e("featurelayer-query","Encountered errors when downloading fields",{errors:n})}async queryByObjectId(e){if(0===e.length)return n.empty(this._metadata);const t=this._queryInfo.createQuery({objectIds:e});return this._fetch(t)}async _fetch(e,t){const r=await this._enqueue(e,t);return await this._tryUpdateFields(r,e.inner),r}async _tryUpdateFields(e,t){const r=this._queryInfo.createPatchFieldsQuery(t,e);if(!r)return;const s=await this._enqueue(r,this._options);e.joinAttributes(s)}async _enqueue(e,t){return this._connection.onEvent({type:"fetchStart"}),this._queue.push({query:e,options:t}).finally((()=>{this._connection.onEvent({type:"fetchEnd",done:0===this._queue.length})}))}}export{i as AFetchLoadStrategy};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.31/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{
|
|
5
|
+
import{ignoreAbortErrors as e}from"../../../../core/promiseUtils.js";import{UpdateTracking2D as s}from"./UpdateTracking2D.js";import{QueueProcessor as r}from"../../../support/QueueProcessor.js";class t{constructor(e){this.updateTracking=new s({debugName:"FeatureCommandQueue"}),this._queueProcessor=new r({concurrency:1,process:e.process})}destroy(){this.updateTracking.destroy(),this._queueProcessor.destroy(),this.clear()}clear(){this._queueProcessor.clear()}async push(s){return e(this.updateTracking.addPromise(this._doPush(s)))}async _doPush(e){const s=this._queueProcessor,r=s.last();switch(e.type){case"update":if(r?.type===e.type)return;return s.push(e);case"edit-by-id":case"edit-by-feature":return s.push(e)}}}export{t as default};
|