SetDisplayAttribute() public static method

public static SetDisplayAttribute ( DisplayItemsType Item, DisplayAttributesType Attribute ) : void
Item DisplayItemsType
Attribute DisplayAttributesType
return void
Ejemplo n.º 1
0
        public static void Load()
        {
            string DisplayAdaptationDataLine;
            string FileName;

            char[]       delimiterChars = { ',', '\t' };
            StreamReader MyStreamReader;

            FileName = @"C:\ASTERIX\ADAPTATION\DisplayAttributes.txt";

            if (System.IO.File.Exists(FileName))
            {
                MyStreamReader = System.IO.File.OpenText(FileName);
                while (MyStreamReader.Peek() >= 0)
                {
                    DisplayAdaptationDataLine = MyStreamReader.ReadLine();
                    string[] words = DisplayAdaptationDataLine.Split(delimiterChars);
                    if (words[0][0] != '#')
                    {
                        DisplayAttributes.DisplayAttributesType DisplayAttribute = new DisplayAttributes.DisplayAttributesType();

                        DisplayAttribute.ItemName         = words[0];
                        DisplayAttribute.TextSize         = int.Parse(words[1]);
                        DisplayAttribute.TextFont         = new FontFamily(words[2]);
                        DisplayAttribute.TextColor        = Color.FromName(words[3]);
                        DisplayAttribute.LineWidth        = int.Parse(words[4]);
                        DisplayAttribute.LineColor        = Color.FromName(words[5]);
                        DisplayAttribute.LineStyle        = DisplayAttributes.GetLineStypefromString(words[6]);
                        DisplayAttribute.AreaPolygonColor = Color.FromName(words[7]);
                        DisplayAttribute.ImageSize        = new Size(int.Parse(words[8]), int.Parse((words[9])));
                        DisplayAttributes.SetDisplayAttribute((DisplayAttributes.DisplayItemsType)Enum.Parse(typeof(DisplayAttributes.DisplayItemsType), DisplayAttribute.ItemName, true), DisplayAttribute);
                    }
                }
            }
        }
Ejemplo n.º 2
0
        private void btnUpdate_Click(object sender, EventArgs e)
        {
            DisplayAttributes.DisplayAttributesType NewDisplayAttribute = new DisplayAttributes.DisplayAttributesType();
            NewDisplayAttribute.ItemName  = this.comboBoxDataItem.Text;
            NewDisplayAttribute.TextSize  = int.Parse(this.comboBoxTextSizeChoice.Text);
            NewDisplayAttribute.TextFont  = new FontFamily(this.comboBoxTextFontChoice.Text);
            NewDisplayAttribute.TextColor = Color.FromName(this.comboBoxTextColorChoice.Text);
            NewDisplayAttribute.LineWidth = int.Parse(this.comboBoxLineWidth.Text);
            NewDisplayAttribute.LineColor = Color.FromName(this.comboBoxLineColorChoice.Text);
            NewDisplayAttribute.LineStyle = DisplayAttributes.GetLineStypefromString(this.comboBoxLineStyleChoice.Text);

            NewDisplayAttribute.AreaPolygonColor = Color.FromName(this.comboBoxAreaPolygonColorChoice.Text);
            NewDisplayAttribute.ImageSize        = new Size((int)this.numericUpDown_X.Value, (int)this.numericUpDown_Y.Value);
            DisplayAttributes.SetDisplayAttribute((DisplayAttributes.DisplayItemsType)Enum.Parse(typeof(DisplayAttributes.DisplayItemsType), NewDisplayAttribute.ItemName, true), NewDisplayAttribute);

            // Always update the background color as well
            NewDisplayAttribute           = new DisplayAttributes.DisplayAttributesType();
            NewDisplayAttribute.TextColor = Color.FromName(this.comboBoxBackgroundColor.Text);
            NewDisplayAttribute.ItemName  = "BackgroundColor";
            DisplayAttributes.SetDisplayAttribute(DisplayAttributes.DisplayItemsType.BackgroundColor, NewDisplayAttribute);

            // Populate the display origin
            GeoCordSystemDegMinSecUtilities.LatLongPrefix LatPrefix;
            GeoCordSystemDegMinSecUtilities.LatLongPrefix LoNPrefix;

            if (this.comboBoxLatDirection.SelectedIndex == 0)
            {
                LatPrefix = GeoCordSystemDegMinSecUtilities.LatLongPrefix.N;
            }
            else
            {
                LatPrefix = GeoCordSystemDegMinSecUtilities.LatLongPrefix.W;
            }

            if (this.comboBoxLonDirection.SelectedIndex == 0)
            {
                LoNPrefix = GeoCordSystemDegMinSecUtilities.LatLongPrefix.E;
            }
            else
            {
                LoNPrefix = GeoCordSystemDegMinSecUtilities.LatLongPrefix.S;
            }

            GeoCordSystemDegMinSecUtilities.LatLongClass LatLon =
                new GeoCordSystemDegMinSecUtilities.LatLongClass(int.Parse(this.txtLatDDD.Text), int.Parse(this.txtLatMM.Text), int.Parse(this.txtLatSS.Text), LatPrefix,
                                                                 int.Parse(this.txtLonDDD.Text), int.Parse(this.txtLonMM.Text), int.Parse(this.txtLonSS.Text), LoNPrefix);

            SystemAdaptationDataSet.SystemOrigin = new GMap.NET.PointLatLng(LatLon.GetLatLongDecimal().LatitudeDecimal, LatLon.GetLatLongDecimal().LongitudeDecimal);
        }
