コード例 #1
0
ファイル: FrmMain.cs プロジェクト: akapetanovic/MUAC
        private string BuildPassiveLabelText(DynamicDisplayBuilder.TargetType Target_In)
        {
            string Label_Text_Out = "";

            if (Target_In.ACID_Mode_S != null)
                Label_Text_Out = Target_In.ModeA + "\n" + Target_In.ACID_Mode_S + "\n" + ApplyCModeHisterysis(Target_In.ModeC);
            else
                Label_Text_Out = Target_In.ModeA + "\n" + ApplyCModeHisterysis(Target_In.ModeC);

            return Label_Text_Out;
        }
コード例 #2
0
ファイル: FrmMain.cs プロジェクト: akapetanovic/MUAC
        /////////////////////////////////////////////////////////////////////////////////
        // This method builds the label text
        /// <summary>
        /// /////////////////////////////////////////////////////////////////////////////
        /// </summary>
        /// <param name="Target_In"></param>
        /// <returns></returns>
        private void BuildDynamicLabelText(DynamicDisplayBuilder.TargetType Target_Data, ref GMapTargetandLabel Label_Data)
        {
            string CoastIndicator;
            if (Target_Data.TrackTerminateTreshold > 1)
                CoastIndicator = " ↘";
            else
                CoastIndicator = "";

            Label_Data.ModeA_CI_STRING = Target_Data.ModeA + CoastIndicator;

            Label_Data.ModeC_STRING = ApplyCModeHisterysis(Target_Data.ModeC);

            if (Target_Data.ModeC_Previous_Cycle != null && Target_Data.ModeC != null && Target_Data.ModeC_Previous_Cycle != "")
            {
                try
                {
                    if (double.Parse(Target_Data.ModeC_Previous_Cycle) > double.Parse(Target_Data.ModeC))
                        Label_Data.ModeC_STRING = Label_Data.ModeC_STRING + "↓";
                    else if (double.Parse(Target_Data.ModeC_Previous_Cycle) < double.Parse(Target_Data.ModeC))
                        Label_Data.ModeC_STRING = Label_Data.ModeC_STRING + "↑";
                }
                catch
                {
                    Label_Data.ModeC_STRING = "---";
                }
            }

            if (Target_Data.ACID_Mode_S != null)
                Label_Data.CALLSIGN_STRING = Target_Data.ACID_Mode_S;

            Label_Data.MyTargetIndex = Target_Data.TrackNumber;

            // At the end move extended lable data to the marker, so it is ready for dynamic manipulation by the client
            Label_Data.Mode_S_Addr = Target_Data.Mode_S_Addr;
            Label_Data.TRK = Target_Data.TRK;
            Label_Data.DAP_HDG = Target_Data.DAP_HDG;
            Label_Data.CALC_HDG_STRING = Target_Data.CALC_HDG;
            Label_Data.IAS = Target_Data.IAS;
            Label_Data.MACH = Target_Data.MACH;
            Label_Data.TAS = Target_Data.TAS;
            Label_Data.CALC_GSPD_STRING = Target_Data.CALC_GSPD;
            Label_Data.DAP_GSPD = Target_Data.DAP_GSPD;
            Label_Data.Roll_Angle = Target_Data.Roll_Ang;
            Label_Data.SelectedAltitude_ShortTerm = Target_Data.SelectedAltitude_ShortTerm;
            Label_Data.SelectedAltitude_LongTerm = Target_Data.SelectedAltitude_LongTerm;
            Label_Data.Rate_Of_Climb = Target_Data.Rate_Of_Climb;
            Label_Data.Barometric_Setting = Target_Data.Barometric_Setting;

            // Set STCA parameters
            foreach (STCA_Target_Item STCA_Item in Target_Data.STCA_List)
                Label_Data.STCA_List.Add(STCA_Item);
        }
 public void AddNewTarget(DynamicDisplayBuilder.TargetType NewTarget)
 {
     TargetList.Add(NewTarget);
 }
