GetDegMinSec() public method

public GetDegMinSec ( ) : LatLongDegMinSec
return LatLongDegMinSec
Example #1
0
        private void PopulateForm()
        {
            // Populate the display origin
            GeoCordSystemDegMinSecUtilities.LatLongClass LatLon = new GeoCordSystemDegMinSecUtilities.LatLongClass(SystemAdaptationDataSet.SystemOriginPoint.Lat, SystemAdaptationDataSet.SystemOriginPoint.Lng);
            this.txtLatDDD.Text = LatLon.GetDegMinSec().Latitude.Deg.ToString();
            this.txtLatMM.Text  = LatLon.GetDegMinSec().Latitude.Min.ToString();
            int Int_Sec = (int)LatLon.GetDegMinSec().Latitude.Sec;

            this.txtLatSS.Text = Int_Sec.ToString();
            if (LatLon.GetDegMinSec().Latitude.Prefix == GeoCordSystemDegMinSecUtilities.LatLongPrefix.N)
            {
                this.comboBoxLatDirection.SelectedIndex = 0;
            }
            else
            {
                this.comboBoxLatDirection.SelectedIndex = 1;
            }

            this.txtLonDDD.Text = LatLon.GetDegMinSec().Longitude.Deg.ToString();
            this.txtLonMM.Text  = LatLon.GetDegMinSec().Longitude.Min.ToString();
            Int_Sec             = (int)LatLon.GetDegMinSec().Longitude.Sec;
            this.txtLonSS.Text  = Int_Sec.ToString();
            if (LatLon.GetDegMinSec().Longitude.Prefix == GeoCordSystemDegMinSecUtilities.LatLongPrefix.E)
            {
                this.comboBoxLonDirection.SelectedIndex = 0;
            }
            else
            {
                this.comboBoxLonDirection.SelectedIndex = 1;
            }

            // Load all display items and set it to the first one in the list
            // and it will cause the selected index to change that will then trigger
            // a call to sync data function
            foreach (DisplayAttributes.DisplayAttributesType DataItem in DisplayAttributes.GetAllDisplayAttributes())
            {
                if (DataItem.ItemName != "BackgroundColor")
                {
                    comboBoxDataItem.Items.Add(DataItem.ItemName);
                }
            }

            // Background Color
            Type colorType = typeof(System.Drawing.Color);

            PropertyInfo[] propInfoList = colorType.GetProperties(BindingFlags.Static |
                                                                  BindingFlags.DeclaredOnly | BindingFlags.Public);
            foreach (PropertyInfo c in propInfoList)
            {
                this.comboBoxBackgroundColor.Items.Add(c.Name);
            }

            // Now set the index of the background color to the currently set background color.
            this.comboBoxBackgroundColor.SelectedIndex =
                this.comboBoxBackgroundColor.FindStringExact(DisplayAttributes.GetDisplayAttribute(DisplayAttributes.DisplayItemsType.BackgroundColor).TextColor.Name);

            /////////////////////////////////////////////////////////////
            // TEXT ATTRIBUTES
            /////////////////////////////////////////////////////////////

            // Text Attributes Color
            foreach (PropertyInfo c in propInfoList)
            {
                this.comboBoxTextColorChoice.Items.Add(c.Name);
            }

            // Text Attributes Font
            FontFamily[] ffArray = FontFamily.Families;
            foreach (FontFamily ff in ffArray)
            {
                this.comboBoxTextFontChoice.Items.Add(ff.Name);
            }

            for (int Index = 0; Index < this.comboBoxTextFontChoice.Items.Count; Index++)
            {
                try { Font TestFOnt = new Font(this.comboBoxTextFontChoice.Items[Index].ToString(), 7); }
                catch { this.comboBoxTextFontChoice.Items.RemoveAt(Index); }
            }

            /////////////////////////////////////////////////////////////
            // LINE ATTRIBUTES
            /////////////////////////////////////////////////////////////

            // Line Attributes Color
            foreach (PropertyInfo c in propInfoList)
            {
                this.comboBoxLineColorChoice.Items.Add(c.Name);
            }

            // Line Attributes Type
            // Hard coded


            /////////////////////////////////////////////////////////////
            // AREA/POLYGON ATTRIBUTES
            /////////////////////////////////////////////////////////////

            // Area/Polygon Attributes
            foreach (PropertyInfo c in propInfoList)
            {
                this.comboBoxAreaPolygonColorChoice.Items.Add(c.Name);
            }

            /////////////////////////////////////////////////////////////
            // IMAGE ATTRIBUTES
            /////////////////////////////////////////////////////////////

            // Now set index to the first display item
            this.comboBoxDataItem.SelectedIndex = 0;
        }
        public static void Save()
        {
            string BackgroundColor = "Black";
            //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
            // HANLDE Display Attributes First
            //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
            string FileName;
            FileName = @"C:\ASTERIX\ADAPTATION\DisplayAttributes.txt";
            DisplayAttributes.DisplayAttributesType DisplayAttribute = new DisplayAttributes.DisplayAttributesType();
            string DisplayAttributesStream = "#ITEM_NAME,TEXT_SIZE,TEXT_FONT,TEXT_COLOR,LINE_WIDTH,LINE_COLOR,LINE_STYLE,AREA_COLOR,IMAGE_SIZE" + Environment.NewLine;

            System.Collections.Generic.List<DisplayAttributes.DisplayAttributesType> AllDisplayAtributes = DisplayAttributes.GetAllDisplayAttributes();

            foreach (DisplayAttributes.DisplayAttributesType DataItem in DisplayAttributes.GetAllDisplayAttributes())
            {
                if (DataItem.ItemName != "BackgroundColor")
                {
                    DisplayAttributesStream = DisplayAttributesStream + DataItem.ItemName + ',';
                    DisplayAttributesStream = DisplayAttributesStream + DataItem.TextSize.ToString() + ',';
                    DisplayAttributesStream = DisplayAttributesStream + DataItem.TextFont.Name + ',';
                    DisplayAttributesStream = DisplayAttributesStream + DataItem.TextColor.Name + ',';
                    DisplayAttributesStream = DisplayAttributesStream + DataItem.LineWidth.ToString() + ',';
                    DisplayAttributesStream = DisplayAttributesStream + DataItem.LineColor.Name + ',';
                    DisplayAttributesStream = DisplayAttributesStream + DataItem.LineStyle.ToString() + ',';
                    DisplayAttributesStream = DisplayAttributesStream + DataItem.AreaPolygonColor.Name + ',';
                    DisplayAttributesStream = DisplayAttributesStream + DataItem.ImageSize.Width.ToString() + ',';
                    DisplayAttributesStream = DisplayAttributesStream + DataItem.ImageSize.Height.ToString() + Environment.NewLine;
                }
                else
                {
                    BackgroundColor = DataItem.TextColor.Name;
                }
            }

            // Remove the last character, which is the new line.
            DisplayAttributesStream.Remove(DisplayAttributesStream.Length - 1);

            // create a writer and open the file
            TextWriter tw = new StreamWriter(FileName);

            try
            {
                // write a line of text to the file
                tw.Write(DisplayAttributesStream);
                MessageBox.Show("DisplayAttributes succefully saved");
            }
            catch (System.IO.IOException e)
            {
                MessageBox.Show(e.Message);
            }

            // close the stream
            tw.Close();

            //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
            // HANLDE MainSettings First
            //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

            FileName = @"C:\ASTERIX\ADAPTATION\Main_Settings.txt";
            DisplayAttributesStream = "# System center is : Deg (int), Min (int), Sec (int), Prefix (E/W/N/S)" + Environment.NewLine;

            GeoCordSystemDegMinSecUtilities.LatLongClass LatLon = new GeoCordSystemDegMinSecUtilities.LatLongClass(SystemAdaptationDataSet.SystemOriginPoint.Lat, SystemAdaptationDataSet.SystemOriginPoint.Lng);
            int Int_Lat_Sec = (int)LatLon.GetDegMinSec().Latitude.Sec;
            string LatPrefix = "N";
            if (LatLon.GetDegMinSec().Latitude.Prefix == GeoCordSystemDegMinSecUtilities.LatLongPrefix.S)
                LatPrefix = "S";
            int Int_Lon_Sec = (int)LatLon.GetDegMinSec().Longitude.Sec;
            string LonPrefix = "E";
            if (LatLon.GetDegMinSec().Longitude.Prefix == GeoCordSystemDegMinSecUtilities.LatLongPrefix.W)
                LonPrefix = "W";

            // 44,6,0,N,20,0,0,E
            DisplayAttributesStream = DisplayAttributesStream + "SYS_ORIGIN," +
                LatLon.GetDegMinSec().Latitude.Deg.ToString() + ',' + LatLon.GetDegMinSec().Latitude.Min.ToString() + ',' + Int_Lat_Sec.ToString() + ',' + LatPrefix + ',' +
                LatLon.GetDegMinSec().Longitude.Deg.ToString() + ',' + LatLon.GetDegMinSec().Longitude.Min.ToString() + ',' + Int_Lon_Sec.ToString() + ',' + LonPrefix +
                Environment.NewLine; ;

            DisplayAttributesStream = DisplayAttributesStream + "BACKGROUND," + BackgroundColor;

            // create a writer and open the file
            tw = new StreamWriter(FileName);

            try
            {
                // write a line of text to the file
                tw.Write(DisplayAttributesStream);
                MessageBox.Show("Main_Settings succefully saved");
            }
            catch (System.IO.IOException e)
            {
                MessageBox.Show(e.Message);
            }

            // close the stream
            tw.Close();
        }
