/*
All material copyright Esri, All Rights Reserved, unless otherwise specified.
See https://js.arcgis.com/5.0/esri/copyright.txt for details.
*/
import{read as e}from"../../../../../renderers/support/jsonUtils.js";import{PipelineCommand as r}from"./PipelineCommand.js";import{createDefaultIconSymbolLayer as t}from"./symbolization/factoryUtils.js";import{IconSymbolLayerRenderer as o}from"./symbolization/IconSymbolLayerRenderer.js";import{Point3DSymbolRenderer as n}from"./symbolization/Point3DSymbolRenderer.js";import{SimpleFeatureRenderer as i}from"./symbolization/SimpleFeatureRenderer.js";import{UniqueValueFeatureRenderer as s}from"./symbolization/UniqueValueFeatureRenderer.js";class a{constructor(e,r,t,o,n,i,s){this.viewSpatialReference=e,this.renderSpatialReference=r,this.mainThreadDelegate=t,this.renderCoordsHelper=o,this.renderCommandContext=n,this.layerInfo=i,this.layerViewInfo=s,this.symbolRendererFactory=new m(this)}createPipelineCommand(e=this.renderCommandContext.createRenderCommandBuffer(),t=[]){return new r(this.renderCommandContext,e,t)}joinPipelineCommands(e){if(0===e.length)return this.createPipelineCommand();return e.filter(e=>null!=e).reduce((e,r)=>(e.append(r),e))}}class m{constructor(e){this.context=e}createSymbolRendererFromJSON(r){const t=e(r??l)??void 0;if(!t)throw new Error("Failed to create renderer");const o=t.type;switch(o){case"simple":return new i(t,this.context);case"unique-value":return new s(t,this.context);default:return console.warn(`Unable to create symbolrenderer for renderer of ${o}`),this.createSymbolRendererFromJSON(l)}}createSymbolRendererFromSymbol(e){const r=e?.type;switch(r){case"point-3d":return new n(e,this.context);case"picture-marker":case"simple-marker":return new o(t(),this.context);default:return console.warn(`Unable to create symbolrenderer for symbol of ${r}`),null}}createSymbolRendererFromSymbolLayer(e){const r=e.type;return"icon"===r?new o(e,this.context):(console.warn(`Unable to create symbolrenderer for symbolLayer of ${r}`),null)}}const l={type:"simple"};export{a as FeatureProcessingContext,m as SymbolRendererFactory};