コード例 #4
0
ファイル: FrmMain.cs プロジェクト: akapetanovic/MUAC
        private void Update_PlotTrack_Data()
        {
            if (this.checkEnableDisplay.Checked == true)
            {

                // First clear all the data from the previous cycle.
                if (DinamicOverlay.Markers.Count > 0)
                    DinamicOverlay.Markers.Clear();

                if (PredictionOverlay.Markers.Count > 0)
                    PredictionOverlay.Markers.Clear();

                // Now get the data since the last cycle and display it on the map
                DynamicDisplayBuilder DP = new DynamicDisplayBuilder();
                System.Collections.Generic.List<DynamicDisplayBuilder.TargetType> TargetList = new System.Collections.Generic.List<DynamicDisplayBuilder.TargetType>();

                // Here handle display od live data
                if (SharedData.bool_Listen_for_Data == true)
                {
                    DynamicDisplayBuilder.GetDisplayData(false, out TargetList);

                    if (FirstCycleDisplayEnabled)
                    {
                        FirstCycleDisplayEnabled = false;
                        TargetList.Clear();
                    }

                    this.lblNumberofTargets.Text = TargetList.Count.ToString();

                    bool Build_Local_Display = comboBoxLiveDisplayMode.Text != "Google Earth";
                    bool Provide_To_Google_Earth = comboBoxLiveDisplayMode.Text != "Local";
                    bool ProvideWebData = comboBoxLiveDisplayMode.Text == "Local & Web" || comboBoxLiveDisplayMode.Text == "Web";
                    Asterix_To_KML_Provider ASTX_TO_KML = new Asterix_To_KML_Provider();
                    WBTD WebBasedDisplayProvider = new WBTD();
                    PredictionBuilder Prediction_B = new PredictionBuilder();

                    try
                    {
                        foreach (DynamicDisplayBuilder.TargetType Target in TargetList)
                        {
                            if (Passes_Check_For_Flight_Level_Filter(Target.ModeC))
                            {
                                // If SSR code filtering is to be applied
                                if (this.checkBoxFilterBySSR.Checked == true && (this.textBoxSSRCode.Text.Length == 4))
                                {
                                    if (Target.ModeA == this.textBoxSSRCode.Text)
                                    {
                                        Target.MyMarker.ToolTipMode = MarkerTooltipMode.Never;
                                        Target.MyMarker.Position = new PointLatLng(Target.Lat, Target.Lon);
                                        BuildDynamicLabelText(Target, ref Target.MyMarker);
                                        SetLabelAttributes(ref Target.MyMarker);

                                        if (Build_Local_Display)
                                        {
                                            DinamicOverlay.Markers.Add(Target.MyMarker);

                                            if (SharedData.Prediction1_Enabled)
                                                Prediction_B.Build_Prediction_Marker(Target.MyMarker.Position, Target.MyMarker.CALLSIGN_STRING, MySqlProvider.PredictionTableNumberType.One, ref PredictionOverlay);

                                            if (SharedData.Prediction2_Enabled)
                                                Prediction_B.Build_Prediction_Marker(Target.MyMarker.Position, Target.MyMarker.CALLSIGN_STRING, MySqlProvider.PredictionTableNumberType.Two, ref PredictionOverlay);

                                            if (SharedData.Prediction3_Enabled)
                                                Prediction_B.Build_Prediction_Marker(Target.MyMarker.Position, Target.MyMarker.CALLSIGN_STRING, MySqlProvider.PredictionTableNumberType.Three, ref PredictionOverlay);

                                        }

                                        if (Provide_To_Google_Earth)
                                            ASTX_TO_KML.AddNewTarget(Target);

                                        if (ProvideWebData)
                                            WebBasedDisplayProvider.SetTargetData(Target.Lat.ToString(), Target.Lon.ToString(), Target.ACID_Mode_S,
                                                Target.ModeA, Target.ModeC);
                                    }
                                }
                                else // No SSR filter so just display all of them
                                {
                                    Target.MyMarker.ToolTipMode = MarkerTooltipMode.Never;
                                    Target.MyMarker.Position = new PointLatLng(Target.Lat, Target.Lon);
                                    BuildDynamicLabelText(Target, ref Target.MyMarker);
                                    SetLabelAttributes(ref Target.MyMarker);

                                    if (Build_Local_Display)
                                    {
                                        DinamicOverlay.Markers.Add(Target.MyMarker);

                                        if (SharedData.Prediction1_Enabled)
                                            Prediction_B.Build_Prediction_Marker(Target.MyMarker.Position, Target.MyMarker.CALLSIGN_STRING, MySqlProvider.PredictionTableNumberType.One, ref PredictionOverlay);

                                        if (SharedData.Prediction2_Enabled)
                                            Prediction_B.Build_Prediction_Marker(Target.MyMarker.Position, Target.MyMarker.CALLSIGN_STRING, MySqlProvider.PredictionTableNumberType.Two, ref PredictionOverlay);

                                        if (SharedData.Prediction3_Enabled)
                                            Prediction_B.Build_Prediction_Marker(Target.MyMarker.Position, Target.MyMarker.CALLSIGN_STRING, MySqlProvider.PredictionTableNumberType.Three, ref PredictionOverlay);
                                    }

                                    if (Provide_To_Google_Earth)
                                        ASTX_TO_KML.AddNewTarget(Target);

                                    if (ProvideWebData)
                                        WebBasedDisplayProvider.SetTargetData(Target.Lat.ToString(), Target.Lon.ToString(), Target.ACID_Mode_S,
                                           Target.ModeA, Target.ModeC);
                                }
                            }
                        }
                    }
                    catch
                    {

                    }

                    Cursor.Position = new Point(Cursor.Position.X + 1, Cursor.Position.Y);
                    Cursor.Position = new Point(Cursor.Position.X - 1, Cursor.Position.Y);

                    // Check if there were any items, if so then tell KML to build the file
                    if (Provide_To_Google_Earth)
                        ASTX_TO_KML.BuildKML();

                    if (ProvideWebData)
                        WebBasedDisplayProvider.WriteTrackData();

                }
                else // Here handle display of passive display (buffered data)
                {
                    DynamicDisplayBuilder.GetDisplayData(true, out TargetList);

                    this.lblNumberofTargets.Text = TargetList.Count.ToString();

                    foreach (DynamicDisplayBuilder.TargetType Target in TargetList)
                    {
                        if (Passes_Check_For_Flight_Level_Filter(Target.ModeC))
                        {
                            // If SSR code filtering is to be applied
                            if (this.checkBoxFilterBySSR.Checked == true && (this.comboBoxSSRFilterBox.Items.Count > 0))
                            {
                                if (Target.ModeA == this.comboBoxSSRFilterBox.Items[SSR_Filter_Last_Index].ToString())
                                {
                                    GMap.NET.WindowsForms.Markers.GMapMarkerCross MyMarker = new GMap.NET.WindowsForms.Markers.GMapMarkerCross(new PointLatLng(Target.Lat, Target.Lon));
                                    MyMarker.ToolTipMode = MarkerTooltipMode.Always;
                                    MyMarker.ToolTipText = BuildPassiveLabelText(Target);
                                    SetLabelAttributes(ref MyMarker);
                                    DinamicOverlay.Markers.Add(MyMarker);
                                }
                            }
                            else // No filter so just display all of them
                            {
                                GMap.NET.WindowsForms.Markers.GMapMarkerCross MyMarker = new GMap.NET.WindowsForms.Markers.GMapMarkerCross(new PointLatLng(Target.Lat, Target.Lon));
                                MyMarker.ToolTipMode = MarkerTooltipMode.Always;
                                MyMarker.ToolTipText = BuildPassiveLabelText(Target);
                                SetLabelAttributes(ref MyMarker);
                                DinamicOverlay.Markers.Add(MyMarker);
                            }
                        }
                    }
                }
            }
        }
