123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246 |
- import {
- _,
- f,
- g,
- u,
- w,
- x
- } from "./chunk-3HCJD762.js";
- import {
- c
- } from "./chunk-RVCE264D.js";
- import {
- F,
- P,
- S2,
- m,
- m2,
- y as y4
- } from "./chunk-3Z755LKF.js";
- import {
- S,
- l as l2,
- o as o3,
- r as r2,
- s as s4,
- t,
- y as y3
- } from "./chunk-ZSW35JPD.js";
- import {
- o as o2
- } from "./chunk-UVVU4UUO.js";
- import {
- s as s3
- } from "./chunk-HZRKBTHJ.js";
- import {
- o
- } from "./chunk-6T6G6LCQ.js";
- import {
- r
- } from "./chunk-PQFTYGF5.js";
- import {
- e,
- l3 as l,
- n5 as n,
- y3 as y2
- } from "./chunk-2Z2TG5CU.js";
- import {
- s2 as s,
- s3 as s2
- } from "./chunk-E5O6P5I2.js";
- import {
- y
- } from "./chunk-SPWQ3AWG.js";
- // node_modules/@arcgis/core/layers/support/LabelExpressionInfo.js
- var l3;
- var n2 = l3 = class extends l {
- constructor() {
- super(...arguments), this.expression = null, this.title = null, this.value = null;
- }
- readExpression(r3, e2) {
- return e2.value ? w(e2.value) : r3;
- }
- writeExpression(r3, e2, s6) {
- null != this.value && (r3 = w(this.value)), null != r3 && (e2[s6] = r3);
- }
- clone() {
- return new l3({ expression: this.expression, title: this.title, value: this.value });
- }
- };
- e([y2({ type: String, json: { write: { writerEnsuresNonNull: true } } })], n2.prototype, "expression", void 0), e([o("expression", ["expression", "value"])], n2.prototype, "readExpression", null), e([r("expression")], n2.prototype, "writeExpression", null), e([y2({ type: String, json: { write: true, origins: { "web-scene": { write: false } } } })], n2.prototype, "title", void 0), e([y2({ json: { read: false, write: false } })], n2.prototype, "value", void 0), n2 = l3 = e([n("esri.layers.support.LabelExpressionInfo")], n2);
- var a = n2;
- // node_modules/@arcgis/core/symbols/support/defaults.js
- var c2 = y4.fromJSON(l2);
- var u2 = m.fromJSON(o3);
- var a2 = S2.fromJSON(S);
- var y5 = m2.fromJSON(t);
- var N = y4.fromJSON(r2);
- var O = m.fromJSON(s4);
- var j = S2.fromJSON(y3);
- // node_modules/@arcgis/core/layers/support/LabelClass.js
- var y6;
- var d = new s3({ esriServerPointLabelPlacementAboveCenter: "above-center", esriServerPointLabelPlacementAboveLeft: "above-left", esriServerPointLabelPlacementAboveRight: "above-right", esriServerPointLabelPlacementBelowCenter: "below-center", esriServerPointLabelPlacementBelowLeft: "below-left", esriServerPointLabelPlacementBelowRight: "below-right", esriServerPointLabelPlacementCenterCenter: "center-center", esriServerPointLabelPlacementCenterLeft: "center-left", esriServerPointLabelPlacementCenterRight: "center-right", esriServerLinePlacementAboveAfter: "above-after", esriServerLinePlacementAboveAlong: "above-along", esriServerLinePlacementAboveBefore: "above-before", esriServerLinePlacementAboveStart: "above-start", esriServerLinePlacementAboveEnd: "above-end", esriServerLinePlacementBelowAfter: "below-after", esriServerLinePlacementBelowAlong: "below-along", esriServerLinePlacementBelowBefore: "below-before", esriServerLinePlacementBelowStart: "below-start", esriServerLinePlacementBelowEnd: "below-end", esriServerLinePlacementCenterAfter: "center-after", esriServerLinePlacementCenterAlong: "center-along", esriServerLinePlacementCenterBefore: "center-before", esriServerLinePlacementCenterStart: "center-start", esriServerLinePlacementCenterEnd: "center-end", esriServerPolygonPlacementAlwaysHorizontal: "always-horizontal" }, { ignoreUnknown: true });
- function x2(e2) {
- var _a;
- return !e2 || "service" !== e2.origin && !("map-image" === ((_a = e2.layer) == null ? void 0 : _a.type));
- }
- function L(e2) {
- return "map-image" === (e2 == null ? void 0 : e2.type);
- }
- function P2(e2) {
- var _a, _b;
- return !!L(e2) && !!((_b = (_a = e2.capabilities) == null ? void 0 : _a.exportMap) == null ? void 0 : _b.supportsArcadeExpressionForLabeling);
- }
- function g2(e2) {
- return x2(e2) || P2(e2.layer);
- }
- var E = y6 = class extends l {
- constructor(e2) {
- super(e2), this.type = "label", this.name = null, this.allowOverrun = false, this.deconflictionStrategy = "static", this.labelExpression = null, this.labelExpressionInfo = null, this.labelPlacement = null, this.labelPosition = "curved", this.maxScale = 0, this.minScale = 0, this.repeatLabel = true, this.repeatLabelDistance = null, this.symbol = y5, this.useCodedValues = void 0, this.where = null;
- }
- static evaluateWhere(e2, r3) {
- const t3 = (e3, r4, t4) => {
- switch (r4) {
- case "=":
- return e3 == t4;
- case "<>":
- return e3 != t4;
- case ">":
- return e3 > t4;
- case ">=":
- return e3 >= t4;
- case "<":
- return e3 < t4;
- case "<=":
- return e3 <= t4;
- }
- return false;
- };
- try {
- if (null == e2)
- return true;
- const o4 = e2.split(" ");
- if (3 === o4.length)
- return t3(r3[o4[0]], o4[1], o4[2]);
- if (7 === o4.length) {
- const e3 = t3(r3[o4[0]], o4[1], o4[2]), n4 = o4[3], s6 = t3(r3[o4[4]], o4[5], o4[6]);
- switch (n4) {
- case "AND":
- return e3 && s6;
- case "OR":
- return e3 || s6;
- }
- }
- return false;
- } catch (o4) {
- console.log("Error.: can't parse = " + e2);
- }
- }
- readLabelExpression(e2, r3) {
- const t3 = r3.labelExpressionInfo;
- if (!t3 || !t3.value && !t3.expression)
- return e2;
- }
- writeLabelExpression(e2, r3, t3) {
- if (this.labelExpressionInfo) {
- if (null != this.labelExpressionInfo.value)
- e2 = u(this.labelExpressionInfo.value);
- else if (null != this.labelExpressionInfo.expression) {
- const r4 = _(this.labelExpressionInfo.expression);
- r4 && (e2 = "[" + r4 + "]");
- }
- }
- null != e2 && (r3[t3] = e2);
- }
- writeLabelExpressionInfo(e2, r3, t3, o4) {
- if (null == e2 && null != this.labelExpression && x2(o4))
- e2 = new a({ expression: this.getLabelExpressionArcade() });
- else if (!e2)
- return;
- const n4 = e2.toJSON(o4);
- n4.expression && (r3[t3] = n4);
- }
- writeMaxScale(e2, r3) {
- (e2 || this.minScale) && (r3.maxScale = e2);
- }
- writeMinScale(e2, r3) {
- (e2 || this.maxScale) && (r3.minScale = e2);
- }
- getLabelExpression() {
- return x(this);
- }
- getLabelExpressionArcade() {
- return f(this);
- }
- getLabelExpressionSingleField() {
- return g(this);
- }
- hash() {
- return JSON.stringify(this);
- }
- clone() {
- return new y6({ allowOverrun: this.allowOverrun, deconflictionStrategy: this.deconflictionStrategy, labelExpression: this.labelExpression, labelExpressionInfo: y(this.labelExpressionInfo), labelPosition: this.labelPosition, labelPlacement: this.labelPlacement, maxScale: this.maxScale, minScale: this.minScale, name: this.name, repeatLabel: this.repeatLabel, repeatLabelDistance: this.repeatLabelDistance, symbol: y(this.symbol), where: this.where, useCodedValues: this.useCodedValues });
- }
- };
- e([y2({ type: String, json: { write: true } })], E.prototype, "name", void 0), e([y2({ type: Boolean, json: { write: true, default: false, origins: { "web-scene": { write: false } } } })], E.prototype, "allowOverrun", void 0), e([y2({ type: String, json: { write: true, default: "static", origins: { "web-scene": { write: false } } } })], E.prototype, "deconflictionStrategy", void 0), e([y2({ type: String, json: { write: { overridePolicy(e2, r3, t3) {
- return this.labelExpressionInfo && "service" === (t3 == null ? void 0 : t3.origin) && P2(t3.layer) ? { enabled: false } : { allowNull: true };
- } } } })], E.prototype, "labelExpression", void 0), e([o("labelExpression")], E.prototype, "readLabelExpression", null), e([r("labelExpression")], E.prototype, "writeLabelExpression", null), e([y2({ type: a, json: { write: { overridePolicy: (e2, r3, t3) => g2(t3) ? { allowNull: true } : { enabled: false } } } })], E.prototype, "labelExpressionInfo", void 0), e([r("labelExpressionInfo")], E.prototype, "writeLabelExpressionInfo", null), e([y2({ type: d.apiValues, json: { type: d.jsonValues, read: d.read, write: d.write } })], E.prototype, "labelPlacement", void 0), e([y2({ type: ["curved", "parallel"], json: { write: true, origins: { "web-map": { write: false }, "web-scene": { write: false }, "portal-item": { write: false } } } })], E.prototype, "labelPosition", void 0), e([y2({ type: Number })], E.prototype, "maxScale", void 0), e([r("maxScale")], E.prototype, "writeMaxScale", null), e([y2({ type: Number })], E.prototype, "minScale", void 0), e([r("minScale")], E.prototype, "writeMinScale", null), e([y2({ type: Boolean, json: { write: true, origins: { "web-scene": { write: false }, "portal-item": { write: false } } } })], E.prototype, "repeatLabel", void 0), e([y2({ type: Number, cast: o2, json: { write: true, origins: { "web-scene": { write: false } } } })], E.prototype, "repeatLabelDistance", void 0), e([y2({ types: P, json: { origins: { "web-scene": { types: F, write: c, default: null } }, write: c, default: null } })], E.prototype, "symbol", void 0), e([y2({ type: Boolean, json: { write: true } })], E.prototype, "useCodedValues", void 0), e([y2({ type: String, json: { write: true } })], E.prototype, "where", void 0), E = y6 = e([n("esri.layers.support.LabelClass")], E);
- var j2 = E;
- // node_modules/@arcgis/core/layers/support/labelingInfo.js
- var n3 = s.getLogger("esri.layers.support.labelingInfo");
- var l4 = /\[([^\[\]]+)\]/gi;
- function i(e2, r3, o4) {
- return e2 ? e2.map((e3) => {
- const n4 = new j2();
- if (n4.read(e3, o4), n4.labelExpression) {
- const e4 = r3.fields || r3.layerDefinition && r3.layerDefinition.fields || this.fields;
- n4.labelExpression = n4.labelExpression.replace(l4, (r4, o5) => `[${s5(o5, e4)}]`);
- }
- return n4;
- }) : null;
- }
- function s5(e2, r3) {
- if (!r3)
- return e2;
- const o4 = e2.toLowerCase();
- for (let t3 = 0; t3 < r3.length; t3++) {
- const e3 = r3[t3].name;
- if (e3.toLowerCase() === o4)
- return e3;
- }
- return e2;
- }
- var a3 = { esriGeometryPoint: ["above-right", "above-center", "above-left", "center-center", "center-left", "center-right", "below-center", "below-left", "below-right"], esriGeometryPolygon: ["always-horizontal"], esriGeometryPolyline: ["center-along"], esriGeometryMultipoint: null };
- function c3(e2, o4) {
- const t3 = y(e2);
- return t3.some((e3) => f2(e3, o4)) ? [] : t3;
- }
- function f2(r3, o4) {
- const t3 = r3.labelPlacement, l5 = a3[o4];
- if (!r3.symbol)
- return n3.warn("No ILabelClass symbol specified."), true;
- if (!l5)
- return n3.error(new s2("labeling:unsupported-geometry-type", `Unable to create labels for layer, geometry type '${o4}' is not supported`)), true;
- if (!l5.includes(t3)) {
- const e2 = l5[0];
- t3 && n3.warn(`Found invalid label placement type ${t3} for ${o4}. Defaulting to ${e2}`), r3.labelPlacement = e2;
- }
- return false;
- }
- export {
- c2 as c,
- u2 as u,
- a2 as a,
- N,
- O,
- j,
- j2,
- i,
- c3 as c2
- };
- //# sourceMappingURL=chunk-JAUFBT5U.js.map
|