UNPKG

@arcgis/core

Version:

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

3 lines (2 loc) 1.46 kB
/* COPYRIGHT Esri - https://js.arcgis.com/5.0.8/LICENSE.txt */ import{create as t}from"../../../../geometry/support/aaBoundingBox.js";import{getCentroidOptimizedGeometry as e}from"../../../../layers/graphics/centroid.js";import r from"../../../../layers/graphics/OptimizedGeometry.js";import{getCachedAttributeValue as i}from"./I3SBinaryReader.js";class o{constructor(t){this._objectIdField=t.objectIdField,this._getFeatureExtent=t.getFeatureExtent}getObjectId(t){return t.id}getAttributes(t){const{meta:e,index:r}=t,o={};this._objectIdField&&(o[this._objectIdField]=t.id);const n=e.attributeInfo?.attributeData;if(null!=n)for(const s of Object.keys(n))o[s]=i(n[s],r);return o}getAttribute(t,e){if(e===this._objectIdField)return t.id;const{meta:r,index:o}=t,n=r.attributeInfo?.attributeData;return null!=n?i(n[e],o):null}getGeometry(t){if(t.geometry)return t.geometry;const[e,i,o,n,u,a]=this._getFeatureExtent(t,s);return new r([5,5],[e,i,o,n,i,o,n,u,o,e,u,o,e,i,o,e,i,a,n,i,a,n,u,a,e,u,a,e,i,a],!0,!1)}getCentroid(t,i){if(t.geometry)return e(t.geometry);const[o,n,u,a,d,c]=this._getFeatureExtent(t,s);return new r([],[(o+a)/2,(n+d)/2,(u+c)/2],!0,!1)}cloneWithGeometry(t,e,r){const{id:i,index:o,meta:s}=t;return new n(i,o,s,e)}getMetadata(t){return t}}class n{constructor(t,e,r,i){this.id=t,this.index=e,this.meta=r,this.geometry=i}get usedMemory(){return 32+(this.geometry?.usedMemory??0)}}const s=t();export{n as I3SQueryFeature,o as I3SQueryFeatureAdapter};