UNPKG

geostyler

Version:
186 lines (185 loc) 5.68 kB
import { jsxs as y, Fragment as z, jsx as n } from "react/jsx-runtime"; import { useState as P } from "react"; import { Form as i } from "antd"; import { OpacityField as U } from "../Field/OpacityField/OpacityField.js"; import { RasterChannelEditor as _ } from "../RasterChannelEditor/RasterChannelEditor.js"; import { ContrastEnhancementField as q } from "../Field/ContrastEnhancementField/ContrastEnhancementField.js"; import { GammaField as A } from "../Field/GammaField/GammaField.js"; import F from "../../../Util/DataUtil.js"; import { ColorMapEditor as H } from "../ColorMapEditor/ColorMapEditor.js"; /* empty css */ import m from "lodash-es/cloneDeep.js"; import S from "lodash-es/get.js"; import { useGeoStylerData as J, useGeoStylerComposition as K, useGeoStylerLocale as Q, useGeoStylerUnsupportedProperties as W } from "../../../context/GeoStylerContext/GeoStylerContext.js"; import { VisibilityField as X } from "../Field/VisibilityField/VisibilityField.js"; import { getFormItemConfig as Y } from "../../../Util/FormItemUtil.js"; const be = (L) => { const b = J(), V = K("RasterEditor"), w = { ...L, ...V }, { colorMapEditor: f, colorRamps: G, contrastEnhancementField: C, contrastEnhancementTypes: M, gammaValueField: r, onSymbolizerChange: t, opacityField: s, rasterChannelEditor: d, visibilityField: u, symbolizer: l } = w, a = Q("RasterEditor"), { getFormItemSupportProps: g } = W(l), [E, h] = P("symbolizer"), R = (o) => { const e = m(l); e.opacity = o, t && t(e); }, k = (o) => { const e = m(l); e.channelSelection = o, t && t(e); }, D = (o) => { const e = m(l); e.contrastEnhancement ? e.contrastEnhancement.enhancementType = o : e.contrastEnhancement = { enhancementType: o }, t && t(e); }, N = (o) => { const e = m(l); e.contrastEnhancement ? e.contrastEnhancement.gammaValue = o : e.contrastEnhancement = { gammaValue: o }, t && t(e); }, T = (o) => { const e = m(l); e.colorMap = o, t && t(e); }, $ = (o) => { const e = m(l); e.visibility = o, t && t(e); }, { opacity: j, contrastEnhancement: v, colorMap: x, channelSelection: O, visibility: B } = l; let I; b && F.isRaster(b) && (I = Object.keys(b.rasterBandInfo)); const p = { wrapperCol: { span: 24 } }, c = Y(); return /* @__PURE__ */ y("div", { className: "gs-raster-symbolizer-editor", children: [ E !== "symbolizer" ? null : /* @__PURE__ */ y(z, { children: [ (u == null ? void 0 : u.visibility) === !1 ? null : /* @__PURE__ */ n( i.Item, { ...c, label: a.visibilityLabel, children: /* @__PURE__ */ n( X, { value: B, onChange: $ } ) } ), (s == null ? void 0 : s.visibility) === !1 ? null : /* @__PURE__ */ n( i.Item, { ...c, label: a.opacityLabel, ...g("opacity"), children: /* @__PURE__ */ n( U, { value: j, defaultValue: s == null ? void 0 : s.default, onChange: R } ) } ), (C == null ? void 0 : C.visibility) === !1 ? null : /* @__PURE__ */ n( i.Item, { ...c, label: a.contrastEnhancementLabel, ...g("contrastEnhancement"), children: /* @__PURE__ */ n( q, { value: S(v, "enhancementType"), onChange: D } ) } ), (r == null ? void 0 : r.visibility) === !1 ? null : /* @__PURE__ */ n( i.Item, { ...c, label: a.gammaValueLabel, ...g("contrastEnhancement"), children: /* @__PURE__ */ n( A, { value: S(v, "gammaValue"), defaultValue: r == null ? void 0 : r.default, onChange: N } ) } ), (f == null ? void 0 : f.visibility) === !1 ? null : /* @__PURE__ */ n( i.Item, { ...c, className: "gs-raster-editor-view-toggle", ...p, children: /* @__PURE__ */ n("a", { onClick: () => h("colorMapEditor"), children: `${a.colorMapLabel} >>` }) } ), (d == null ? void 0 : d.visibility) === !1 ? null : /* @__PURE__ */ n( i.Item, { ...c, className: "gs-raster-editor-view-toggle", ...p, children: /* @__PURE__ */ n("a", { onClick: () => h("rasterChannelEditor"), children: `${a.channelSelectionLabel} >>` }) } ) ] }), E !== "rasterChannelEditor" ? null : /* @__PURE__ */ y(z, { children: [ /* @__PURE__ */ n( _, { channelSelection: O, sourceChannelNames: I, contrastEnhancementTypes: M, onChange: k } ), /* @__PURE__ */ n( i.Item, { ...p, children: /* @__PURE__ */ n("a", { onClick: () => h("symbolizer"), children: `<< ${a.symbolizerLabel}` }) } ) ] }), E !== "colorMapEditor" ? null : /* @__PURE__ */ y(z, { children: [ /* @__PURE__ */ n( H, { colorMap: x, colorRamps: G, onChange: T } ), /* @__PURE__ */ n( i.Item, { ...p, children: /* @__PURE__ */ n("a", { onClick: () => h("symbolizer"), children: `<< ${a.symbolizerLabel}` }) } ) ] }) ] }); }; export { be as RasterEditor };