UNPKG

@arcgis/core

Version:

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

3 lines (2 loc) 3.09 kB
/* COPYRIGHT Esri - https://js.arcgis.com/5.0.8/LICENSE.txt */ import{__decorate as t}from"tslib";import e from"../../Graphic.js";import r from"../../PopupTemplate.js";import{ClonableMixin as o}from"../../core/Clonable.js";import{JSONSupport as s}from"../../core/JSONSupport.js";import{property as a,subclass as i}from"../../core/accessorSupport/decorators.js";import l from"../../geometry/Polygon.js";import{getPrefixedProperties as p,setPrefixedProperties as m,toKebabImpedanceAttributes as n,fromKebabImpedanceAttributes as u}from"../route/utils.js";import{barrierTypeJsonMap as y}from"./networkEnums.js";import{symbolTypes as c}from"../../symbols/support/typeUtils.js";import{reader as b}from"../../core/accessorSupport/decorators/reader.js";import{writer as d}from"../../core/accessorSupport/decorators/writer.js";var h;let j=class extends(o(s)){static{h=this}constructor(t){super(t),this.barrierType=null,this.costs=null,this.geometry=null,this.name=null,this.objectId=null,this.popupTemplate=null,this.scaleFactor=null,this.symbol=null,this.type="polygon-barrier"}readCosts(t,e){return p(e.attributes,"Attr_")}writeCosts(t,e){m(t,e,"Attr_")}static{this.fields=[{name:"ObjectID",alias:"ObjectID",type:"esriFieldTypeOID",editable:!1,nullable:!1},{name:"BarrierType",alias:"Barrier Type",type:"esriFieldTypeInteger",editable:!0,nullable:!0},{name:"Costs",alias:"Costs",type:"esriFieldTypeString",editable:!0,nullable:!0,length:1048576},{name:"Name",alias:"Name",type:"esriFieldTypeString",editable:!0,nullable:!0,length:255},{name:"ScaleFactor",alias:"Scale Factor",type:"esriFieldTypeDouble",editable:!0,nullable:!0}]}static fromGraphic(t){return new h({barrierType:null!=t.attributes.BarrierType?y.fromJSON(t.attributes.BarrierType):null,costs:null!=t.attributes.Costs?n(JSON.parse(t.attributes.Costs)):null,geometry:t.geometry,name:t.attributes.Name??null,objectId:t.attributes.ObjectID??t.attributes.__OBJECTID,popupTemplate:t.popupTemplate,scaleFactor:t.attributes.ScaleFactor??null,symbol:t.symbol})}toGraphic(){const t={ObjectID:this.objectId,BarrierType:this.barrierType?y.toJSON(this.barrierType):null,Costs:this.costs?JSON.stringify(u(this.costs)):null,Name:this.name??null,ScaleFactor:this.scaleFactor??null};return new e({geometry:this.geometry,attributes:t,symbol:this.symbol,popupTemplate:this.popupTemplate})}};t([a({type:y.apiValues,json:{name:"attributes.BarrierType",read:{reader:y.read},write:{writer:y.write}}})],j.prototype,"barrierType",void 0),t([a()],j.prototype,"costs",void 0),t([b("costs",["attributes"])],j.prototype,"readCosts",null),t([d("costs")],j.prototype,"writeCosts",null),t([a({type:l,json:{write:!0}})],j.prototype,"geometry",void 0),t([a({json:{name:"attributes.Name"}})],j.prototype,"name",void 0),t([a({json:{name:"attributes.ObjectID"}})],j.prototype,"objectId",void 0),t([a({type:r})],j.prototype,"popupTemplate",void 0),t([a()],j.prototype,"scaleFactor",void 0),t([a({types:c})],j.prototype,"symbol",void 0),t([a({readOnly:!0,json:{read:!1}})],j.prototype,"type",void 0),j=h=t([i("esri.rest.support.PolygonBarrier")],j);export{j as default};