@arcgis/core 5.2.0-next.103 → 5.2.0-next.105
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/arcgisGlobal.d.ts +2 -0
- package/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/{ec5542d6ecc0622f7705.js → 1ec01fd6330d011c76d6.js} +1 -1
- package/assets/esri/core/workers/chunks/{c91905b5808b8049f96d.js → 2168ee64fd32f160dcf1.js} +3 -3
- package/assets/esri/core/workers/chunks/{ffca0b2333e760b66d3a.js → 262052dfaec3af8a58b9.js} +1 -1
- package/assets/esri/core/workers/chunks/33e583166ab3943ecf0e.js +1 -0
- package/assets/esri/core/workers/chunks/{2350f1eb70819cc06bb6.js → 4c00a46bf0345f99a9bb.js} +1 -1
- package/assets/esri/core/workers/chunks/{240bee7d0dc5e5dab826.js → 91e545745706111f5f62.js} +1 -1
- package/assets/esri/core/workers/chunks/c7b762bae945f383c723.js +1 -0
- package/assets/esri/core/workers/chunks/d0eb609a214d85d21ed5.js +1 -0
- package/assets/esri/core/workers/chunks/{a4dc1a80ed6604d71722.js → dc1b38f490142f7273ef.js} +1 -1
- package/chunks/GlobalIllumination.glsl.js +4 -4
- package/config.js +1 -1
- package/kernel.js +1 -1
- package/package.json +6 -6
- package/support/revision.js +1 -1
- package/symbols/TextSymbol3DLayer.js +1 -1
- package/symbols/cim/TextRasterizer.js +1 -1
- package/symbols/cim/richTextUtils.js +1 -1
- package/symbols/support/Symbol3DTextBorder.js +2 -0
- package/views/2d/engine/webgl/GlyphWorker.js +1 -1
- package/views/2d/engine/webgl/mesh/templates/shapingUtils.js +1 -1
- package/views/2d/engine/webgl/util/AnnotationMatcher.js +1 -1
- package/views/2d/layers/support/annodime/DimensionInfo.js +1 -1
- package/views/2d/layers/support/annodime/MatcherGeometryOverride.js +1 -1
- package/views/2d/layers/support/annodime/dimensionUtils.js +1 -1
- package/views/3d/layers/ImageryTileLayerView3D.js +1 -1
- package/views/3d/support/QualityProfile.js +1 -1
- package/views/3d/terrain/TerrainData.js +1 -1
- package/views/3d/terrain/TileRenderer.js +1 -1
- package/views/3d/webgl-engine/lib/BufferGeometry.js +1 -1
- package/views/3d/webgl-engine/lib/BufferObject3D.js +1 -1
- package/views/3d/webgl-engine/lib/Intersector.js +1 -1
- package/views/3d/webgl-engine/lib/Renderer.js +1 -1
- package/views/3d/webgl-engine/lib/TextRenderParameters.js +1 -1
- package/views/3d/webgl-engine/lib/TextRenderer.js +1 -1
- package/views/3d/webgl-engine/lib/depthRangeUtils.js +1 -1
- package/views/3d/webgl-engine/materials/renderers/MergedRenderer.js +1 -1
- package/widgets/Editor/EditorViewModel.d.ts +3 -2
- package/widgets/Editor/types.d.ts +19 -1
- package/widgets/Editor.d.ts +3 -2
- package/widgets/support/SelectionToolbar/VisibleElements.d.ts +60 -0
- package/widgets/support/SelectionToolbar.d.ts +202 -0
- package/assets/esri/core/workers/chunks/a191ddb3b59ec1a7d818.js +0 -1
- package/assets/esri/core/workers/chunks/ad695de9f73b268af139.js +0 -1
- package/assets/esri/core/workers/chunks/b4e5027c121d848c3d5a.js +0 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import
|
|
2
|
+
import t from"../../../../request.js";import{bidiText as e}from"../../../../core/BidiText.js";import{getFullyQualifiedFontName as s}from"../../../../core/fontUtils.js";import has from"../../../../core/has.js";import i from"../../../../core/Logger.js";import{throwIfNotAbortError as a}from"../../../../core/promiseUtils.js";import{loadTextModule as r}from"../../../../libs/librust-text/loadTextModule.js";import{parseRichTextRuns as h}from"../../../../symbols/cim/richTextUtils.js";import{sdfRadiusComplex as n,sdfBufferGlyphSDFCreator as o,sdfSizeComplex as c,sdfBufferServer as p,sdfRadiusSimple as l,sdfSizeSimple as f}from"./definitions.js";import{decorGlyphRect as g}from"./GlyphMosaic.js";import{GlyphSDFCreator as d}from"./GlyphSDFCreator.js";import _ from"./GlyphSource.js";import y from"./Rect.js";import u from"./RectangleBinPack.js";import{hashMosaic as m}from"./TextureManager.js";import{charCodes as w}from"./Utils.js";const S=.25,C="arial-unicode-ms-regular",G=/[\u0695\u0698\u06a9\u06af\u06b5\u06be\u06c6\u06cc\u06ce\u06d5\u06ca]|\p{Script=Thai}|\p{Script=Lao}|\p{Script=Tamil}|\p{Script=Khmer}/u,P=new Set(["Noto Sans Khmer","Noto Sans Lao","Noto Sans Myanmar","Noto Sans Thai"]),b=()=>i.getLogger("esri.views.MapView"),x=(t,e="")=>b().warnOnce(t,e);class R{constructor(){this._glyphSources=new Map,this._snapCoords=!0,this._currentPage=0,this._faces=new Map,this._facePromises=new Map,this._pbfRangePromises=new Map,this._glyphCache=new Map,this._pbfGlyphCache=new Map,this._invalidFonts=new Set,this._preloadCache={},this._glyphSDFCreator=new d({sdfSizePx:c,sdfBufferPx:o,radius:n,cutoff:S})}set remoteClient(t){this._client=t.createInvokeProxy();const e=this._client.getOptions();this._inited=this._init(e)}async rasterizeText(t,e,s){await this._inited;const i=e.symbol?h(e):null;if(i){return{type:"rich-glyphs",runs:(await Promise.all(i.map(async e=>({fontSize:e.fontSize,characterSpacing:e.characterSpacing,decoration:e.font.decoration,color:e.color,glyphs:await this._rasterizeTextRun(t,e.font,e.text,s)})))).filter(t=>null!=t.glyphs)}}return this._rasterizeTextRun(t,e.font,e.textString,s)}async _rasterizeTextRun(t,e,i,a){const r=s(e),h=this._invalidFonts.has(r),n=!!has("esri-2d-force-complex-shaping"),o=!!has("esri-2d-complex-shaping")&&G.test(i),c=P.has(e.family),p=n||o||c,l=h?C:r;let f=await this.getGlyphItems(i,p,t,l,!1,a);return f||(x(`Font ${r} is not available on the web, using "Arial Unicode MS Regular"`),this._invalidFonts.add(r),f=await this.getGlyphItems(i,p,t,C,!1,a)),f}async getGlyphItems(t,s,i,a,r,h){await this._inited;const g=this._getSource(i),d=s?c:f,_=s?n:l,y=s?o:p;let u,m,S;if(has("esri-2d-stabilize-glyphs")&&await this.preloadASCIIGlyphCache(g,a).catch(()=>{}),s){const e=await this._getFace(g,a);if(!e)return null;let s=this._glyphCache.get(a);s||(s=new Map,this._glyphCache.set(a,s));const{shaping:i,isRTL:r}=this._shape(e,t);S=r,u=i.map(t=>this._getShapedGlyph(e,s,t)),m={baseline:e.baseline()/d,midline:e.midline()/d}}else{let s=this._pbfGlyphCache.get(a);s||(s=new Map,this._pbfGlyphCache.set(a,s));const[i,n,o]=e(t),c=w(i);try{await this._fetchRanges(g,a,c,h)}catch{return null}S=n,u=c.map(t=>this._getPBFGlyph(s,g,a,t,r)).filter(t=>!!t)}const C=u.filter(t=>t.needsRecord);return C.length>0&&await this._client.recordGlyphs(C),{type:"glyphs",glyphs:u,faceInfo:m,isRightToLeft:S,sdfSize:d,sdfRadius:_,sdfPadding:y}}async _init(t){const{width:e,height:s,snapCoords:i}=await t;this._glyphCache=new Map,this._pbfGlyphCache=new Map,this._binPack=new u(e,s),this._snapCoords=i,this._currentPage=0,this._initDecorationGlyphs()}_getShapedGlyph(t,e,s){let i,a,r=e.get(s.glyphId);if(!r){i=this._glyphSDFCreator.draw(t,s.glyphId);const h=this._glyphSDFCreator.sdfBufferPx;r={mosaicItem:{rect:this._recordGlyph(i?.rect,h),page:this._currentPage,sdf:!0,textureBinding:m(1,this._currentPage,!0)},glyphRect:i?.rect??{width:0,height:0,top:0,left:0}},e.set(s.glyphId,r),a=!0}return{mosaicItem:r.mosaicItem,rect:r.glyphRect,shaping:{xAdvance:s.xAdvance,yAdvance:s.yAdvance,xOffset:s.xOffset,yOffset:s.yOffset},code:s.isNewline?10:s.isWhitespace?32:NaN,sdf:i,needsRecord:a}}_getPBFGlyph(t,e,s,i,a=!1){let r,h,n=t.get(i);if(!n){const c=e.getRange(s,i),p=c?.getRect(i),l=c?.getShaping(i),f=c?.getBitmap(i);if(a&&(!p||!l))return;if(!p||!l)return j(i);r=f&&{buffer:f,rect:p},n={mosaicItem:{rect:f?this._recordGlyph(p,o):new y(0,0,0,0),sdf:!0,page:this._currentPage,textureBinding:m(1,this._currentPage,!0)},rect:p,shaping:l,code:i},h=!0,t.set(i,n)}const{mosaicItem:c,rect:p,shaping:l}=n;return{mosaicItem:c,rect:p,shaping:l,code:i,sdf:r,needsRecord:h}}_shape(t,s){const i=this._glyphSDFCreator.sdfSizePx,[a,r,h]=e(s,!1),n=new Uint32Array(Array.from(a).map((t,e)=>h.levels[h.targetToSource[e]]));return{shaping:t.shape(a,n,i),isRTL:r}}async _getFace(e,s,i){if(this._faces.has(s))return this._faces.get(s);const a=e.woffURL(s);return await M(this._facePromises,s,async()=>{const e=await t(a,{responseType:"array-buffer",...i}),h=(await r()).Face.parseWoff2(new Uint8Array(e.data));this._faces.set(s,h)}),this._faces.get(s)}_getSource(t){return this._glyphSources.has(t)||this._glyphSources.set(t,new _(t)),this._glyphSources.get(t)}async _fetchRanges(t,e,s,i){const a=I(s),r=[];a.forEach(s=>{r.push(this._fetchRange(t,e,s,i))}),await Promise.all(r)}async _fetchRange(t,e,s,i){if(s>256)return;const a=e+s;return M(this._pbfRangePromises,a,()=>t.fetchRange(e,s,i))}_allocNewPage(){this._currentPage++,this._binPack=new u(this._binPack.width,this._binPack.height),this._initDecorationGlyphs()}_recordGlyph(t,e){const s=this._binPack;if(!t||0===t.width)return new y;const i=t.width+2*e,a=t.height+2*e;let r=i,h=a;if(this._snapCoords){r+=i%4?4-i%4:4,h+=a%4?4-a%4:4}const n=s.allocate(r,h);return n.isEmpty?(this._allocNewPage(),s.allocate(r,h)):n}_initDecorationGlyphs(){this._recordGlyph(g,p),this._recordGlyph(g,p)}preloadASCIIGlyphCache(t,e){const s=this._preloadCache[e];if(null!=s)return s;const i=t.preloadASCIIRange(e).then(async()=>{let s=this._pbfGlyphCache.get(e);s||(s=new Map,this._pbfGlyphCache.set(e,s));for(let a=0;a<256;a++)this._getPBFGlyph(s,t,e,a);const i=Array.from(this._pbfGlyphCache.get(e).values());await this._client.recordGlyphs(i)},t=>{throw delete this._preloadCache[e],t});return this._preloadCache[e]=i,i}}function I(t){const e=new Set;for(const s of t)e.add(Math.floor(s/256));return e}function M(t,e,s){return t.has(e)||t.set(e,s().finally(()=>{t.delete(e)}).catch(t=>{a(t)})),t.get(e)}const j=t=>({mosaicItem:{rect:new y(0,0,0,0),sdf:!0,page:0},rect:{left:0,width:0,height:0,top:0},shaping:{xAdvance:0,yAdvance:0,xOffset:0,yOffset:0},code:t});export{R as default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{pt2px as t}from"../../../../../../core/screenUtils.js";import{fromRotation as e,multiply as n,translate as i,rotate as s}from"../../../../../../core/libs/gl-matrix-2/math/mat2d.js";import{create as o}from"../../../../../../core/libs/gl-matrix-2/factories/mat2df32.js";import{transformMat2d as h,set as r}from"../../../../../../core/libs/gl-matrix-2/math/vec2.js";import{create as a}from"../../../../../../core/libs/gl-matrix-2/factories/vec2f32.js";import{getXAnchorDirection as l,getYAnchorDirection as c}from"../../alignmentUtils.js";import{magicLabelLineHeight as f}from"../../definitions.js";import d from"../../Rect.js";import g from"../../collisions/BoundingBox.js";const m=22,u=4,p=m+u,y=m-6,x=Math.PI/180,w=8,b=1.5;class M{static fromGlyph(t,e,n,i,s){const{mosaicItem:o,rect:h,shaping:r,code:a}=n,l=o.rect;return new M({width:0===a?h.width:l.width*i,height:0===a?h.height:l.height*i,x:i*(t+r.xOffset+h.left),y:i*(e+r.yOffset-h.top),textureBinding:o.textureBinding,texcoords:{topLeft:[l.x,l.y],topRight:[l.x+l.width,l.y],bottomLeft:[l.x,l.y+l.height],bottomRight:[l.x+l.width,l.y+l.height]},fontSize:s?.fontSize,color:s?.color})}constructor(t){this._rotationT=o(),this._transform=o(),this._angle=0,this._bounds=null,this.width=t.width,this.height=t.height,this.x=t.x,this.y=t.y,this.textureBinding=t.textureBinding,this.texcoords=t.texcoords,this.fontSize=t.fontSize,this.color=t.color}set angle(t){this._angle=t,e(this._rotationT,-t),this._offsets=this._bounds=null}get angle(){return this._angle}get offsets(){if(!this._offsets){const{x:t,y:i,width:s,height:r}=this,a=e(o(),-this.angle),l=n(o(),a,this._transform);this._offsets={topLeft:h([0,0],[t,i],l),topRight:h([0,0],[t+s,i],l),bottomLeft:h([0,0],[t,i+r],l),bottomRight:h([0,0],[t+s,i+r],l)}}return this._offsets}get bounds(){if(this.width<=0)return null;if(!this._bounds){const t=this.offsets;let e=1/0,n=1/0,i=-1/0,s=-1/0;for(const[l,c]of[t.topLeft,t.topRight,t.bottomLeft,t.bottomRight])e=Math.min(e,l),n=Math.min(n,c),i=Math.max(i,l),s=Math.max(s,c);const o=i-e,h=s-n,r=e+o/2,a=n+h/2;this._bounds=new g(r,a,o,h)}return this._bounds}setTransform(t){this._transform=t,this._offsets=null}}const _=(t,e)=>({code:0,mosaicItem:{rect:new d(0,0,11,8),sdf:!0,page:0,textureBinding:e},rect:{height:4,width:t,left:0,top:0},shaping:{xOffset:0,yOffset:0,xAdvance:0,yAdvance:0}});function A(t,e){return t.forEach(t=>h(t,t,e)),{topLeft:t[0],topRight:t[1],bottomLeft:t[2],bottomRight:t[3]}}class v{constructor(t,e,n,i){this._rotation=0,this._decorate(t,e,n,i),this.glyphs=t,this.bounds=this._createBounds(t),this.isMultiline=e.length>1,this._hasRotation=0!==n.angle,this._transform=this._createGlyphTransform(this.bounds,n),this._borderLineSizePx=n.borderLineSizePx,(n.borderLineSizePx||n.hasBackground)&&([this.bounds,this.textBox]=this.shapeBackground(this._transform));for(const s of t)s.setTransform(this._transform)}setRotation(t){if(0===t&&0===this._rotation)return;this._rotation=t;const i=this._transform,s=e(o(),t);n(i,s,i);for(const e of this.glyphs)e.setTransform(this._transform)}_decorate(t,e,n,i){if(!n.decoration||"none"===n.decoration||!t.length)return;const s=n.scale,o=t[0].textureBinding;for(const h of e){const e=h.scale??s,r="underline"===n.decoration?h.baseline??i?.baseline??p:h.midline??i?.midline??y,a=h.startX*e,l=h.startY*e,c=(h.width+h.glyphWidthEnd)*e;t.push(M.fromGlyph(a,l+r*e,_(c,o),1))}}shapeBackground(t){const e=this._borderLineSizePx||0,n=(b+e)/2,i=this._borderLineSizePx?n:0,{xmin:s,ymin:o,xmax:h,ymax:r,x:a,y:l,width:c,height:f}=this.bounds,d=[s-w,o-w],m=[h+w,o-w],u=[s-w,r+w],p=[h+w,r+w],y=A([[d[0]-n,d[1]-n],[m[0]+n,m[1]-n],[d[0]+i,d[1]+i],[m[0]-i,m[1]+i]],t),x=A([[u[0]+i,u[1]-i],[p[0]-i,p[1]-i],[u[0]-n,u[1]+n],[p[0]+n,p[1]+n]],t),M=A([[d[0]-n,d[1]-n],[d[0]+i,d[1]+i],[u[0]-n,u[1]+n],[u[0]+i,u[1]-i]],t),_=A([[m[0]-i,m[1]+i],[m[0]+n,m[1]-n],[p[0]-i,p[1]-i],[p[0]+n,p[1]+n]],t),v={main:A([d,m,u,p],t),top:y,bot:x,left:M,right:_};return[new g(a,l,c+2*n,f+2*n),v]}get boundsT(){const t=this.bounds,e=r(a(),t.x,t.y);if(h(e,e,this._transform),this._hasRotation){const n=Math.max(t.width,t.height);return new g(e[0],e[1],n,n)}return new g(e[0],e[1],t.width,t.height)}_createBounds(t){let e=1/0,n=1/0,i=0,s=0;for(const r of t)e=Math.min(e,r.offsets.topLeft[0]),n=Math.min(n,r.offsets.topLeft[1]),i=Math.max(i,r.offsets.bottomRight[0]),s=Math.max(s,r.offsets.bottomRight[1]);const o=i-e,h=s-n;return new g(e+o/2,n+h/2,o,h)}_createGlyphTransform(t,e){const n=x*e.angle,h=o(),l=a();return i(h,h,r(l,e.xOffset,-e.yOffset)),e.useCIMAngleBehavior?s(h,h,n):(i(h,h,r(l,t.x,t.y)),s(h,h,n),i(h,h,r(l,-t.x,-t.y))),h}}class z{constructor(t,e,n,i,s,o){this.glyphWidthEnd=0,this.startX=0,this.startY=0,this.start=Math.max(0,Math.min(e,n)),this.end=Math.max(0,Math.max(e,n)),this.end<t.length&&(this.glyphWidthEnd=t[this.end].rect.width),this.width=i,this.yMin=s,this.yMax=o}}const L=t=>10===t,R=t=>32===t;function S(t,e,n){const i=new Array,s=1/n.scale,o=n.maxLineWidth*s,h=e?t.length-1:0,r=e?-1:t.length,a=e?-1:1;let l=h,c=0,f=0,d=l,g=d,m=0,u=1/0,p=0;for(;l!==r;){const{code:e,rect:n,shaping:s}=t[l],r=Math.abs(n.top);if(L(e)||R(e)||(u=Math.min(u,r),p=Math.max(p,r+n.height)),L(e))l!==h&&(i.push(new z(t,d,l-a,c,u===1/0?0:u,p)),u=1/0,p=0),c=0,d=l+a,g=l+a,f=0;else if(R(e))g=l+a,f=0,m=s.xAdvance,c+=s.xAdvance;else if(c>o){if(g!==d){const e=g-2*a;c-=m,i.push(new z(t,d,e,c-f,u,p)),u=1/0,p=0,d=g,c=f}else i.push(new z(t,d,l-a,c,u,p)),u=1/0,p=0,d=l,g=l,c=0;c+=s.xAdvance,f+=s.xAdvance}else c+=s.xAdvance,f+=s.xAdvance;l+=a}const y=new z(t,d,l-a,c,u,p);return y.start>=0&&y.end<t.length&&i.push(y),i}function B(t,e){let n=0;for(let o=0;o<t.length;o++){const{width:e}=t[o];n=Math.max(e,n)}const i="underline"===e.decoration?u:0,s=t[0].yMin;return{x:0,y:s,height:t[t.length-1].yMax+e.lineHeight*(t.length-1)+i-s,width:n}}function Y(t,e,n){let i=0;for(let s=e;s<n;s++)R(t[s].code)&&!L(t[s+1].code)&&i++;return i}function j(t,e){const n=e.scale,i=new Array,s=t.sdfPadding,{faceInfo:o,glyphs:h,isRightToLeft:r}=t,a="justify"===e.horizontalAlignment||"Justify"===e.horizontalAlignment,f=S(h,r,e),d=f.length?B(f,e):{y:0,height:0,width:0},g=a?r?1:-1:l(e.horizontalAlignment),u=c(e.verticalAlignment),p=2===u?1:0,y=p?0:u-1,x=o?.baseline??m,w=f.length>1,b=p?w?-d.y-d.height:-x:-d.y+y*(d.height/2);for(let l=0;l<f.length;l++){const{start:o,end:r,width:c}=f[l],m=a&&l<f.length-1?Y(h,o,r):0,u=m>0?(d.width-c)/m:0;let p=-1*(g+1)*((u>0?d.width:c)/2)-s;const y=(t.isRightToLeft?f.length-1-l:l)*e.lineHeight+b-s;f[l].startX=p,f[l].startY=y;for(let t=o;t<=r;t++){const e=h[t];if(L(e.code))continue;const s=M.fromGlyph(p,y,e,n);p+=e.shaping.xAdvance,u>0&&R(e.code)&&(p+=u),i.push(s)}}return new v(i,f,e,o)}function H(t,e){const n=e.scale,{faceInfo:i,glyphs:s}=t,o=s.reduce((t,e)=>Math.max(t,e.rect.height),0),h=s.map(t=>M.fromGlyph(-t.rect.width/2,-o,t,n));return new v(h,[],e,i)}function T(t,e){return"glyphs"===t.type?j(t,e):E(t,e)}function W(t,e){return"glyphs"===t.type?H(t,e):G(t,e)}function E(t,e){const n=I(t,e),i=X(n,e),s=i.length?O(i):{width:0},o=new Array,h="justify"===e.horizontalAlignment||"Justify"===e.horizontalAlignment,r=h?-1:l(e.horizontalAlignment),a=c(e.verticalAlignment),f=2===a,d=i.length?i[0].yMin:0,g=i.length?i[i.length-1].startY+i[i.length-1].yMax:0,m=g-d,u=f?i.length>1?-g:-(i[0]?.baseline??0):1===a?-d:-1===a?-g:-(d+m/2);for(let l=0;l<i.length;l++){const t=i[l],e=h&&l<i.length-1?k(n,t.start,t.end):0,a=e>0?(s.width-t.width)/e:0;let c=-1*(r+1)*((a>0?s.width:t.width)/2);const f=t.startY+u;t.startX=c,t.startY=f;for(let i=t.start;i<=t.end;i++){const e=n[i],{glyph:s,scale:h,fontSize:r}=e;if(L(s.code))continue;const l=f+t.baseline-e.baseline;o.push(M.fromGlyph(c/h,l/h,s,h,{fontSize:r,color:e.color})),c+=e.xAdvance,a>0&&R(s.code)&&(c+=a)}}return new v(o,i,e)}function G(t,e){const n=I(t,e),i=n.reduce((t,e)=>Math.max(t,e.glyph.rect.height*e.scale),0),s=n.filter(t=>!L(t.glyph.code)).map(t=>M.fromGlyph(-t.glyph.rect.width/2,-i/t.scale,t.glyph,t.scale,{fontSize:t.fontSize,color:t.color}));return new v(s,[],e)}function I(e,n){const i=n.lineHeightRatio??1,s=[];for(const o of e.runs){const e=t(o.fontSize),n=e/o.glyphs.sdfSize,h=e*(f/24)*i,r=(o.glyphs.faceInfo?.baseline??m)*n,a=(o.glyphs.faceInfo?.midline??y)*n,l=1+(o.characterSpacing??0);for(const t of o.glyphs.glyphs){const i=t.shaping.xAdvance*n,c=Math.abs(t.rect.top)*n,f=c+t.rect.height*n;s.push({glyph:t,scale:n,fontSize:e,color:o.color,xAdvance:L(t.code)||R(t.code)?i:i*l,top:c,bottom:f,lineHeight:h,baseline:r,midline:a})}}return s}function X(t,e){const n=[],i=e.maxLineWidth;let s=0,o=0,h=0,r=0,a=0,l=0;for(;s<t.length;){const e=t[s],{glyph:c}=e;if(L(c.code))0!==s&&n.push({width:o,start:r,end:s-1,glyphWidthEnd:t[s-1]?.glyph.rect.width*t[s-1]?.scale||0,yMin:0,yMax:0,lineHeight:0,baseline:0,midline:0,startX:0,startY:0,scale:1}),o=0,r=s+1,a=r,h=0,l=0;else if(R(c.code))a=s+1,h=0,l=e.xAdvance,o+=e.xAdvance;else if(o>i){if(a!==r){const e=a-2;o-=l,n.push({width:o-h,start:r,end:e,glyphWidthEnd:t[e]?.glyph.rect.width*t[e]?.scale||0,yMin:0,yMax:0,lineHeight:0,baseline:0,midline:0,startX:0,startY:0,scale:1}),r=a,o=h}else n.push({width:o,start:r,end:s-1,glyphWidthEnd:t[s-1]?.glyph.rect.width*t[s-1]?.scale||0,yMin:0,yMax:0,lineHeight:0,baseline:0,midline:0,startX:0,startY:0,scale:1}),r=s,a=s,o=0;o+=e.xAdvance,h+=e.xAdvance}else o+=e.xAdvance,h+=e.xAdvance;s++}if(r<t.length){const e=t.length-1;n.push({width:o,start:r,end:e,glyphWidthEnd:t[e]?.glyph.rect.width*t[e]?.scale||0,yMin:0,yMax:0,lineHeight:0,baseline:0,midline:0,startX:0,startY:0,scale:1})}return P(t,n)}function P(t,e){for(let n=0;n<e.length;n++){const i=e[n];let s=0,o=1/0,h=0;for(let e=i.start;e<=i.end;e++){const n=t[e];L(n.glyph.code)||R(n.glyph.code)||(s=Math.max(s,n.baseline),h=Math.max(h,n.lineHeight))}let r=1/0,a=-1/0;for(let e=i.start;e<=i.end;e++){const n=t[e];L(n.glyph.code)||R(n.glyph.code)||(r=Math.min(r,s-n.baseline+n.top),a=Math.max(a,s-n.baseline+n.bottom),o=Math.min(o,s-n.baseline+n.midline))}i.baseline=s,i.midline=o===1/0?s:o,i.lineHeight=h||Math.max(0,a-r),i.yMin=r===1/0?0:r,i.yMax=a===-1/0?0:a,i.startY=n>0?e[n-1].startY+e[n-1].lineHeight:0}return e}function O(t){let e=0;for(const s of t)e=Math.max(s.width+s.glyphWidthEnd,e);const n=t[0].yMin,i=t[t.length-1];return{x:0,y:n,height:i.startY+i.yMax-n,width:e}}function k(t,e,n){let i=0;for(let s=e;s<n;s++)R(t[s].glyph.code)&&!L(t[s+1].glyph.code)&&i++;return i}export{M as ShapedGlyph,v as ShapingInfo,j as shapeGlyphs,H as shapeGlyphsForMultipoint,E as shapeRichText,G as shapeRichTextForMultipoint,T as shapeTextResource,W as shapeTextResourceForMultipoint};
|
|
2
|
+
import{pt2px as t}from"../../../../../../core/screenUtils.js";import{fromRotation as e,multiply as n,translate as i,rotate as o}from"../../../../../../core/libs/gl-matrix-2/math/mat2d.js";import{create as s}from"../../../../../../core/libs/gl-matrix-2/factories/mat2df32.js";import{transformMat2d as h,set as r}from"../../../../../../core/libs/gl-matrix-2/math/vec2.js";import{create as a}from"../../../../../../core/libs/gl-matrix-2/factories/vec2f32.js";import{getXAnchorDirection as l,getYAnchorDirection as c}from"../../alignmentUtils.js";import{magicLabelLineHeight as d}from"../../definitions.js";import f from"../../Rect.js";import g from"../../collisions/BoundingBox.js";const u=22,m=4,p=2,y=u-6,x=Math.PI/180,w=8,b=1.5;class M{static fromGlyph(t,e,n,i,o){const{mosaicItem:s,rect:h,shaping:r,code:a}=n,l=s.rect;return new M({width:0===a?h.width:l.width*i,height:0===a?h.height:l.height*i,x:i*(t+r.xOffset+h.left),y:i*(e+r.yOffset-h.top),textureBinding:s.textureBinding,texcoords:{topLeft:[l.x,l.y],topRight:[l.x+l.width,l.y],bottomLeft:[l.x,l.y+l.height],bottomRight:[l.x+l.width,l.y+l.height]},fontSize:o?.fontSize,color:o?.color})}constructor(t){this._rotationT=s(),this._transform=s(),this._angle=0,this._bounds=null,this.width=t.width,this.height=t.height,this.x=t.x,this.y=t.y,this.textureBinding=t.textureBinding,this.texcoords=t.texcoords,this.fontSize=t.fontSize,this.color=t.color}set angle(t){this._angle=t,e(this._rotationT,-t),this._offsets=this._bounds=null}get angle(){return this._angle}get offsets(){if(!this._offsets){const{x:t,y:i,width:o,height:r}=this,a=e(s(),-this.angle),l=n(s(),a,this._transform);this._offsets={topLeft:h([0,0],[t,i],l),topRight:h([0,0],[t+o,i],l),bottomLeft:h([0,0],[t,i+r],l),bottomRight:h([0,0],[t+o,i+r],l)}}return this._offsets}get bounds(){if(this.width<=0)return null;if(!this._bounds){const t=this.offsets;let e=1/0,n=1/0,i=-1/0,o=-1/0;for(const[l,c]of[t.topLeft,t.topRight,t.bottomLeft,t.bottomRight])e=Math.min(e,l),n=Math.min(n,c),i=Math.max(i,l),o=Math.max(o,c);const s=i-e,h=o-n,r=e+s/2,a=n+h/2;this._bounds=new g(r,a,s,h)}return this._bounds}setTransform(t){this._transform=t,this._offsets=null}}const _=(t,e)=>({code:0,mosaicItem:{rect:new f(0,0,11,8),sdf:!0,page:0,textureBinding:e},rect:{height:4,width:t,left:0,top:0},shaping:{xOffset:0,yOffset:0,xAdvance:0,yAdvance:0}});function A(e){return"underline"===e?t(p):0}function v(t,e,n,i,o){switch(t){case"underline":return(n??o?.baseline??u)+m+A(t)/e;case"line-through":return i??o?.midline??y;default:return 0}}function z(t,e){return t.forEach(t=>h(t,t,e)),{topLeft:t[0],topRight:t[1],bottomLeft:t[2],bottomRight:t[3]}}class B{constructor(t,e,n,i){this._rotation=0,this._decorate(t,e,n,i),this.glyphs=t,this.bounds=this._createBounds(t),this.isMultiline=e.length>1,this._hasRotation=0!==n.angle,this._transform=this._createGlyphTransform(this.bounds,n),this._borderLineSizePx=n.borderLineSizePx,(n.borderLineSizePx||n.hasBackground)&&([this.bounds,this.textBox]=this.shapeBackground(this._transform));for(const o of t)o.setTransform(this._transform)}setRotation(t){if(0===t&&0===this._rotation)return;this._rotation=t;const i=this._transform,o=e(s(),t);n(i,o,i);for(const e of this.glyphs)e.setTransform(this._transform)}_decorate(t,e,n,i){if(!n.decoration||"none"===n.decoration||!t.length)return;const o=n.scale,s=t[0].textureBinding;for(const h of e){const e=h.scale??o,r=v(n.decoration,e,h.baseline,h.midline,i),a=h.startX*e,l=h.startY*e,c=(h.width+h.glyphWidthEnd)*e;t.push(M.fromGlyph(a,l+r*e,_(c,s),1))}}shapeBackground(t){const e=this._borderLineSizePx||0,n=(b+e)/2,i=this._borderLineSizePx?n:0,{xmin:o,ymin:s,xmax:h,ymax:r,x:a,y:l,width:c,height:d}=this.bounds,f=[o-w,s-w],u=[h+w,s-w],m=[o-w,r+w],p=[h+w,r+w],y=z([[f[0]-n,f[1]-n],[u[0]+n,u[1]-n],[f[0]+i,f[1]+i],[u[0]-i,u[1]+i]],t),x=z([[m[0]+i,m[1]-i],[p[0]-i,p[1]-i],[m[0]-n,m[1]+n],[p[0]+n,p[1]+n]],t),M=z([[f[0]-n,f[1]-n],[f[0]+i,f[1]+i],[m[0]-n,m[1]+n],[m[0]+i,m[1]-i]],t),_=z([[u[0]-i,u[1]+i],[u[0]+n,u[1]-n],[p[0]-i,p[1]-i],[p[0]+n,p[1]+n]],t),A={main:z([f,u,m,p],t),top:y,bot:x,left:M,right:_};return[new g(a,l,c+2*n,d+2*n),A]}get boundsT(){const t=this.bounds,e=r(a(),t.x,t.y);if(h(e,e,this._transform),this._hasRotation){const n=Math.max(t.width,t.height);return new g(e[0],e[1],n,n)}return new g(e[0],e[1],t.width,t.height)}_createBounds(t){let e=1/0,n=1/0,i=0,o=0;for(const r of t)e=Math.min(e,r.offsets.topLeft[0]),n=Math.min(n,r.offsets.topLeft[1]),i=Math.max(i,r.offsets.bottomRight[0]),o=Math.max(o,r.offsets.bottomRight[1]);const s=i-e,h=o-n;return new g(e+s/2,n+h/2,s,h)}_createGlyphTransform(t,e){const n=x*e.angle,h=s(),l=a();return i(h,h,r(l,e.xOffset,-e.yOffset)),e.useCIMAngleBehavior?o(h,h,n):(i(h,h,r(l,t.x,t.y)),o(h,h,n),i(h,h,r(l,-t.x,-t.y))),h}}class L{constructor(t,e,n,i,o,s){this.glyphWidthEnd=0,this.startX=0,this.startY=0,this.start=Math.max(0,Math.min(e,n)),this.end=Math.max(0,Math.max(e,n)),this.end<t.length&&(this.glyphWidthEnd=t[this.end].rect.width),this.width=i,this.yMin=o,this.yMax=s}}const R=t=>10===t,S=t=>32===t;function X(t,e,n){const i=new Array,o=1/n.scale,s=n.maxLineWidth*o,h=e?t.length-1:0,r=e?-1:t.length,a=e?-1:1;let l=h,c=0,d=0,f=l,g=f,u=0,m=1/0,p=0;for(;l!==r;){const{code:e,rect:n,shaping:o}=t[l],r=Math.abs(n.top);if(R(e)||S(e)||(m=Math.min(m,r),p=Math.max(p,r+n.height)),R(e))l!==h&&(i.push(new L(t,f,l-a,c,m===1/0?0:m,p)),m=1/0,p=0),c=0,f=l+a,g=l+a,d=0;else if(S(e))g=l+a,d=0,u=o.xAdvance,c+=o.xAdvance;else if(c>s){if(g!==f){const e=g-2*a;c-=u,i.push(new L(t,f,e,c-d,m,p)),m=1/0,p=0,f=g,c=d}else i.push(new L(t,f,l-a,c,m,p)),m=1/0,p=0,f=l,g=l,c=0;c+=o.xAdvance,d+=o.xAdvance}else c+=o.xAdvance,d+=o.xAdvance;l+=a}const y=new L(t,f,l-a,c,m,p);return y.start>=0&&y.end<t.length&&i.push(y),i}function O(t,e){let n=0;for(let s=0;s<t.length;s++){const{width:e}=t[s];n=Math.max(e,n)}const i="underline"===e.decoration?m:0,o=t[0].yMin;return{x:0,y:o,height:t[t.length-1].yMax+e.lineHeight*(t.length-1)+i-o,width:n}}function W(t,e,n){let i=0;for(let o=e;o<n;o++)S(t[o].code)&&!R(t[o+1].code)&&i++;return i}function E(t,e){const n=e.scale,i=new Array,o=t.sdfPadding,{faceInfo:s,glyphs:h,isRightToLeft:r}=t,a="justify"===e.horizontalAlignment||"Justify"===e.horizontalAlignment,d=X(h,r,e),f=d.length?O(d,e):{y:0,height:0,width:0},g=a?r?1:-1:l(e.horizontalAlignment),m=c(e.verticalAlignment),p=2===m?1:0,y=p?0:m-1,x=s?.baseline??u,w=d.length>1,b=p?w?-f.y-f.height:-x:-f.y+y*(f.height/2);for(let l=0;l<d.length;l++){const{start:s,end:r,width:c}=d[l],u=a&&l<d.length-1?W(h,s,r):0,m=u>0?(f.width-c)/u:0;let p=-1*(g+1)*((m>0?f.width:c)/2)-o;const y=(t.isRightToLeft?d.length-1-l:l)*e.lineHeight+b-o;d[l].startX=p,d[l].startY=y;for(let t=s;t<=r;t++){const e=h[t];if(R(e.code))continue;const o=M.fromGlyph(p,y,e,n);p+=e.shaping.xAdvance,m>0&&S(e.code)&&(p+=m),i.push(o)}}return new B(i,d,e,s)}function H(t,e){const n=e.scale,{faceInfo:i,glyphs:o}=t,s=o.reduce((t,e)=>Math.max(t,e.rect.height),0),h=o.map(t=>M.fromGlyph(-t.rect.width/2,-s,t,n));return new B(h,[],e,i)}function Y(t,e){return"glyphs"===t.type?E(t,e):I(t,e)}function j(t,e){return"glyphs"===t.type?H(t,e):T(t,e)}function I(t,e){const n=G(t,e),i=P(n,e),o=i.length?J(i):{width:0},s=new Array,h="underline"===e.decoration?"none":e.decoration,r="justify"===e.horizontalAlignment||"Justify"===e.horizontalAlignment,a=r?-1:l(e.horizontalAlignment),d=c(e.verticalAlignment),f=2===d,g=i.length?i[0].yMin:0,u=i.length?U(i[i.length-1]):0,m=u-g,p=f?i.length>1?-u:-(i[0]?.baseline??0):1===d?-g:-1===d?-u:-(g+m/2);for(let l=0;l<i.length;l++){const t=i[l],e=r&&l<i.length-1?C(n,t.start,t.end):0,h=e>0?(o.width-t.width)/e:0;let c=-1*(a+1)*((h>0?o.width:t.width)/2);const d=t.startY+p;let f=null;t.startX=c,t.startY=d;for(let i=t.start;i<=t.end;i++){const e=n[i],{glyph:o,scale:r,fontSize:a}=e,l=c;if(R(o.code)){f=q(s,f,d,t.baseline);continue}("underline"!==e.decoration||f&&f.underlineOffset!==e.underlineOffset||f&&!D(f.color,e.color))&&(f=q(s,f,d,t.baseline));const g=d+t.baseline-e.baseline;s.push(M.fromGlyph(c/r,g/r,o,r,{fontSize:a,color:e.color})),c+=e.xAdvance,"underline"===e.decoration&&(f??={startX:l,endX:c,glyphWidthEnd:o.rect.width*r,textureBinding:o.mosaicItem.textureBinding,underlineOffset:e.underlineOffset,color:e.color},f.endX=c,f.glyphWidthEnd=o.rect.width*r,f.textureBinding=f.textureBinding??o.mosaicItem.textureBinding),h>0&&S(o.code)&&(c+=h,f&&(f.endX=c))}q(s,f,d,t.baseline)}return new B(s,i,{...e,decoration:h})}function T(t,e){const n=G(t,e),i=n.reduce((t,e)=>Math.max(t,e.glyph.rect.height*e.scale),0),o=n.filter(t=>!R(t.glyph.code)).map(t=>M.fromGlyph(-t.glyph.rect.width/2,-i/t.scale,t.glyph,t.scale,{fontSize:t.fontSize,color:t.color}));return new B(o,[],e)}function G(e,n){const i=n.lineHeightRatio??1,o=[];for(const s of e.runs){const e=t(s.fontSize),n=e/s.glyphs.sdfSize,h=e*(d/24)*i,r=(s.glyphs.faceInfo?.baseline??u)*n,a=(s.glyphs.faceInfo?.midline??y)*n,l=m*n+A(s.decoration),c=1+(s.characterSpacing??0);for(const t of s.glyphs.glyphs){const i=t.shaping.xAdvance*n,d=Math.abs(t.rect.top)*n,f=d+t.rect.height*n;o.push({glyph:t,scale:n,fontSize:e,decoration:s.decoration,underlineOffset:l,color:s.color,xAdvance:R(t.code)||S(t.code)?i:i*c,top:d,bottom:f,lineHeight:h,baseline:r,midline:a})}}return o}function P(t,e){const n=[],i=e.maxLineWidth;let o=0,s=0,h=0,r=0,a=0,l=0;for(;o<t.length;){const e=t[o],{glyph:c}=e;if(R(c.code))0!==o&&n.push({width:s,start:r,end:o-1,glyphWidthEnd:t[o-1]?.glyph.rect.width*t[o-1]?.scale||0,yMin:0,yMax:0,lineHeight:0,baseline:0,midline:0,startX:0,startY:0,scale:1}),s=0,r=o+1,a=r,h=0,l=0;else if(S(c.code))a=o+1,h=0,l=e.xAdvance,s+=e.xAdvance;else if(s>i){if(a!==r){const e=a-2;s-=l,n.push({width:s-h,start:r,end:e,glyphWidthEnd:t[e]?.glyph.rect.width*t[e]?.scale||0,yMin:0,yMax:0,lineHeight:0,baseline:0,midline:0,startX:0,startY:0,scale:1}),r=a,s=h}else n.push({width:s,start:r,end:o-1,glyphWidthEnd:t[o-1]?.glyph.rect.width*t[o-1]?.scale||0,yMin:0,yMax:0,lineHeight:0,baseline:0,midline:0,startX:0,startY:0,scale:1}),r=o,a=o,s=0;s+=e.xAdvance,h+=e.xAdvance}else s+=e.xAdvance,h+=e.xAdvance;o++}if(r<t.length){const e=t.length-1;n.push({width:s,start:r,end:e,glyphWidthEnd:t[e]?.glyph.rect.width*t[e]?.scale||0,yMin:0,yMax:0,lineHeight:0,baseline:0,midline:0,startX:0,startY:0,scale:1})}return k(t,n)}function k(t,e){for(let n=0;n<e.length;n++){const i=e[n];let o=0,s=1/0,h=0,r=0;for(let e=i.start;e<=i.end;e++){const n=t[e];"underline"===n.decoration&&(r=Math.max(r,n.underlineOffset)),R(n.glyph.code)||S(n.glyph.code)||(o=Math.max(o,n.baseline),h=Math.max(h,n.lineHeight))}let a=1/0,l=-1/0;for(let e=i.start;e<=i.end;e++){const n=t[e];R(n.glyph.code)||S(n.glyph.code)||(a=Math.min(a,o-n.baseline+n.top),l=Math.max(l,o-n.baseline+n.bottom),s=Math.min(s,o-n.baseline+n.midline))}r>0&&(l=Math.max(l,o+r)),i.baseline=o,i.midline=s===1/0?o:s,i.lineHeight=Math.max(h,l),i.yMin=a===1/0?0:a,i.yMax=l===-1/0?0:l,i.startY=n>0?e[n-1].startY+e[n-1].lineHeight:0}return e}function J(t){let e=0;for(const i of t)e=Math.max(i.width+i.glyphWidthEnd,e);const n=t[0].yMin;return{x:0,y:n,height:U(t[t.length-1])-n,width:e}}function U(t){return t.startY+t.lineHeight}function C(t,e,n){let i=0;for(let o=e;o<n;o++)S(t[o].glyph.code)&&!R(t[o+1].glyph.code)&&i++;return i}function q(t,e,n,i){return e?(t.push(M.fromGlyph(e.startX,n+i+e.underlineOffset,_(e.endX-e.startX+e.glyphWidthEnd,e.textureBinding),1,{color:e.color})),null):null}function D(t,e){return t===e||!!t&&!!e&&t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2]&&t[3]===e[3]}export{M as ShapedGlyph,B as ShapingInfo,E as shapeGlyphs,H as shapeGlyphsForMultipoint,I as shapeRichText,T as shapeRichTextForMultipoint,Y as shapeTextResource,j as shapeTextResourceForMultipoint};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import has from"../../../../../core/has.js";import{clone as e}from"../../../../../core/lang.js";import{OverrideHelper as t}from"../../../../../symbols/cim/OverrideHelper.js";import{FeatureMatcher as r}from"./Matcher.js";import{getCIMSymbols as s,getCIMSymbol as o}from"../../../layers/support/annodime/cimAnnotations.js";import{createDebugWriters as n}from"../../../layers/support/annodime/debugUtils.js";import{createAnnotationMatcherFeatureInfo as i,mixFeature as m}from"../../../layers/support/annodime/MatcherGeometryOverride.js";import{createTileObjectId as l}from"../../../layers/support/annodime/TileObjectId.js";import{hasSymbolFields as c,symbolFields as y}from"../../../layers/support/annodime/virtualFields.js";class a extends r{constructor(e,t){super(),this._context=e,this._symbolCollection=t,this._meshWriters=new Map,this._matcherGeometryOverrides=new Map,this._symbols=s(t)}static async fromAnnotationSchema(e,t){return new a(e,t.symbolCollection)}hasArcadeDependency(){return!1}doMatch(e,t,r){return this._meshWriters.get(l(r,e.getObjectId()))}async fetchResources(e,t,r,s){this._meshWriters.clear(),this._matcherGeometryOverrides.clear();const o=t.getCursor();for(;o.next();){const r=i(o);if(!r)continue;const n=m(o,r);if(!n)continue;const c=await this._createSymbolReference(o,n,r);if(!c)continue;const y=l(s,o.getObjectId());let a=this._meshWriters.get(y);a||(a=await this._createGroup(c,e,t.geometryType),this._meshWriters.set(y,a)),this._matcherGeometryOverrides.set(y,r.geometryOverride)}}async _createGroup(e,t,r){const s=await t.fetchMeshResourceImmediate({type:"mesh-request",symbolReference:e}),o=await b(this._context,s?.meshes||[]);if(has("esri-2d-annotation-dimension-debug")){const e=await n(this._context,t,r);return e.length?[...o,...e]:o}return o}async _createSymbolReference(e,r,s){const o=this._getUnresolvedSymbolReference(s);if(!o)return null;p(o);const n=await t.resolveSymbolOverrides(o,r,e.metadata.outSpatialReference,null,e.geometryType);return n?{type:"CIMSymbolReference",symbol:n}:null}_getUnresolvedSymbolReference(t){const{annotationGraphic:r,annotationGeometryType:s}=t,{bloated:o,symbolID:n}=r;if(o||c(r))return this._getProcessedSymbolReference(t);if(n){const t=this._symbols[n][s];return t?e(t.data):null}return null}_getProcessedSymbolReference(e){const{annotationGraphic:t,annotationGeometryType:r}=e,{bloated:s,symbol:n,symbolID:i}=t;let m=this._getRawSymbolReference(n,i);if(!m||!m.symbol)return null;if(s||(m=this._applySymbolFields(m,t)),!m.symbol||"CIMTextSymbol"!==m.symbol.type)return null;const{data:l}=o(m.symbol,r);return{type:"CIMSymbolReference",symbol:l.symbol,primitiveOverrides:[...m.primitiveOverrides||[],...l.primitiveOverrides||[]]}}_getRawSymbolReference(e,t){if(e&&null!=e.symbol&&"CIMTextSymbol"===e.symbol.type)return e;if(null!=t){const e=this._symbolCollection.find(e=>(e.iD??0)===t);if(e)return{type:"CIMSymbolReference",symbol:e.symbol}}return null}_applySymbolFields(t,r){if(!t.symbol||"CIMTextSymbol"!==t.symbol.type)return t;const s=e(t.symbol);for(const e of y)e.setOnSymbol(s,r);return{type:"CIMSymbolReference",symbol:s,primitiveOverrides:t.primitiveOverrides}}cleanup(e,t,r){const s=t.getObjectId(),o=l(r,s);this._matcherGeometryOverrides.delete(o),this._meshWriters.delete(o)}getMatcherGeometryOverride(e){return this._matcherGeometryOverrides.get(e)??null}}function b(e,t){const r=t.map(e=>({...e}));return e.createMeshWriters(r)}function u(e){return e}function p(e){if(!e.symbol||!("symbolLayers"in e.symbol))return;const t=u({type:"PrivateMatcherGeometryOverrideEffect"});e.symbol.symbolLayers=(e.symbol.symbolLayers||[]).map(e=>({...e,effects:[t,...e.effects||[]]}))}export{a as AnnotationMatcher};
|
|
2
|
+
import has from"../../../../../core/has.js";import{clone as e}from"../../../../../core/lang.js";import{OverrideHelper as t}from"../../../../../symbols/cim/OverrideHelper.js";import{FeatureMatcher as r}from"./Matcher.js";import{getCIMSymbols as s,getCIMSymbol as o}from"../../../layers/support/annodime/cimAnnotations.js";import{createDebugWriters as n}from"../../../layers/support/annodime/debugUtils.js";import{createAnnotationMatcherFeatureInfo as i,mixFeature as m}from"../../../layers/support/annodime/MatcherGeometryOverride.js";import{createTileObjectId as l}from"../../../layers/support/annodime/TileObjectId.js";import{hasSymbolFields as c,symbolFields as y}from"../../../layers/support/annodime/virtualFields.js";class a extends r{constructor(e,t){super(),this._context=e,this._symbolCollection=t,this._meshWriters=new Map,this._matcherGeometryOverrides=new Map,this._symbols=s(t)}static async fromAnnotationSchema(e,t){return new a(e,t.symbolCollection)}hasArcadeDependency(){return!1}doMatch(e,t,r){return this._meshWriters.get(l(r,e.getObjectId()))}async fetchResources(e,t,r,s){this._meshWriters.clear(),this._matcherGeometryOverrides.clear();const o=t.getCursor();for(;o.next();){const r=i(o);if(!r)continue;const n=m(o,r);if(!n)continue;const c=await this._createSymbolReference(o,n,r);if(!c)continue;const y=l(s,o.getObjectId());let a=this._meshWriters.get(y);a||(a=await this._createGroup(c,e,t.geometryType),this._meshWriters.set(y,a)),this._matcherGeometryOverrides.set(y,r.geometryOverride)}}async _createGroup(e,t,r){const s=await t.fetchMeshResourceImmediate({type:"mesh-request",symbolReference:e}),o=await b(this._context,s?.meshes||[]);if(has("esri-2d-annotation-dimension-debug")){const e=await n(this._context,t,r);return e.length?[...o,...e]:o}return o}async _createSymbolReference(e,r,s){const o=this._getUnresolvedSymbolReference(s);if(!o)return null;p(o);const n=await t.resolveSymbolOverrides(o,r,e.metadata.outSpatialReference,null,e.geometryType);return n?{type:"CIMSymbolReference",symbol:n}:null}_getUnresolvedSymbolReference(t){const{annotationGraphic:r,annotationGeometryType:s}=t,{bloated:o,symbolID:n}=r;if(o||c(r))return this._getProcessedSymbolReference(t);if(null!=n){const t=this._symbols[n][s];return t?e(t.data):null}return null}_getProcessedSymbolReference(e){const{annotationGraphic:t,annotationGeometryType:r}=e,{bloated:s,symbol:n,symbolID:i}=t;let m=this._getRawSymbolReference(n,i);if(!m||!m.symbol)return null;if(s||(m=this._applySymbolFields(m,t)),!m.symbol||"CIMTextSymbol"!==m.symbol.type)return null;const{data:l}=o(m.symbol,r);return{type:"CIMSymbolReference",symbol:l.symbol,primitiveOverrides:[...m.primitiveOverrides||[],...l.primitiveOverrides||[]]}}_getRawSymbolReference(e,t){if(e&&null!=e.symbol&&"CIMTextSymbol"===e.symbol.type)return e;if(null!=t){const e=this._symbolCollection.find(e=>(e.iD??0)===t);if(e)return{type:"CIMSymbolReference",symbol:e.symbol}}return null}_applySymbolFields(t,r){if(!t.symbol||"CIMTextSymbol"!==t.symbol.type)return t;const s=e(t.symbol);for(const e of y)e.setOnSymbol(s,r);return{type:"CIMSymbolReference",symbol:s,primitiveOverrides:t.primitiveOverrides}}cleanup(e,t,r){const s=t.getObjectId(),o=l(r,s);this._matcherGeometryOverrides.delete(o),this._meshWriters.delete(o)}getMatcherGeometryOverride(e){return this._matcherGeometryOverrides.get(e)??null}}function b(e,t){const r=t.map(e=>({...e}));return e.createMeshWriters(r)}function u(e){return e}function p(e){if(!e.symbol||!("symbolLayers"in e.symbol))return;const t=u({type:"PrivateMatcherGeometryOverrideEffect"});e.symbol.symbolLayers=(e.symbol.symbolLayers||[]).map(e=>({...e,effects:[t,...e.effects||[]]}))}export{a as AnnotationMatcher};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import i from"../../../../../core/Error.js";import e from"../../../../../core/Logger.js";import{deg2rad as n,rad2deg as t}from"../../../../../core/mathUtils.js";import{dist as s,set as o,equals as r,subtract as h,len as l,scale as m}from"../../../../../core/libs/gl-matrix-2/math/vec2.js";import{fromValues as _,create as d}from"../../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{isPolygon as a}from"../../../../../geometry/support/jsonTypeUtils.js";import u from"../../../../../layers/support/FieldsIndex.js";import{createRendererExpression as g}from"../../../../../support/ArcadeExpression.js";import{fromCIMHorizontalAlignment as c,fromCIMVerticalAlignment as x,fromCIMFontDecoration as P}from"../../../../../symbols/cim/utils.js";import p from"../../../arcade/callExpressionWithFeature.js";import{magicLabelLineHeight as b}from"../../../engine/webgl/definitions.js";import f from"../../../engine/webgl/Rect.js";import{shapeTextResource as y}from"../../../engine/webgl/mesh/templates/shapingUtils.js";import{roundPtToWholePixel as D,getLineWidth as L}from"../../graphics/graphicsUtils.js";import{initializeDimensionStyleDefaults as R}from"./dimensionStyleDefaults.js";import{DimensionRealFieldName as S,rectsOverlap as M,queryPointOnLine as T,angleFromXAxis as w,intersectLinesByPointsAndAngles as E,measureMarkerSymbolSize as k,translateRect as N,scaleRect as v,rotatePoint as A,rectsOverlapOnAxis as B}from"./dimensionUtils.js";import{getAttributeValue as F}from"./utils.js";class j{static async create(i,e,n){const t=new j(i);return await t.initialize(e,n),t}constructor(i){if(this._dimensionStyle=i,this._textString=null,this._displayExtLines=!0,this._systemLength=0,this._dimensionAngleRad=0,this._dimensionLength=0,this._dimensionDirection=null,this._textSize=null,this._extAngleRad=Math.PI/2,this._compiledExpression=null,this._fieldsIndex=null,this._textResource=null,this._beginBaselinePoint=null,this._endBaselinePoint=null,this._dimensionLinePoint=null,this._beginDimensionPoint=null,this._endDimensionPoint=null,this._beginMarkerRect=null,this._endMarkerRect=null,this._textRect=null,this._textPoint=null,this._dimensionPolyline=null,this._dimensionExtensionLines=null,this._hasTextPoint=!1,this._doMarkersFit=!0,this._dimensionIsEvaluated=!1,null==i)throw new Error("dimension syle must be defined!");R(i)}async initialize(n,t){if(!this._dimensionStyle)return;const{attributes:s}=n;if("Expression"===(this._dimensionStyle.textOption??"None")){const{expression:s,expressionParserName:o}=this._dimensionStyle;s&&o&&"arcade"===o.toLowerCase()?(this._compiledExpression=await g(s,t),this._fieldsIndex=I(n)):e.getLogger("esri.layers.DimensionFeatureLayer").warn(new i("dimension-layer:unsupported-expression","Only Arcade expressions are supported",{expressionType:o,expression:s}))}const o=Number(F(S.extAngle,s));this._extAngleRad=isNaN(o)?Math.PI/2:o,this._systemLength=Number(F("__SYSTEM_LENGTH__",s));const{geometry:r}=n;if(r&&!a(r))throw new i("dimension-layer","processed geometry must be a valid 'polygon'.");const h=r?.rings[0];if(!h||h.length<3)throw new i("dimension-layer","processed geometry must have at least 3 points.");this._hasTextPoint=0!==h[3][0]&&0!==h[3][1]&&void 0!==h[3][0]&&void 0!==h[3][1],this._hasTextPoint&&(this._textPoint=h[3]);const l=this._dimensionStyle.textSymbol;s.__DIMENSION_ANGLE__+=l?.angle??0}getTextString(i){return null==this._textString&&(this._textString=this._getDimensionText(i)),this._textString}get textSymbol(){return this._dimensionStyle.textSymbol??null}setTextResource(i){this._textResource=i??null}get beginBaselinePoint(){return this._beginBaselinePoint}get endBaselinePoint(){return this._endBaselinePoint}get beginDimensionPoint(){return this._beginDimensionPoint}get endDimensionPoint(){return this._endDimensionPoint}get textPoint(){return this._textPoint}get dimensionLine(){return this._dimensionPolyline}get extensionLines(){return this._displayExtLines?this._dimensionExtensionLines:null}evaluateWithGeometry(i,e){this._dimensionIsEvaluated||(this._computeDimensionLineInfo(i,e),this._evaluateDefaultPlacement(e),this._updateExtensionLines(e),this._updateTextPoint(e),this._offsetTextPoint(e),this._dimensionIsEvaluated=!0)}_updateTextPoint(i){if(this._hasTextPoint)return;const{textFit:e}=this._dimensionStyle;let n=!0;if(!this._doMarkersFit){if(this._hasTextPoint)return;if("None"===e||!this._beginMarkerRect||!this._endMarkerRect||!this._textRect)return void(n=!0);if((M(this._beginMarkerRect,this._textRect)||M(this._endMarkerRect,this._textRect))&&(n=!1),!n){const i=this._textRect.width/2,n=this._beginMarkerRect.width/2,t=this._endMarkerRect.width/2;"MoveBegin"===e?(this._textPoint=T(this._beginDimensionPoint,this._endDimensionPoint,-(i+n)),this._extendDimensionLineForMovedText("begin",n+this._textRect.width)):"MoveEnd"===e&&(this._textPoint=T(this._endDimensionPoint,this._beginDimensionPoint,-(i+t)),this._extendDimensionLineForMovedText("end",t+this._textRect.width))}}}_extendDimensionLineForMovedText(i,e){if(this._dimensionPolyline?.length)if("begin"===i){const i=T(this._beginDimensionPoint,this._endDimensionPoint,-e);this._dimensionPolyline[0]=[i,this._beginDimensionPoint]}else{const i=T(this._beginDimensionPoint,this._endDimensionPoint,this._dimensionLength+e);this._dimensionPolyline[1]=[i,this._endDimensionPoint]}}_offsetTextPoint(i){if(this._hasTextPoint)return;const e=this._textPoint;if(!e)return;const n=.5*this._textSize*i,t=-n*this._dimensionDirection[1],s=n*this._dimensionDirection[0];e[0]+=t,e[1]+=s}_updateExtensionLines(i){if(!(this._displayExtLines&&this._beginDimensionPoint&&this._dimensionLinePoint&&this._endDimensionPoint))return;const{extensionLineOvershot:e,extensionLineOffset:n}=this._dimensionStyle;let t=this._dimensionLinePoint,o=this._endDimensionPoint;null==e||isNaN(e)||0===e||(t=T(this._dimensionLinePoint,this._beginBaselinePoint,-e*i),o=T(this._endDimensionPoint,this._endBaselinePoint,-e*i));let r=this._beginBaselinePoint,h=this._endBaselinePoint;if(null!=n&&!isNaN(n)&&0!==n){const i=s(t,this._beginBaselinePoint),e=s(o,this._endBaselinePoint);r=T(t,this._beginBaselinePoint,i-n),h=T(o,this._endBaselinePoint,e-n)}this._dimensionExtensionLines=[[t,r],[o,h]]}_computeDimensionLineInfo(e,s){if(!e||!a(e)||e.rings[0].length<3)throw new i("DimensionLayerView: bad geometry","Dimension cann't be applied to an empty geometry!");const u=e.rings[0],g=_(u[0][0],u[0][1]),c=_(u[1][0],u[1][1]),x=_(u[2][0],u[2][1]);this._beginBaselinePoint=o(d(),g[0],g[1]),this._endBaselinePoint=o(d(),c[0],c[1]),this._dimensionLinePoint=x;let P=this._extAngleRad;if(r(g,x))this._beginDimensionPoint=o(d(),g[0],g[1]),this._endDimensionPoint=o(d(),c[0],c[1]),this._displayExtLines=!1;else{const e=w([c[0]-g[0],c[1]-g[1]]),s=t(P);s>=-1&&s<=1?P+=n(1):s>=179&&s<=181&&(P-=n(1));const r=E(x,e,c,e+P);if(!r)throw new i("DimensionLayerView: bad geometry","Failed to construct dimension extension lines!");this._beginDimensionPoint=o(d(),x[0],x[1]),this._endDimensionPoint=o(d(),r[0],r[1])}this._dimensionDirection=h(d(),this._endDimensionPoint,this._beginDimensionPoint),this._dimensionAngleRad=w(this._dimensionDirection),this._dimensionLength=l(this._dimensionDirection),this._dimensionDirection=m(this._dimensionDirection,this._dimensionDirection,1/this._dimensionLength),this._hasTextPoint||(this._textPoint=T(this._beginDimensionPoint,this._endDimensionPoint,this._dimensionLength/2))}_evaluateDefaultPlacement(i){const{beginMarkerSymbol:e,endMarkerSymbol:n}=this._dimensionStyle,t=k(e,this._dimensionAngleRad),s=k(n,this._dimensionAngleRad+Math.PI),o=this._measureDimensionText(this._textString||"",this._textPoint,i);this._textRect=o;const r=i*((t?.width??0)/2),h=i*((s?.width??0)/2),l=t&&this._beginDimensionPoint?N(v(t,i),this._beginDimensionPoint[0],this._beginDimensionPoint[1]):null,m=s&&this._endDimensionPoint?N(v(s,i),this._endDimensionPoint[0],this._endDimensionPoint[1]):null;if(this._beginMarkerRect=l,this._endMarkerRect=m,this._doMarkersFit=this._checkMarkerFit(l,m,o,i),this._doMarkersFit){const i=T(this._beginDimensionPoint,this._endDimensionPoint,this._dimensionLength/2);this._dimensionPolyline=[[i,this._beginDimensionPoint],[i,this._endDimensionPoint]]}else{const i=T(this._beginDimensionPoint,this._endDimensionPoint,-4*r),e=T(this._beginDimensionPoint,this._endDimensionPoint,this._dimensionLength+4*h);this._dimensionPolyline=[[i,this._beginDimensionPoint],[e,this._endDimensionPoint]]}}_checkMarkerFit(i,e,n,t){if(!i||!e)return!1;const{markerFit:s,markerOption:o,markerFitTolerance:r}=this._dimensionStyle;if("None"===s)return!0;let h=!0;const l=(i,e)=>M(i,e)||B(i,e,this._dimensionDirection);if("Tolerance"===s)r*t>=this._dimensionLength&&(h=!1);else{if(this._hasTextPoint&&"Both"!==o)return!0;this._hasTextPoint&&"Both"===o?l(i,e)&&(h=!1):(l(i,e)&&(h=!1),h&&n&&(l(n,i)||l(n,e))&&(h=!1))}return h}_measureDimensionText(i,e,n){if(null==this._textString||null==e||null==this._textResource)return null;const t=this._dimensionStyle.textSymbol;if(!t)return null;const s=c(t.horizontalAlignment),o=x(t.verticalAlignment),r=P(t),h=D(t.height||10);this._textSize="glyphs"===this._textResource.type?h:Math.max(h,...this._textResource.runs.map(i=>D(i.fontSize||0)));const l=!0,m=t.angle||0,_="glyphs"===this._textResource.type?this._textResource.sdfSize:this._textResource.runs[0]?.glyphs.sdfSize;if(!_)return null;const d=h/_,a=L(t.lineWidth),u=Math.max(.25,Math.min(h||1,4)),g=b*u,p=y(this._textResource,{scale:d,angle:m,xOffset:0,yOffset:0,horizontalAlignment:s,verticalAlignment:o,decoration:r,lineHeight:g,lineHeightRatio:u,useCIMAngleBehavior:l,maxLineWidth:a,hasBackground:!1}),R=e;if(!R)return null;const S=n,M=[p.bounds.blX,p.bounds.trY],T=[p.bounds.trX,p.bounds.trY],w=[p.bounds.blX,p.bounds.blY],E=[p.bounds.trX,p.bounds.blY];M[0]-=p.bounds.x,M[1]-=p.bounds.y,T[0]-=p.bounds.x,T[1]-=p.bounds.y,w[0]-=p.bounds.x,w[1]-=p.bounds.y,E[0]-=p.bounds.x,E[1]-=p.bounds.y,M[0]*=S,M[1]*=S,T[0]*=S,T[1]*=S,w[0]*=S,w[1]*=S,E[0]*=S,E[1]*=S,this._dimensionAngleRad&&(A(M,this._dimensionAngleRad),A(T,this._dimensionAngleRad),A(w,this._dimensionAngleRad),A(E,this._dimensionAngleRad)),M[0]+=R[0],M[1]+=R[1],T[0]+=R[0],T[1]+=R[1],w[0]+=R[0],w[1]+=R[1],E[0]+=R[0],E[1]+=R[1];const k=Math.min(M[0],T[0],w[0],E[0]),N=Math.min(M[1],T[1],w[1],E[1]),v=Math.max(M[0],T[0],w[0],E[0]),B=Math.max(M[1],T[1],w[1],E[1]);return new f(k,N,1.1*(v-k),1.1*(B-N))}_getDimensionText(i){const{attributes:e}=i;let n=null;const t=1===Number(F(S.useCustomLength,e));n=Number(F(t?S.customLength:S.dimLength,e)),(0===n||isNaN(n)||null==n)&&(n=this._systemLength);let s=this._getDimensionString(n,i);return"number"==typeof s&&(s=s.toString()),e.__COMPUTED_TEXT_STRING__=s,s||""}_getDimensionString(i,e){const{convertUnits:n,displayUnits:t,displayPrecision:s,prefix:o,suffix:r,textOption:h}=this._dimensionStyle;if("None"===h)return null;if("Expression"===h&&this._compiledExpression&&e)return p(this._compiledExpression,e,{},"esriGeometryPolyline",this._fieldsIndex);let l=(i=null==s||isNaN(s)?parseFloat(i.toString()):parseFloat(i.toFixed(s))).toString();return"Suffix"===h&&(o&&(l=`${o} ${l}`),r&&(l=`${l} ${r}`)),l}}function I(i){const{attributes:e}=i,n=Object.keys(S).map(i=>({name:i,alias:i,type:"string"==typeof e[i]?"esriFieldTypeString":"esriFieldTypeDouble"}));return new u(n)}export{j as default};
|
|
2
|
+
import i from"../../../../../core/Error.js";import n from"../../../../../core/Logger.js";import{dist as e,set as t,subtract as s,len as o,scale as r,equals as h}from"../../../../../core/libs/gl-matrix-2/math/vec2.js";import{fromValues as l,create as m}from"../../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{isPolygon as _}from"../../../../../geometry/support/jsonTypeUtils.js";import d from"../../../../../layers/support/FieldsIndex.js";import{createRendererExpression as a}from"../../../../../support/ArcadeExpression.js";import{fromCIMHorizontalAlignment as u,fromCIMVerticalAlignment as g,fromCIMFontDecoration as c}from"../../../../../symbols/cim/utils.js";import x from"../../../arcade/callExpressionWithFeature.js";import{magicLabelLineHeight as P}from"../../../engine/webgl/definitions.js";import p from"../../../engine/webgl/Rect.js";import{shapeTextResource as b}from"../../../engine/webgl/mesh/templates/shapingUtils.js";import{roundPtToWholePixel as y,getLineWidth as D}from"../../graphics/graphicsUtils.js";import{initializeDimensionStyleDefaults as f}from"./dimensionStyleDefaults.js";import{normalizeExtensionAngle as L,DimensionRealFieldName as R,rectsOverlap as S,queryPointOnLine as T,angleFromXAxis as M,capDimensionExtensionAngle as w,intersectLinesByPointsAndAngles as E,projectLinearDimensionPoints as k,measureMarkerSymbolSize as v,translateRect as A,scaleRect as F,rotatePoint as N,rectsOverlapOnAxis as B}from"./dimensionUtils.js";import{getAttributeValue as j}from"./utils.js";class I{static async create(i,n,e){const t=new I(i);return await t.initialize(n,e),t}constructor(i){if(this._dimensionStyle=i,this._textString=null,this._displayExtLines=!0,this._systemLength=0,this._dimensionAngleRad=0,this._dimensionLength=0,this._dimensionDirection=null,this._textSize=null,this._extAngleRad=Math.PI/2,this._dimensionType=0,this._compiledExpression=null,this._fieldsIndex=null,this._textResource=null,this._beginBaselinePoint=null,this._endBaselinePoint=null,this._dimensionLinePoint=null,this._beginDimensionPoint=null,this._endDimensionPoint=null,this._beginMarkerRect=null,this._endMarkerRect=null,this._textRect=null,this._textPoint=null,this._dimensionPolyline=null,this._dimensionExtensionLines=null,this._hasTextPoint=!1,this._doMarkersFit=!0,this._dimensionIsEvaluated=!1,null==i)throw new Error("dimension syle must be defined!");f(i)}async initialize(e,t){if(!this._dimensionStyle)return;const{attributes:s}=e;if("Expression"===(this._dimensionStyle.textOption??"None")){const{expression:s,expressionParserName:o}=this._dimensionStyle;s&&o&&"arcade"===o.toLowerCase()?(this._compiledExpression=await a(s,t),this._fieldsIndex=O(e)):n.getLogger("esri.layers.DimensionFeatureLayer").warn(new i("dimension-layer:unsupported-expression","Only Arcade expressions are supported",{expressionType:o,expression:s}))}this._extAngleRad=L(j(R.extAngle,s)),this._dimensionType=1===Number(j(R.dimType,s))?1:0,this._systemLength=Number(j("__SYSTEM_LENGTH__",s));const{geometry:o}=e;if(o&&!_(o))throw new i("dimension-layer","processed geometry must be a valid 'polygon'.");const r=o?.rings[0];if(!r||r.length<3)throw new i("dimension-layer","processed geometry must have at least 3 points.");this._hasTextPoint=null!=r[3]&&0!==r[3][0]&&0!==r[3][1]&&void 0!==r[3][0]&&void 0!==r[3][1],this._hasTextPoint&&(this._textPoint=r[3]);const h=this._dimensionStyle.textSymbol;s.__DIMENSION_ANGLE__+=h?.angle??0}getTextString(i){return null==this._textString&&(this._textString=this._getDimensionText(i)),this._textString}get textSymbol(){return this._dimensionStyle.textSymbol??null}setTextResource(i){this._textResource=i??null}get beginBaselinePoint(){return this._beginBaselinePoint}get endBaselinePoint(){return this._endBaselinePoint}get beginDimensionPoint(){return this._beginDimensionPoint}get endDimensionPoint(){return this._endDimensionPoint}get textPoint(){return this._textPoint}get dimensionLine(){return this._dimensionPolyline}get extensionLines(){return this._displayExtLines?this._dimensionExtensionLines:null}evaluateWithGeometry(i,n){this._dimensionIsEvaluated||(this._computeDimensionLineInfo(i,n),this._evaluateDefaultPlacement(n),this._updateExtensionLines(n),this._updateTextPoint(n),this._offsetTextPoint(n),this._dimensionIsEvaluated=!0)}_updateTextPoint(i){if(this._hasTextPoint)return;const{textFit:n}=this._dimensionStyle;let e=!0;if(!this._doMarkersFit){if(this._hasTextPoint)return;if("None"===n||!this._beginMarkerRect||!this._endMarkerRect||!this._textRect)return void(e=!0);if((S(this._beginMarkerRect,this._textRect)||S(this._endMarkerRect,this._textRect))&&(e=!1),!e){const i=this._textRect.width/2,e=this._beginMarkerRect.width/2,t=this._endMarkerRect.width/2;"MoveBegin"===n?(this._textPoint=T(this._beginDimensionPoint,this._endDimensionPoint,-(i+e)),this._extendDimensionLineForMovedText("begin",e+this._textRect.width)):"MoveEnd"===n&&(this._textPoint=T(this._endDimensionPoint,this._beginDimensionPoint,-(i+t)),this._extendDimensionLineForMovedText("end",t+this._textRect.width))}}}_extendDimensionLineForMovedText(i,n){if(this._dimensionPolyline?.length)if("begin"===i){const i=T(this._beginDimensionPoint,this._endDimensionPoint,-n);this._dimensionPolyline[0]=[i,this._beginDimensionPoint]}else{const i=T(this._beginDimensionPoint,this._endDimensionPoint,this._dimensionLength+n);this._dimensionPolyline[1]=[i,this._endDimensionPoint]}}_offsetTextPoint(i){if(this._hasTextPoint)return;const n=this._textPoint;if(!n)return;const e=.5*this._textSize*i,t=-e*this._dimensionDirection[1],s=e*this._dimensionDirection[0];n[0]+=t,n[1]+=s}_updateExtensionLines(i){if(!(this._displayExtLines&&this._beginDimensionPoint&&this._dimensionLinePoint&&this._endDimensionPoint))return;const{extensionLineOvershot:n,extensionLineOffset:t}=this._dimensionStyle;let s=this._dimensionLinePoint,o=this._endDimensionPoint;null==n||isNaN(n)||0===n||(s=T(this._dimensionLinePoint,this._beginBaselinePoint,-n*i),o=T(this._endDimensionPoint,this._endBaselinePoint,-n*i));let r=this._beginBaselinePoint,h=this._endBaselinePoint;if(null!=t&&!isNaN(t)&&0!==t){const i=e(s,this._beginBaselinePoint),n=e(o,this._endBaselinePoint);r=T(s,this._beginBaselinePoint,i-t),h=T(o,this._endBaselinePoint,n-t)}this._dimensionExtensionLines=[[s,r],[o,h]]}_computeDimensionLineInfo(n,e){if(!n||!_(n)||n.rings[0].length<3)throw new i("DimensionLayerView: bad geometry","Dimension cann't be applied to an empty geometry!");const h=n.rings[0],d=l(h[0][0],h[0][1]),a=l(h[1][0],h[1][1]),u=l(h[2][0],h[2][1]);this._beginBaselinePoint=t(m(),d[0],d[1]),this._endBaselinePoint=t(m(),a[0],a[1]),this._dimensionLinePoint=u,1===this._dimensionType?this._computeLinearDimensionPoints(d,a,u):this._computeAlignedDimensionPoints(d,a,u);const g=this._beginDimensionPoint,c=this._endDimensionPoint;if(!g||!c)throw new i("DimensionLayerView: bad geometry","Failed to construct the dimension line!");this._dimensionDirection=s(m(),c,g),this._dimensionAngleRad=M(this._dimensionDirection),this._dimensionLength=o(this._dimensionDirection),this._dimensionDirection=r(this._dimensionDirection,this._dimensionDirection,1/this._dimensionLength),this._hasTextPoint||(this._textPoint=T(g,c,this._dimensionLength/2))}_computeAlignedDimensionPoints(n,e,s){const o=w(this._extAngleRad);if(h(n,s))return this._beginDimensionPoint=t(m(),n[0],n[1]),this._endDimensionPoint=t(m(),e[0],e[1]),void(this._displayExtLines=!1);const r=M([e[0]-n[0],e[1]-n[1]]),l=E(s,r,e,r+o);if(!l)throw new i("DimensionLayerView: bad geometry","Failed to construct dimension extension lines!");this._beginDimensionPoint=t(m(),s[0],s[1]),this._endDimensionPoint=t(m(),l[0],l[1])}_computeLinearDimensionPoints(i,n,e){const s=k(i,n,e,this._extAngleRad);if(!s)return this._beginDimensionPoint=t(m(),i[0],i[1]),this._endDimensionPoint=t(m(),n[0],n[1]),void(this._displayExtLines=!1);this._beginDimensionPoint=s.beginDimensionPoint,this._endDimensionPoint=s.endDimensionPoint}_evaluateDefaultPlacement(i){const{beginMarkerSymbol:n,endMarkerSymbol:e}=this._dimensionStyle,t=v(n,this._dimensionAngleRad),s=v(e,this._dimensionAngleRad+Math.PI),o=this._measureDimensionText(this._textString||"",this._textPoint,i);this._textRect=o;const r=i*((t?.width??0)/2),h=i*((s?.width??0)/2),l=t&&this._beginDimensionPoint?A(F(t,i),this._beginDimensionPoint[0],this._beginDimensionPoint[1]):null,m=s&&this._endDimensionPoint?A(F(s,i),this._endDimensionPoint[0],this._endDimensionPoint[1]):null;if(this._beginMarkerRect=l,this._endMarkerRect=m,this._doMarkersFit=this._checkMarkerFit(l,m,o,i),this._doMarkersFit){const i=T(this._beginDimensionPoint,this._endDimensionPoint,this._dimensionLength/2);this._dimensionPolyline=[[i,this._beginDimensionPoint],[i,this._endDimensionPoint]]}else{const i=T(this._beginDimensionPoint,this._endDimensionPoint,-4*r),n=T(this._beginDimensionPoint,this._endDimensionPoint,this._dimensionLength+4*h);this._dimensionPolyline=[[i,this._beginDimensionPoint],[n,this._endDimensionPoint]]}}_checkMarkerFit(i,n,e,t){if(!i||!n)return!1;const{markerFit:s,markerOption:o,markerFitTolerance:r}=this._dimensionStyle;if("None"===s)return!0;let h=!0;const l=(i,n)=>S(i,n)||B(i,n,this._dimensionDirection);if("Tolerance"===s)r*t>=this._dimensionLength&&(h=!1);else{if(this._hasTextPoint&&"Both"!==o)return!0;this._hasTextPoint&&"Both"===o?l(i,n)&&(h=!1):(l(i,n)&&(h=!1),h&&e&&(l(e,i)||l(e,n))&&(h=!1))}return h}_measureDimensionText(i,n,e){if(null==this._textString||null==n||null==this._textResource)return null;const t=this._dimensionStyle.textSymbol;if(!t)return null;const s=u(t.horizontalAlignment),o=g(t.verticalAlignment),r=c(t),h=y(t.height||10);this._textSize="glyphs"===this._textResource.type?h:Math.max(h,...this._textResource.runs.map(i=>y(i.fontSize||0)));const l=!0,m=t.angle||0,_="glyphs"===this._textResource.type?this._textResource.sdfSize:this._textResource.runs[0]?.glyphs.sdfSize;if(!_)return null;const d=h/_,a=D(t.lineWidth),x=Math.max(.25,Math.min(h||1,4)),f=P*x,L=b(this._textResource,{scale:d,angle:m,xOffset:0,yOffset:0,horizontalAlignment:s,verticalAlignment:o,decoration:r,lineHeight:f,lineHeightRatio:x,useCIMAngleBehavior:l,maxLineWidth:a,hasBackground:!1}),R=n;if(!R)return null;const S=e,T=[L.bounds.blX,L.bounds.trY],M=[L.bounds.trX,L.bounds.trY],w=[L.bounds.blX,L.bounds.blY],E=[L.bounds.trX,L.bounds.blY];T[0]-=L.bounds.x,T[1]-=L.bounds.y,M[0]-=L.bounds.x,M[1]-=L.bounds.y,w[0]-=L.bounds.x,w[1]-=L.bounds.y,E[0]-=L.bounds.x,E[1]-=L.bounds.y,T[0]*=S,T[1]*=S,M[0]*=S,M[1]*=S,w[0]*=S,w[1]*=S,E[0]*=S,E[1]*=S,this._dimensionAngleRad&&(N(T,this._dimensionAngleRad),N(M,this._dimensionAngleRad),N(w,this._dimensionAngleRad),N(E,this._dimensionAngleRad)),T[0]+=R[0],T[1]+=R[1],M[0]+=R[0],M[1]+=R[1],w[0]+=R[0],w[1]+=R[1],E[0]+=R[0],E[1]+=R[1];const k=Math.min(T[0],M[0],w[0],E[0]),v=Math.min(T[1],M[1],w[1],E[1]),A=Math.max(T[0],M[0],w[0],E[0]),F=Math.max(T[1],M[1],w[1],E[1]);return new p(k,v,1.1*(A-k),1.1*(F-v))}_getDimensionText(i){const{attributes:n}=i;let e=null;const t=1===Number(j(R.useCustomLength,n));e=Number(j(t?R.customLength:R.dimLength,n)),(0===e||isNaN(e)||null==e)&&(e=this._systemLength);let s=this._getDimensionString(e,i);return"number"==typeof s&&(s=s.toString()),n.__COMPUTED_TEXT_STRING__=s,s||""}_getDimensionString(i,n){const{convertUnits:e,displayUnits:t,displayPrecision:s,prefix:o,suffix:r,textOption:h}=this._dimensionStyle;if("None"===h)return null;if("Expression"===h&&this._compiledExpression&&n)return x(this._compiledExpression,n,{},"esriGeometryPolyline",this._fieldsIndex);let l=(i=null==s||isNaN(s)?parseFloat(i.toString()):parseFloat(i.toFixed(s))).toString();return"Suffix"===h&&(o&&(l=`${o} ${l}`),r&&(l=`${l} ${r}`)),l}}function O(i){const{attributes:n}=i,e=Object.keys(R).map(i=>({name:i,alias:i,type:"string"==typeof n[i]?"esriFieldTypeString":"esriFieldTypeDouble"}));return new d(e)}export{I as default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{rad2deg as e}from"../../../../../core/mathUtils.js";import t from"../../../../../geometry/Point.js";import{normalizeTransform as r,quantizeY as
|
|
2
|
+
import{rad2deg as e}from"../../../../../core/mathUtils.js";import t from"../../../../../geometry/Point.js";import{normalizeTransform as r,quantizeY as n,quantizeX as o}from"../../../../../geometry/support/quantizationUtils.js";import{convertToGeometry as i}from"../../../../../layers/graphics/featureConversionUtils.js";import a from"../../../../../layers/graphics/OptimizedGeometry.js";import{project as m}from"../../../../../layers/graphics/data/projectionSupport.js";import{DimensionRealFieldName as s,projectLinearDimensionPoints as u,normalizeExtensionAngle as y,angleFromXAxis as p}from"./dimensionUtils.js";import{getAttributeValue as l,parseElement as f,reprojectAndQuantize as c}from"./utils.js";import{featureFields as g}from"./virtualFields.js";function d(e){const t=e.readAttribute("element");if(!t)return null;const n=e.getInTransform()??e.getDisplayTransform();if(!n)throw new Error("Quantization transform is required to read annotation features.");const o=e.geometryType;if(!o)return null;const i=e.metadata.outSpatialReference,a=e.metadata.attributeSpatialReference??e.metadata.spatialReference??i,m=r(n),s=f(t),{geometry:u}=s;if(!u)return null;const y=c(u,a,i,m);if(!y)return null;const p={},l={annotationGeometryType:h(s),annotationGraphic:s,attributes:p,geometryOverride:{geometry:y,geometryType:o}};for(const r of g)r.setOnFeature(l,s);return l}function b(i){const f=i.getInTransform()??i.getDisplayTransform();if(!f)throw new Error("Quantization transform is required to read dimension features.");const c=i.geometryType;if(!c)return null;const g={...i.readAttributes()},d=i.metadata.outSpatialReference,b=i.metadata.attributeSpatialReference??i.metadata.spatialReference??d,N=r(f),h={x:Number(l(s.beginX,g)),y:Number(l(s.beginY,g)),spatialReference:b},x={x:Number(l(s.endX,g)),y:Number(l(s.endY,g)),spatialReference:b},w={x:Number(l(s.dimX,g)),y:Number(l(s.dimY,g)),spatialReference:b};if(isNaN(h.x)||isNaN(h.y)||isNaN(x.x)||isNaN(x.y))return console.error(`Feature with ${s.objectId}=${l(s.objectId,g)} is missing valid begin, end, or dimension points and will be skipped.`),null;(isNaN(w.x)||isNaN(w.y))&&(w.x=h.x,w.y=h.y);const T=m(new t(h),b,d),j=m(new t(x),b,d),R=m(new t(w),b,d),_=[T,j,R],E=j.x-T.x,I=j.y-T.y;let M=Math.PI/2;0!==E?M=Math.atan2(I,E):I<0&&(M=-Math.PI/2);let S=Math.sqrt(E*E+I*I);if(1===Number(l(s.dimType,g))){const e=u([T.x,T.y],[j.x,j.y],[R.x,R.y],y(l(s.extAngle,g)));if(e){const t=e.endDimensionPoint[0]-e.beginDimensionPoint[0],r=e.endDimensionPoint[1]-e.beginDimensionPoint[1];S=Math.sqrt(t*t+r*r),M=p([t,r])}}const D=l(s.textX,g),P=l(s.textY,g);if(null!=D&&null!=P){const e=new t({x:Number(D),y:Number(P),spatialReference:b}),r=m(e,b,d);_.push(r)}const U=_.map(e=>({x:o(N,e.x),y:n(N,e.y)})).flatMap(e=>[e.x,e.y]);return g.__SYSTEM_LENGTH__=S,g.__DIMENSION_ANGLE__=360-e(M),{attributes:g,geometryOverride:{geometry:new a([U.length],U),geometryType:c}}}function N(e,t){const{geometry:r,geometryType:n}=t.geometryOverride,o=i(r,n,!1,!1);return o?{attributes:{...e.readAttributes(),...t.attributes},centroid:null,geometry:o}:null}function h(e){if(e.geometry){if("custom-two-point"===e.geometry.type)return"line";if("custom-multipoint"===e.geometry.type)return"multipoint";if("geometry-bag"===e.geometry.type){if("custom-multipoint"===e.geometry.geometries[0].type)return"multipoint";throw new Error("Unable to determine geometry type from annotation graphic")}if("custom-point"===e.geometry.type)return"point";if("polyline"===e.geometry.type)return"line";if("point"===e.geometry.type)return"point";throw new Error("Unable to determine geometry type from annotation graphic")}throw new Error("Unable to determine geometry type from annotation graphic")}export{d as createAnnotationMatcherFeatureInfo,b as createDimensionMatcherFeatureInfo,h as getAnnotationGeometryType,N as mixFeature};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{getFontFamily as t}from"../../../../../core/fontUtils.js";import{
|
|
2
|
+
import{getFontFamily as t}from"../../../../../core/fontUtils.js";import{deg2rad as n,rad2deg as o}from"../../../../../core/mathUtils.js";import{set as i,len as e,scaleAndAdd as r,dot as c}from"../../../../../core/libs/gl-matrix-2/math/vec2.js";import{create as s}from"../../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{create as u}from"../../../../../geometry/support/aaBoundingRect.js";import{getBoundsXY as a}from"../../../../../geometry/support/boundsUtils.js";import{fromCIMFontDecoration as f,fromCIMFontStyle as h}from"../../../../../symbols/cim/utils.js";import m from"../../../engine/webgl/Rect.js";function l(n){const o=f(n),{style:i,weight:e}=h(n.fontStyleName);return{family:t(n.fontFamilyName),decoration:o,style:i,weight:e}}function y(t){const n=(t.symbolLayers||[]).map(t=>"CIMVectorMarker"!==t.type||t.anchorPoint||!t.frame?t:{...t,anchorPointUnits:"Absolute",anchorPoint:{x:-t.frame.xmin,y:0}});return{...t,symbolLayers:n}}function x(t,n,o){if(!t?.symbolLayers?.length)return null;const i=y(t);let e=null;for(const c of i.symbolLayers||[]){const t=M(c,n);t&&(e=e?N(e,t):t)}const r=new m(-16,-16,32,32);return e?N(e,r):r}function M(t,n){switch(t.type){case"CIMVectorMarker":return g(t,n);case"CIMPictureMarker":return P(t,n);default:return p(t,n)}}function g(t,n){const o=d(t.markerGraphics),i=t.frame,e=i?new m(i.xmin,i.ymin,i.xmax-i.xmin,i.ymax-i.ymin):null,r=o??e??w(t.size);if(!r)return null;const c=b(r),s=null!=i?.xmax&&null!=i?.xmin?i.xmax-i.xmin:r.width,u=null!=i?.ymax&&null!=i?.ymin?i.ymax-i.ymin:r.height,a=t.size&&u?t.size/u:1;if(e&&D(c,.5*-(i.xmax+i.xmin),.5*-(i.ymax+i.ymin)),t.anchorPoint){let n=t.anchorPoint.x,o=t.anchorPoint.y;"Absolute"!==t.anchorPointUnits?(n*=s,o*=u):0!==a&&(n/=a,o/=a),D(c,-n,-o)}return 1!==a&&T(c,a,a),I(c,t,n),E(c)}function P(t,n){const o=t.size;if(!o)return null;const i=o*(t.scaleX??1),e=b(new m(-i/2,-o/2,i,o));if(t.anchorPoint){let n=t.anchorPoint.x,r=t.anchorPoint.y;"Absolute"!==t.anchorPointUnits&&(n*=i,r*=o),D(e,-n,-r)}return I(e,t,n),E(e)}function p(t,n){const o=w(t.size);if(!o)return null;const i=b(o);if(t.anchorPoint){let n=t.anchorPoint.x,e=t.anchorPoint.y;"Absolute"!==t.anchorPointUnits&&(n*=o.width,e*=o.height),D(i,-n,-e)}return I(i,t,n),E(i)}function d(t){let n=null;for(const o of t||[]){if(!o.geometry)continue;const t=a(u(),o.geometry),i=new m(t[0],t[1],t[2]-t[0],t[3]-t[1]);n=n?N(n,i):i}return n}function w(t){return t?new m(-t/2,-t/2,t,t):null}function I(t,n,o){const i=n.rotation??0,e=(n.rotateClockwise?-i:i)*(Math.PI/180);e&&L(t,e),(n.offsetX||n.offsetY)&&D(t,n.offsetX??0,n.offsetY??0),o&&L(t,o)}function b(t){return[[t.x,t.y],[t.x+t.width,t.y],[t.x+t.width,t.y+t.height],[t.x,t.y+t.height]]}function E(t){let n=1/0,o=1/0,i=-1/0,e=-1/0;for(const[r,c]of t)n=Math.min(n,r),o=Math.min(o,c),i=Math.max(i,r),e=Math.max(e,c);return new m(n,o,i-n,e-o)}function D(t,n,o){for(const i of t)i[0]+=n,i[1]+=o}function T(t,n,o){for(const i of t)i[0]*=n,i[1]*=o}function L(t,n){for(const o of t)H(o,n)}function N(t,n){const o=Math.min(t.x,n.x),i=Math.min(t.y,n.y),e=Math.max(t.x+t.width,n.x+n.width),r=Math.max(t.y+t.height,n.y+n.height);return new m(o,i,e-o,r-i)}var X;function Y(t){const n=null==t?NaN:Number(t);return isNaN(n)?Math.PI/2:n}function A(t,n,o,r){const c=i(s(),o[0]-t[0],o[1]-t[1]);if(0===e(c))return null;const u=F(c),a=O(o,u-U(r),n,u);return a?{beginDimensionPoint:i(s(),o[0],o[1]),endDimensionPoint:a}:null}function U(t){const i=o(t);return i>=-1&&i<=1?t+n(1):i>=179&&i<=181?t-n(1):t}function j(t,n,o){const c=i(s(),n[0]-t[0],n[1]-t[1]),u=e(c);return 0===u?[t[0],t[1]]:r(s(),t,c,o/u)}function S(t){return{left:t.x,right:t.x+t.width,top:t.y+t.height,bottom:t.y}}function C(t,n){const o=S(t),i=S(n),e=o.left<=i.right&&i.left<=o.right,r=o.bottom<=i.top&&i.bottom<=o.top;return e&&r}function G(t,n,o){const i=k(t,o),e=k(n,o);return i[0]<=e[1]&&e[0]<=i[1]}function k(t,n){const o=[[t.x,t.y],[t.x+t.width,t.y],[t.x+t.width,t.y+t.height],[t.x,t.y+t.height]];let i=1/0,e=-1/0;for(const[r,s]of o){const t=c([r,s],n);i=Math.min(i,t),e=Math.max(e,t)}return[i,e]}function z(t,n){return new m(t.x*n,t.y*n,t.width*n,t.height*n)}function B(t,n,o){return new m(t.x+n,t.y+o,t.width,t.height)}function H(t,n){const o=t[0],i=t[1];t[0]=o*Math.cos(n)-i*Math.sin(n),t[1]=o*Math.sin(n)+i*Math.cos(n)}!function(t){t.objectId="OBJECTID",t.shape="SHAPE",t.dimLength="DIMLENGTH",t.beginX="BEGINX",t.beginY="BEGINY",t.endX="ENDX",t.endY="ENDY",t.textX="TEXTX",t.textY="TEXTY",t.styleId="STYLEID",t.dimX="DIMX",t.dimY="DIMY",t.customLength="CUSTOMLENGTH",t.useCustomLength="USECUSTOMLENGTH",t.dimDisplay="DIMDISPLAY",t.extDisplay="EXTDISPLAY",t.markerDisplay="MARKERDISPLAY",t.extAngle="EXTANGLE",t.dimType="DIMTYPE",t.textAngle="TEXTANGLE"}(X||(X={}));const R=1e-9;function v(t,n){return t[0]*n[1]-t[1]*n[0]}function O(t,n,o,i){return V(t,n,o,i)?.point??null}function V(t,n,o,e){const c=i(s(),Math.cos(n),Math.sin(n)),u=i(s(),Math.cos(e),Math.sin(e)),a=i(s(),o[0]-t[0],o[1]-t[1]),f=v(c,u);if(Math.abs(f)<=R)return null;const h=v(a,u)/f,m=v(a,c)/f;return{point:r(s(),t,c,h),t1:h,t2:m}}function F(t){const n=t[0],o=t[1];if(0===n&&0===o)return 0;if(0===n&&o>0)return Math.PI/2;if(0===n&&o<0)return 3*Math.PI/2;if(n<0&&0===o)return Math.PI;if(n>0&&0===o)return 0;let i=Math.atan2(o,n);return i<0&&(i+=2*Math.PI),i}export{X as DimensionRealFieldName,F as angleFromXAxis,U as capDimensionExtensionAngle,l as getFontForCIMTextSymbol,O as intersectLinesByPointsAndAngles,x as measureMarkerSymbolSize,Y as normalizeExtensionAngle,A as projectLinearDimensionPoints,k as projectRectToAxis,j as queryPointOnLine,C as rectsOverlap,G as rectsOverlapOnAxis,y as repositionMarkerSymbol,H as rotatePoint,z as scaleRect,S as toBounds,B as translateRect};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{__decorate as e}from"tslib";import t from"../../../core/Error.js";import"../../../core/has.js";import{whenOnce as i,watch as r,sync as s}from"../../../core/reactiveUtils.js";import{property as l,subclass as a}from"../../../core/accessorSupport/decorators.js";import{computeSrcResolutions as
|
|
2
|
+
import{__decorate as e}from"tslib";import t from"../../../core/Error.js";import"../../../core/has.js";import{whenOnce as i,watch as r,sync as s}from"../../../core/reactiveUtils.js";import{property as l,subclass as a}from"../../../core/accessorSupport/decorators.js";import{computeSrcResolutions as o,projectDatasetExtent as n}from"../../../layers/raster/functions/rasterProjectionHelper.js";import{LayerView3D as h}from"./LayerView3D.js";import{TiledLayerView3D as m}from"./TiledLayerView3D.js";import u from"../support/flow/FlowSubViewTiles3D.js";import{RasterTile as d}from"../terrain/RasterTile.js";import{emptyTile as p}from"../terrain/TerrainData.js";import c from"../../layers/ImageryTileLayerView.js";import{RefreshableLayerView as y}from"../../layers/RefreshableLayerView.js";import{createQueryGeometry as f}from"../../support/drapedUtils.js";import{getWebGLCapabilities as w}from"../../webgl/capabilities.js";let g=class extends(y(m(h(c)))){constructor(){super(...arguments),this._srcResolutions=[],this.type="imagery-tile-3d",this._isAlignedMapTile=!0,this._flowSubView=null,this.ignoresMemoryFactor=!1,this.unloadedMemory=0}initialize(){this.layer.increaseRasterJobHandlerUsage(),null==this.fullExtent&&this.addResolvingPromise(Promise.reject(new t("layerview:spatial-reference-incompatible","The layer extent cannot be projected to the view's spatial reference",{layer:this.layer})));const e=i(()=>this.view?.basemapTerrain?.tilingSchemeLocked).then(()=>{const e=this.view.basemapTerrain.tilingScheme,t=this.layer.tileInfo;this._isAlignedMapTile=["png","png24","png32","jpg","mixed"].includes(t.format)&&e.compatibleWith(t),this.tileInfo=this._isAlignedMapTile?t:e.toTileInfo(),this._srcResolutions=o(this.layer.serviceRasterInfo,this.tileInfo),this.addHandles([r(()=>this.layer.renderer,e=>{this._setSubView(e),this._updatingHandles.consumePromise(this.doRefresh())},s),r(()=>[this.layer.interpolation,this.layer.bandIds,this.layer.multidimensionalDefinition,this.layer.multidimensionalSubset,this.layer.rasterFunction,this.timeExtent],()=>this._updatingHandles.addPromise(this.doRefresh()),s)])});this._setSubView(this.layer.renderer),this.addResolvingPromise(e)}destroy(){this.layer.decreaseRasterJobHandlerUsage(),this._flowSubView?.destroy()}get fullExtent(){try{return this.layer.loaded?this._getFullExtent():null}catch{return null}}_setSubView(e){if("wcs"===this.layer.type)return;const t="flow"===e?.type,i=this._flowSubView;t&&null!=i||(i?.destroy(),this._flowSubView=t?new u({layerView:this}):null)}get _hasFlow(){return null!=this._flowSubView}get imageFormatIsOpaque(){return"jpg"===this.layer.tileInfo.format}get hasMixedImageFormats(){return"mixed"===this.layer.tileInfo.format}get dataLevelRange(){const e=this.layer.tileInfo,t=this.tileInfo.lodAt(0)?.scale,i=e.lodAt(e.lods.length-1)?.scale;return this.levelRangeFromScaleRange(t,i)}get visibleAtCurrentScale(){return this._flowSubView?.visibleAtCurrentScale??this.tilesVisibleAtCurrentScale()}_getFullExtent(){return n(this.layer.serviceRasterInfo,this.view.groundView?.spatialReference??this.view.spatialReference)}async fetchTile(e,i){if(this._isAlignedMapTile)return this.layer.fetchImageBitmapTile(e[0],e[1],e[2],{...i,allowDeriveTypeFromData:!0,imageOrientation:"flipY"});const r=this.tileInfo,s=this._canSymbolizeInWebGL(),l={tileInfo:r,requestRawData:s&&!this._hasFlow,signal:i.signal,timeExtent:this.timeExtent,requestProjectedLocalDirections:this._hasFlow,srcResolution:this._srcResolutions[e[0]],noClip:!1},{layer:a}=this,[o,n,h]=e,m=await a.fetchTile(o,n,h,l);if(m instanceof HTMLImageElement||m instanceof ImageBitmap)throw new t("layerview:unexpected-tile-data","Expected fetchTile to return raster data, but received an image element. This may indicate a problem with the layer's fetchTile implementation.");let u=m?.pixelBlock;if(null==u)return p;if(!s&&!this._hasFlow&&(u=await a.applyRenderer(m),null==u))return p;const c=new d([o,n,h],u,r.size[0],r.size[1]);return s?(c.symbolizerRenderer=a.symbolizer.rendererJSON,c.symbolizerParameters=a.symbolizer.generateWebGLParameters(this._getSymbolizerOptions(o)),c.transformGrid=m.transformGrid,c.bandIds=a.bandIds):(c.isRenderedSource=!0,c.bandIds=null),c.interpolation=a.interpolation,c}_getSymbolizerOptions(e){const t=this.tileInfo.lodAt(e).resolution;return{pixelBlock:null,isGCS:null!=this.view.groundView?.spatialReference?this.view.groundView.spatialReference.isGeographic:this.view.spatialReference.isGeographic,resolution:{x:t,y:t},bandIds:this.layer.bandIds}}ensureSymbolizerParameters(e){this._canSymbolizeInWebGL()&&JSON.stringify(e.symbolizerRenderer)!==JSON.stringify(this.layer.symbolizer.rendererJSON)&&(e.symbolizerParameters=this.layer.symbolizer.generateWebGLParameters(this._getSymbolizerOptions(e.lij[0])))}createFetchPopupFeaturesQueryGeometry(e,t){return f(e,t,this.view)}async doRefresh(){this.suspended||(this._flowSubView?.doRefresh(),this.emit("data-changed"))}isUpdating(){return this._flowSubView?.updating??!1}_canSymbolizeInWebGL(){const e=w(),{symbolizer:t}=this.layer,i=t.lookup.colormapLut?.indexedColormap,r=!!this.layer.rasterFunction?.hasClipFunction,s=i&&i.length>4*(e.maxTextureSize||4096);return t.canRenderInWebGL&&!s&&!r}get usedMemory(){return this._flowSubView?.usedMemory??0}get test(){}};e([l()],g.prototype,"fullExtent",null),e([l()],g.prototype,"_hasFlow",null),e([l({readOnly:!0})],g.prototype,"imageFormatIsOpaque",null),e([l({readOnly:!0})],g.prototype,"hasMixedImageFormats",null),e([l()],g.prototype,"_flowSubView",void 0),e([l({readOnly:!0})],g.prototype,"dataLevelRange",null),e([l({readOnly:!0})],g.prototype,"visibleAtCurrentScale",null),g=e([a("esri.views.3d.layers.ImageryTileLayerView3D")],g);const b=g;export{b as default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import has from"../../../core/has.js";import{Milliseconds as e}from"../../../core/time.js";function a(e){return l[e]}function i(){return has("esri-iPhone")?"low":"medium"}const o={reset(){const e=m();for(const a of Object.keys(e))l[a]=e[a]}},t={IPhone12Pro:120,GalaxyS20:200,FullHD:240,SurfacePro7:300,FullHDRetina:430},l=m();function m(){const a=!!has("esri-mobile"),i=!!has("ios"),o=e(400);return{low:{graphics3D:{maxTotalNumberOfFeatures:5e4,maxNumberOfDrawCalls:8e3,maxTotalNumberOfVertices:255e4,polygonLodFactor:.5,polylineLodFactor:1,snapshotAvailable:!1,skipHighSymbolLods:!0},heatmap:{pixelRatio:.125},sceneService:{objectLoDFactor:.2,pointLoDFactor:1,meshLoDFactor:.6,pointCloudLoDFactor:.5},gaussianSplat:{minimumPixelRadius:2,minimumOpacity:0,maximumNumberOfGaussians:
|
|
2
|
+
import has from"../../../core/has.js";import{Milliseconds as e}from"../../../core/time.js";function a(e){return l[e]}function i(){return has("esri-iPhone")?"low":"medium"}const o={reset(){const e=m();for(const a of Object.keys(e))l[a]=e[a]}},t={IPhone12Pro:120,GalaxyS20:200,FullHD:240,SurfacePro7:300,FullHDRetina:430},l=m();function m(){const a=!!has("esri-mobile"),i=!!has("ios"),o=e(400);return{low:{graphics3D:{maxTotalNumberOfFeatures:5e4,maxNumberOfDrawCalls:8e3,maxTotalNumberOfVertices:255e4,polygonLodFactor:.5,polylineLodFactor:1,snapshotAvailable:!1,skipHighSymbolLods:!0},heatmap:{pixelRatio:.125},sceneService:{objectLoDFactor:.2,pointLoDFactor:1,meshLoDFactor:.6,pointCloudLoDFactor:.5},gaussianSplat:{minimumPixelRadius:2,minimumOpacity:0,maximumNumberOfGaussians:2e6},flow:{maxTotalNumberOfStreamlines:5e3,maxTracingResolution:1024,transitionEnabled:!1},tiledSurface:{lodBias:-1,angledSplitBias:.5,vtlContentZoom:.75,elevationLevelDelta:3,reduceTileLevelDifferences:!0},fadeDuration:e(0),physicallyBasedRenderingEnabled:!1,maxTexturePixels:a?1048576:4194304,memoryLimit:200+t.IPhone12Pro,additionalCacheMemory:0,frameRate:0,maximumPixelRatio:1},medium:{graphics3D:{maxTotalNumberOfFeatures:15e4,maxNumberOfDrawCalls:17e3,maxTotalNumberOfVertices:625e4,polygonLodFactor:a?.8:1,polylineLodFactor:a?1.2:1.5,snapshotAvailable:!i,skipHighSymbolLods:!1},heatmap:{pixelRatio:.25},sceneService:{objectLoDFactor:1,pointLoDFactor:1,meshLoDFactor:1,pointCloudLoDFactor:1},gaussianSplat:{minimumPixelRadius:1,minimumOpacity:1,maximumNumberOfGaussians:4e6},flow:{maxTotalNumberOfStreamlines:2e4,maxTracingResolution:2048,transitionEnabled:!0},tiledSurface:{lodBias:0,angledSplitBias:1,vtlContentZoom:1.5,elevationLevelDelta:3,reduceTileLevelDifferences:!0},fadeDuration:o,physicallyBasedRenderingEnabled:!0,maxTexturePixels:a?4194304:4096**2,memoryLimit:a?600+t.GalaxyS20:750+t.FullHD,additionalCacheMemory:a?-100:150,frameRate:0,maximumPixelRatio:1},high:{graphics3D:{maxTotalNumberOfFeatures:3e5,maxNumberOfDrawCalls:17e3,maxTotalNumberOfVertices:125e5,polygonLodFactor:a?1.2:2,polylineLodFactor:a?1.2:2,snapshotAvailable:!i,skipHighSymbolLods:!1},heatmap:{pixelRatio:.5},sceneService:{objectLoDFactor:1,pointLoDFactor:1,meshLoDFactor:1,pointCloudLoDFactor:1},gaussianSplat:{minimumPixelRadius:.5,minimumOpacity:2,maximumNumberOfGaussians:8e6},flow:{maxTotalNumberOfStreamlines:2e4,maxTracingResolution:2048,transitionEnabled:!0},tiledSurface:{lodBias:0,angledSplitBias:1,vtlContentZoom:1.5,elevationLevelDelta:2,reduceTileLevelDifferences:!0},fadeDuration:o,physicallyBasedRenderingEnabled:!0,maxTexturePixels:a?4096**2:1/0,memoryLimit:a?900+t.SurfacePro7:1500+t.FullHDRetina,additionalCacheMemory:a?-150:0,frameRate:0,maximumPixelRatio:a?1:1/0}}}export{o as QualityProfileTest,i as getDefaultQualityProfileName,a as getQualityProfileSettings};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
function
|
|
2
|
+
const t={type:"empty-tile"};function e(t){return null!=t&&"type"in t&&"vector-tile"===t.type}function n(t){return null!=t&&"type"in t&&"raster-tile"===t.type}function i(t){return null!=t&&"type"in t&&"tile-texture"===t.type}function u(t){return null!=t&&"type"in t&&"empty-tile"===t.type}function l(t){return null!=t&&"type"in t&&"bitmap"in t}export{t as emptyTile,l as isCreateBitmapResult,u as isEmptyTile,n as isRasterTile,i as isTileTexture,e as isVectorTile};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import"../../../core/has.js";import{disposeMaybe as e,releaseMaybe as t}from"../../../core/maybe.js";import{set as r,copy as s}from"../../../core/libs/gl-matrix-2/math/vec2.js";import{ZEROS as
|
|
2
|
+
import"../../../core/has.js";import{disposeMaybe as e,releaseMaybe as t}from"../../../core/maybe.js";import{set as r,copy as s}from"../../../core/libs/gl-matrix-2/math/vec2.js";import{ZEROS as a}from"../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{fromValues as o}from"../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{isBaseLayer as i,isGroupLayer as n,isReferenceLayer as u}from"../../../layers/support/layerUtils.js";import{isLayerViewWithFlowRenderer as c}from"../support/flowUtils.js";import{BlendLayersPassParameters as p}from"./BlendLayersTechnique.js";import{isEmptyTile as l}from"./TerrainData.js";import{isBlendableLayerView as d,isVectorTileLayerView as h,isVectorTileRenderInfo as m,isImageryTileRenderInfo as f,isImageSourceRenderInfo as _,isTextureTileRenderInfo as x,isVectorTilePerLayerInfo as T}from"./terrainUtils.js";import{TextureReference as y}from"./TextureReference.js";import{TileCompositor as g}from"./TileCompositor.js";import{TileRenderInfo as b}from"./TileRenderInfo.js";import{getCacheKey as k,TileTexture as L}from"./TileTexture.js";import{fallsWithinLayerView as I}from"./tileUtils.js";import{blendModeFromString as w}from"../webgl-engine/core/shaderLibrary/output/BlendOptions.js";import{isCompressible as B}from"../../support/TextureCompressionWorkerHandle.js";import C from"../../webgl/Texture.js";import{TextureDescriptor as P}from"../../webgl/TextureDescriptor.js";class M{constructor(e,t,r,s,a){this._rctx=e,this.tileSize=t,this._techniques=r,this._cache=s,this._compressionTracker=a,this._passParameters=new p,this._backgroundColor=null,this._maxAnisotropy=this._rctx.parameters.maxMaxAnisotropy,this._compositor=new g(this._rctx,this._techniques)}dispose(){this._compositor=e(this._compositor),this._backgroundTexture=t(this._backgroundTexture)}get backgroundIsGrid(){return null==this._backgroundColor}get backgroundColor(){return this._backgroundColor}updateHeading(e){this._compositor?.updateHeading(e)}updateTileTexture(e,t){if(!e.renderData)return;const r=this._prepareUpdateState(e),s=r.targetTextureSize/this.tileSize;0!==r.numTexturedLayers&&null!==r.firstTexturedLayerIndex?1===r.numTexturedLayers&&!r.foundBlendMode&&this._useLayerTexture(e,r.firstTexturedLayerIndex)||this._composeLayers(e,t,r.lastLayerIndex,r.hasBasemapLayers,r.targetTextureSize,s,!r.backgroundCovered||r.foundBlendMode,U,r.foundBlendMode):this._useBackgroundTexture(e,r.numVisibleLayers,0!==t)}_prepareUpdateState(e){const t=e.surface,r=t.baseOpacity,s=t.view.state.contentPixelRatio,a=e.layerInfo[1];let o=0,p=0,m=this.tileSize,f=!1,_=!1,x=!1,T=null;U.clear(),F.length=0;for(let y=0;y<a.length;y++){const g=t.layerViewByIndex(y,1),b=g.layer,k=!I(e,g),L=b.opacity,w=g.fullOpacity;if(_=_||i(b),c(g))continue;if(d(g)){let e="normal"!==g.layer.blendMode;if(n(b.parent)){const t=b.parent.uid;null!=t&&""!==t&&(e=S(b.parent)||e)}e&&(x=e,f=!1)}if(this._canSkipLayer(L,k,x)){this._clearTexturePendingUpdates(a[y]);continue}++p;const B=h(g),C=j(e,y,B);if(C&&(this._clearTexturePendingUpdates(a[y]),!l(C.sourceLayerInfo.data))){if(n(b.parent)){const e=b.parent.uid;null!=e&&""!==e&&v(b.parent,y)}if(B)m=Math.max(m,this.tileSize*s);else{const e=this._prepareTextureForBackgroundCoverageCheck(C,u(b));1===r&&1===w&&(g.isOpaque||!0===e?.descriptor.isOpaque)&&(f=!0)}++o,null===T&&(T=y)}}return{numTexturedLayers:o,numVisibleLayers:p,targetTextureSize:m,backgroundCovered:f,hasBasemapLayers:_,foundBlendMode:x,firstTexturedLayerIndex:T,lastLayerIndex:a.length-1}}_canSkipLayer(e,t,r){return this._isLayerNonContributing(e,t)&&!r}_isLayerNonContributing(e,t){return 0===e||t}_clearTexturePendingUpdates(e){e.pendingUpdates&=-1}_prepareTextureForBackgroundCoverageCheck(e,t){return this._dataToTexture(e,t)?e.sourceLayerInfo.data:null}setBackground(e){this._backgroundColor!==e&&(this._backgroundColor=e,this._backgroundTexture&&this._drawBackgroundTexture(this._backgroundTexture))}_ensureBackgroundTexture(){return null==this._backgroundTexture&&(this._backgroundTexture=this._buildTexture(this.tileSize,!1),this._drawBackgroundTexture(this._backgroundTexture)),this._backgroundTexture}_drawBackgroundTexture(e){this._compositor.bind(this.tileSize),this._passParameters.offset=a,this._passParameters.scale=1,this._passParameters.opacity=1,this.backgroundColor&&(this._passParameters.backgroundColor=this.backgroundColor),this._compositor.drawBackground(this._passParameters,null!=this.backgroundColor),this._compositor.copyFBOToTexture(e),this._compositor.unbind()}_useBackgroundTexture(e,t,r){const s=e.renderData,a=!r&&null!=s.textureReference&&(e.surface.view.layerViewManager.updating||t>0)?5e3:0,o=this._ensureBackgroundTexture();s.setTextureReference(new y(o,0,R,e.surface.baseOpacity,0,1),a)}_useLayerTexture(e,t){const r=e.surface.layerViewByIndex(t,1),s=i(r.layer),a=s?e.surface.baseOpacity:1,n=s?1:e.surface.baseOpacity,c=r.fullOpacity,p=j(e,t,!1);return!!this._dataToTexture(p,u(r.layer))&&(e.renderData.setTextureReference(new y(p.sourceLayerInfo.data,0,o(p.offset[0],p.offset[1],p.scale,p.scale),a,n,c)),!0)}_composeLayers(e,t,r,s,o,n,p,_,x){this._compositor.ensureBuffer(o);const T=e.surface.baseOpacity;let g=!1,b=9987,k=!1,L=0;for(let y=r;y>=0;y--){const t=e.surface.layerViewByIndex(y,1);if(c(t))continue;const r=t.layer,B=j(e,y,h(t)),C=r.opacity,P=!I(e,t);if(!B||l(B.sourceLayerInfo.data)||this._canSkipLayer(C,P,x))continue;const M=!i(r)&&!g;g||=M;const S=this._openGroupsAtLayer(y,o,T,s,p,M,_),v=S?4:p&&0===L?this.backgroundIsGrid?3:2:1,D=w[d(t)?t.layer.blendMode:"normal"];for(this._passParameters.baseOpacity=M&&!S&&T<1?T:1,this._passParameters.opacity=C,m(B)?k=this._compositor.drawVectorData(this._passParameters,v,o,D,B,n,this.tileSize,k):f(B)?(this._compositor.drawRasterData(this._passParameters,v,o,D,B),O(B)&&(b=9728)):this._dataToTexture(B,u(r))&&(this._passParameters.texture=B.sourceLayerInfo.data.texture,this._passParameters.offset=B.offset,this._passParameters.scale=B.scale,this._compositor.drawImageData(this._passParameters,v,o,D));F.length>0&&F[F.length-1].end===y;){const e=F.pop();this._passParameters.baseOpacity=e.baseOpacity,this._passParameters.opacity=e.opacity,this._passParameters.offset=a,this._passParameters.scale=1,this._compositor.drawGroup(this._passParameters,e.output,o,w[e.blendMode])}L++}const B=e.renderData,C=x||g&&T<1,P=B.ensureTexture(o,C,t,()=>this._buildTexture(o,C,b));this._compositor.copyFBOToTexture(P),this._compositor.unbind(),B.setTextureReference(new y(P,t,R,g?1:T,0,1))}_openGroupsAtLayer(e,t,r,s,a,o,i){let n=!1;return i.forEach(i=>{i.start===e&&(i.output=s?1:a&&o?this.backgroundIsGrid?3:2:1,i.baseOpacity=o?r:1,F.push(i),this._compositor.openGroup(t),n=!0)}),n}_dataToTexture(e,t){if(_(e)){const r=e.sourceLayerInfo,s=!t;r.data=this._buildTexture(r.data,!0,s,1!==e.scale,e.tile.onCompressionFinished),e.tile.setMemoryDirty()}return x(e)}_buildTexture(e,t,r=9987,s=!1,a=()=>{}){return null==e?null:"number"==typeof e?this._buildTextureFromSize(e,t,r):this._buildTextureFromImage(e,t,r,s,a)}_buildTextureFromSize(e,t,r){const s=this._createTextureDescriptor(t,"boolean"==typeof r?9987:r);s.width=s.height=e;const a=this._buildTileTexture(s);return this._generateTextureMipmap(a),a}_buildTextureFromImage(e,t,r,s,a){const o=this._createTextureDescriptor(t,"boolean"==typeof r?9987:r);o.isOpaque=e.isOpaque,o.isOpaque&&(o.pixelFormat=6407);const{bitmap:i}=e;o.width=i.width,o.height=i.height;const n="boolean"==typeof r&&r,u=this._buildTileTexture(o,n,s,a,i);return this._generateTextureMipmap(u),u}_createTextureDescriptor(e,t){const r=new P;return r.wrapMode=33071,r.samplingMode=t,r.maxAnisotropy=this._maxAnisotropy,r.preMultiplyAlpha=!0,r.flipped=!0,r.hasMipmap=!0,e||(r.pixelFormat=6407),r}_generateTextureMipmap(e){const t=this._rctx,r=t.bindTexture(e.texture,C.TEXTURE_UNIT_FOR_UPDATES);e.generateMipmap(),t.bindTexture(r,C.TEXTURE_UNIT_FOR_UPDATES)}_buildTileTexture(e,t=!1,r=!1,s=()=>{},a){const o=this._cache.pop(k(e,!1))??this._cache.pop(k(e,!0));if(t&&=B(a,e),o)return o.retain(),t?o.texture.enableCompression({compressionTracker:this._compressionTracker,compressionCallback:s,preserveSourceBitmap:r}):o.texture.disableCompression(),o.texture.setData(a),o;e.compress=t?{compressionTracker:this._compressionTracker,compressionCallback:s,preserveSourceBitmap:r}:void 0;const i=new C(this._rctx,e,a);return new L(i,this._cache)}get test(){}}function j(e,t,a){z.layerIndex=t,z.vtlNeighborInfos.clear();const o=e.layerInfo[1][t];if(r(z.offset,0,0),z.tile=e,z.scale=1,z.sourceLod=e.lij,z.sourceLayerInfo=o,z.isVTLBackground=a,o.data)return a&&e.forEachLoadedNeighbor((r,s)=>{if(r.level!==e.level)return;const a=r.layerInfo[1][t];if(!T(a)||o.data===a.data)return;const i=z.vtlNeighborInfos.pushNew();i.offset=A[s],i.sourceLod=r.lij,i.sourceLayerInfo=a}),z;const i=o.upsampleInfo,n=i?.tile?.layerInfo[1][t];return n&&i.tile?(z.tile=i.tile,s(z.offset,i.offset),z.scale=i.scale,z.sourceLod=i.tile.lij,z.sourceLayerInfo=n,z):a?z:null}function O(e){const t=e.sourceLayerInfo.data;return!!t.source&&"nearest"===t.interpolation}function S(e){let t="normal"!==e.blendMode;return n(e.parent)&&(t=S(e.parent)||t),t}function v(e,t){n(e.parent)&&v(e.parent,t);const r=e.uid;if(null!=r&&""!==r){const s=U.get(r);s?s.start=t:U.set(r,new D(t,t,e.blendMode,e.opacity,1,1))}}class D{constructor(e,t,r,s,a,o){this.start=e,this.end=t,this.blendMode=r,this.opacity=s,this.output=a,this.baseOpacity=o}}const U=new Map,F=new Array,z=new b,R=o(0,0,1,1),A=new Array;function N(){z.sourceLayerInfo=null,z.tile=null,z.vtlNeighborInfos.prune()}A[0]=[0,-1],A[1]=[-1,-1],A[2]=[-1,0],A[3]=[-1,1],A[4]=[0,1],A[5]=[1,1],A[6]=[1,0],A[7]=[1,-1];export{D as GroupInfo,M as TileRenderer,N as cleanupTileRenderer};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{generateUID as i}from"../../../../core/uid.js";import{add as t}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{getContinuousIndexArray as e}from"../../../../geometry/support/Indices.js";import{BoundingInfo as s}from"./BoundingInfo.js";import{Object3DHighlightStateID as
|
|
2
|
+
import{generateUID as i}from"../../../../core/uid.js";import{add as t}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{getContinuousIndexArray as e}from"../../../../geometry/support/Indices.js";import{NullSphere as n,Sphere as h}from"../../../../geometry/support/sphere.js";import{BoundingInfo as s}from"./BoundingInfo.js";import{Object3DHighlightStateID as o}from"./Object3DStateID.js";import{assert as r}from"./Util.js";class g{constructor(t,e,n,h={}){this.material=t,this._buffers=e,this.localOrigin=n,this.id=i(),this.type=1,this.baseGeometry=null,this.layerViewUid=null,this.graphicUid=null,this._readPrimitivePosition=null,this._boundingInfo=null,this._boundingSphere=null,this._highlights=null,this._highlightOptionsCounts=null,this.occludees=void 0,this.visible=!0;const s=t?.useIndexing??!1,o=null!=e.index;r(s===o,"Material index requirement and BufferGeometry.buffers.index must match"),this.castShadow=h.castShadow??!1}get buffers(){return this._buffers}get indexCount(){return this._buffers.index?.length??this._buffers.vertex.count??0}get faceCount(){return this.indexCount/3}get readPrimitivePosition(){return this._readPrimitivePosition??=this.material.createPrimitivePositionReader(this.buffers),this._readPrimitivePosition}get boundingInfo(){return this._boundingInfo??=this._calculateBoundingInfo(),this._boundingInfo}get boundingSphere(){const i=this.boundingInfo?.sphere;if(null==i)return n;if(null==this._boundingSphere){const e=new h;e.copyFrom(i),t(e.center,e.center,this.localOrigin.vec3),this._boundingSphere=e}return this._boundingSphere}_calculateBoundingInfo(){const i=this.indexCount;if(0===i)return null;const t=this.material.primitiveVertexCount;r(i%t===0,"Indexing error: "+i+" not divisible by "+t);const n=e(i/t);return new s(n,t,this.readPrimitivePosition)}invalidateBoundingInfo(){this._boundingInfo=null,this._boundingSphere=null}computeAttachmentOrigin(i){return!!this.material.computeAttachmentOrigin(i,this.readPrimitivePosition,this.indexCount)&&(t(i,i,this.localOrigin.vec3),!0)}get highlights(){return this._highlights||u}get hasHighlights(){return(this._highlightOptionsCounts?.size??0)>0}forEachHighlightOption(i){this._highlightOptionsCounts?.forEach((t,e)=>i(e))}allocateIdAndHighlight(i){const t=new o(i);return this.addHighlight(t)}addHighlight(i){this._ensureHighlights().add(i);const{highlightName:t}=i,e=(this._highlightOptionsCounts?.get(t)??0)+1;return this._ensureHighlightOptionsCounts().set(t,e),i}_ensureHighlights(){let i=this._highlights;return i||(i=new Set,this._highlights=i),i}_ensureHighlightOptionsCounts(){let i=this._highlightOptionsCounts;return i||(i=new Map,this._highlightOptionsCounts=i),i}removeHighlight(i){if(this._highlights?.delete(i)){const{highlightName:t}=i,e=this._highlightOptionsCounts?.get(t)??0;e<=1?this._highlightOptionsCounts?.delete(t):this._ensureHighlightOptionsCounts().set(t,e-1)}}}const u=new Set;export{g as BufferGeometry};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{generateUID as e}from"../../../../core/uid.js";import{identity as t}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as i,IDENTITY as r}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{
|
|
2
|
+
import{generateUID as e}from"../../../../core/uid.js";import{identity as t}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as i,IDENTITY as r}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{empty as o,copy as s,offset as n}from"../../../../geometry/support/aaBoundingBox.js";import{BoundingVolume as l}from"./BoundingVolume.js";import{Object3DOccludeeStateID as h,Object3DHighlightStateID as m}from"./Object3DStateID.js";import{assert as g}from"./Util.js";import{addObject3DStateID as a,removeObject3DStateID as u}from"../materials/renderers/utils.js";class d{constructor(t){this.id=e(),this.type=1,this.lastValidElevationBB=void 0,this._layer=null,this._boundingVolume=null,this._geometries=[t.geometry],t.isElevationSource&&(this.lastValidElevationBB=o())}dispose(){this._geometries.length=0}get layerViewUid(){return this.geometry.layerViewUid}get graphicUid(){return this.geometry.graphicUid}get geometries(){return this._geometries}get geometry(){return this._geometries[0]}get layer(){return this._layer}set layer(e){g(null==this._layer||null==e,"BufferObject3D can only be added to a single Layer"),this._layer=e}get visible(){return this.geometry.visible}set visible(e){this.visible!==e&&(this.geometry.visible=e,this._emit("visibilityChanged",this))}_emit(e,t){this.layer?.events.emit(e,t)}maskOccludee(){const e=new h;return this.geometry.occludees=a(this.geometry.occludees,e),this._emit("occlusionChanged",this),e}removeOcclude(e){this.geometry.occludees=u(this.geometry.occludees,e),this._emit("occlusionChanged",this)}highlight(e){const t=new m(e);return this.geometry.addHighlight(t),this._emit("highlightChanged",this),t}removeHighlight(e){this.geometry.removeHighlight(e),this._emit("highlightChanged",this)}removeStateID(e){0===e.channel?this.removeHighlight(e):this.removeOcclude(e)}getCombinedStaticTransformation(e,i){return t(i)}getCombinedShaderTransformation(e,r=i()){return t(r)}get boundingVolumeWorldSpace(){return this._boundingVolume||(this._boundingVolume=new l,this._validateBoundingVolume(this._boundingVolume)),this._boundingVolume}get boundingVolumeObjectSpace(){return this.boundingVolumeWorldSpace}_validateBoundingVolume(e){const{boundingInfo:t,localOrigin:i,boundingSphere:r}=this.geometry;if(null==t)return;const{box:o,sphere:l}=e,[h,m,g]=i.vec3;s(o,t.box),n(o,h,m,g),l.copyFrom(r)}get transformation(){return r}get shaderTransformation(){return null}get effectiveTransformation(){return r}}export{d as BufferObject3D};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{add as
|
|
2
|
+
import{fromTranslation as t}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as e}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{add as s,transformMat4 as i,copy as r}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as n}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{intersectsSphere as o}from"../../../../geometry/support/frustumPlanes.js";import{create as a,fromPoints as l,copy as c}from"../../../../geometry/support/ray.js";import h from"../../webgl/RenderCamera.js";import{HUDTarget as f,HUDIntersectorResult as m}from"./HUDIntersectorResult.js";import{IntersectorOptions as u}from"./IntersectorInterfaces.js";import{IntersectorResultRay as y,compareOrderedIntersectionHits as d}from"./IntersectorResult.js";import{ObjectTarget as g}from"./ObjectTarget.js";import{PolygonIntersectionResults as p}from"./PolygonIntersectionResults.js";import{IntersectorTransform as _,getVerticalOffsetObject3D as v}from"./verticalOffsetUtils.js";const b=1e-5,j=e();class O{constructor(t){this.options=new u,this._results=new P,this.polygonResults=new p,this.transform=new _,this.camera=new h,this.screenPolygonPrimitiveProcessor=w,this.tolerance=b,this.verticalOffset=null,this._ray=a(),this._rayEnd=n(),this._rayBeginTransformed=n(),this._rayEndTransformed=n(),this.viewingMode=t??1}get results(){return this._results}get ray(){return this._ray}get rayBegin(){return this._ray.origin}get rayEnd(){return this._rayEnd}reset(t,e,s){this.resetWithRay(l(t,e,this._ray),s)}resetWithRay(t,e){this.camera=e,t!==this._ray&&c(t,this._ray),0!==this.options.verticalOffset?2===this.viewingMode?this._ray.origin[2]-=this.options.verticalOffset:this.verticalOffset=this.options.verticalOffset:this.verticalOffset=null,s(this._rayEnd,this._ray.origin,this._ray.direction),this._results.init(this._ray),this.polygonResults.init()}intersect(t=null,e,s,i,r){this.point=e,this.filterPredicate=i,this.tolerance=s??b;const n=v(this.verticalOffset);if(t&&t.length>0){const e=r?t=>{r(t)&&this.intersectObject(t)}:t=>{this.intersectObject(t)};for(const s of t){const t=s.getSpatialQueryAccelerator?.();null!=t?(null!=n?t.forEachAlongRayWithVerticalOffset(this._ray.origin,this._ray.direction,e,n):t.forEachAlongRay(this._ray.origin,this._ray.direction,e),this.options.selectionMode&&this.options.hud&&t.forEachDegenerateObject(e)):s.objects.forEach(t=>e(t))}}this.sortResults()}*intersectScreenPolygon(t=null,e){if(this.verticalOffset=null,t?.length)for(const s of t){const t=s.getSpatialQueryAccelerator?.();if(null!=t)for(const s of t.intersectingFrustumValues(e.broadPhaseFrustum,t=>t.visible))yield*this._intersectScreenPolygonObject(s,e);else for(const i of s.objects.values())i.visible&&o(e.broadPhaseFrustum,i.boundingVolumeWorldSpace.sphere)&&(yield*this._intersectScreenPolygonObject(i,e))}}*intersectHUDScreenPolygon(t=null,e){if(this.verticalOffset=null,this.options.selectionMode&&this.options.hud&&t?.length)for(const s of t){const t=s.getSpatialQueryAccelerator?.(),i=t?.degenerateObjectValues()??s.objects.values();for(const s of i)yield*this._intersectScreenPolygonObject(s,e)}}*_intersectScreenPolygonObject(t,e){const s=t.geometries;if(!t.visible||!s)return;const i=t.effectiveTransformation;for(const r of s){if(!r.visible)continue;const{material:s,id:n}=r;if(!s.visible||!s.intersectScreenPolygon)continue;this._setGeometryTransform(i,r);const o=s.intersectScreenPolygon(r,this.transform.transform,this,e);o?.valid&&this._handleObjectScreenPolygonIntersection(o.type,new g(t,n,o.primitiveIndex),o.distance,o.point),yield}}intersectObject(t){const e=t.geometries;if(!e)return;const s=t.effectiveTransformation,r=v(this.verticalOffset);for(const n of e){if(!n.visible)continue;const{material:e,id:o}=n;if(!e.visible)continue;this._setGeometryTransform(s,n),i(this._rayBeginTransformed,this.rayBegin,this.transform.inverse),i(this._rayEndTransformed,this.rayEnd,this.transform.inverse);const a=this.transform.transform;null!=r&&(r.objectTransform=this.transform),e.intersectRay(n,this.transform.transform,this,this._rayBeginTransformed,this._rayEndTransformed,(e,s,i,r,n)=>this.handleObjectIntersection({object:t,geometryId:o,primitiveIndex:r},e,s,i,a,n))}}_setGeometryTransform(e,s){const i=1===s.type?t(j,s.localOrigin.vec3):s.transformation;this.transform.setAndInvalidateLazyTransforms(e,i)}handleObjectIntersection(t,e,s,i,r,n){if(e<0||null!=this.filterPredicate&&!this.filterPredicate(this._ray.origin,this._rayEnd,s))return;const o=n?this._results.hud:this._results;t=n?new f(t,n):t;const a=n?r=>r.set(1,t,e,s,i):n=>n.set(4,t,e,s,i,r);if((null==o.min.renderDistance||s<o.min.renderDistance)&&a(o.min),0!==this.options.store&&(null==o.max.renderDistance||s>o.max.renderDistance)&&a(o.max),2===this.options.store)if(n){const t=new m(this._ray);a(t),this._results.hud.all.push(t)}else{const t=new y(this._ray);a(t),this._results.all.push(t)}}_handleObjectScreenPolygonIntersection(t,e,s,i){s<0||(null==this.filterPredicate||null!=i&&this.filterPredicate(this.camera.eye,i,1))&&this.polygonResults.add(t,1===t&&i?new f(e,i):e,s)}sortResults(t=this._results.all){t.sort(d)}}class P{constructor(){this.min=new y(a()),this.max=new y(a()),this.hud={min:new m(a()),max:new m(a()),all:new Array},this.ground=new y(a()),this.all=[]}init(t){this.min.init(t),this.max.init(t),this.ground.init(t),this.all.length=0,this.hud.min.init(t),this.hud.max.init(t),this.hud.all.length=0}}const w={*processTriangle(t){yield t},*processLineSegment(t,e,s){r(t[0],e),r(t[1],s),yield t},validatePoint:()=>!0};export{O as Intersector,w as defaultScreenPolygonPrimitiveProcessor,b as defaultTolerance};
|