@arcgis/core
Version:
ArcGIS Maps SDK for JavaScript: A complete 2D and 3D mapping and data visualization API
6 lines (5 loc) • 2.84 kB
JavaScript
/*
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
*/
import{watch as e,syncAndInitial as t}from"../../../core/reactiveUtils.js";import{intersection as n}from"../../../core/SetUtils.js";import{sqlAnd as r}from"../../../core/sql.js";import{mergeTimeExtents as o}from"../../../core/timeUtils.js";import{s as i}from"../../../chunks/vec32.js";import{makeDehydratedPoint as s}from"../../../layers/graphics/dehydratedPoint.js";import a from"../../../rest/support/Query.js";import{ViewEventPriorities as p}from"../../input/InputManager.js";import{snappingKeys as c}from"../keybindings.js";import{fromAnyMapPoint as l}from"../sketch/normalizedPoint.js";import{isWebMap as m}from"../../../webmap/utils.js";const d=Symbol("grid-placement-graphic");function u(e,t){const n=e.length===t.length&&e[0]===t[0]&&e[1]===t[1];switch(e.length){case 2:return n;case 3:return n&&e[2]===t[2];case 4:return n&&e[2]===t[2]&&e[3]===t[3]}return!1}function g(e,t){const n=e.x-t.x,r=e.y-t.y;return n*n+r*r}function f(e,t){return Math.sqrt(g(e,t))}function E(e,t){t.sort(((t,n)=>i(t.targetPoint,e)-i(n.targetPoint,e)))}var h;function y({parameters:{point:e,distance:t,returnEdge:n,vertexMode:i,coordinateHelper:{spatialReference:p},filter:c},mode:l,returnZ:m,filter:d}){const u=d?.clone()??new a({where:"1=1"});return u.returnZ=m??"3d"===l,c&&(u.geometry=c.geometry,u.distance=c.distance,u.spatialRelationship=c.spatialRelationship,u.where=r(u.where,c.where),u.timeExtent=o(u.timeExtent,c.timeExtent),u.objectIds=w(u.objectIds,c.objectIds)),{point:s(e[0],e[1],e[2],p.toJSON()),mode:l,distance:t,returnEdge:n,vertexMode:i,query:u.toJSON()}}function w(e,t){return e||t?t?e?Array.from(n(new Set(e),new Set(t))):t:e:null}function j(e,t,n){return{left:l(e.leftVertex.pos,t,n),right:l(e.rightVertex.pos,t,n)}}!function(e){e[e.TARGET=0]="TARGET",e[e.REFERENCE=1]="REFERENCE",e[e.REFERENCE_EXTENSION=2]="REFERENCE_EXTENSION"}(h||(h={}));const R=Symbol("snapping-toggle");function N(n,r=()=>{}){const o=e((()=>({view:n.view,snappingOptions:n.snappingOptions})),(({view:e,snappingOptions:t})=>{if(n.removeHandles(R),!e||!t)return;const o=p.TOOL,i=[e.on("key-down",(e=>{e.key!==c.toggle||e.repeat||(t.enabledToggled=!0,r())}),o),e.on("key-up",(e=>{e.key===c.toggle&&(t.enabledToggled=!1,r())}),o),e.on("pointer-move",(e=>{const n=e.native.ctrlKey;t.enabledToggled!==n&&(t.enabledToggled=n,r())}),o)];n.addHandles(i,R)}),t);n.addHandles(o)}function b(e){return m(e)&&"utilityNetworks"in e&&!!e.utilityNetworks?.length}export{h as LineSegmentHintType,j as editEdgeToSnappingEdge,d as gridPlacementGraphicSymbol,b as isUtilityNetworkWebMap,y as makeSnappingQuery,u as objectEqual,f as screenDistance,N as setupSnappingToggleHandles,E as sortCandidatesInPlace,g as squaredScreenDistance};