public void CursorArrayTest() { DenseVector v = DenseVector.Zero(4); // cursor VectorArray a = new VectorArray(v, 3, 2); int i; for (i = 0; i < a.Count; i++) { a[i].SetAllElementsTo(i); } for (i = 0; i < a.Count; i++) { Console.WriteLine("shape[{0}] = {1}", i, a[i]); } Console.WriteLine("foreach:"); i = 0; foreach (Vector x in a) { Console.WriteLine("shape[{0}] = {1}", i++, x); } Console.WriteLine(""); Console.WriteLine("shape[2,1] = {0}", a[2, 1]); Console.WriteLine("v.Start = {0}", v.Start); Console.WriteLine("FirstGetsSum():"); Action action = delegate() { v.SetToSum(v, v); }; a.ForEach(a, action); i = 0; foreach (Vector x in a) { Console.WriteLine("shape[{0}] = {1}", i++, x); } Console.WriteLine(""); // a is now used as a cursor in a larger array CursorArray <VectorArray> aa = new CursorArray <VectorArray>(a, 2); // should be 4*3*2*2 = 48 Console.WriteLine("total data count = {0}", ((ICursor)aa).Count); Console.WriteLine("v.SourceArray.Length = {0}", v.SourceArray.Length); }
/// <summary> /// Draws the cursors of a particular cursor array /// </summary> /// <param name="Cursors">The array of cursors to draw</param> public void DrawCursors(CursorArray Cursors, Graphics g, bool bold) { string UseFont; float FontSize; string CursorText; Color rgb; // for each cursor used in the array, determine features // and draw it to the audiogram for (int i = 0; i < Cursors.PointsUsed; i++) { if ( (RightEar & (byte)Cursors.Symbols[i]) == RightEar ) rgb = Color.Red; // Cursor is a right cursor else rgb = Color.Blue; // Cursor is a left cursor UseFont = "Arial"; // Unless otherwise specified FontSize = FONT_SIZE; // Location of the cursor on the plot globalPts.X = Cursors.Points[i].X; globalPts.Y = Cursors.Points[i].Y; switch (Cursors.Symbols[i]) { // Some cursor positions require shifts // or change of font case SymbolType.LeftAir: CursorText = "X"; globalPts.X += 2; break; case SymbolType.RightAir: CursorText = "O"; break; case SymbolType.LeftBone: CursorText = ">"; globalPts.X += 13; break; case SymbolType.RightBone: CursorText = "<"; globalPts.X -= 10; break; case SymbolType.LeftAirMasked: CursorText = "\x0063"; // A square in Wingdings (ASCII code A8 = 168) UseFont = "Webdings"; // NOT wingdings 3!! FontSize = 12; globalPts.X -= 2; globalPts.Y -= 1; break; case SymbolType.RightAirMasked: CursorText = "\x00EA"; // A triangle in Wingdings 3 (r) //UseFont = "Wingdings 3"; UseFont = "Webdings"; //UseFont = "Arial Narrow"; FontSize = 19; globalPts.X -= 8; globalPts.Y -= 6; break; case SymbolType.LeftBoneMasked: CursorText = "]"; globalPts.X += 20; globalPts.Y -= 1; break; case SymbolType.RightBoneMasked: CursorText = "["; globalPts.X -= 13; globalPts.Y -= 1; break; case SymbolType.LeftNoResponse: CursorText = "m"; // A down-right arrow in Wingdings 3 UseFont = "Wingdings 3"; globalPts.X += 7; globalPts.Y += 7; break; case SymbolType.RightNoResponse: CursorText = "l"; // A down-left arrow in Wingdings 3 UseFont = "Wingdings 3"; globalPts.X -= 7; globalPts.Y += 7; break; /*case SymbolType.Aided: CursorText = "A"; globalPts.X += 1; break; case SymbolType.SoundField: CursorText = "S"; globalPts.X += 1; break;*/ default: CursorText = "O"; break; } #region removemesoon /* else if (this.patho_cursorArray[i] == "UR") { cursor = "UR"; rgb = ACTUAL_RIGHT_COLOR; } else if (this.patho_cursorArray[i] == "UL") { cursor = "UL"; rgb = ACTUAL_LEFT_COLOR; }*/ #endregion Font font; if (bold) font = new Font(UseFont, FontSize, FontStyle.Bold); else font = new Font(UseFont, FontSize); g.DrawString(CursorText, font, new SolidBrush(rgb), globalPts.X, globalPts.Y); } }