public static GetDisplayAttribute ( DisplayItemsType ItemToGet ) : DisplayAttributesType | ||
ItemToGet | DisplayItemsType | |
Résultat | DisplayAttributesType |
public static void Build(ref GMapOverlay OverlayOut) { /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Display defined radars // string FileName = @"C:\ASTERIX\IMAGES\radar.jpg"; Image RadarImage = Image.FromFile(FileName); // Get radar display attributes DisplayAttributes.DisplayAttributesType RadarDisplayAttribute = DisplayAttributes.GetDisplayAttribute(DisplayAttributes.DisplayItemsType.Radar); RadarImage = GraphicUtilities.ResizeImage(RadarImage, new Size(RadarDisplayAttribute.ImageSize.Width, RadarDisplayAttribute.ImageSize.Height), false); // Here loop through defined radars and display them on the map foreach (SystemAdaptationDataSet.Radar Radar in SystemAdaptationDataSet.RadarDataSet) { // Image properties GMapMarkerImage MyMarkerImage = new GMapMarkerImage(new PointLatLng(Radar.RadarPosition.GetLatLongDecimal().LatitudeDecimal, Radar.RadarPosition.GetLatLongDecimal().LongitudeDecimal), RadarImage); MyMarkerImage.ToolTipMode = MarkerTooltipMode.Never; System.Drawing.SolidBrush myBrush; myBrush = new System.Drawing.SolidBrush(RadarDisplayAttribute.TextColor); // Get radar marker image WaypointMarker WPT_Marker = new WaypointMarker(new PointLatLng(Radar.RadarPosition.GetLatLongDecimal().LatitudeDecimal, Radar.RadarPosition.GetLatLongDecimal().LongitudeDecimal), Radar.RadarName, new Font(RadarDisplayAttribute.TextFont, RadarDisplayAttribute.TextSize, FontStyle.Bold, GraphicsUnit.Pixel), myBrush); // Load radar marker and label to overlay OverlayOut.Markers.Add(MyMarkerImage); OverlayOut.Markers.Add(WPT_Marker); } }
private void SyncFormData() { // First get all the display attributes for the selected data item DisplayAttributes.DisplayAttributesType DisplayAttribute = DisplayAttributes.GetDisplayAttribute((DisplayAttributes.DisplayItemsType)Enum.Parse(typeof(DisplayAttributes.DisplayItemsType), this.comboBoxDataItem.Text, true)); ///////////////////////////////////////////////////////////// // TEXT ATTRIBUTES ///////////////////////////////////////////////////////////// // Text Attributes Color this.comboBoxTextColorChoice.SelectedIndex = this.comboBoxTextColorChoice.FindStringExact(DisplayAttribute.TextColor.Name); // Text Attributes Font this.comboBoxTextFontChoice.SelectedIndex = this.comboBoxTextFontChoice.FindStringExact(DisplayAttribute.TextFont.Name); // Text Attributes Size this.comboBoxTextSizeChoice.SelectedIndex = DisplayAttribute.TextSize - 1; ///////////////////////////////////////////////////////////// // LINE ATTRIBUTES ///////////////////////////////////////////////////////////// // Line Attributes Color this.comboBoxLineColorChoice.SelectedIndex = this.comboBoxLineColorChoice.FindStringExact(DisplayAttribute.LineColor.Name); // Line Attributes Type this.comboBoxLineStyleChoice.SelectedIndex = this.comboBoxLineStyleChoice.FindStringExact(DisplayAttribute.LineStyle.ToString()); // Line Attributes Size. this.comboBoxLineWidth.SelectedIndex = DisplayAttribute.LineWidth - 1; ///////////////////////////////////////////////////////////// // AREA/POLYGON ATTRIBUTES ///////////////////////////////////////////////////////////// this.comboBoxAreaPolygonColorChoice.SelectedIndex = this.comboBoxAreaPolygonColorChoice.FindStringExact(DisplayAttribute.AreaPolygonColor.Name); ///////////////////////////////////////////////////////////// // IMAGE ATTRIBUTES ///////////////////////////////////////////////////////////// this.numericUpDown_X.Value = DisplayAttribute.ImageSize.Width; this.numericUpDown_Y.Value = DisplayAttribute.ImageSize.Height; this.pictureBox.BackColor = Color.FromName(this.comboBoxBackgroundColor.Text); UpdateSampleLine(); UpdateSampleText(); UpdateAreaPolygonSample(); UpdatePictureSample(); }
public static void Build(ref GMapOverlay OverlayOut) { // Here loop through defined state borders and display them on the map foreach (SystemAdaptationDataSet.StateBorder State in SystemAdaptationDataSet.StateBorderDataSet) { System.Collections.Generic.List <PointLatLng> SectorPointList = new System.Collections.Generic.List <PointLatLng>(); foreach (GeoCordSystemDegMinSecUtilities.LatLongClass SectorPoint in State.StateBorderPoints) { SectorPointList.Add(new PointLatLng(SectorPoint.GetLatLongDecimal().LatitudeDecimal, SectorPoint.GetLatLongDecimal().LongitudeDecimal)); } GMapRoute StateBoundaryData = new GMapRoute(SectorPointList, State.StateName); StateBoundaryData.Stroke.Width = DisplayAttributes.GetDisplayAttribute(DisplayAttributes.DisplayItemsType.StateBorder).LineWidth; StateBoundaryData.Stroke.DashStyle = DisplayAttributes.GetDisplayAttribute(DisplayAttributes.DisplayItemsType.StateBorder).LineStyle; StateBoundaryData.Stroke.Color = DisplayAttributes.GetDisplayAttribute(DisplayAttributes.DisplayItemsType.StateBorder).LineColor; OverlayOut.Routes.Add(StateBoundaryData); } }
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 Build(ref GMapOverlay OverlayOut) { // Here loop through defined Runways and display them on the map foreach (SystemAdaptationDataSet.RunwayBorder Runway in SystemAdaptationDataSet.RunwayBorderDataSet) { System.Collections.Generic.List <PointLatLng> RunwayPointList = new System.Collections.Generic.List <PointLatLng>(); foreach (GeoCordSystemDegMinSecUtilities.LatLongClass RunwayPoint in Runway.RunwayBorderPoints) { RunwayPointList.Add(new PointLatLng(RunwayPoint.GetLatLongDecimal().LatitudeDecimal, RunwayPoint.GetLatLongDecimal().LongitudeDecimal)); } // Get Runway border display attributes DisplayAttributes.DisplayAttributesType RunwayBorderDisplayAttribute = DisplayAttributes.GetDisplayAttribute(DisplayAttributes.DisplayItemsType.RunwayBorder); GMapPolygon RunwayPolygon = new GMapPolygon(RunwayPointList, Runway.RunwayName); RunwayPolygon.Stroke = new Pen(RunwayBorderDisplayAttribute.LineColor, RunwayBorderDisplayAttribute.LineWidth); Type brushType = typeof(Brushes); Brush myBrush = (Brush)brushType.InvokeMember(RunwayBorderDisplayAttribute.AreaPolygonColor.Name, BindingFlags.Public | BindingFlags.Static | BindingFlags.GetProperty, null, null, new object[] { }); RunwayPolygon.Fill = myBrush; OverlayOut.Polygons.Add(RunwayPolygon); } }
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); } }