UNPKG

@doegis/core

Version:

DOE GIS API

3 lines (1 loc) 4.76 kB
import{_ as e}from"../../chunks/tslib.es6.js";import t from"../../Graphic.js";import i from"../../PopupTemplate.js";import{symbolTypes as o}from"../../symbols.js";import{ClonableMixin as r}from"../../core/Clonable.js";import{JSONSupport as l}from"../../core/JSONSupport.js";import{unwrap as s,isSome as n}from"../../core/maybe.js";import{property as a}from"../../core/accessorSupport/decorators/property.js";import"../../core/accessorSupport/ensureType.js";import"../../core/arrayUtils.js";import{subclass as p}from"../../core/accessorSupport/decorators/subclass.js";import d from"../../geometry/Polyline.js";import{directionLineTypeJsonMap as c}from"./networkEnums.js";var m;let u=m=class extends(r(l)){constructor(e){super(e),this.directionLineType=null,this.directionPointId=null,this.distance=null,this.duration=null,this.fromLevel=null,this.geometry=null,this.objectId=null,this.popupTemplate=null,this.symbol=null,this.toLevel=null,this.type="direction-line"}static fromGraphic(e){return new m({directionLineType:c.fromJSON(e.attributes.DirectionLineType),directionPointId:e.attributes.DirectionPointID,distance:e.attributes.Meters,duration:e.attributes.Minutes,fromLevel:e.attributes.FromLevel??null,geometry:e.geometry,objectId:e.attributes.ObjectID??e.attributes.__OBJECTID,popupTemplate:e.popupTemplate,symbol:e.symbol,toLevel:e.attributes.ToLevel??null})}toGraphic(){const e={ObjectID:s(this.objectId),DirectionLineType:n(this.directionLineType)?c.toJSON(this.directionLineType):null,DirectionPointID:s(this.directionPointId),Meters:s(this.distance),Minutes:s(this.duration)};return n(this.fromLevel)&&(e.FromLevel=this.fromLevel),n(this.toLevel)&&(e.ToLevel=this.toLevel),new t({geometry:this.geometry,attributes:e,symbol:this.symbol,popupTemplate:this.popupTemplate})}};u.fields=[{name:"ObjectID",alias:"ObjectID",type:"esriFieldTypeOID",editable:!1,nullable:!1,domain:null},{name:"DirectionLineType",alias:"Line Type",type:"esriFieldTypeInteger",editable:!0,nullable:!0,visible:!0,domain:{type:"codedValue",name:"esriDirectionsLineType",codedValues:[{name:"Unknown",code:0},{name:"Segment",code:1},{name:"Maneuver Segment",code:2},{name:"Restriction violation",code:3},{name:"Scale cost barrier crossing",code:4},{name:"Heavy Traffic",code:5},{name:"Slow Traffic",code:6},{name:"Moderate Traffic",code:7}]}},{name:"DirectionPointID",alias:"Direction Point ID",type:"esriFieldTypeInteger",editable:!0,nullable:!0,visible:!1},{name:"FromLevel",alias:"Start from 3D Level",type:"esriFieldTypeInteger",editable:!0,nullable:!0,visible:!1},{name:"Meters",alias:"Length in Meters",type:"esriFieldTypeDouble",editable:!0,nullable:!0,visible:!0},{name:"Minutes",alias:"Duration in Minutes",type:"esriFieldTypeDouble",editable:!0,nullable:!0,visible:!0},{name:"ToLevel",alias:"End at 3D Level",type:"esriFieldTypeInteger",editable:!0,nullable:!0,visible:!1}],u.popupInfo={title:"Direction Lines",fieldInfos:[{fieldName:"DirectionLineType",label:"Line Type",isEditable:!1,tooltip:"",visible:!0,stringFieldOption:"textbox"},{fieldName:"Meters",label:"Length in Meters",isEditable:!1,tooltip:"",visible:!0,format:{places:2,digitSeparator:!0},stringFieldOption:"textbox"},{fieldName:"Minutes",label:"Duration in Minutes",isEditable:!1,tooltip:"",visible:!0,format:{places:2,digitSeparator:!0},stringFieldOption:"textbox"},{fieldName:"DirectionPointID",label:"Direction Point ID",isEditable:!1,tooltip:"",visible:!0,format:{places:0,digitSeparator:!0},stringFieldOption:"textbox"},{fieldName:"FromLevel",label:"Start from 3D Level",isEditable:!1,tooltip:"",visible:!1,format:{places:0,digitSeparator:!0},stringFieldOption:"textbox"},{fieldName:"ToLevel",label:"End at 3D Level",isEditable:!1,tooltip:"",visible:!1,format:{places:0,digitSeparator:!0},stringFieldOption:"textbox"}],description:null,showAttachments:!1,mediaInfos:[]},e([a({type:c.apiValues,json:{read:{source:"attributes.DirectionLineType",reader:c.read}}})],u.prototype,"directionLineType",void 0),e([a({json:{read:{source:"attributes.DirectionPointID"}}})],u.prototype,"directionPointId",void 0),e([a({json:{read:{source:"attributes.Meters"}}})],u.prototype,"distance",void 0),e([a({json:{read:{source:"attributes.Minutes"}}})],u.prototype,"duration",void 0),e([a({json:{read:{source:"attributes.FromLevel"}}})],u.prototype,"fromLevel",void 0),e([a({type:d})],u.prototype,"geometry",void 0),e([a({json:{read:{source:"attributes.ObjectID"}}})],u.prototype,"objectId",void 0),e([a({type:i})],u.prototype,"popupTemplate",void 0),e([a({types:o})],u.prototype,"symbol",void 0),e([a({json:{read:{source:"attributes.ToLevel"}}})],u.prototype,"toLevel",void 0),e([a({readOnly:!0,json:{read:!1}})],u.prototype,"type",void 0),u=m=e([p("esri.rest.support.DirectionLine")],u);const b=u;export{b as default};