UNPKG

@arcgis/core

Version:

ArcGIS Maps SDK for JavaScript: A complete 2D and 3D mapping and data visualization API

6 lines (5 loc) 1.72 kB
/* All material copyright ESRI, All Rights Reserved, unless otherwise specified. See https://js.arcgis.com/4.33/esri/copyright.txt for details. */ import e from"../../core/Error.js";import{setDeepValue as o}from"../../core/object.js";import{isSceneServiceLayer as n}from"../../layers/support/layerUtils.js";import t from"../WebStyleSymbol.js";import{to3D as r}from"./symbolConversion.js";import{readSymbol as s,isSymbol3D as l}from"./typeUtils.js";function i(e,n,t,r){const s=a(e,{},{context:r,isLabelSymbol:!1});null!=s&&o(t,s,n)}function p(e,o,n,t){const r=a(e,{},{context:t,isLabelSymbol:!0});null!=r&&(o[n]=r)}function m(e){return l(e)||e instanceof t}function y(e){return"polygon-3d"===e?.type||"line-3d"===e?.type}function a(o,t,s){if(null==o)return null;const{context:l,isLabelSymbol:i}=s,p=l?.origin,a=l?.messages;if("web-scene"===p&&!m(o)){const n=r(o,{retainCIM:!0,hasLabelingContext:i});return null!=n.symbol?n.symbol.write(t,l):(a?.push(new e("symbol:unsupported",`Symbols of type '${o.declaredClass}' are not supported in scenes. Use 3D symbology instead when working with WebScene and SceneView`,{symbol:o,context:l,error:n.error})),null)}return n(l?.layer)&&y(o)?(a?.push(new e("symbol:unsupported",`Symbols of type '${o.declaredClass}' are not supported on layers of type '${l?.layer?.declaredClass}'.`,{symbol:o,context:l})),null):("web-map"===p||"portal-item"===p&&!n(l?.layer))&&m(o)?(a?.push(new e("symbol:unsupported",`Symbols of type '${o.declaredClass}' are not supported in web maps and portal items. Use 2D symbology and CIMSymbol instead when working with MapView`,{symbol:o,context:l})),null):o.write(t,l)}function u(e,o){return s(e,null,o)}export{u as fromJSON,i as write,p as writeLabelSymbol};