Beispiel #1
0
        private void UpdateViolatingPlanes(List <IPlane> updatedPlaneList)
        {
            // Check for violations
            List <List <IPlane> > newViolatingPlaneList = PlaneSeparator.CheckPlanes(updatedPlaneList);


            foreach (var newPlanePair in newViolatingPlaneList)
            {
                // If new plane-pair exist in old planelist then do nothing
                if (ConditionViolationSeparation.Contains(newPlanePair))
                {
                    continue;
                }

                // Create log message
                string msgToLog = string.Format("{0:YYY:HH:mm:ss}: {1} and {2} Violates Separation condition!", DateTime.Now, newPlanePair[0].Tag, newPlanePair[1].Tag);

                // Write log message to log
                Logger?.AddToLog(msgToLog);
            }

            foreach (var oldPlanePair in ConditionViolationSeparation)
            {
                // If old plane-pair exist in new planelist then do nothing
                if (newViolatingPlaneList.Contains(oldPlanePair))
                {
                    continue;
                }
                // Create log message
                string msgToLog = string.Format("{0:YYY:HH:mm:ss}: {1} and {2} no longer violates Separation condition!", DateTime.Now, oldPlanePair[0].Tag, oldPlanePair[1].Tag);

                // Write log message to log
                Logger?.AddToLog(msgToLog);
            }

            // Update ConditionViolation_Separation to contain new errors
            ConditionViolationSeparation.Clear();
            ConditionViolationSeparation = newViolatingPlaneList;

            RenditionOutputter.RenderViolations(ConditionViolationSeparation);
        }
Beispiel #2
0
        public void UpdatePlaneList(List <IPlane> newPlaneList)
        {
            List <IPlane> updatedPlaneList = new List <IPlane>();

            // Only select planes present in ObservableAirspace
            foreach (var plane in newPlaneList)
            {
                // Check if plane is within airspace
                bool planeInAirspace = ObservableAirspace.IsWithinArea(plane.XCoordinate, plane.YCoordinate, plane.Altitude);
                PlaneList.Add(plane);
                // Add plane to list if it's within the airspace
                if (planeInAirspace)
                {
                    updatedPlaneList.Add(plane);
                }
            }


            UpdateViolatingPlanes(updatedPlaneList);    // Update violating planes

            PlaneList = updatedPlaneList;

            RenditionOutputter.RenderPlanes(PlaneList);
        }