GetLineStypefromString() public static method

public static GetLineStypefromString ( string LineStyleIn ) : DashStyle
LineStyleIn string
return DashStyle
Beispiel #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);
                    }
                }
            }
        }
Beispiel #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);
        }
Beispiel #3
0
        private void btnUpdate_Click(object sender, EventArgs e)
        {
            // Label text attributes
            LabelAttributes.TextColor = Color.FromName(this.comboBoxTextColorChoice.Text);
            LabelAttributes.TextFont  = new FontFamily(this.comboBoxTextFontChoice.Text);
            LabelAttributes.TextSize  = int.Parse(this.comboBoxTextSizeChoice.Text);

            // Label Box and leader line attributes
            LabelAttributes.LineColor = Color.FromName(this.comboBoxLineColorChoice.Text);
            LabelAttributes.LineStyle = DisplayAttributes.GetLineStypefromString(this.comboBoxLineStyleChoice.Text);
            LabelAttributes.LineWidth = int.Parse(this.comboBoxLineWidth.Text);

            // Label background color
            LabelAttributes.BackgroundColor = Color.FromName(this.comboBoxBackroundColor.Text);

            // Target Symbol Attributes
            LabelAttributes.TargetColor = Color.FromName(this.comboBoxTargetColor.Text);
            LabelAttributes.TargetStyle = DisplayAttributes.GetLineStypefromString(this.comboBoxTargetStyle.Text);
            LabelAttributes.TargetSize  = int.Parse(this.comboBoxTargetSize.Text);
        }
Beispiel #4
0
        private void UpdateSampleLine()
        {
            if (this.comboBoxLineColorChoice.Text.Length > 0 && this.comboBoxLineWidth.Text.Length > 0 && this.comboBoxLineStyleChoice.Text.Length > 0)
            {
                // Create pen.
                Pen MyPen = new Pen(Color.FromName(this.comboBoxLineColorChoice.Text), int.Parse(this.comboBoxLineWidth.Text));

                // Set line style
                MyPen.DashStyle = DisplayAttributes.GetLineStypefromString(this.comboBoxLineStyleChoice.Text);

                int x1 = panelLineAttributes.Width / int.Parse(this.comboBoxTextSizeChoice.Text);
                int y1 = panelLineAttributes.Height / int.Parse(this.comboBoxTextSizeChoice.Text);

                // Draw line to screen.
                Graphics MyGraphics = this.panelLineAttributes.CreateGraphics();
                panelLineAttributes.Refresh();
                MyGraphics.DrawLine(MyPen, 0, 0, panelLineAttributes.Width, panelLineAttributes.Height);
                MyGraphics.Dispose();
                MyPen.Dispose();
            }
        }
Beispiel #5
0
        public static void Load()
        {
            string DisplayAdaptationDataLine;
            string FileName;

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

            FileName = @"C:\ASTERIX\ADAPTATION\LabelAttributes.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] != '#')
                    {
                        switch (words[0])
                        {
                        case "TEXT_COLOR":
                            TextColor = Color.FromName(words[1]);
                            break;

                        case "TEXT_FONT":
                            TextFont = new FontFamily(words[1]);
                            break;

                        case "TEXT_SIZE":
                            TextSize = int.Parse(words[1]);
                            break;

                        case "LINE_COLOR":
                            LineColor = Color.FromName(words[1]);
                            break;

                        case "LINE_STYLE":
                            LineStyle = DisplayAttributes.GetLineStypefromString(words[1]);
                            break;

                        case "LINE_WIDTH":
                            LineWidth = int.Parse(words[1]);
                            break;

                        case "TARGET_COLOR":
                            TargetColor = Color.FromName(words[1]);
                            break;

                        case "TARGET_STYLE":
                            TargetStyle = DisplayAttributes.GetLineStypefromString(words[1]);
                            break;

                        case "TARGET_SIZE":
                            TargetSize = int.Parse(words[1]);
                            break;

                        default:
                            MessageBox.Show("Bad format of LabelAttributes.txt");
                            break;
                        }
                    }
                }
            }
        }