Example #3
0
        public static void Save()
        {
            string BackgroundColor = "Black";
            //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
            // HANLDE Display Attributes First
            //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
            string FileName;

            FileName = @"C:\ASTERIX\ADAPTATION\DisplayAttributes.txt";
            DisplayAttributes.DisplayAttributesType DisplayAttribute = new DisplayAttributes.DisplayAttributesType();
            string DisplayAttributesStream = "#ITEM_NAME,TEXT_SIZE,TEXT_FONT,TEXT_COLOR,LINE_WIDTH,LINE_COLOR,LINE_STYLE,AREA_COLOR,IMAGE_SIZE" + Environment.NewLine;

            System.Collections.Generic.List <DisplayAttributes.DisplayAttributesType> AllDisplayAtributes = DisplayAttributes.GetAllDisplayAttributes();

            foreach (DisplayAttributes.DisplayAttributesType DataItem in DisplayAttributes.GetAllDisplayAttributes())
            {
                if (DataItem.ItemName != "BackgroundColor")
                {
                    DisplayAttributesStream = DisplayAttributesStream + DataItem.ItemName + ',';
                    DisplayAttributesStream = DisplayAttributesStream + DataItem.TextSize.ToString() + ',';
                    DisplayAttributesStream = DisplayAttributesStream + DataItem.TextFont.Name + ',';
                    DisplayAttributesStream = DisplayAttributesStream + DataItem.TextColor.Name + ',';
                    DisplayAttributesStream = DisplayAttributesStream + DataItem.LineWidth.ToString() + ',';
                    DisplayAttributesStream = DisplayAttributesStream + DataItem.LineColor.Name + ',';
                    DisplayAttributesStream = DisplayAttributesStream + DataItem.LineStyle.ToString() + ',';
                    DisplayAttributesStream = DisplayAttributesStream + DataItem.AreaPolygonColor.Name + ',';
                    DisplayAttributesStream = DisplayAttributesStream + DataItem.ImageSize.Width.ToString() + ',';
                    DisplayAttributesStream = DisplayAttributesStream + DataItem.ImageSize.Height.ToString() + Environment.NewLine;
                }
                else
                {
                    BackgroundColor = DataItem.TextColor.Name;
                }
            }

            // Remove the last character, which is the new line.
            DisplayAttributesStream.Remove(DisplayAttributesStream.Length - 1);

            // create a writer and open the file
            TextWriter tw = new StreamWriter(FileName);

            try
            {
                // write a line of text to the file
                tw.Write(DisplayAttributesStream);
                MessageBox.Show("DisplayAttributes succefully saved");
            }
            catch (System.IO.IOException e)
            {
                MessageBox.Show(e.Message);
            }

            // close the stream
            tw.Close();


            //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
            // HANLDE MainSettings First
            //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

            FileName = @"C:\ASTERIX\ADAPTATION\Main_Settings.txt";
            DisplayAttributesStream = "# System center is : Deg (int), Min (int), Sec (int), Prefix (E/W/N/S)" + Environment.NewLine;

            GeoCordSystemDegMinSecUtilities.LatLongClass LatLon = new GeoCordSystemDegMinSecUtilities.LatLongClass(SystemAdaptationDataSet.SystemOriginPoint.Lat, SystemAdaptationDataSet.SystemOriginPoint.Lng);
            int    Int_Lat_Sec = (int)LatLon.GetDegMinSec().Latitude.Sec;
            string LatPrefix   = "N";

            if (LatLon.GetDegMinSec().Latitude.Prefix == GeoCordSystemDegMinSecUtilities.LatLongPrefix.S)
            {
                LatPrefix = "S";
            }
            int    Int_Lon_Sec = (int)LatLon.GetDegMinSec().Longitude.Sec;
            string LonPrefix   = "E";

            if (LatLon.GetDegMinSec().Longitude.Prefix == GeoCordSystemDegMinSecUtilities.LatLongPrefix.W)
            {
                LonPrefix = "W";
            }

            // 44,6,0,N,20,0,0,E
            DisplayAttributesStream = DisplayAttributesStream + "SYS_ORIGIN," +
                                      LatLon.GetDegMinSec().Latitude.Deg.ToString() + ',' + LatLon.GetDegMinSec().Latitude.Min.ToString() + ',' + Int_Lat_Sec.ToString() + ',' + LatPrefix + ',' +
                                      LatLon.GetDegMinSec().Longitude.Deg.ToString() + ',' + LatLon.GetDegMinSec().Longitude.Min.ToString() + ',' + Int_Lon_Sec.ToString() + ',' + LonPrefix +
                                      Environment.NewLine;;

            DisplayAttributesStream = DisplayAttributesStream + "BACKGROUND," + BackgroundColor;

            // create a writer and open the file
            tw = new StreamWriter(FileName);

            try
            {
                // write a line of text to the file
                tw.Write(DisplayAttributesStream);
                MessageBox.Show("Main_Settings succefully saved");
            }
            catch (System.IO.IOException e)
            {
                MessageBox.Show(e.Message);
            }

            // close the stream
            tw.Close();
        }
        private void PopulateForm()
        {
            // Populate the display origin
            GeoCordSystemDegMinSecUtilities.LatLongClass LatLon = new GeoCordSystemDegMinSecUtilities.LatLongClass(SystemAdaptationDataSet.SystemOriginPoint.Lat, SystemAdaptationDataSet.SystemOriginPoint.Lng);
            this.txtLatDDD.Text = LatLon.GetDegMinSec().Latitude.Deg.ToString();
            this.txtLatMM.Text = LatLon.GetDegMinSec().Latitude.Min.ToString();
            int Int_Sec = (int)LatLon.GetDegMinSec().Latitude.Sec;
            this.txtLatSS.Text = Int_Sec.ToString();
            if (LatLon.GetDegMinSec().Latitude.Prefix == GeoCordSystemDegMinSecUtilities.LatLongPrefix.N)
                this.comboBoxLatDirection.SelectedIndex = 0;
            else
                this.comboBoxLatDirection.SelectedIndex = 1;

            this.txtLonDDD.Text = LatLon.GetDegMinSec().Longitude.Deg.ToString();
            this.txtLonMM.Text = LatLon.GetDegMinSec().Longitude.Min.ToString();
            Int_Sec = (int)LatLon.GetDegMinSec().Longitude.Sec;
            this.txtLonSS.Text = Int_Sec.ToString();
            if (LatLon.GetDegMinSec().Longitude.Prefix == GeoCordSystemDegMinSecUtilities.LatLongPrefix.E)
                this.comboBoxLonDirection.SelectedIndex = 0;
            else
                this.comboBoxLonDirection.SelectedIndex = 1;

            // Load all display items and set it to the first one in the list
            // and it will cause the selected index to change that will then trigger
            // a call to sync data function
            foreach (DisplayAttributes.DisplayAttributesType DataItem in DisplayAttributes.GetAllDisplayAttributes())
                if (DataItem.ItemName != "BackgroundColor")
                    comboBoxDataItem.Items.Add(DataItem.ItemName);

            // Background Color
            Type colorType = typeof(System.Drawing.Color);
            PropertyInfo[] propInfoList = colorType.GetProperties(BindingFlags.Static |
                                          BindingFlags.DeclaredOnly | BindingFlags.Public);
            foreach (PropertyInfo c in propInfoList)
                this.comboBoxBackgroundColor.Items.Add(c.Name);

            // Now set the index of the background color to the currently set background color.
            this.comboBoxBackgroundColor.SelectedIndex =
                this.comboBoxBackgroundColor.FindStringExact(DisplayAttributes.GetDisplayAttribute(DisplayAttributes.DisplayItemsType.BackgroundColor).TextColor.Name);

            /////////////////////////////////////////////////////////////
            // TEXT ATTRIBUTES
            /////////////////////////////////////////////////////////////

            // Text Attributes Color
            foreach (PropertyInfo c in propInfoList)
                this.comboBoxTextColorChoice.Items.Add(c.Name);

            // Text Attributes Font
            FontFamily[] ffArray = FontFamily.Families;
            foreach (FontFamily ff in ffArray)
                this.comboBoxTextFontChoice.Items.Add(ff.Name);

            for (int Index = 0; Index < this.comboBoxTextFontChoice.Items.Count; Index++)
            {
                try { Font TestFOnt = new Font(this.comboBoxTextFontChoice.Items[Index].ToString(), 7); }
                catch { this.comboBoxTextFontChoice.Items.RemoveAt(Index); }
            }

            /////////////////////////////////////////////////////////////
            // LINE ATTRIBUTES
            /////////////////////////////////////////////////////////////

            // Line Attributes Color
            foreach (PropertyInfo c in propInfoList)
                this.comboBoxLineColorChoice.Items.Add(c.Name);

            // Line Attributes Type
            // Hard coded

            /////////////////////////////////////////////////////////////
            // AREA/POLYGON ATTRIBUTES
            /////////////////////////////////////////////////////////////

            // Area/Polygon Attributes
            foreach (PropertyInfo c in propInfoList)
                this.comboBoxAreaPolygonColorChoice.Items.Add(c.Name);

            /////////////////////////////////////////////////////////////
            // IMAGE ATTRIBUTES
            /////////////////////////////////////////////////////////////

            // Now set index to the first display item
            this.comboBoxDataItem.SelectedIndex = 0;
        }