CameraOnPositon() public method

public CameraOnPositon ( short carPosition, short group, short camera ) : void
carPosition short
group short
camera short
return void
        public bool IsActive(DataSample data)
        {
            if (restarting)
            {
                if (data.Telemetry.SessionTimeSpan < restartEndTime)
                {
                    return(true);
                }

                restartMarker.Stop();

                restarting = false;
                return(false);
            }

            if (wasUnderPaceCar)
            {
                if (data.Telemetry.UnderPaceCar)
                {
                    return(true);
                }

                restartEndTime = data.Telemetry.SessionTimeSpan + RestartStickyTime;
                restarting     = true;

                TraceInfo.WriteLine("{0} Race restarting", data.Telemetry.SessionTimeSpan);
                wasUnderPaceCar = false;
                restartMarker.Start();
                return(true);
            }

            wasUnderPaceCar = data.Telemetry.UnderPaceCar;
            if (wasUnderPaceCar)
            {
                TraceInfo.WriteLineIf(wasUnderPaceCar, "{0} Double Yellows. Pace Car", data.Telemetry.SessionTimeSpan);
                battleMarker.Stop();
                cameraControl.CameraOnPositon(1, cameraControl.RaceStartCameraNumber);
            }

            return(wasUnderPaceCar);
        }
        public ReplayControl(SessionData sessionData, Incidents incidents, RemovalEdits removalEdits, TrackCameras trackCameras)
        {
            var cameras = trackCameras.Where(tc => tc.TrackName == sessionData.WeekendInfo.TrackDisplayName).ToArray();

            TraceInfo.WriteLineIf(cameras.Count() <= 0, "Track Cameras not defined for {0}", sessionData.WeekendInfo.TrackDisplayName);
            Debug.Assert(cameras.Count() > 0, "Track Cameras not defined for {0}".F(sessionData.WeekendInfo.TrackDisplayName));

            foreach (var tc in cameras)
            {
                tc.CameraNumber = (short)sessionData.CameraInfo.Groups.First(g => g.GroupName.ToLower() == tc.CameraName.ToLower()).GroupNum;
            }

            var camera = cameras.First(tc => tc.IsRaceStart);

            var cameraControl = new CameraControl(cameras);

            cameraControl.CameraOnPositon(1, camera.CameraNumber);

            var battleMarker  = removalEdits.For(InterestState.Battle);
            var restartMarker = removalEdits.For(InterestState.Restart);

            var ruleLastSectors       = new RuleLastLapPeriod(cameraControl, removalEdits);
            var ruleUnlimitedIncident = new RuleIncident(cameraControl, removalEdits, incidents, 999);
            var ruleLimitedIncident   = new RuleIncident(cameraControl, removalEdits, incidents, Settings.Default.IgnoreIncidentsBelowPosition);
            var ruleFirstSectors      = new RuleFirstLapPeriod(cameraControl, removalEdits);
            var rulePaceLaps          = new RulePaceLaps(cameraControl, restartMarker, battleMarker);
            var ruleBattle            = new RuleBattle(cameraControl, battleMarker, Settings.Default.CameraStickyPeriod, Settings.Default.BattleStickyPeriod, Settings.Default.BattleGap, Settings.Default.BattleFactor2);

            ruleRandom = new RuleRandomDriver(cameraControl, sessionData, Settings.Default.CameraStickyPeriod);

            var ruleForFirstSectors = Settings.Default.IgnoreIncidentsDuringRaceStart ? ruleFirstSectors : ruleFirstSectors.WithVeto(ruleUnlimitedIncident);

            directionRules = new IDirectionRule[] {
                ruleLastSectors,
                ruleForFirstSectors,
                rulePaceLaps.WithVeto(ruleUnlimitedIncident.WithVeto(ruleLastSectors)),
                ruleBattle.WithVeto(ruleLimitedIncident.WithVeto(ruleLastSectors)),
                ruleUnlimitedIncident.WithVeto(ruleLastSectors),
                ruleRandom.WithVeto(ruleLastSectors)
            };

            currentRule = directionRules[0];
        }
        public ReplayControl(SessionData sessionData, Incidents incidents, RemovalEdits removalEdits, TrackCameras trackCameras)
        {
            var cameras = trackCameras.Where(tc => tc.TrackName == sessionData.WeekendInfo.TrackDisplayName).ToArray();

            TraceInfo.WriteLineIf(cameras.Count() <= 0, "Track Cameras not defined for {0}", sessionData.WeekendInfo.TrackDisplayName);
            Debug.Assert(cameras.Count() > 0, "Track Cameras not defined for {0}".F(sessionData.WeekendInfo.TrackDisplayName));

            foreach (var tc in cameras)
                tc.CameraNumber = (short)sessionData.CameraInfo.Groups.First(g => g.GroupName.ToLower() == tc.CameraName.ToLower()).GroupNum;

            var camera = cameras.First(tc => tc.IsRaceStart);

            var cameraControl = new CameraControl(cameras);
            cameraControl.CameraOnPositon(1, camera.CameraNumber);

            var battleMarker = removalEdits.For(InterestState.Battle);
            var restartMarker = removalEdits.For(InterestState.Restart);

            var ruleLastSectors = new RuleLastLapPeriod(cameraControl, removalEdits);
            var ruleUnlimitedIncident = new RuleIncident(cameraControl, removalEdits, incidents, 999);
            var ruleLimitedIncident = new RuleIncident(cameraControl, removalEdits, incidents, Settings.Default.IgnoreIncidentsBelowPosition);
            var ruleFirstSectors = new RuleFirstLapPeriod(cameraControl, removalEdits);
            var rulePaceLaps = new RulePaceLaps(cameraControl, restartMarker, battleMarker);
            var ruleBattle = new RuleBattle(cameraControl, battleMarker, Settings.Default.CameraStickyPeriod, Settings.Default.BattleStickyPeriod, Settings.Default.BattleGap, Settings.Default.BattleFactor2);
            ruleRandom = new RuleRandomDriver(cameraControl, sessionData, Settings.Default.CameraStickyPeriod);

            var ruleForFirstSectors = Settings.Default.IgnoreIncidentsDuringRaceStart ? ruleFirstSectors : ruleFirstSectors.WithVeto(ruleUnlimitedIncident);

            directionRules = new IDirectionRule[] { 
                ruleLastSectors,
                ruleForFirstSectors,
                rulePaceLaps.WithVeto(ruleUnlimitedIncident.WithVeto(ruleLastSectors)),
                ruleBattle.WithVeto(ruleLimitedIncident.WithVeto(ruleLastSectors)),
                ruleUnlimitedIncident.WithVeto(ruleLastSectors),
                ruleRandom.WithVeto(ruleLastSectors)
            };

            currentRule = directionRules[0];
        }