UNPKG

@arcgis/core

Version:

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

6 lines (5 loc) 1.51 kB
/* All material copyright ESRI, All Rights Reserved, unless otherwise specified. See https://js.arcgis.com/4.32/esri/copyright.txt for details. */ import e from"../../../core/Error.js";import t from"../../../geometry/Geometry.js";import o from"../Entity.js";import i from"../Relationship.js";import{geometryToWasm as n}from"./queryToWasmEncodedFactories.js";function r(t,n){if(!t.typeName)throw new e("knowledge-graph:no-type-name","You must indicate the entity/relationship named object type to apply edits");if(t instanceof o){const e=new n.EntityValue;e.deleteLater(),e.type_name=t.typeName;for(const[o,i]of Object.entries(t.properties))e.set_key_value(o,a(i,n));return t.id&&e.set_id(t.id),e}if(t instanceof i){const e=new n.RelationshipValue;e.deleteLater(),e.type_name=t.typeName;for(const[o,i]of Object.entries(t.properties))e.set_key_value(o,a(i,n));return t.id&&e.set_id(t.id),t.originId&&t.destinationId&&e.set_related_entity_ids(t.originId,t.destinationId),e}throw new e("knowledge-graph:applyEdits-encoding-failure","Could not determine the type of a named graph object passed to the encoder")}function s(e){return{xy_resolution:e.xyResolution,x_false_origin:e.xFalseOrigin,y_false_origin:e.yFalseOrigin,z_resolution:e.zResolution,z_false_origin:e.zFalseOrigin,m_resolution:e.mResolution,m_false_origin:e.mFalseOrigin}}function a(e,o){return null==e?null:"object"!=typeof e||e instanceof Date?e:e instanceof t?n(e,o):null}export{s as inputQuantizationParametersToWasmFormat,r as namedObjectToWasm};