public TrackNew(tblCompTrack ti) { ComponentLinks = new Dictionary <string, int>(); MileageDirection = LeftToRightMiles.Indeterminate; TrackSpeeds = new Dictionary <string, int>(); AlternateTrackAbbreviation = ti.AlternateTrackAbbreviation; AlternateTrackNames = ti.AlternateTrackNames; ComponentLinks.Add(new KeyValuePair <string, int>("AltLinkFour", ti.AltLinkFour ?? 0)); ComponentLinks.Add(new KeyValuePair <string, int>("AltLinkOne", ti.AltLinkOne ?? 0)); ComponentLinks.Add(new KeyValuePair <string, int>("AltLinkThree", ti.AltLinkThree ?? 0)); ComponentLinks.Add(new KeyValuePair <string, int>("AltLinkTwo", ti.AltLinkTwo ?? 0)); ComponentLinks.Add(new KeyValuePair <string, int>("LeftAltLink", ti.LeftAltLink ?? 0)); ComponentLinks.Add(new KeyValuePair <string, int>("LeftLink", ti.LeftLink ?? 0)); ComponentLinks.Add(new KeyValuePair <string, int>("RightAltLink", ti.RightAltLink ?? 0)); ComponentLinks.Add(new KeyValuePair <string, int>("RightLink", ti.RightLink ?? 0)); Codeline = ti.Codeline ?? 0; ControlPoint = ti.ControlPoint ?? 0; GraphicGroup = ti.GraphicGroup ?? 0; Guid = ti.UID; GeolocationLeft = new Point(ti.LatitudeLeft ?? 0.0, ti.LongitudeLeft ?? 0); GeolocationRight = new Point(ti.LatitudeRight ?? 0, ti.LongitudeRight ?? 0); LeftLimitName = ti.LeftLimitName; MilePostLeft = (float)(ti.LeftLimitMPRange ?? 0.0); MilePostRight = (float)(ti.RightLimitMPRange ?? 0.0); MilepostPrefix = ti.MilepostPrefix; MilePostSuffix = ti.MilePostSuffix; Name = ti.Name; Notes = ti.Notes; RailroadUniqueIdentifierName = ti.RailroadUniqueIdentifierName; RightLimitName = ti.RightLimitName; ScreenPositionLeft = new Point(ti.LX ?? 0.0, ti.LY ?? 0.0); ScreenPositionRight = new Point(ti.RX ?? 0.0, ti.RY ?? 0.0); ScreenRegion = ti.ScreenRegion ?? 0; SubdivisionId = ti.Subdivision ?? 0; TerritoryId = ti.TerritoryAssignment ?? 0; TrackElevationAscending = ti.TrackElevationAscending ?? false; TrackElevationAverage = (float)(ti.TrackElevationAverage ?? 0.0); TrackElevationMaximum = (float)(ti.TrackElevationMaximum ?? 0.0); TrackLengthInMiles = Math.Abs(MilePostRight - MilePostLeft); TrackNameAlias = ti.TrackNameAlias; TrackSpeedAverage = ti.TrackSpeedAverage ?? 0; TrackSpeedMaximum = ti.TrackSpeedMaximum ?? 0; TrackSpeedMaximumFreight = ti.TrackSpeedMaximumFreight ?? 0; TrackSpeedMaximumPassenger = ti.TrackSpeedMaximumPassengar ?? 0; TurnOutTrack = ti.TurnOutTrack ?? false; Type = ti.Type; MileageDirection = GetMileageDirection(MilePostLeft, MilePostRight); }
public Track(tblCompTrack ti) { Tags = new Tags(); AbsolutePermissiveBlockPtcUid = ti.AbsolutePermissiveBlockPTCUID ?? 0; AdditionalReferenceUid = ti.AdditionalReferenceUID; AllowForceOperationsToTwc = ti.AllowForceOperationsToTWC ?? false; AllowMainTrackEntrance = ti.AllowMainTrackEntrance ?? false; AllowOpposingAuthorityCreationToLeft = ti.AllowOpposingAuthorityCreationToLeft ?? false; AllowOpposingAuthorityCreationToRight = ti.AllowOpposingAuthorityCreationToRight ?? false; AlternateTrackAbbreviation = ti.AlternateTrackAbbreviation; AlternateTrackNames = ti.AlternateTrackNames; AltLinkFour = ti.AltLinkFour ?? 0; AltLinkOne = ti.AltLinkOne ?? 0; AltLinkThree = ti.AltLinkThree ?? 0; AltLinkTwo = ti.AltLinkTwo ?? 0; AuthorityConfirmationRequired = ti.AuthorityConfirmationRequired ?? false; AuthorityType = ti.AuthorityType; BlueFlag = ti.BlueFlag ?? false; Codeline = ti.Codeline ?? 0; ControlPoint = ti.ControlPoint ?? 0; DerailmentDetectorCtlBit = ti.DerailmentDetectorCtlBit; DerailmentDetectorEnabled = ti.DerailmentDetectorEnabled ?? false; DerailmentDetectorIndBit = ti.DerailmentDetectorIndBit; DerailmentDetectorInhibited = ti.DerailmentDetectorInhibited ?? false; DeviceBlocking = ti.DeviceBlocking ?? false; DisallowLeftSignalRequestOnOccupancy = ti.DisallowLeftSignalRequestOnOccupancy ?? false; DisallowRightSignalRequestOnOccupancy = ti.DisallowRightSignalRequestOnOccupancy ?? false; DisallowTntOnSplit = ti.DisallowTNTOnSplit ?? false; EnableAbsolutePermissiveBlock = ti.EnableAbsolutePermissiveBlock ?? false; EnableControlledSiding = ti.EnableControlledSiding ?? false; EnableNonControlledSiding = ti.EnableNonControlledSiding ?? false; EnablePositionReporting = ti.EnablePositionReporting ?? false; Fbk = ti.FBK; Fbk2 = ti.FBK2; Fbz = ti.FBK2; Fbz2 = ti.FBZ2; FieldBlocking = ti.FieldBlocking ?? false; ForceIgnoreTrainDirectionChange = ti.ForceIgnoreTrainDirectionChange ?? false; FoulingTrackSpms = ti.FoulingTrackSPMS ?? false; FoulTime = ti.FoulTime ?? false; GraphicGroup = ti.GraphicGroup ?? 0; Guid = ti.UID; HazmatAlarming = ti.HAZMATAlarming ?? false; HoldingSignalOSLeftBoundReporting = ti.HoldingSignalOSLeftBoundReporting ?? false; HoldingSignalOSRightBoundReporting = ti.HoldingSignalOSRightBoundReporting ?? false; HoldingSignalSlottingTrack = ti.HoldingSignalSlottingTrack ?? false; JointControl = ti.JointControl ?? false; LatitudeLeft = (float)(ti.LatitudeLeft ?? 0.0); LatitudeRight = (float)(ti.LatitudeRight ?? 0.0); LeftAltLink = ti.LeftAltLink ?? 0; LeftLimitMPRange = (float)(ti.LeftLimitMPRange ?? 0.0); LeftLimitName = ti.LeftLimitName; LeftLimitRange = ti.LeftLimitRange ?? 0; LeftLink = ti.LeftLink ?? 0; LineSegmentGroupUid = ti.LineSegmentGroupUID; LongitudeLeft = (float)(ti.LongitudeLeft ?? 0.0); LongitudeRight = (float)(ti.LongitudeRight ?? 0.0); LossOfShunt = ti.LossOfShunt ?? 0; LX = ti.LX ?? 0.0f; LY = ti.LY ?? 0.0f; MainTrackEntrancePoints = ti.MainTrackEntrancePoints; MatchMode = ti.MatchMode ?? false; MilepostPrefix = ti.MilepostPrefix; MilePostSuffix = ti.MilePostSuffix; Name = ti.Name; Notes = ti.Notes; Ocs = ti.OCS ?? false; OSReporting = ti.OSReporting ?? false; OverrideLeftTrafficCheck = ti.OverrideLeftTrafficCheck ?? false; OverrideRightTrafficCheck = ti.OverrideRightTrafficCheck ?? false; PassRedSignalAlertOff = ti.PassRedSignalAlertOff ?? false; Pctl = ti.PCTL; Pind = ti.PIND; PtcBlockId = ti.PTCBlockID ?? 0; PtcTrackType = ti.PTCBlockID ?? 0; Qctl = ti.QCTL; Qind = ti.QIND; RailroadUniqueIdentifierName = ti.RailroadUniqueIdentifierName; RefuseOpposingAuthoritiesFromLeft = ti.RefuseOpposingAuthoritiesFromLeft ?? false; RefuseOpposingAuthoritiesFromRight = ti.RefuseOpposingAuthoritiesFromRight ?? false; ReleaseTrainIDTrack = ti.ReleaseTrainIDTrack ?? false; RightAltLink = ti.RightAltLink ?? 0; RightLimitMPRange = (float)(ti.RightLimitMPRange ?? 0.0); RightLimitName = ti.RightLimitName; RightLimitRange = ti.RightLimitRange ?? 0; RightLink = ti.RightLink ?? 0; RouteBlocking = ti.RouteBlocking ?? false; RouteName = ti.RouteName; RX = (float)(ti.RX ?? 0.0); RY = (float)(ti.RY ?? 0.0); ScreenRegion = ti.ScreenRegion ?? 0; Sctl = ti.SCTL; Sind = ti.SIND; SlotFieldTraffic = ti.SlotFieldTraffic ?? false; SlottingTK = ti.SlottingTK ?? false; Subdivision = ti.Subdivision ?? 0; SuppressAuthorityRelease = ti.SuppressAuthorityRelease ?? false; Tctl = ti.TCTL; TerritoryAssignment = ti.TerritoryAssignment ?? 0; TimeZone = ti.TimeZone; Tind = ti.TIND; TizMonitorModeTimeOut = ti.TIZMonitorModeTimeOut ?? 0; TmpsCircuitName = ti.TMPSCircuitName; TmpsEnabled = ti.TMPSEnabled ?? false; TmpsLinkAlt1 = ti.TMPSLinkAlt1 ?? 0; TmpsLinkAlt2 = ti.TMPSLinkAlt2 ?? 0; TmpsLinkAlt3 = ti.TMPSLinkAlt3 ?? 0; TmpsLinkAlt4 = ti.TMPSLinkAlt4 ?? 0; TmpsLinkLeft = ti.TMPSLinkLeft ?? 0; TmpsLinkRight = ti.TMPSLinkRight ?? 0; TrackBlockingReferences = ti.TrackBlockingReferences; TrackElevationAscending = ti.TrackElevationAscending ?? false; TrackElevationAverage = (float)(ti.TrackElevationAverage ?? 0.0); TrackElevationMaximum = (float)(ti.TrackElevationMaximum ?? 0.0); TrackIntegrityZone = ti.TrackIntegrityZone ?? false; TrackIntegrityZoneName = ti.TrackIntegrityZoneName; TrackIntegrityZoneUid = ti.TrackIntegrityZoneUID ?? 0; TrackLength = ti.TrackLength ?? 0; TrackLock = ti.TrackLock ?? false; TrackLockBit = ti.TrackLockBit; TrackNameAlias = ti.TrackNameAlias; TrackPermit = ti.TrackPermit ?? false; TrackSpeedAverage = ti.TrackSpeedAverage ?? 0; TrackSpeedMaximum = ti.TrackSpeedMaximum ?? 0; TrackSpeedMaximumFreight = ti.TrackSpeedMaximumFreight ?? 0; TrackSpeedMaximumPassengar = ti.TrackSpeedMaximumPassengar ?? 0; TrackSpeeds = ti.TrackSpeeds; TrackTime = ti.TrackTime ?? false; TrackUid = ti.TrackUID ?? 0; TrackWarrantEnforcementEnabled = ti.TrackWarrantEnforcementEnabled ?? false; Traffic = ti.Traffic ?? false; TrkName = ti.TrkName; TurnOutTrack = ti.TurnOutTrack ?? false; Type = ti.Type; }