Custom Gis Application with Arcgis Javascript API with modern layouting
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

6 lines
1.5 KiB

// All material copyright Esri, All Rights Reserved, unless otherwise specified.
// See https://js.arcgis.com/4.30/esri/copyright.txt for details.
//>>built
define(["exports","../../core/Error","../../core/Logger","./LabelClass"],function(f,p,q,r){const g=()=>q.getLogger("esri.layers.support.labelingInfo"),t=/\[([^[\]]+)\]/gi,u={esriGeometryPoint:"above-right above-center above-left center-center center-left center-right below-center below-left below-right".split(" "),esriGeometryPolygon:["always-horizontal"],esriGeometryPolyline:["center-along","above-along","below-along"],esriGeometryMultipoint:null,esriGeometryEnvelope:null};f.reader=function(a,d,
e){return a?a.map(c=>{const b=new r;b.read(c,e);if(b.labelExpression){const h=d.fields||d.layerDefinition?.fields||this.fields;b.labelExpression=b.labelExpression.replaceAll(t,(m,k)=>{a:if(h){m=k.toLowerCase();for(let l=0;l<h.length;l++){const n=h[l].name;if(n.toLowerCase()===m){k=n;break a}}}return`[${k}]`})}return b}):null};f.validateLabelingInfo=function(a,d){const e=[];for(const b of a){a=b.labelPlacement;var c=u[d];if(!b.symbol)return g().warn("No ILabelClass symbol specified."),[];if(!c)return g().error(new p("labeling:unsupported-geometry-type",
`Unable to create labels for layer, geometry type '${d}' is not supported`)),[];c.includes(a)?e.push(b):(c=c[0],a&&g().warn(`Found invalid label placement type ${a} for ${d}. Defaulting to ${c}`),a=b.clone(),a.labelPlacement=c,e.push(a))}return e};Object.defineProperty(f,Symbol.toStringTag,{value:"Module"})});