@arcgis/core
Version:
ArcGIS Maps SDK for JavaScript: A complete 2D and 3D mapping and data visualization API
3 lines (2 loc) • 6.78 kB
JavaScript
/* COPYRIGHT Esri - https://js.arcgis.com/5.0.8/LICENSE.txt */
import{__decorate as t}from"tslib";import e from"../../Graphic.js";import i from"../../PopupTemplate.js";import{ClonableMixin as a}from"../../core/Clonable.js";import{JSONSupport as s}from"../../core/JSONSupport.js";import{property as l,subclass as o}from"../../core/accessorSupport/decorators.js";import r from"../../geometry/Polyline.js";import{getTimezoneOffset as n,getPrefixedProperties as u,toKebabImpedanceAttributes as p,fromKebabImpedanceAttributes as m}from"../route/utils.js";import T from"./RouteSettings.js";import{symbolTypes as d}from"../../symbols/support/typeUtils.js";import{reader as b}from"../../core/accessorSupport/decorators/reader.js";var y;let f=class extends(a(s)){static{y=this}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 null!=e.attributes.EndTimeUTC?new Date(e.attributes.EndTimeUTC):null}readEndTimeOffset(t,e){return n(e.attributes.EndTime,e.attributes.EndTimeUTC)}readStartTime(t,e){return null!=e.attributes.StartTimeUTC?new Date(e.attributes.StartTimeUTC):null}readStartTimeOffset(t,e){return n(e.attributes.StartTime,e.attributes.StartTimeUTC)}readTotalCosts(t,e){return u(e.attributes,"Total_")}readTotalViolations(t,e){return u(e.attributes,"TotalViolation_")}readTotalWait(t,e){return u(e.attributes,"TotalWait_")}static{this.fields=[{name:"ObjectID",alias:"ObjectID",type:"esriFieldTypeOID",editable:!1,nullable:!1},{name:"AnalysisSettings",alias:"Analysis Settings",type:"esriFieldTypeString",editable:!0,nullable:!0,length:1048576},{name:"EndTime",alias:"End Time",type:"esriFieldTypeDate",editable:!0,nullable:!0,length:36},{name:"EndUTCOffset",alias:"End Time Offset",type:"esriFieldTypeInteger",editable:!0,nullable:!0},{name:"Messages",alias:"Messages",type:"esriFieldTypeString",editable:!0,nullable:!0,length:1048576},{name:"RouteName",alias:"Route Name",type:"esriFieldTypeString",editable:!0,nullable:!0,length:1024},{name:"StartTime",alias:"Start Time",type:"esriFieldTypeDate",editable:!0,nullable:!0,length:36},{name:"StartUTCOffset",alias:"Start Time Offset",type:"esriFieldTypeInteger",editable:!0,nullable:!0},{name:"TotalCosts",alias:"Total Costs",type:"esriFieldTypeString",editable:!0,nullable:!0,length:1048576},{name:"TotalLateMinutes",alias:"Total Late Minutes",type:"esriFieldTypeDouble",editable:!0,nullable:!0},{name:"TotalMeters",alias:"Total Meters",type:"esriFieldTypeDouble",editable:!0,nullable:!0},{name:"TotalMinutes",alias:"Total Minutes",type:"esriFieldTypeDouble",editable:!0,nullable:!0},{name:"TotalWaitMinutes",alias:"Total Wait Minutes",type:"esriFieldTypeDouble",editable:!0,nullable:!0},{name:"Version",alias:"Version",type:"esriFieldTypeString",editable:!0,nullable:!0,length:16}]}static fromGraphic(t){return new y({analysisSettings:null!=t.attributes.AnalysisSettings?T.fromJSON(JSON.parse(t.attributes.AnalysisSettings)):null,endTime:null!=t.attributes.EndTime?new Date(t.attributes.EndTime):null,endTimeOffset:t.attributes.EndUTCOffset??null,geometry:t.geometry,messages:null!=t.attributes.Messages?JSON.parse(t.attributes.Messages):null,name:t.attributes.RouteName,objectId:t.attributes.ObjectID??t.attributes.__OBJECTID,popupTemplate:t.popupTemplate,startTime:null!=t.attributes.StartTime?new Date(t.attributes.StartTime):null,startTimeOffset:t.attributes.StartUTCOffset??null,symbol:t.symbol,totalCosts:null!=t.attributes.TotalCosts?p(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:this.objectId,AnalysisSettings:this.analysisSettings?JSON.stringify(this.analysisSettings.toJSON()):null,EndTime:this.endTime?.getTime()??null,EndUTCOffset:this.endTimeOffset,Messages:this.messages?JSON.stringify(this.messages):null,RouteName:this.name,StartTime:this.startTime?.getTime()??null,StartUTCOffset:this.startTimeOffset,TotalCosts:this.totalCosts?JSON.stringify(m(this.totalCosts)):null,TotalLateMinutes:this.totalLateDuration,TotalMeters:this.totalDistance,TotalMinutes:this.totalDuration,TotalWaitMinutes:this.totalWaitDuration,Version:this.version};return new e({geometry:this.geometry,attributes:t,symbol:this.symbol,popupTemplate:this.popupTemplate})}};t([l()],f.prototype,"analysisSettings",void 0),t([l({type:Date})],f.prototype,"endTime",void 0),t([b("endTime",["attributes.EndTimeUTC"])],f.prototype,"readEndTime",null),t([l()],f.prototype,"endTimeOffset",void 0),t([b("endTimeOffset",["attributes.EndTime","attributes.EndTimeUTC"])],f.prototype,"readEndTimeOffset",null),t([l({json:{read:{source:"attributes.FirstStopID"}}})],f.prototype,"firstStopId",void 0),t([l({type:r})],f.prototype,"geometry",void 0),t([l({json:{read:{source:"attributes.LastStopID"}}})],f.prototype,"lastStopId",void 0),t([l()],f.prototype,"messages",void 0),t([l({json:{read:{source:"attributes.Name"}}})],f.prototype,"name",void 0),t([l({json:{read:{source:"attributes.ObjectID"}}})],f.prototype,"objectId",void 0),t([l({type:i})],f.prototype,"popupTemplate",void 0),t([l({type:Date})],f.prototype,"startTime",void 0),t([b("startTime",["attributes.StartTimeUTC"])],f.prototype,"readStartTime",null),t([l()],f.prototype,"startTimeOffset",void 0),t([b("startTimeOffset",["attributes.StartTime","attributes.StartTimeUTC"])],f.prototype,"readStartTimeOffset",null),t([l({json:{read:{source:"attributes.StopCount"}}})],f.prototype,"stopCount",void 0),t([l({types:d})],f.prototype,"symbol",void 0),t([l()],f.prototype,"totalCosts",void 0),t([b("totalCosts",["attributes"])],f.prototype,"readTotalCosts",null),t([l()],f.prototype,"totalDistance",void 0),t([l()],f.prototype,"totalDuration",void 0),t([l()],f.prototype,"totalLateDuration",void 0),t([l()],f.prototype,"totalViolations",void 0),t([b("totalViolations",["attributes"])],f.prototype,"readTotalViolations",null),t([l()],f.prototype,"totalWait",void 0),t([b("totalWait",["attributes"])],f.prototype,"readTotalWait",null),t([l()],f.prototype,"totalWaitDuration",void 0),t([l({readOnly:!0,json:{read:!1}})],f.prototype,"type",void 0),t([l()],f.prototype,"version",void 0),f=y=t([o("esri.rest.support.RouteInfo")],f);export{f as default};