/* COPYRIGHT Esri - https://js.arcgis.com/5.1.2/LICENSE.txt */
import{__decorate as e}from"tslib";import{removeUnordered as t}from"../core/arrayUtils.js";import{strict as r}from"../core/jsonMap.js";import{JSONSupport as i}from"../core/JSONSupport.js";import{unitFromRESTJSON as o,getVerticalUnitStringForSR as s}from"../core/units.js";import n from"../core/Warning.js";import{property as a,subclass as l}from"../core/accessorSupport/decorators.js";import{vcsLookup as h}from"./support/vcsLookup.js";import{writer as c}from"../core/accessorSupport/decorators/writer.js";import{reader as d}from"../core/accessorSupport/decorators/reader.js";var u;const p=r()({orthometric:"gravity-related-height",gravity_related_height:"gravity-related-height",ellipsoidal:"ellipsoidal"}),g=p.jsonValues.slice();t(g,"orthometric");const m=r()({meter:"meters",foot:"feet","us-foot":"us-feet","clarke-foot":"clarke-feet","clarke-yard":"clarke-yards","clarke-link":"clarke-links","sears-yard":"sears-yards","sears-foot":"sears-feet","sears-chain":"sears-chains","benoit-1895-b-chain":"benoit-1895-b-chains","indian-yard":"indian-yards","indian-1937-yard":"indian-1937-yards","gold-coast-foot":"gold-coast-feet","sears-1922-truncated-chain":"sears-1922-truncated-chains","50-kilometers":"50-kilometers","150-kilometers":"150-kilometers"});let f=u=class extends i{constructor(e){super(e),this.heightModel="gravity-related-height",this.heightUnit="meters",this.vertCRS=null}writeHeightModel(e,t,r){return p.write(e,t,r)}readHeightModel(e,t,r){const i=p.read(e);return i||(r?.messages&&r.messages.push(y(e,{context:r})),null)}readHeightUnit(e,t,r){const i=m.read(e);return i||(r?.messages&&r.messages.push(v(e,{context:r})),null)}readHeightUnitService(e,t,r){const i=o(e)||m.read(e);return i||(r?.messages&&r.messages.push(v(e,{context:r})),null)}readVertCRS(e,t){return t.vertCRS||t.ellipsoid||t.geoid}clone(){return new u({heightModel:this.heightModel,heightUnit:this.heightUnit,vertCRS:this.vertCRS})}equals(e){return!!e&&(this===e||this.heightModel===e.heightModel&&this.heightUnit===e.heightUnit&&this.vertCRS===e.vertCRS)}static deriveUnitFromSR(e,t){const r=s(t);return new u({heightModel:e.heightModel,heightUnit:r??void 0,vertCRS:e.vertCRS})}static fromSpatialReference(e){const{latestVcsWkid:t,vcsWkid:r}=e;if(!r)return null;const i=(null!=t?h.get(t):null)??h.get(r);return i?new u({heightModel:0===i.type?"gravity-related-height":"ellipsoidal",heightUnit:o(i.unit.name),vertCRS:i.datum}):null}write(e,t){return t={origin:"web-scene",...t},super.write(e,t)}static fromJSON(e){if(!e)return null;const t=new u;return t.read(e,{origin:"web-scene"}),t}};function v(e,t){return new n("height-unit:unsupported",`Height unit of value '${e}' is not supported`,t)}function y(e,t){return new n("height-model:unsupported",`Height model of value '${e}' is not supported`,t)}e([a({type:p.apiValues,constructOnly:!0,json:{origins:{"web-scene":{type:g,default:"ellipsoidal",write:{isRequired:!0}}}}})],f.prototype,"heightModel",void 0),e([c("web-scene","heightModel")],f.prototype,"writeHeightModel",null),e([d(["web-scene","service"],"heightModel")],f.prototype,"readHeightModel",null),e([a({type:m.apiValues,constructOnly:!0,json:{origins:{"web-scene":{type:m.jsonValues,write:{writer:m.write,isRequired:!0}}}}})],f.prototype,"heightUnit",void 0),e([d("web-scene","heightUnit")],f.prototype,"readHeightUnit",null),e([d("service","heightUnit")],f.prototype,"readHeightUnitService",null),e([a({type:String,constructOnly:!0,json:{origins:{"web-scene":{write:!0}}}})],f.prototype,"vertCRS",void 0),e([d("service","vertCRS",["vertCRS","ellipsoid","geoid"])],f.prototype,"readVertCRS",null),f=u=e([l("esri.geometry.HeightModelInfo")],f);export{f as default};
