@doegis/core
Version:
DOE GIS API
3 lines (1 loc) • 2.09 kB
JavaScript
import{bidiText as e}from"../../../../core/BidiText.js";import{unwrap as t}from"../../../../core/maybe.js";import{pt2px as n}from"../../../../core/screenUtils.js";import i from"../../../../geometry/Polygon.js";import{create as r}from"../../../../geometry/support/aaBoundingRect.js";import{getInfo as o}from"../../../../geometry/support/spatialReferenceUtils.js";import{getXAnchorDirection as s,getYAnchorDirection as a}from"../../engine/webgl/alignmentUtils.js";import{GLYPH_SIZE as l,MAGIC_LABEL_LINE_HEIGHT as m}from"../../engine/webgl/definitions.js";import{shapeGlyphs as c}from"../../engine/webgl/mesh/templates/shapingUtils.js";const f=512,g=50;function u(e,t){const n=o(t);if(!n)return null;const[i,s]=n.valid;return e[2]>s?[r([e[0],e[1],s,e[3]]),r([i,e[1],i+e[2]-s,e[3]])]:e[0]<i?[r([i,e[1],e[2],e[3]]),r([s-(i-e[0]),e[1],s,e[3]])]:null}function p(e){return"text"===e||"esriTS"===e}function h(e){return"simple-marker"===e||"picture-marker"===e||"esriSMS"===e||"esriPMS"===e}function y(e){switch(t(e.geometry).type){case"point":case"multipoint":return 0;case"polyline":return 1;case"polygon":case"extent":return 2}return 0}function d(t,i,r){if(!r?.glyphMosaicItems?.length)return t;const o=e(i.text)[1],f=r.glyphMosaicItems,g=c(f,o,{scale:n(i.font.size)/l,angle:i.angle??0,xOffset:i.xoffset??0,yOffset:i.yoffset??0,hAlign:s(i.horizontalAlignment||"center"),vAlign:a(i.verticalAlignment||"baseline"),maxLineWidth:Math.max(32,Math.min(i.lineWidth||512,512)),lineHeight:m*Math.max(.25,Math.min(i.lineHeight||1,4)),decoration:i.font.decoration||"none",isCIM:!1,hasBackground:!!i.backgroundColor,borderLineSize:i.borderLineSize}).bounds;return t[0]=n(g.x-g.halfWidth),t[1]=n(g.y-g.halfHeight),t[2]=n(g.width),t[3]=n(g.height),t}function x(e){if(!e)return null;const{xmin:t,ymin:n,xmax:r,ymax:o,spatialReference:s}=e;return new i({rings:[[[t,n],[t,o],[r,o],[r,n],[t,n]]],spatialReference:s})}export{g as PIXEL_BUFFER,f as TILE_SIZE,d as getTextSymbolSize,y as graphicGeometryToNumber,u as intersectingInternationalDateline,h as isMarkerSymbol,p as isTextSymbol,x as polygonFromExtent};