@doegis/core
Version:
DOE GIS API
3 lines (1 loc) • 6.03 kB
JavaScript
import{_ as e}from"../../chunks/tslib.es6.js";import t from"../../Graphic.js";import r from"../../PopupTemplate.js";import{symbolTypes as o}from"../../symbols.js";import{ClonableMixin as s}from"../../core/Clonable.js";import{JSONSupport as i}from"../../core/JSONSupport.js";import{isSome as a,unwrap as l}from"../../core/maybe.js";import{property as p}from"../../core/accessorSupport/decorators/property.js";import"../../core/accessorSupport/ensureType.js";import"../../core/arrayUtils.js";import{reader as d}from"../../core/accessorSupport/decorators/reader.js";import{subclass as u}from"../../core/accessorSupport/decorators/subclass.js";import{writer as n}from"../../core/accessorSupport/decorators/writer.js";import m from"../../geometry/Point.js";import{getPrefixedProperties as c,setPrefixedProperties as b,toKebabImpedanceAttributes as y,fromKebabImpedanceAttributes as h}from"../route/utils.js";import{barrierTypeJsonMap as f,curbApproachJsonMap as j,fullEdgeJsonMap as g,statusJsonMap as T,sideOfEdgeJsonMap as S}from"./networkEnums.js";var C;let N=C=class extends(s(i)){constructor(e){super(e),this.addedCost=null,this.barrierType=null,this.costs=null,this.curbApproach=null,this.fullEdge=null,this.geometry=null,this.name=null,this.objectId=null,this.popupTemplate=null,this.sideOfEdge=null,this.sourceId=null,this.sourceOid=null,this.status=null,this.symbol=null,this.type="point-barrier"}readCosts(e,t){return c(t.attributes,"Attr_")}writeCosts(e,t){b(e,t,"Attr_")}static fromGraphic(e){return new C({addedCost:e.attributes.AddedCost??null,barrierType:a(e.attributes.BarrierType)?f.fromJSON(e.attributes.BarrierType):null,costs:a(e.attributes.Costs)?y(JSON.parse(e.attributes.Costs)):null,curbApproach:a(e.attributes.CurbApproach)?j.fromJSON(e.attributes.CurbApproach):null,fullEdge:a(e.attributes.FullEdge)?g.fromJSON(e.attributes.FullEdge):null,geometry:e.geometry,name:e.attributes.Name??null,objectId:e.attributes.ObjectID??e.attributes.__OBJECTID,popupTemplate:e.popupTemplate,status:a(e.attributes.Status)?T.fromJSON(e.attributes.Status):null,symbol:e.symbol})}toGraphic(){const e={ObjectID:l(this.objectId),AddedCost:this.addedCost,BarrierType:a(this.barrierType)?f.toJSON(this.barrierType):null,Costs:a(this.costs)?JSON.stringify(h(this.costs)):null,CurbApproach:a(this.curbApproach)?j.toJSON(this.curbApproach):null,FullEdge:a(this.fullEdge)?g.toJSON(this.fullEdge):null,Name:this.name,Status:a(this.status)?T.toJSON(this.status):null};return new t({geometry:this.geometry,attributes:e,symbol:this.symbol,popupTemplate:this.popupTemplate})}};N.fields=[{name:"ObjectID",alias:"ObjectID",type:"esriFieldTypeOID",editable:!1,nullable:!1,domain:null},{name:"AddedCost",alias:"Added Cost",type:"esriFieldTypeDouble",editable:!0,nullable:!0,visible:!0,domain:null},{name:"BarrierType",alias:"Barrier Type",type:"esriFieldTypeInteger",editable:!0,nullable:!0,visible:!0,domain:{type:"codedValue",name:"esriNABarrierType",codedValues:[{name:"Restriction",code:0},{name:"Scaled Cost",code:1},{name:"Added Cost",code:2}]}},{name:"Costs",alias:"Costs",type:"esriFieldTypeString",length:1048576,editable:!0,nullable:!0,visible:!1,domain:null},{name:"CurbApproach",alias:"Curb Approach",type:"esriFieldTypeInteger",editable:!0,nullable:!0,visible:!1,domain:{type:"codedValue",name:"esriNACurbApproachType",codedValues:[{name:"Either side",code:0},{name:"From the right",code:1},{name:"From the left",code:2},{name:"Depart in the same direction",code:3}]}},{name:"FullEdge",alias:"Full Edge",type:"esriFieldTypeInteger",editable:!0,nullable:!0,visible:!0,domain:{type:"codedValue",name:"esriNAIntYesNo",codedValues:[{name:"No",code:0},{name:"Yes",code:1}]}},{name:"Name",alias:"Name",type:"esriFieldTypeString",length:255,editable:!0,nullable:!0,visible:!0},{name:"Status",alias:"Status",type:"esriFieldTypeInteger",editable:!0,nullable:!0,visible:!0,domain:{type:"codedValue",name:"esriNAObjectStatus",codedValues:[{name:"OK",code:0},{name:"Not Located on Network",code:1},{name:"Network Unbuilt",code:2},{name:"Prohibited Street",code:3},{name:"Invalid Field Values",code:4},{name:"Cannot Reach",code:5},{name:"Time Window Violation",code:6}]}}],N.popupInfo={title:"Point Barriers",fieldInfos:[{fieldName:"Name",label:"Name",isEditable:!0,tooltip:"",visible:!0,stringFieldOption:"textbox"},{fieldName:"BarrierType",label:"Barrier Type",isEditable:!0,tooltip:"",visible:!0,stringFieldOption:"textbox"},{fieldName:"AddedCost",label:"Added Cost",isEditable:!0,tooltip:"",visible:!0,format:{places:3,digitSeparator:!0},stringFieldOption:"textbox"}],description:null,showAttachments:!1,mediaInfos:[]},e([p()],N.prototype,"addedCost",void 0),e([p({type:f.apiValues,json:{name:"attributes.BarrierType",read:{reader:f.read},write:{writer:f.write}}})],N.prototype,"barrierType",void 0),e([p()],N.prototype,"costs",void 0),e([d("costs",["attributes"])],N.prototype,"readCosts",null),e([n("costs")],N.prototype,"writeCosts",null),e([p({type:j.apiValues,json:{read:{source:"attributes.CurbApproach",reader:j.read}}})],N.prototype,"curbApproach",void 0),e([p({type:g.apiValues,json:{name:"attributes.FullEdge",read:{reader:g.read},write:{writer:g.write}}})],N.prototype,"fullEdge",void 0),e([p({type:m,json:{write:!0}})],N.prototype,"geometry",void 0),e([p({json:{name:"attributes.Name"}})],N.prototype,"name",void 0),e([p({json:{name:"attributes.ObjectID"}})],N.prototype,"objectId",void 0),e([p({type:r})],N.prototype,"popupTemplate",void 0),e([p({type:S.apiValues,json:{read:{source:"attributes.SideOfEdge",reader:S.read}}})],N.prototype,"sideOfEdge",void 0),e([p({json:{read:{source:"attributes.SourceID"}}})],N.prototype,"sourceId",void 0),e([p({json:{read:{source:"attributes.SourceOID"}}})],N.prototype,"sourceOid",void 0),e([p({type:T.apiValues,json:{read:{source:"attributes.Status",reader:T.read}}})],N.prototype,"status",void 0),e([p({types:o})],N.prototype,"symbol",void 0),e([p({readOnly:!0,json:{read:!1}})],N.prototype,"type",void 0),N=C=e([u("esri.rest.support.PointBarrier")],N);const O=N;export{O as default};