コード例 #5
0
        // This method takes in two Target Positions and determines if horizontal
        // separation is infringed. The first parameter is passed by reference as
        // the method will, in the case it determines that separation is infringed
        // set appropriate inication in the passed in Target. It actually sets all
        // items in the STCA_List
        private static void Check_And_Set_Horizontal_Infringed(ref DynamicDisplayBuilder.TargetType T1, DynamicDisplayBuilder.TargetType T2)
        {
            ////////////////////////////////////////////////////////////////////////////////////////////////
            // First extract and validate all the data
            //
            GlobalPosition Track_1_Pos = new GlobalPosition(new GlobalCoordinates(T1.Lat, T1.Lon));
            GlobalPosition Track_2_Pos = new GlobalPosition(new GlobalCoordinates(T2.Lat, T2.Lon));
            bool DataValid = false;
            double Track_1_SPD;
            double Track_2_SPD;
            double Track_1_TRK;
            double Track_2_TRK;

            if (!double.TryParse(T1.CALC_GSPD, out Track_1_SPD))
                DataValid = false;
            if (!double.TryParse(T2.CALC_GSPD, out Track_2_SPD))
                DataValid = false;
            if (!double.TryParse(T1.TRK, out Track_1_TRK))
            {
                if (!double.TryParse(T1.DAP_HDG, out Track_1_TRK))
                    DataValid = false;
            }
            if (!double.TryParse(T2.TRK, out Track_2_TRK))
            {
                if (!double.TryParse(T2.DAP_HDG, out Track_2_TRK))
                    DataValid = false;
            }

            // Data validated
            if (DataValid)
            {
                // select a reference elllipsoid
                Ellipsoid reference = Ellipsoid.WGS84;
                // instantiate the calculator
                GeodeticCalculator geoCalc = new GeodeticCalculator();
                // Used to calculate the time to the min distance
                GlobalPosition Track_1 = new GlobalPosition(new GlobalCoordinates(Track_1_Pos.Latitude, Track_1_Pos.Longitude));
                GlobalPosition Track_2 = new GlobalPosition(new GlobalCoordinates(Track_2_Pos.Latitude, Track_2_Pos.Longitude));

                ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
                // First check if the two targets are already in separation violation status.
                // If so, then add the STCA items to the STCA pair target
                double DistanceToTravel = geoCalc.CalculateGeodeticMeasurement(reference, Track_1, Track_2).PointToPointDistance;
                DistanceToTravel = DistanceToTravel * 0.00053996; // Convert to nautical miles

                if (DistanceToTravel < Min_Horizontal_Separation_Nm)
                {
                    STCA_Target_Item STCA_Item = new STCA_Target_Item();
                    STCA_Item.CurrentDistance = DistanceToTravel;
                    STCA_Item.STCA_Partner = T2.TrackNumber;
                    STCA_Item.STCA_Status = STCA_Status_Type.Violation;
                    STCA_Item.TimeToImpact_Sec = 10;
                    STCA_Item.TimeToConflictSec = 0;
                    T1.STCA_List.Add(STCA_Item);
                }

                // No they are not, then check if the two targets are going to be in
                // the separation violation status a parameter set time in the future
                // This is so called "violation prediction status"

            }
        }