Ejemplo n.º 3
0
        public static void Load()
        {
            string ConfigurationData;
            string FileName;

            char[]       delimiterChars = { ',', '\t' };
            StreamReader MyStreamReader;

            string ItemName;
            int    LatDeg;
            int    LatMin;
            int    LatSec;

            GeoCordSystemDegMinSecUtilities.LatLongPrefix LatPrefix;
            int LonDeg;
            int LonMin;
            int LonSec;

            GeoCordSystemDegMinSecUtilities.LatLongPrefix LonPrefix;

            /////////////////////////////////////////////////////////////////////////
            // First set the system origin
            /////////////////////////////////////////////////////////////////////////
            FileName = @"C:\ASTERIX\ADAPTATION\Main_Settings.txt";
            Exception Bad_Main_Settings = new Exception("Bad Main_Settings.txt file");

            if (System.IO.File.Exists(FileName))
            {
                MyStreamReader = System.IO.File.OpenText(FileName);
                while (MyStreamReader.Peek() >= 0)
                {
                    ConfigurationData = MyStreamReader.ReadLine();
                    string[] words = ConfigurationData.Split(delimiterChars);
                    if (words[0][0] != '#')
                    {
                        switch (words[0])
                        {
                        case "SYS_ORIGIN":
                            ItemName = words[0];

                            // Get Latitude
                            if (int.TryParse(words[1], out LatDeg) == false)
                            {
                                throw Bad_Main_Settings;
                            }
                            if (int.TryParse(words[2], out LatMin) == false)
                            {
                                throw Bad_Main_Settings;
                            }
                            if (int.TryParse(words[3], out LatSec) == false)
                            {
                                throw Bad_Main_Settings;
                            }

                            switch (words[4])
                            {
                            case "E":
                                LatPrefix = GeoCordSystemDegMinSecUtilities.LatLongPrefix.E;
                                break;

                            case "W":
                                LatPrefix = GeoCordSystemDegMinSecUtilities.LatLongPrefix.W;
                                break;

                            case "N":
                                LatPrefix = GeoCordSystemDegMinSecUtilities.LatLongPrefix.N;
                                break;

                            case "S":
                                LatPrefix = GeoCordSystemDegMinSecUtilities.LatLongPrefix.S;
                                break;

                            default:
                                throw Bad_Main_Settings;
                            }

                            // Get Longitude
                            if (int.TryParse(words[5], out LonDeg) == false)
                            {
                                throw Bad_Main_Settings;
                            }
                            if (int.TryParse(words[6], out LonMin) == false)
                            {
                                throw Bad_Main_Settings;
                            }
                            if (int.TryParse(words[7], out LonSec) == false)
                            {
                                throw Bad_Main_Settings;
                            }

                            switch (words[8])
                            {
                            case "E":
                                LonPrefix = GeoCordSystemDegMinSecUtilities.LatLongPrefix.E;
                                break;

                            case "W":
                                LonPrefix = GeoCordSystemDegMinSecUtilities.LatLongPrefix.W;
                                break;

                            case "N":
                                LonPrefix = GeoCordSystemDegMinSecUtilities.LatLongPrefix.N;
                                break;

                            case "S":
                                LonPrefix = GeoCordSystemDegMinSecUtilities.LatLongPrefix.S;
                                break;

                            default:
                                throw Bad_Main_Settings;
                            }

                            GeoCordSystemDegMinSecUtilities.LatLongClass T = new GeoCordSystemDegMinSecUtilities.LatLongClass(LatDeg, LatMin, LatSec,
                                                                                                                              LatPrefix, LonDeg, LonMin, LonSec, LonPrefix);
                            SystemAdaptationDataSet.SystemOrigin = new GMap.NET.PointLatLng(T.GetLatLongDecimal().LatitudeDecimal, T.GetLatLongDecimal().LongitudeDecimal);

                            break;

                        case "BACKGROUND":

                            DisplayAttributes.DisplayAttributesType DisplayAttributeBackground = DisplayAttributes.GetDisplayAttribute(DisplayAttributes.DisplayItemsType.BackgroundColor);
                            DisplayAttributeBackground.TextColor = System.Drawing.Color.FromName(words[1]);
                            DisplayAttributes.SetDisplayAttribute(DisplayAttributes.DisplayItemsType.BackgroundColor, DisplayAttributeBackground);
                            break;
                        }
                    }
                }
            }
            else
            {
                // Here is it initialized to the center of Bosnia and Herzegovina.
                SystemAdaptationDataSet.SystemOrigin = new GMap.NET.PointLatLng(44.05267, 17.6769);
            }
        }