@doegis/core
Version:
DOE GIS API
3 lines (1 loc) • 9.07 kB
JavaScript
import{_ as t}from"../../chunks/tslib.es6.js";import e from"../../Graphic.js";import i from"../../PopupTemplate.js";import{symbolTypes as s}from"../../symbols.js";import{ClonableMixin as a}from"../../core/Clonable.js";import{JSONSupport as l}from"../../core/JSONSupport.js";import{isSome as o,unwrap as r}from"../../core/maybe.js";import{property as n}from"../../core/accessorSupport/decorators/property.js";import"../../core/accessorSupport/ensureType.js";import"../../core/arrayUtils.js";import{reader as p}from"../../core/accessorSupport/decorators/reader.js";import{subclass as u}from"../../core/accessorSupport/decorators/subclass.js";import m from"../../geometry/Polyline.js";import{getTimezoneOffset as d,getPrefixedProperties as b,toKebabImpedanceAttributes as T,fromKebabImpedanceAttributes as f}from"../route/utils.js";import y from"./RouteSettings.js";var S;let g=S=class extends(a(l)){constructor(t){super(t),this.analysisSettings=null,this.endTime=null,this.endTimeOffset=null,this.firstStopId=null,this.geometry=null,this.lastStopId=null,this.messages=null,this.name=null,this.objectId=null,this.popupTemplate=null,this.startTime=null,this.startTimeOffset=null,this.stopCount=null,this.symbol=null,this.totalCosts=null,this.totalDistance=null,this.totalDuration=null,this.totalLateDuration=null,this.totalViolations=null,this.totalWait=null,this.totalWaitDuration=null,this.type="route-info",this.version="1.0.0"}readEndTime(t,e){return o(e.attributes.EndTimeUTC)?new Date(e.attributes.EndTimeUTC):null}readEndTimeOffset(t,e){return d(e.attributes.EndTime,e.attributes.EndTimeUTC)}readStartTime(t,e){return o(e.attributes.StartTimeUTC)?new Date(e.attributes.StartTimeUTC):null}readStartTimeOffset(t,e){return d(e.attributes.StartTime,e.attributes.StartTimeUTC)}readTotalCosts(t,e){return b(e.attributes,"Total_")}readTotalViolations(t,e){return b(e.attributes,"TotalViolation_")}readTotalWait(t,e){return b(e.attributes,"TotalWait_")}static fromGraphic(t){return new S({analysisSettings:o(t.attributes.AnalysisSettings)?y.fromJSON(JSON.parse(t.attributes.AnalysisSettings)):null,endTime:o(t.attributes.EndTime)?new Date(t.attributes.EndTime):null,endTimeOffset:t.attributes.EndUTCOffset??null,geometry:t.geometry,messages:o(t.attributes.Messages)?JSON.parse(t.attributes.Messages):null,name:t.attributes.RouteName,objectId:t.attributes.ObjectID??t.attributes.__OBJECTID,popupTemplate:t.popupTemplate,startTime:o(t.attributes.StartTime)?new Date(t.attributes.StartTime):null,startTimeOffset:t.attributes.StartUTCOffset??null,symbol:t.symbol,totalCosts:o(t.attributes.TotalCosts)?T(JSON.parse(t.attributes.TotalCosts)):null,totalDistance:t.attributes.TotalMeters??null,totalDuration:t.attributes.TotalMinutes??null,totalLateDuration:t.attributes.TotalLateMinutes??null,totalWaitDuration:t.attributes.TotalWaitMinutes??null,version:t.attributes.Version})}toGraphic(){const t={ObjectID:r(this.objectId),AnalysisSettings:o(this.analysisSettings)?JSON.stringify(this.analysisSettings.toJSON()):null,EndTime:o(this.endTime)?this.endTime.getTime():null,EndUTCOffset:this.endTimeOffset,Messages:o(this.messages)?JSON.stringify(this.messages):null,RouteName:r(this.name),StartTime:o(this.startTime)?this.startTime.getTime():null,StartUTCOffset:this.startTimeOffset,TotalCosts:o(this.totalCosts)?JSON.stringify(f(this.totalCosts)):null,TotalLateMinutes:this.totalLateDuration,TotalMeters:this.totalDistance,TotalMinutes:this.totalDuration,TotalWaitMinutes:this.totalWaitDuration,Version:r(this.version)};return new e({geometry:this.geometry,attributes:t,symbol:this.symbol,popupTemplate:r(this.popupTemplate)})}};g.fields=[{name:"ObjectID",alias:"ObjectID",type:"esriFieldTypeOID",editable:!1,nullable:!1,domain:null},{name:"AnalysisSettings",alias:"Analysis Settings",type:"esriFieldTypeString",length:1048576,editable:!0,nullable:!0,visible:!1,domain:null},{name:"EndTime",alias:"End Time",type:"esriFieldTypeDate",length:36,editable:!0,nullable:!0,visible:!0},{name:"EndUTCOffset",alias:"End Time: Offset from UTC in Minutes",type:"esriFieldTypeInteger",editable:!0,nullable:!0,visible:!0},{name:"Messages",alias:"Analysis Messages",type:"esriFieldTypeString",length:1048576,editable:!0,nullable:!0,visible:!1,domain:null},{name:"RouteName",alias:"Route Name",type:"esriFieldTypeString",length:1024,editable:!0,nullable:!0,visible:!0,domain:null},{name:"StartTime",alias:"Start Time",type:"esriFieldTypeDate",length:36,editable:!0,nullable:!0,visible:!0},{name:"StartUTCOffset",alias:"Start Time: Offset from UTC in Minutes",type:"esriFieldTypeInteger",editable:!0,nullable:!0,visible:!0},{name:"TotalCosts",alias:"Total Costs",type:"esriFieldTypeString",length:1048576,editable:!0,nullable:!0,visible:!1,domain:null},{name:"TotalLateMinutes",alias:"Total Late Minutes",type:"esriFieldTypeDouble",editable:!0,nullable:!0,visible:!1},{name:"TotalMeters",alias:"Total Meters",type:"esriFieldTypeDouble",editable:!0,nullable:!0,visible:!0},{name:"TotalMinutes",alias:"Total Minutes",type:"esriFieldTypeDouble",editable:!0,nullable:!0,visible:!0},{name:"TotalWaitMinutes",alias:"Total Wait Minutes",type:"esriFieldTypeDouble",editable:!0,nullable:!0,visible:!1},{name:"Version",alias:"Version",type:"esriFieldTypeString",length:16,editable:!0,nullable:!0,visible:!0,domain:null}],g.popupInfo={title:"Route Details",fieldInfos:[{fieldName:"RouteName",label:"Route Name",isEditable:!1,tooltip:"",visible:!0,stringFieldOption:"textbox"},{fieldName:"TotalMinutes",label:"Total Minutes",isEditable:!1,tooltip:"",visible:!0,format:{places:2,digitSeparator:!0},stringFieldOption:"textbox"},{fieldName:"TotalMeters",label:"Total Meters",isEditable:!1,tooltip:"",visible:!0,format:{places:2,digitSeparator:!0},stringFieldOption:"textbox"},{fieldName:"TotalLateMinutes",label:"Total Late Minutes",isEditable:!1,tooltip:"",visible:!1,format:{places:2,digitSeparator:!0},stringFieldOption:"textbox"},{fieldName:"TotalWaitMinutes",label:"Total Wait Minutes",isEditable:!1,tooltip:"",visible:!1,format:{places:2,digitSeparator:!0},stringFieldOption:"textbox"},{fieldName:"TotalCosts",label:"Total Costs",isEditable:!1,tooltip:"",visible:!1,stringFieldOption:"textbox"},{fieldName:"StartTime",label:"Start Time",isEditable:!1,tooltip:"",visible:!0,format:{dateFormat:"shortDateShortTime24"},stringFieldOption:"textbox"},{fieldName:"StartUTCOffset",label:"Start Time: Offset from UTC in Minutes",isEditable:!1,tooltip:"",visible:!0,format:{places:0,digitSeparator:!0},stringFieldOption:"textbox"},{fieldName:"EndTime",label:"End Time",isEditable:!1,tooltip:"",visible:!0,format:{dateFormat:"shortDateShortTime24"},stringFieldOption:"textbox"},{fieldName:"EndUTCOffset",label:"End Time: Offset from UTC in Minutes",isEditable:!1,tooltip:"",visible:!0,format:{places:0,digitSeparator:!0},stringFieldOption:"textbox"},{fieldName:"Messages",label:"Analysis Messages",isEditable:!1,tooltip:"",visible:!1,stringFieldOption:"textbox"},{fieldName:"AnalysisSettings",isEditable:!1,tooltip:"",visible:!1,stringFieldOption:"textbox"},{fieldName:"Version",label:"Version",isEditable:!1,tooltip:"",visible:!0,stringFieldOption:"textbox"}],description:null,showAttachments:!1,mediaInfos:[]},t([n()],g.prototype,"analysisSettings",void 0),t([n()],g.prototype,"endTime",void 0),t([p("endTime",["attributes.EndTimeUTC"])],g.prototype,"readEndTime",null),t([n()],g.prototype,"endTimeOffset",void 0),t([p("endTimeOffset",["attributes.EndTime","attributes.EndTimeUTC"])],g.prototype,"readEndTimeOffset",null),t([n({json:{read:{source:"attributes.FirstStopID"}}})],g.prototype,"firstStopId",void 0),t([n({type:m})],g.prototype,"geometry",void 0),t([n({json:{read:{source:"attributes.LastStopID"}}})],g.prototype,"lastStopId",void 0),t([n()],g.prototype,"messages",void 0),t([n({json:{read:{source:"attributes.Name"}}})],g.prototype,"name",void 0),t([n({json:{read:{source:"attributes.ObjectID"}}})],g.prototype,"objectId",void 0),t([n({type:i})],g.prototype,"popupTemplate",void 0),t([n()],g.prototype,"startTime",void 0),t([p("startTime",["attributes.StartTimeUTC"])],g.prototype,"readStartTime",null),t([n()],g.prototype,"startTimeOffset",void 0),t([p("startTimeOffset",["attributes.StartTime","attributes.StartTimeUTC"])],g.prototype,"readStartTimeOffset",null),t([n({json:{read:{source:"attributes.StopCount"}}})],g.prototype,"stopCount",void 0),t([n({types:s})],g.prototype,"symbol",void 0),t([n()],g.prototype,"totalCosts",void 0),t([p("totalCosts",["attributes"])],g.prototype,"readTotalCosts",null),t([n()],g.prototype,"totalDistance",void 0),t([n()],g.prototype,"totalDuration",void 0),t([n()],g.prototype,"totalLateDuration",void 0),t([n()],g.prototype,"totalViolations",void 0),t([p("totalViolations",["attributes"])],g.prototype,"readTotalViolations",null),t([n()],g.prototype,"totalWait",void 0),t([p("totalWait",["attributes"])],g.prototype,"readTotalWait",null),t([n()],g.prototype,"totalWaitDuration",void 0),t([n({readOnly:!0,json:{read:!1}})],g.prototype,"type",void 0),t([n()],g.prototype,"version",void 0),g=S=t([u("esri.rest.support.RouteInfo")],g);const h=g;export{h as default};