/// <summary> /// Constructor that builds a <see cref="Label" /> from a text <see cref="string" /> /// and a <see cref="FontSpec" /> instance. /// </summary> /// <param name="text"></param> /// <param name="fontSpec"></param> public Label(string text, FontSpec fontSpec) { _text = (text == null) ? string.Empty : text; _fontSpec = fontSpec; _isVisible = true; }
/// <summary> /// Constructor to build an <see cref="AxisLabel" /> from the text and the /// associated font properties. /// </summary> /// <param name="text">The <see cref="string" /> representing the text to be /// displayed</param> /// <param name="fontFamily">The <see cref="String" /> font family name</param> /// <param name="fontSize">The size of the font in points and scaled according /// to the <see cref="PaneBase.CalcScaleFactor" /> logic.</param> /// <param name="color">The <see cref="Color" /> instance representing the color /// of the font</param> /// <param name="isBold">true for a bold font face</param> /// <param name="isItalic">true for an italic font face</param> /// <param name="isUnderline">true for an underline font face</param> public Label(string text, string fontFamily, float fontSize, Color color, bool isBold, bool isItalic, bool isUnderline) { _text = (text == null) ? string.Empty : text; _fontSpec = new FontSpec(fontFamily, fontSize, color, isBold, isItalic, isUnderline); _isVisible = true; }
/// <summary> /// Local dispose method /// </summary> /// <param name="bDisposing">if disposing is required</param> protected virtual void Dispose(bool bDisposing) { if (!m_bDisposed) { if (bDisposing) { if (_fontSpec != null) { _fontSpec.Dispose(); _fontSpec = null; } } m_bDisposed = true; } }
/// <summary> /// The Copy Constructor /// </summary> /// <param name="rhs">The FontSpec object from which to copy</param> public FontSpec( FontSpec rhs ) { _fontColor = rhs.FontColor; _family = rhs.Family; _isBold = rhs.IsBold; _isItalic = rhs.IsItalic; _isUnderline = rhs.IsUnderline; _fill = rhs.Fill.Clone(); _border = rhs.Border.Clone(); _isAntiAlias = rhs._isAntiAlias; _stringAlignment = rhs.StringAlignment; _angle = rhs.Angle; _size = rhs.Size; _isDropShadow = rhs._isDropShadow; _dropShadowColor = rhs._dropShadowColor; _dropShadowAngle = rhs._dropShadowAngle; _dropShadowOffset = rhs._dropShadowOffset; _scaleFactor = rhs._scaleFactor; _scaledSize = rhs._scaledSize; Remake( 1.0F, _size, ref _scaledSize, ref _font ); }
/// <summary> /// Basic constructor -- requires that the <see cref="Scale" /> object be intialized with /// a pre-existing owner <see cref="Axis" />. /// </summary> /// <param name="ownerAxis">The <see cref="Axis" /> object that is the owner of this /// <see cref="Scale" /> instance.</param> public Scale( Axis ownerAxis ) { _ownerAxis = ownerAxis; _min = 0.0; _max = 1.0; _majorStep = 0.1; _minorStep = 0.1; _exponent = 1.0; _mag = 0; _baseTic = PointPair.Missing; _minGrace = Default.MinGrace; _maxGrace = Default.MaxGrace; _minAuto = true; _maxAuto = true; _majorStepAuto = true; _minorStepAuto = true; _magAuto = true; _formatAuto = true; _isReverse = Default.IsReverse; _isUseTenPower = true; _isPreventLabelOverlap = true; _isVisible = true; _isSkipFirstLabel = false; _isSkipLastLabel = false; _isSkipCrossLabel = false; _majorUnit = DateUnit.Day; _minorUnit = DateUnit.Day; _format = null; _textLabels = null; _isLabelsInside = Default.IsLabelsInside; _align = Default.Align; _alignH = Default.AlignH; _fontSpec = new FontSpec( Default.FontFamily, Default.FontSize, Default.FontColor, Default.FontBold, Default.FontUnderline, Default.FontItalic, Default.FillColor, Default.FillBrush, Default.FillType ); _fontSpec.Border.IsVisible = false; _labelGap = Default.LabelGap; }
public PointAnnotation( string label ) { Label = label; ExtraAnnotation = null; FontSpec = new FontSpec(); }
/// <summary> /// The Copy Constructor /// </summary> /// <param name="rhs">The XAxis object from which to copy</param> public Legend( Legend rhs ) { rect = rhs.Rect; position = rhs.Position; isHStack = rhs.IsHStack; isVisible = rhs.IsVisible; this.location = (Location) rhs.Location; this.border = (Border) rhs.Border.Clone(); this.fill = (Fill) rhs.Fill.Clone(); fontSpec = (FontSpec) rhs.FontSpec.Clone(); }
private void Init( string text ) { if ( text != null ) _text = text; else text = "Text"; _fontSpec = new FontSpec( Default.FontFamily, Default.FontSize, Default.FontColor, Default.FontBold, Default.FontItalic, Default.FontUnderline ); //this.isWrapped = Default.IsWrapped ; _layoutArea = new SizeF( 0, 0 ); }
private int? GetDotProductsPointSize(Graphics g) { for (int pointSize = (int) Settings.Default.AreaFontSize; pointSize > 4; pointSize--) { var fontLabel = new FontSpec {Size = pointSize}; var sizeLabel = fontLabel.MeasureString(g, DotpLabelText, CalcScaleFactor()); float labelWidth = (float) XAxis.Scale.ReverseTransform((XAxis.Scale.Transform(0) + sizeLabel.Width)); if (labelWidth < 1.2) return pointSize; } return null; }
///////////////////////////////////////////////////// //plot Cp graph.///////////////////////////////////// //error code 013.//////////////////////////////////// private void cp_gra_Click(object sender, EventArgs e) { try { if (string.IsNullOrEmpty(cppath)) //judge the cppath string is null or empty. { MessageBox.Show("请选择要显示的Cp文件夹或者其中的任意文件,或者开始新的计算。", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } string foilname = null; string restatus = null; //Reynold's number status. string aoastatus = null; //angle of attack status. string mastatus = null; //Mach number status. string xtrstatus = null; //xtr status. string title = null; //title for differ data. FileStream cpfile = null; if ((!string.IsNullOrEmpty(cppath)) && (!string.IsNullOrEmpty(foilpath))) { int ifoil = foilpath.LastIndexOf("."); int jfoil = foilpath.LastIndexOf("\\"); foilname = foilpath.Substring(jfoil + 1, ifoil - jfoil - 1); cpfile = new FileStream(cppath, FileMode.Open, FileAccess.Read); int ialfa = cppath.LastIndexOf("_A"); int ima = cppath.LastIndexOf("_Ma"); int jma = cppath.LastIndexOf("."); aoastatus = cppath.Substring(ialfa + 2, ima - ialfa - 2); //read in aoa status. mastatus = cppath.Substring(ima + 3, jma - ima - 3); //read in ma status. title = foilname + "@α " + aoastatus + "@Ma " + mastatus; DirectoryInfo dirr = new DirectoryInfo(cppath.Substring(0, cppath.LastIndexOf("\\") + 1)); FileInfo[] ff = dirr.GetFiles(); foreach (FileInfo f in ff) { if (f.FullName.IndexOf("deployment.cfg") >= 0) //read in re status and xtr status. { FileStream cfgfile = new FileStream(f.FullName, FileMode.Open, FileAccess.Read); StreamReader cfgreader = new StreamReader(cfgfile); string content = cfgreader.ReadLine(); if (!string.IsNullOrEmpty(content)) //if there is a string, it must be Reynold's atatus. { restatus = content; title = title + "Re " + restatus; } content = cfgreader.ReadLine(); if (!string.IsNullOrEmpty(content)) //if there is another line of string, it must be xtr status. { xtrstatus = content; title = title + "xtr " + xtrstatus; } cfgreader.Close(); cfgfile.Close(); } } } StreamReader reader = new StreamReader(cpfile); List<List<double>> listcp = new List<List<double>>(); string temp = null; GraphPane cppane = gra.GraphPane; gra.GraphPane.CurveList.Clear(); reader.ReadLine(); while (!string.IsNullOrEmpty(temp = reader.ReadLine())) { string[] cpArr = temp.Trim().Split(' '); List<double> templist = new List<double>(); foreach (string s in cpArr) { if (!string.IsNullOrEmpty(s)) { templist.Add(double.Parse(s)); } } listcp.Add(templist); } reader.Close(); cpfile.Close(); double[] X = new double[listcp.Count]; double[] Y = new double[listcp.Count]; for (int i = 0; i < listcp.Count; i++) { X[i] = listcp[i][0]; Y[i] = listcp[i][1]; } cppane.Title.Text = "Cp Graph"; cppane.XAxis.Title.Text = "Chord location"; FontSpec font = new FontSpec("Times New Roman", 20, Color.Black, false, false, false); cppane.Title.FontSpec = font; cppane.XAxis.Title.FontSpec = font; cppane.XAxis.Scale.MaxAuto = true; cppane.XAxis.Scale.MinAuto = true; cppane.YAxis.Scale.MaxAuto = true; cppane.YAxis.Scale.MinAuto = true; cppane.YAxis.Scale.IsReverse = true; //define reversed Y axis only for Cp graph. cppane.YAxis.Title.Text = "Cp"; cppane.YAxis.Title.FontSpec = font; LineItem cpcurve = cppane.AddCurve(title, X, Y, Color.Red, SymbolType.Plus); gra.AxisChange(); gra.Refresh(); } catch (System.Exception ex) { MessageBox.Show("请查看帮助文档或者将错误信息告知:\r\nE-Mail:[email protected].\r\nEC:013", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning); } }
/// <summary> /// The Copy Constructor /// </summary> /// <param name="rhs">The <see cref="TextObj"/> object from which to copy</param> public TextObj( TextObj rhs ) : base(rhs) { _text = rhs.Text; _fontSpec = new FontSpec( rhs.FontSpec ); }
private void SetDefaultFontSpec(FontSpec fontSpec) { fontSpec.Family = "Verdana"; fontSpec.Size = 11f * _dpiFactor; fontSpec.IsBold = false; }
/// <summary> /// Create a new graph pane /// </summary> public GraphPane CreateGraphPane(string name) { GraphPane pane = new GraphPane(); //Here I create a new pane to stack charts? FontSpec _fontTitle = new FontSpec("Arial", 12, Color.Black, true, false, false); FontSpec _fontChart = new FontSpec("Arial", 10, Color.Black, false, false, false); FontSpec _fontLegend = new FontSpec("Arial", 10, Color.Black, false, false, false); _fontTitle.Border.IsVisible = false; _fontTitle.Border.Color = Color.Transparent; _fontChart.Border.IsVisible = false; _fontChart.Border.Color = Color.Transparent; _fontLegend.Border.IsVisible = false; _fontLegend.Border.Color = Color.Transparent; pane.Border.IsVisible = false; pane.Chart.IsRectAuto = true; pane.Chart.Border.Width = 1; int titleIndex = DrawTitle(ref pane, name, 0.5, 0.15, 13); pane.Title.FontSpec = _fontTitle; //X axis pane.XAxis.Title.IsVisible = false; pane.XAxis.Title.Text = "Time"; pane.XAxis.Title.FontSpec = _fontChart; pane.XAxis.Scale.FontSpec = _fontChart; pane.XAxis.Color = Color.Black; if (_startDate != new DateTime()) pane.XAxis.Scale.Min = _startDate.ToOADate(); if (_endDate != new DateTime()) pane.XAxis.Scale.Max = _endDate.ToOADate(); //pane.XAxis.CrossAuto = true; pane.XAxis.MajorGrid.IsVisible = true; pane.XAxis.Scale.MajorStepAuto = true; pane.XAxis.Type = AxisType.Date; pane.XAxis.Scale.Format = "yyyy-MM-dd"; //Y axis pane.YAxis.Title.IsVisible = false; pane.YAxis.MajorGrid.IsVisible = true; pane.Y2Axis.Title.FontSpec = _fontChart; pane.Y2Axis.Scale.FontSpec = _fontChart; pane.YAxis.Title.FontSpec = _fontChart; pane.YAxis.Scale.FontSpec = _fontChart; pane.YAxis.Color = Color.Black; pane.Chart.Fill = new Fill(Color.White); pane.LineType = LineType.Stack; //Set the legend: pane.Legend.Position = LegendPos.InsideBotRight; pane.Legend.FontSpec = _fontLegend; pane.Legend.Border.IsVisible = false; return pane; }
private void Init( string text ) { if ( text != null ) this.text = text; else text = "Text"; this.fontSpec = new FontSpec( Default.FontFamily, Default.FontSize, Default.FontColor, Default.FontBold, Default.FontItalic, Default.FontUnderline ); }
/// <summary> /// The Copy Constructor /// </summary> /// <param name="rhs">The <see cref="TextItem"/> object from which to copy</param> public TextItem( TextItem rhs ) : base(rhs) { text = rhs.Text; fontSpec = new FontSpec( rhs.FontSpec ); }
public PointAnnotation( string label, FontSpec fontSpec ) { Label = label; ExtraAnnotation = null; FontSpec = fontSpec; }
/// <summary> /// Copy Constructor. Create a new <see cref="Scale" /> object based on the specified /// existing one. /// </summary> /// <param name="rhs">The <see cref="Scale" /> object to be copied.</param> /// <param name="owner">The <see cref="Axis" /> object that will own the /// new instance of <see cref="Scale" /></param> public Scale( Scale rhs, Axis owner ) { _ownerAxis = owner; _min = rhs._min; _max = rhs._max; _majorStep = rhs._majorStep; _minorStep = rhs._minorStep; _exponent = rhs._exponent; _baseTic = rhs._baseTic; _minAuto = rhs._minAuto; _maxAuto = rhs._maxAuto; _majorStepAuto = rhs._majorStepAuto; _minorStepAuto = rhs._minorStepAuto; _magAuto = rhs._magAuto; _formatAuto = rhs._formatAuto; _minGrace = rhs._minGrace; _maxGrace = rhs._maxGrace; _mag = rhs._mag; _isUseTenPower = rhs._isUseTenPower; _isReverse = rhs._isReverse; _isPreventLabelOverlap = rhs._isPreventLabelOverlap; _isVisible = rhs._isVisible; _isSkipFirstLabel = rhs._isSkipFirstLabel; _isSkipLastLabel = rhs._isSkipLastLabel; _isSkipCrossLabel = rhs._isSkipCrossLabel; _majorUnit = rhs._majorUnit; _minorUnit = rhs._minorUnit; _format = rhs._format; _isLabelsInside = rhs._isLabelsInside; _align = rhs._align; _alignH = rhs._alignH; _fontSpec = (FontSpec) rhs._fontSpec.Clone(); _labelGap = rhs._labelGap; if ( rhs._textLabels != null ) _textLabels = (string[])rhs._textLabels.Clone(); else _textLabels = null; }
//////////////////////////////////////////////////////// //plot airfoil graph./////////////////////////////////// //error code 012./////////////////////////////////////// private void foil_gra_Click(object sender, EventArgs e) { try { if (string.IsNullOrEmpty(foilpath)) //judge the foilpath string is null or empty. { MessageBox.Show("请选择要显示的翼型数据文件夹或者其中的任意文件,或者开始新的计算。", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } FileStream foilfile = null; //declare airfoil file filestream. string foilname = null; //declare airfoil name string. if (!string.IsNullOrEmpty(foilpath)) { int l = foilpath.LastIndexOf("."); int m = foilpath.LastIndexOf("\\"); foilname = foilpath.Substring(m + 1, l - m - 1); //get the airfoil name. foilfile = new FileStream(foilpath, FileMode.Open, FileAccess.Read); } StreamReader reader = new StreamReader(foilfile); List<List<double>> listXY = new List<List<double>>(); string coor = null; GraphPane foilpane = gra.GraphPane; gra.GraphPane.CurveList.Clear(); reader.ReadLine(); while (!string.IsNullOrEmpty(coor = reader.ReadLine())) { string[] foilArr = coor.Trim().Split(new char[] { '\t', ' ' }); List<double> templist = new List<double>(); foreach (string s in foilArr) { if (!string.IsNullOrEmpty(s)) { templist.Add(double.Parse(s)); } } listXY.Add(templist); } reader.Close(); foilfile.Close(); double[] X = new double[listXY.Count]; double[] Y = new double[listXY.Count]; for (int i = 0; i < listXY.Count; i++) { X[i] = listXY[i][0]; Y[i] = listXY[i][1]; } foilpane.Title.Text = "Airfoil"; foilpane.XAxis.Title.Text = "Chord Location"; foilpane.YAxis.Title.Text = "Deep Location"; FontSpec font = new FontSpec("Times New Roman", 20, Color.Black, false, false, false); foilpane.Title.FontSpec = font; foilpane.XAxis.Title.FontSpec = font; foilpane.YAxis.Title.FontSpec = font; foilpane.YAxis.Scale.Max = 0.48; //define the graph axis scale. foilpane.YAxis.Scale.Min = -0.48; foilpane.XAxis.Scale.Max = 1.2; foilpane.XAxis.Scale.Min = -0.2; foilpane.YAxis.Scale.IsReverse = false; //Y axis is not reversed. LineItem foilcurve = foilpane.AddCurve(foilname, X, Y, Color.Red, SymbolType.None); gra.AxisChange(); gra.Refresh(); } catch (System.Exception ex) { MessageBox.Show("请查看帮助文档或者将错误信息告知:\r\nE-Mail:[email protected].\r\nEC:012", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning); } }
/// <summary> /// Constructor for deserializing objects /// </summary> /// <param name="info">A <see cref="SerializationInfo"/> instance that defines the serialized data /// </param> /// <param name="context">A <see cref="StreamingContext"/> instance that contains the serialized data /// </param> protected Scale( SerializationInfo info, StreamingContext context ) { // The schema value is just a file version parameter. You can use it to make future versions // backwards compatible as new member variables are added to classes int sch = info.GetInt32( "schema" ); _min = info.GetDouble( "min" ); _max = info.GetDouble( "max" ); _majorStep = info.GetDouble( "majorStep" ); _minorStep = info.GetDouble( "minorStep" ); _exponent = info.GetDouble( "exponent" ); _baseTic = info.GetDouble( "baseTic" ); _minAuto = info.GetBoolean( "minAuto" ); _maxAuto = info.GetBoolean( "maxAuto" ); _majorStepAuto = info.GetBoolean( "majorStepAuto" ); _minorStepAuto = info.GetBoolean( "minorStepAuto" ); _magAuto = info.GetBoolean( "magAuto" ); _formatAuto = info.GetBoolean( "formatAuto" ); _minGrace = info.GetDouble( "minGrace" ); _maxGrace = info.GetDouble( "maxGrace" ); _mag = info.GetInt32( "mag" ); _isReverse = info.GetBoolean( "isReverse" ); _isPreventLabelOverlap = info.GetBoolean( "isPreventLabelOverlap" ); _isUseTenPower = info.GetBoolean( "isUseTenPower" ); _isVisible = true; _isVisible = info.GetBoolean( "isVisible" ); _isSkipFirstLabel = info.GetBoolean( "isSkipFirstLabel" ); _isSkipLastLabel = info.GetBoolean( "isSkipLastLabel" ); _isSkipCrossLabel = info.GetBoolean( "isSkipCrossLabel" ); _textLabels = (string[]) info.GetValue( "textLabels", typeof(string[]) ); _format = info.GetString( "format" ); _majorUnit = (DateUnit) info.GetValue( "majorUnit", typeof(DateUnit) ); _minorUnit = (DateUnit) info.GetValue( "minorUnit", typeof(DateUnit) ); _isLabelsInside = info.GetBoolean( "isLabelsInside" ); _align = (AlignP)info.GetValue( "align", typeof( AlignP ) ); if ( schema >= 11 ) _alignH = (AlignH)info.GetValue( "alignH", typeof( AlignH ) ); _fontSpec = (FontSpec)info.GetValue( "fontSpec", typeof( FontSpec ) ); _labelGap = info.GetSingle( "labelGap" ); }
/////////////////////////////////////////////////////// //plot drag polar graph/////////////////////////////////////// //error code 016.////////////////////////////////////// private void polar_gra_Click(object sender, EventArgs e) { try { if (string.IsNullOrEmpty(parapath)) //judge the parapath string is null or empty. { MessageBox.Show("请选择要显示的数据文件夹或者其中的任意文件,或者开始新的计算。", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } List<List<double>> listp = new List<List<double>>(); GraphPane polarpane = gra.GraphPane; gra.GraphPane.CurveList.Clear(); string foilname = null; string restatus = null; //Reynold's number status. List<string> mastatus = new List<string>(); //Mach number status. string xtrstatus = null; //xtr status. List<string> title = new List<string>(); //title for differ data. Color[] color = { Color.Black, Color.Blue, Color.Brown, Color.Fuchsia, Color.Gray, Color.Green, Color.Orchid, Color.Purple, Color.Red, Color.Yellow }; SymbolType[] symbol = { SymbolType.Circle, SymbolType.Diamond, SymbolType.Plus, SymbolType.Square, SymbolType.Star, SymbolType.Triangle, SymbolType.TriangleDown, SymbolType.XCross, SymbolType.VDash, SymbolType.HDash }; if ((!string.IsNullOrEmpty(parapath)) && (!string.IsNullOrEmpty(foilpath))) { //get the airfoil name. int ifoil = foilpath.LastIndexOf("."); int jfoil = foilpath.LastIndexOf("\\"); foilname = foilpath.Substring(jfoil + 1, ifoil - jfoil - 1); } DirectoryInfo dirr = new DirectoryInfo(parapath.Substring(0, parapath.LastIndexOf("\\") + 1)); FileInfo[] ff = dirr.GetFiles(); foreach (FileInfo f in ff) { if (f.FullName.IndexOf("outdata.cfg") >= 0) //read in all parameters. { FileStream outdatafile = new FileStream(f.FullName, FileMode.Open, FileAccess.Read); StreamReader reader = new StreamReader(outdatafile); string row = null; while (!string.IsNullOrEmpty(row = reader.ReadLine())) { if (row.IndexOf("10086.0") == -1) { string[] ds = row.Trim().Split(' '); List<double> pararow = new List<double>(); foreach (string s in ds) { if (!string.IsNullOrEmpty(s)) { pararow.Add(double.Parse(s)); } } listp.Add(pararow); } } reader.Close(); outdatafile.Close(); } if (f.FullName.IndexOf("deployment.cfg") >= 0) //read in re status and xtr status. { FileStream cfgfile = new FileStream(f.FullName, FileMode.Open, FileAccess.Read); StreamReader cfgreader = new StreamReader(cfgfile); string content = cfgreader.ReadLine(); if (!string.IsNullOrEmpty(content)) { restatus = "@Re " + content; } content = cfgreader.ReadLine(); if (!string.IsNullOrEmpty(content)) { xtrstatus = "@xtr " + content; } cfgreader.Close(); cfgfile.Close(); } } if (listp[0][3] == 0) { return; } double tempma = listp[0][0]; mastatus.Add(Convert.ToString(tempma)); List<int> maflag = new List<int>(); for (int ima = 1; ima < listp.Count; ima++) { if (!(listp[ima][0] == tempma)) //differ differential ma. { maflag.Add(ima); //the next different ma position in listp. tempma = listp[ima][0]; mastatus.Add(Convert.ToString(tempma)); } } maflag.Add(listp.Count); if (mastatus.Count > 9) //if the count of Mach number greater than ten, the graph couldn't display. { MessageBox.Show("请保证一次计算的不同马赫数数量不大于10个,否则图形无法显示", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } polarpane.Title.Text = "Polar Graph"; polarpane.XAxis.Title.Text = "Cd"; polarpane.YAxis.Title.Text = "Cl"; FontSpec font = new FontSpec("Times New Roman", 20, Color.Black, false, false, false); polarpane.Title.FontSpec = font; polarpane.XAxis.Title.FontSpec = font; polarpane.YAxis.Title.FontSpec = font; polarpane.YAxis.Scale.IsReverse = false; polarpane.XAxis.Scale.MaxAuto = true; polarpane.XAxis.Scale.MinAuto = true; polarpane.YAxis.Scale.MaxAuto = true; polarpane.YAxis.Scale.MinAuto = true; for (int i = 0; i < mastatus.Count; i++) { if (i == 0) //output the first line. { double[] X = new double[maflag[0]]; double[] Y = new double[maflag[0]]; for (int i0 = 0; i0 < maflag[0]; i0++) { X[i0] = listp[i0][3]; Y[i0] = listp[i0][2]; } title.Add(foilname + "@Ma " + mastatus[0] + restatus + xtrstatus); LineItem polarcurve = polarpane.AddCurve(title[0], X, Y, color[0], symbol[0]); gra.AxisChange(); gra.Refresh(); } else //output other line using different method. { double[] X = new double[maflag[i] - maflag[i - 1]]; double[] Y = new double[maflag[i] - maflag[i - 1]]; for (int i1 = maflag[i - 1]; i1 < maflag[i]; i1++) { X[i1 - maflag[i - 1]] = listp[i1][3]; Y[i1 - maflag[i - 1]] = listp[i1][2]; } title.Add(foilname + "@Ma " + mastatus[i] + restatus + xtrstatus); LineItem polarcurve = polarpane.AddCurve(title[i], X, Y, color[i], symbol[i]); gra.AxisChange(); gra.Refresh(); } } } catch (System.Exception ex) { MessageBox.Show("请查看帮助文档。\r\nEC:016", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning); } }
/// <summary> /// Constructor for deserializing objects /// </summary> /// <param name="info">A <see cref="SerializationInfo"/> instance that defines the serialized data /// </param> /// <param name="context">A <see cref="StreamingContext"/> instance that contains the serialized data /// </param> protected TextObj( SerializationInfo info, StreamingContext context ) : base(info, context) { // The schema value is just a file version parameter. You can use it to make future versions // backwards compatible as new member variables are added to classes int sch = info.GetInt32( "schema2" ); _text = info.GetString( "text" ); _fontSpec = (FontSpec) info.GetValue( "fontSpec", typeof(FontSpec) ); //isWrapped = info.GetBoolean ("isWrapped") ; _layoutArea = (SizeF) info.GetValue( "layoutArea", typeof(SizeF) ); }
/// <summary> /// Copy constructor /// </summary> /// <param name="rhs">the <see cref="Label" /> instance to be copied.</param> public Label(Label rhs) { if (rhs._text != null) _text = (string) rhs._text.Clone(); else _text = string.Empty; _isVisible = rhs._isVisible; if (rhs._fontSpec != null) _fontSpec = rhs._fontSpec.Clone(); else _fontSpec = null; }
/// <summary> /// Constructor for deserializing objects /// </summary> /// <param name="info">A <see cref="SerializationInfo"/> instance that defines the serialized data /// </param> /// <param name="context">A <see cref="StreamingContext"/> instance that contains the serialized data /// </param> protected Label(SerializationInfo info, StreamingContext context) { // The schema value is just a file version parameter. You can use it to make future versions // backwards compatible as new member variables are added to classes int sch = info.GetInt32("schema"); _text = info.GetString("text"); _isVisible = info.GetBoolean("isVisible"); _fontSpec = (FontSpec) info.GetValue("fontSpec", typeof (FontSpec)); }
/// <summary> /// The Copy Constructor /// </summary> /// <param name="rhs">The XAxis object from which to copy</param> public Legend( Legend rhs ) { _rect = rhs.Rect; _position = rhs.Position; _isHStack = rhs.IsHStack; _isVisible = rhs.IsVisible; _location = rhs.Location; _border = rhs.Border.Clone(); _fill = rhs.Fill.Clone(); _fontSpec = rhs.FontSpec.Clone(); _gap = rhs._gap; _isReverse = rhs._isReverse; _isShowLegendSymbols = rhs._isShowLegendSymbols; }
public ChromGraphItem(TransitionGroupDocNode transitionGroupNode, TransitionDocNode transition, ChromatogramInfo chromatogram, TransitionChromInfo tranPeakInfo, IRegressionFunction timeRegressionFunction, bool[] annotatePeaks, double[] dotProducts, double bestProduct, bool isFullScanMs, bool isSummary, int step, Color color, float fontSize, int width, FullScanInfo fullScanInfo = null) { TransitionGroupNode = transitionGroupNode; TransitionNode = transition; Chromatogram = chromatogram; TransitionChromInfo = tranPeakInfo; TimeRegressionFunction = timeRegressionFunction; Color = color; FullScanInfo = fullScanInfo; _step = step; _fontSpec = CreateFontSpec(color, fontSize); _width = width; _dotProducts = dotProducts; _bestProduct = bestProduct; _isFullScanMs = isFullScanMs; _isSummary = isSummary; _arrayLabelIndexes = new int[annotatePeaks.Length]; if (chromatogram == null) { _measuredTimes = new double[0]; _displayTimes = _measuredTimes; _intensities = new double[0]; } else { // Cache values early to avoid accessing slow enumerators // which show up under profiling. Chromatogram.AsArrays(out _measuredTimes, out _intensities); if (TimeRegressionFunction == null) { _displayTimes = _measuredTimes; } else { _displayTimes = _measuredTimes.Select(TimeRegressionFunction.GetY).ToArray(); } // Add peak times to hash set for labeling int iLastStart = 0; for (int i = 0; i < chromatogram.NumPeaks; i++) { int maxIndex = -1; if (annotatePeaks[i]) { ChromPeak peak = chromatogram.GetPeak(i); maxIndex = GetMaxIndex(peak.StartTime, peak.EndTime, ref iLastStart); } _arrayLabelIndexes[i] = maxIndex; if (maxIndex != -1 && !_annotatedTimes.ContainsKey(maxIndex)) _annotatedTimes.Add(maxIndex, i); } // Calculate best peak index if (tranPeakInfo != null) { iLastStart = 0; _bestPeakTimeIndex = GetMaxIndex(tranPeakInfo.StartRetentionTime, tranPeakInfo.EndRetentionTime, ref iLastStart); } } }
public PointAnnotation() { Label = string.Empty; ExtraAnnotation = null; FontSpec = new FontSpec(); }
/// <summary> /// Default constructor that sets all <see cref="Legend"/> properties to default /// values as defined in the <see cref="Default"/> class. /// </summary> public Legend() { _position = Default.Position; _isHStack = Default.IsHStack; _isVisible = Default.IsVisible; this.Location = new Location( 0, 0, CoordType.PaneFraction ); _fontSpec = new FontSpec( Default.FontFamily, Default.FontSize, Default.FontColor, Default.FontBold, Default.FontItalic, Default.FontUnderline, Default.FontFillColor, Default.FontFillBrush, Default.FontFillType ); _fontSpec.Border.IsVisible = false; _border = new Border( Default.IsBorderVisible, Default.BorderColor, Default.BorderWidth ); _fill = new Fill( Default.FillColor, Default.FillBrush, Default.FillType ); _gap = Default.Gap; _isReverse = Default.IsReverse; _isShowLegendSymbols = Default.IsShowLegendSymbols; }
public override void AddPreCurveAnnotations(MSGraphPane graphPane, Graphics g, MSPointList pointList, GraphObjList annotations) { if (Chromatogram == null) return; // Give priority to showing the best peak text object above all other annotations if (DragInfo != null || (!HideBest && TransitionChromInfo != null) || CurveAnnotation != null) { // Show text and arrow for the best peak double intensityBest = 0; if (_bestPeakTimeIndex != -1) { ScaledRetentionTime timeBest = new ScaledRetentionTime(_measuredTimes[_bestPeakTimeIndex], _displayTimes[_bestPeakTimeIndex]); float xBest = graphPane.XAxis.Scale.Transform(timeBest.DisplayTime); intensityBest = _intensities[_bestPeakTimeIndex]; float yBest = graphPane.YAxis.Scale.Transform(intensityBest); if (GraphChromatogram.ShowRT != ShowRTChrom.none || DragInfo != null) { // Best peak gets its own label to avoid curve overlap detection double intensityLabel = graphPane.YAxis.Scale.ReverseTransform(yBest - 5); float? massError = Settings.Default.ShowMassError && TransitionChromInfo != null ? TransitionChromInfo.MassError : null; double dotProduct = _dotProducts != null ? _bestProduct : 0; TextObj text; if (CurveAnnotation != null) { // Darken peptide name a little so light colors stand out against the white background. var color = FontSpec.FontColor; if (!GraphInfo.IsSelected) color = Color.FromArgb(color.R*7/10, color.G*7/10, color.B*7/10); var fontSpec = new FontSpec(FontSpec) { FontColor = color, Angle = 90 }; if (GraphInfo.IsSelected) fontSpec = new FontSpec(fontSpec) {IsBold = true, Size = fontSpec.Size + 2, IsAntiAlias = true}; // Display peptide name label using vertical text. text = new TextObj(CurveAnnotation, timeBest.DisplayTime, intensityLabel, CoordType.AxisXYScale, AlignH.Left, AlignV.Center) { ZOrder = ZOrder.A_InFront, IsClippedToChartRect = true, FontSpec = fontSpec, Tag = new GraphObjTag(this, GraphObjType.best_peak, timeBest), }; } else { string label = FormatTimeLabel(timeBest.DisplayTime, massError, dotProduct); text = new TextObj(label, timeBest.DisplayTime, intensityLabel, CoordType.AxisXYScale, AlignH.Center, AlignV.Bottom) { ZOrder = ZOrder.A_InFront, IsClippedToChartRect = true, FontSpec = FontSpec, Tag = new GraphObjTag(this, GraphObjType.best_peak, timeBest), }; } annotations.Add(text); } // If showing multiple peptides, skip the best peak arrow indicator. if (CurveAnnotation == null) { // Show the best peak arrow indicator double timeArrow = graphPane.XAxis.Scale.ReverseTransform(xBest - 4); double intensityArrow = graphPane.YAxis.Scale.ReverseTransform(yBest - 2); ArrowObj arrow = new ArrowObj(COLOR_BEST_PEAK, 12f, timeArrow, intensityArrow, timeArrow, intensityArrow) { Location = {CoordinateFrame = CoordType.AxisXYScale}, IsArrowHead = true, IsClippedToChartRect = true, ZOrder = ZOrder.A_InFront }; annotations.Add(arrow); } } // Show the best peak boundary lines if (CurveAnnotation == null) { double startTime = 0, endTime = 0; if (DragInfo != null) { startTime = DragInfo.StartTime.MeasuredTime; endTime = DragInfo.EndTime.MeasuredTime; } else if (TransitionChromInfo != null) { var tranPeakInfo = TransitionChromInfo; startTime = tranPeakInfo.StartRetentionTime; endTime = tranPeakInfo.EndRetentionTime; } AddPeakBoundaries(graphPane, annotations, true, ScaleRetentionTime(startTime), ScaleRetentionTime(endTime), intensityBest); } } }
/// <summary> /// Constructor for deserializing objects /// </summary> /// <param name="info">A <see cref="SerializationInfo"/> instance that defines the serialized data /// </param> /// <param name="context">A <see cref="StreamingContext"/> instance that contains the serialized data /// </param> protected Legend( SerializationInfo info, StreamingContext context ) { // The schema value is just a file version parameter. You can use it to make future versions // backwards compatible as new member variables are added to classes int sch = info.GetInt32( "schema" ); _position = (LegendPos)info.GetValue( "position", typeof( LegendPos ) ); _isHStack = info.GetBoolean( "isHStack" ); _isVisible = info.GetBoolean( "isVisible" ); _fill = (Fill)info.GetValue( "fill", typeof( Fill ) ); _border = (Border)info.GetValue( "border", typeof( Border ) ); _fontSpec = (FontSpec)info.GetValue( "fontSpec", typeof( FontSpec ) ); _location = (Location)info.GetValue( "location", typeof( Location ) ); _gap = info.GetSingle( "gap" ); if ( schema >= 11 ) _isReverse = info.GetBoolean( "isReverse" ); if ( schema >= 12 ) _isShowLegendSymbols = info.GetBoolean( "isShowLegendSymbols" ); }
private static FontSpec CreateFontSpec(Color color, float size) { var fontSpec = new FontSpec(FONT_FACE, size, color, false, false, false) { Fill = new Fill(Color.FromArgb(0xC0, 0xff, 0xff, 0xff)), Border = new Border(Color.FromArgb(0x40, 0xff, 0xff, 0xff), 2.0f) }; return fontSpec; }