@doegis/core
Version:
DOE GIS API
3 lines (1 loc) • 17.6 kB
JavaScript
import{_ as e}from"../../chunks/tslib.es6.js";import t from"../../Graphic.js";import i from"../../PopupTemplate.js";import{symbolTypes as a}from"../../symbols.js";import{ClonableMixin as r}from"../../core/Clonable.js";import{JSONSupport as o}from"../../core/JSONSupport.js";import{isNone as s,isSome as l,unwrap as n}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 u}from"../../core/accessorSupport/decorators/reader.js";import{subclass as d}from"../../core/accessorSupport/decorators/subclass.js";import{writer as m}from"../../core/accessorSupport/decorators/writer.js";import b from"../../geometry/Point.js";import{getTimezoneOffset as c,getPrefixedProperties as v,setPrefixedProperties as T,toKebabImpedanceAttributes as f,fromKebabImpedanceAttributes as y}from"../route/utils.js";import{curbApproachJsonMap as h,locationTypeJsonMap as C,statusJsonMap as S,sideOfEdgeJsonMap as O}from"./networkEnums.js";var g;let w=g=class extends(r(o)){constructor(e){super(e),this.arriveCurbApproach=null,this.arriveTime=null,this.arriveTimeOffset=null,this.bearing=null,this.bearingTol=null,this.cumulativeCosts=null,this.cumulativeDistance=null,this.cumulativeDuration=null,this.curbApproach=null,this.departCurbApproach=null,this.departTime=null,this.departTimeOffset=null,this.distanceToNetworkInMeters=null,this.geometry=null,this.lateDuration=null,this.locationType=null,this.name=null,this.navLatency=null,this.objectId=null,this.popupTemplate=null,this.posAlong=null,this.routeName=null,this.serviceCosts=null,this.serviceDistance=null,this.serviceDuration=null,this.sequence=null,this.sideOfEdge=null,this.snapX=null,this.snapY=null,this.snapZ=null,this.sourceId=null,this.sourceOid=null,this.status=null,this.symbol=null,this.timeWindowEnd=null,this.timeWindowEndOffset=null,this.timeWindowStart=null,this.timeWindowStartOffset=null,this.type="stop",this.violations=null,this.waitDuration=null,this.wait=null}readArriveTimeOffset(e,t){return c(t.attributes.ArriveTime,t.attributes.ArriveTimeUTC)}readCumulativeCosts(e,t){return v(t.attributes,"Cumul_")}readDepartTimeOffset(e,t){return c(t.attributes.DepartTime,t.attributes.DepartTimeUTC)}readServiceCosts(e,t){return v(t.attributes,"Attr_")}writeServiceCosts(e,t){T(e,t,"Attr_")}writeTimeWindowEnd(e,t){s(e)||(t.attributes||(t.attributes={}),t.attributes.TimeWindowEnd=e.getTime())}writeTimeWindowStart(e,t){s(e)||(t.attributes||(t.attributes={}),t.attributes.TimeWindowStart=e.getTime())}readViolations(e,t){return v(t.attributes,"Violation_")}readWait(e,t){return v(t.attributes,"Wait_")}static fromGraphic(e){return new g({arriveCurbApproach:l(e.attributes.ArrivalCurbApproach)?h.fromJSON(e.attributes.ArrivalCurbApproach):null,arriveTime:l(e.attributes.ArrivalTime)?new Date(e.attributes.ArrivalTime):null,arriveTimeOffset:e.attributes.ArrivalUTCOffset,cumulativeCosts:l(e.attributes.CumulativeCosts)?f(JSON.parse(e.attributes.CumulativeCosts)):null,cumulativeDistance:e.attributes.CumulativeMeters??null,cumulativeDuration:e.attributes.CumulativeMinutes??null,curbApproach:l(e.attributes.CurbApproach)?h.fromJSON(e.attributes.CurbApproach):null,departCurbApproach:l(e.attributes.DepartureCurbApproach)?h.fromJSON(e.attributes.DepartureCurbApproach):null,departTime:l(e.attributes.DepartureTime)?new Date(e.attributes.DepartureTime):null,departTimeOffset:e.attributes.DepartureUTCOffset??null,geometry:e.geometry,lateDuration:e.attributes.LateMinutes??null,locationType:l(e.attributes.LocationType)?C.fromJSON(e.attributes.LocationType):null,name:e.attributes.Name,objectId:e.attributes.ObjectID??e.attributes.__OBJECTID,popupTemplate:e.popupTemplate,routeName:e.attributes.RouteName,sequence:e.attributes.Sequence??null,serviceCosts:l(e.attributes.ServiceCosts)?f(JSON.parse(e.attributes.ServiceCosts)):null,serviceDistance:e.attributes.ServiceMeters??null,serviceDuration:e.attributes.ServiceMinutes??null,status:l(e.attributes.Status)?S.fromJSON(e.attributes.Status):null,symbol:e.symbol,timeWindowEnd:l(e.attributes.TimeWindowEnd)?new Date(e.attributes.TimeWindowEnd):null,timeWindowEndOffset:e.attributes.TimeWindowEndUTCOffset??null,timeWindowStart:l(e.attributes.TimeWindowStart)?new Date(e.attributes.TimeWindowStart):null,timeWindowStartOffset:e.attributes.TimeWindowStartUTCOffset??null,waitDuration:e.attributes.WaitMinutes??null})}toGraphic(){const e={ObjectID:n(this.objectId),ArrivalCurbApproach:l(this.arriveCurbApproach)?h.toJSON(this.arriveCurbApproach):null,ArrivalTime:l(this.arriveTime)?this.arriveTime.getTime():null,ArrivalUTCOffset:this.arriveTimeOffset,CumulativeCosts:l(this.cumulativeCosts)?JSON.stringify(y(this.cumulativeCosts)):null,CumulativeMeters:this.cumulativeDistance,CumulativeMinutes:this.cumulativeDuration,CurbApproach:l(this.curbApproach)?h.toJSON(this.curbApproach):null,DepartureCurbApproach:l(this.departCurbApproach)?h.toJSON(this.departCurbApproach):null,DepartureTime:l(this.departTime)?this.departTime.getTime():null,DepartureUTCOffset:this.departTimeOffset,LateMinutes:this.lateDuration,LocationType:l(this.locationType)?C.toJSON(this.locationType):null,Name:n(this.name),RouteName:n(this.routeName),Sequence:this.sequence,ServiceCosts:l(this.serviceCosts)?JSON.stringify(y(this.serviceCosts)):null,ServiceMeters:this.serviceDistance,ServiceMinutes:this.serviceDuration,Status:l(this.status)?S.toJSON(this.status):null,TimeWindowEnd:l(this.timeWindowEnd)?this.timeWindowEnd.getTime():null,TimeWindowEndUTCOffset:this.timeWindowEndOffset??this.arriveTimeOffset,TimeWindowStart:l(this.timeWindowStart)?this.timeWindowStart.getTime():null,TimeWindowStartUTCOffset:this.timeWindowStartOffset??this.arriveTimeOffset,WaitMinutes:this.waitDuration};return new t({geometry:this.geometry,attributes:e,symbol:this.symbol,popupTemplate:this.popupTemplate})}};w.fields=[{name:"ObjectID",alias:"ObjectID",type:"esriFieldTypeOID",editable:!1,nullable:!1,domain:null},{name:"ArrivalCurbApproach",alias:"Arrival Curb Approach",type:"esriFieldTypeInteger",editable:!0,nullable:!0,visible:!0,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:"ArrivalTime",alias:"Arrival Time",type:"esriFieldTypeDate",length:36,editable:!0,nullable:!0,visible:!0},{name:"ArrivalUTCOffset",alias:"Arrival Time: Offset from UTC in Minutes",type:"esriFieldTypeInteger",editable:!0,nullable:!0,visible:!0},{name:"CumulativeCosts",alias:"Cumulative Costs",type:"esriFieldTypeString",length:1048576,editable:!0,nullable:!0,visible:!1,domain:null},{name:"CumulativeMeters",alias:"Cumulative Meters",type:"esriFieldTypeDouble",editable:!0,nullable:!0,visible:!0},{name:"CumulativeMinutes",alias:"Cumulative Minutes",type:"esriFieldTypeDouble",editable:!0,nullable:!0,visible:!0},{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:"DepartureCurbApproach",alias:"Departure Curb Approach",type:"esriFieldTypeInteger",editable:!0,nullable:!0,visible:!0,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:"DepartureTime",alias:"Departure Time",type:"esriFieldTypeDate",length:36,editable:!0,nullable:!0,visible:!0},{name:"DepartureUTCOffset",alias:"Departure Time: Offset from UTC in Minutes",type:"esriFieldTypeInteger",editable:!0,nullable:!0,visible:!0},{name:"LateMinutes",alias:"Minutes Late",type:"esriFieldTypeDouble",editable:!0,nullable:!0,visible:!1},{name:"LocationType",alias:"Location Type",type:"esriFieldTypeInteger",editable:!0,nullable:!0,visible:!0,domain:{type:"codedValue",name:"esriNALocationType",codedValues:[{name:"Stop",code:0},{name:"Waypoint",code:1}]}},{name:"Name",alias:"Name",type:"esriFieldTypeString",length:255,editable:!0,nullable:!0,visible:!0},{name:"RouteName",alias:"Route Name",type:"esriFieldTypeString",length:255,editable:!0,nullable:!0,visible:!0},{name:"Sequence",alias:"Sequence",type:"esriFieldTypeInteger",editable:!0,nullable:!0,visible:!0},{name:"ServiceCosts",alias:"Service Costs",type:"esriFieldTypeString",length:1048576,editable:!0,nullable:!0,visible:!1,domain:null},{name:"ServiceMeters",alias:"Service Meters",type:"esriFieldTypeDouble",editable:!0,nullable:!0,visible:!1},{name:"ServiceMinutes",alias:"Service Minutes",type:"esriFieldTypeDouble",editable:!0,nullable:!0,visible:!1},{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}]}},{name:"TimeWindowEnd",alias:"Time Window End",type:"esriFieldTypeDate",length:36,editable:!0,nullable:!0,visible:!1},{name:"TimeWindowEndUTCOffset",alias:"Time Window End: Offset from UTC in Minutes",type:"esriFieldTypeInteger",editable:!0,nullable:!0,visible:!0},{name:"TimeWindowStart",alias:"Time Window Start",type:"esriFieldTypeDate",length:36,editable:!0,nullable:!0,visible:!1},{name:"TimeWindowStartUTCOffset",alias:"Time Window Start: Offset from UTC in Minutes",type:"esriFieldTypeInteger",editable:!0,nullable:!0,visible:!0},{name:"WaitMinutes",alias:"Minutes Early",type:"esriFieldTypeDouble",editable:!0,nullable:!0,visible:!1}],w.popupInfo={title:"{Name}",fieldInfos:[{fieldName:"Name",label:"Name",isEditable:!0,tooltip:"",visible:!0,stringFieldOption:"textbox"},{fieldName:"RouteName",label:"Route Name",isEditable:!0,tooltip:"",visible:!0,stringFieldOption:"textbox"},{fieldName:"Sequence",label:"Sequence",isEditable:!1,tooltip:"",visible:!0,format:{places:0,digitSeparator:!0},stringFieldOption:"textbox"},{fieldName:"ArrivalTime",label:"Arrival Time",isEditable:!0,tooltip:"",visible:!0,format:{dateFormat:"shortDateShortTime24"},stringFieldOption:"textbox"},{fieldName:"ArrivalUTCOffset",label:"Arrival Time: Offset from UTC in Minutes",isEditable:!1,tooltip:"",visible:!0,format:{places:0,digitSeparator:!0},stringFieldOption:"textbox"},{fieldName:"DepartureTime",label:"Departure Time",isEditable:!0,tooltip:"",visible:!0,format:{dateFormat:"shortDateShortTime24"},stringFieldOption:"textbox"},{fieldName:"DepartureUTCOffset",label:"Departure Time: Offset from UTC in Minutes",isEditable:!1,tooltip:"",visible:!0,format:{places:0,digitSeparator:!0},stringFieldOption:"textbox"},{fieldName:"CurbApproach",label:"Curb Approach",isEditable:!0,tooltip:"",visible:!1,format:{places:0,digitSeparator:!0},stringFieldOption:"textbox"},{fieldName:"ArrivalCurbApproach",label:"Arrival Curb Approach",isEditable:!1,tooltip:"",visible:!0,format:{places:0,digitSeparator:!0},stringFieldOption:"textbox"},{fieldName:"DepartureCurbApproach",label:"Departure Curb Approach",isEditable:!1,tooltip:"",visible:!0,format:{places:0,digitSeparator:!0},stringFieldOption:"textbox"},{fieldName:"Status",label:"Status",isEditable:!1,tooltip:"",visible:!0,format:{places:0,digitSeparator:!0},stringFieldOption:"textbox"},{fieldName:"LocationType",label:"Location Type",isEditable:!1,tooltip:"",visible:!0,format:{places:0,digitSeparator:!0},stringFieldOption:"textbox"},{fieldName:"TimeWindowStart",label:"Time Window Start",isEditable:!0,tooltip:"",visible:!1,format:{dateFormat:"shortDateShortTime24"},stringFieldOption:"textbox"},{fieldName:"TimeWindowStartUTCOffset",label:"Time Window Start: Offset from UTC in Minutes",isEditable:!1,tooltip:"",visible:!1,format:{places:0,digitSeparator:!0},stringFieldOption:"textbox"},{fieldName:"TimeWindowEnd",label:"Time Window End",isEditable:!0,tooltip:"",visible:!1,format:{dateFormat:"shortDateShortTime24"},stringFieldOption:"textbox"},{fieldName:"TimeWindowEndUTCOffset",label:"Time Window End: Offset from UTC in Minutes",isEditable:!1,tooltip:"",visible:!1,format:{places:0,digitSeparator:!0},stringFieldOption:"textbox"},{fieldName:"ServiceMinutes",label:"Service Minutes",isEditable:!0,tooltip:"",visible:!1,format:{places:2,digitSeparator:!0},stringFieldOption:"textbox"},{fieldName:"ServiceMeters",label:"Service Meters",isEditable:!0,tooltip:"",visible:!1,format:{places:2,digitSeparator:!0},stringFieldOption:"textbox"},{fieldName:"ServiceCosts",label:"Service Costs",isEditable:!0,tooltip:"",visible:!1,stringFieldOption:"textbox"},{fieldName:"CumulativeMinutes",label:"Cumulative Minutes",isEditable:!1,tooltip:"",visible:!0,format:{places:2,digitSeparator:!0},stringFieldOption:"textbox"},{fieldName:"CumulativeMeters",label:"Cumulative Meters",isEditable:!1,tooltip:"",visible:!0,format:{places:2,digitSeparator:!0},stringFieldOption:"textbox"},{fieldName:"CumulativeCosts",label:"Cumulative Costs",isEditable:!0,tooltip:"",visible:!1,stringFieldOption:"textbox"},{fieldName:"LateMinutes",label:"Minutes Late",isEditable:!1,tooltip:"",visible:!1,format:{places:2,digitSeparator:!0},stringFieldOption:"textbox"},{fieldName:"WaitMinutes",label:"Minutes Early",isEditable:!1,tooltip:"",visible:!1,format:{places:2,digitSeparator:!0},stringFieldOption:"textbox"}],description:null,showAttachments:!1,mediaInfos:[]},e([p({type:h.apiValues,json:{read:{source:"attributes.ArrivalCurbApproach",reader:h.read}}})],w.prototype,"arriveCurbApproach",void 0),e([p({type:Date,json:{read:{source:"attributes.ArriveTimeUTC"}}})],w.prototype,"arriveTime",void 0),e([p()],w.prototype,"arriveTimeOffset",void 0),e([u("arriveTimeOffset",["attributes.ArriveTime","attributes.ArriveTimeUTC"])],w.prototype,"readArriveTimeOffset",null),e([p({json:{name:"attributes.Bearing",read:!1,write:!0}})],w.prototype,"bearing",void 0),e([p({json:{name:"attributes.BearingTol",read:!1,write:!0}})],w.prototype,"bearingTol",void 0),e([p()],w.prototype,"cumulativeCosts",void 0),e([u("cumulativeCosts",["attributes"])],w.prototype,"readCumulativeCosts",null),e([p()],w.prototype,"cumulativeDistance",void 0),e([p()],w.prototype,"cumulativeDuration",void 0),e([p({type:h.apiValues,json:{name:"attributes.CurbApproach",read:{reader:h.read},write:{writer:h.write}}})],w.prototype,"curbApproach",void 0),e([p({type:h.apiValues,json:{read:{source:"attributes.DepartCurbApproach",reader:h.read}}})],w.prototype,"departCurbApproach",void 0),e([p({type:Date,json:{read:{source:"attributes.DepartTimeUTC"}}})],w.prototype,"departTime",void 0),e([p()],w.prototype,"departTimeOffset",void 0),e([u("departTimeOffset",["attributes.DepartTime","attributes.DepartTimeUTC"])],w.prototype,"readDepartTimeOffset",null),e([p({json:{read:{source:"attributes.DistanceToNetworkInMeters"}}})],w.prototype,"distanceToNetworkInMeters",void 0),e([p({type:b,json:{write:!0}})],w.prototype,"geometry",void 0),e([p()],w.prototype,"lateDuration",void 0),e([p({type:C.apiValues,json:{name:"attributes.LocationType",read:{reader:C.read},write:{writer:C.write}}})],w.prototype,"locationType",void 0),e([p({json:{name:"attributes.Name"}})],w.prototype,"name",void 0),e([p({json:{name:"attributes.NavLatency",read:!1,write:!0}})],w.prototype,"navLatency",void 0),e([p({json:{name:"attributes.ObjectID"}})],w.prototype,"objectId",void 0),e([p({type:i})],w.prototype,"popupTemplate",void 0),e([p({json:{read:{source:"attributes.PosAlong"}}})],w.prototype,"posAlong",void 0),e([p({json:{name:"attributes.RouteName"}})],w.prototype,"routeName",void 0),e([p()],w.prototype,"serviceCosts",void 0),e([u("serviceCosts",["attributes"])],w.prototype,"readServiceCosts",null),e([m("serviceCosts")],w.prototype,"writeServiceCosts",null),e([p()],w.prototype,"serviceDistance",void 0),e([p()],w.prototype,"serviceDuration",void 0),e([p({json:{name:"attributes.Sequence"}})],w.prototype,"sequence",void 0),e([p({type:O.apiValues,json:{read:{source:"attributes.SideOfEdge",reader:O.read}}})],w.prototype,"sideOfEdge",void 0),e([p({json:{read:{source:"attributes.SnapX"}}})],w.prototype,"snapX",void 0),e([p({json:{read:{source:"attributes.SnapY"}}})],w.prototype,"snapY",void 0),e([p({json:{read:{source:"attributes.SnapZ"}}})],w.prototype,"snapZ",void 0),e([p({json:{read:{source:"attributes.SourceID"}}})],w.prototype,"sourceId",void 0),e([p({json:{read:{source:"attributes.SourceOID"}}})],w.prototype,"sourceOid",void 0),e([p({type:S.apiValues,json:{read:{source:"attributes.Status",reader:S.read}}})],w.prototype,"status",void 0),e([p({types:a})],w.prototype,"symbol",void 0),e([p({type:Date,json:{name:"attributes.TimeWindowEnd"}})],w.prototype,"timeWindowEnd",void 0),e([m("timeWindowEnd")],w.prototype,"writeTimeWindowEnd",null),e([p()],w.prototype,"timeWindowEndOffset",void 0),e([p({type:Date,json:{name:"attributes.TimeWindowStart"}})],w.prototype,"timeWindowStart",void 0),e([m("timeWindowStart")],w.prototype,"writeTimeWindowStart",null),e([p()],w.prototype,"timeWindowStartOffset",void 0),e([p({readOnly:!0,json:{read:!1}})],w.prototype,"type",void 0),e([p()],w.prototype,"violations",void 0),e([u("violations",["attributes"])],w.prototype,"readViolations",null),e([p()],w.prototype,"waitDuration",void 0),e([p()],w.prototype,"wait",void 0),e([u("wait",["attributes"])],w.prototype,"readWait",null),w=g=e([d("esri.rest.support.Stop")],w);const D=w;export{D as default};