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