/*
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
See https://js.arcgis.com/4.24/esri/copyright.txt for details.
*/
define(["exports","../../../core/unitUtils","../../../geometry/support/spatialReferenceUtils","../../../layers/graphics/OptimizedFeature","../../../layers/graphics/OptimizedFeatureSet","../../../layers/graphics/OptimizedGeometry"],(function(e,t,r,i,n,o){"use strict";const s=["esriGeometryPoint","esriGeometryMultipoint","esriGeometryPolyline","esriGeometryPolygon"];let a=function(){function e(e){this.options=e,this.geometryTypes=s,this._coordinatePtr=0,this._vertexDimension=0}var a=e.prototype;return a.createFeatureResult=function(){return new n},a.prepareFeatures=function(e){this._vertexDimension=2,e.hasZ&&this._vertexDimension++,e.hasM&&this._vertexDimension++},a.finishFeatureResult=function(e){if(!e||!e.features||!e.hasZ||!this.options.sourceSpatialReference||!e.spatialReference||r.equals(e.spatialReference,this.options.sourceSpatialReference)||e.spatialReference.vcsWkid)return;const n=t.getMetersPerVerticalUnitForSR(this.options.sourceSpatialReference)/t.getMetersPerVerticalUnitForSR(e.spatialReference);if(1!==n)for(const t of e.features){if(!i.hasGeometry(t))continue;const e=t.geometry.coords;for(let t=2;t<e.length;t+=3)e[t]*=n}},a.addFeature=function(e,t){e.features.push(t)},a.createFeature=function(){return new i.OptimizedFeature},a.createSpatialReference=function(){return{wkid:0}},a.createGeometry=function(){return new o},a.addField=function(e,t){e.fields.push(t)},a.allocateCoordinates=function(e){e.coords.length=e.lengths.reduce(((e,t)=>e+t),0)*this._vertexDimension,this._coordinatePtr=0},a.addCoordinate=function(e,t){e.coords[this._coordinatePtr++]=t},a.addCoordinatePoint=function(e,t){e.coords.push(t)},a.addLength=function(e,t){e.lengths.push(t)},a.addQueryGeometry=function(e,t){e.queryGeometry=t.queryGeometry,e.queryGeometryType=t.queryGeometryType},a.createPointGeometry=function(){return new o},e}();e.OPTIMIZED_GEOMETRY_TYPES=s,e.OptimizedFeatureSetParserContext=a,Object.defineProperties(e,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})}));
