public override int GetHashCode() { return(OriginalDate.GetHashCode() ^ 7 * OriginalHomeName.GetHashCode() ^ 11 * OriginalAwayName.GetHashCode() ^ 17 * TipsterId.GetHashCode() ^ 19 * PickId.GetHashCode() ^ 23 * OriginalDiscipline.GetHashCode() ^ 29); }
public override void Draw(Graphics3D graphics) { System.Drawing.Graphics g = graphics.Graphics; var viewDir = graphics.ViewDirection; Face[] faces = Faces; for (int i = 0; i < 6; ++i) { // Face Face face = faces[i]; // visible ? if (!faces[i].IsVisible(viewDir)) { continue; } // color faces[i].ColorFill = Colors[i]; // points Vector3D[] points3D = faces[i].Points; Point[] pt = graphics.TransformPoint(points3D); // draw solid face Brush brush = new SolidBrush(faces[i].ColorGraph(graphics)); g.FillPolygon(brush, pt); // draw textures if (null != face.Textures && graphics.ShowTextures) { foreach (Texture texture in face.Textures) { Point[] ptsImage = graphics.TransformPoint(PointsImage(i, texture)); Point[] pts = new Point[3]; pts[0] = ptsImage[3]; pts[1] = ptsImage[2]; pts[2] = ptsImage[0]; g.DrawImage(texture.Bitmap, pts); } } // draw path Brush brushPath = new SolidBrush(faces[i].ColorPath); Pen penPathThick = new Pen(brushPath, IsBundle ? 2.0f : 1.5f); int ptCount = pt.Length; for (int j = 1; j < ptCount; ++j) { g.DrawLine(penPathThick, pt[j - 1], pt[j]); } g.DrawLine(penPathThick, pt[ptCount - 1], pt[0]); // draw bundle lines if (IsBundle && i < 4) { Pen penPathThin = new Pen(brushPath, 1.5f); int noSlice = Math.Min(BundleFlats, 4); for (int iSlice = 0; iSlice < noSlice - 1; ++iSlice) { Vector3D[] ptSlice = new Vector3D[2]; ptSlice[0] = points3D[0] + (iSlice + 1) / (double)noSlice * (points3D[3] - points3D[0]); ptSlice[1] = points3D[1] + (iSlice + 1) / (double)noSlice * (points3D[2] - points3D[1]); Point[] pt2D = graphics.TransformPoint(ptSlice); g.DrawLine(penPathThin, pt2D[0], pt2D[1]); } } } Pen penBlack = new Pen(new SolidBrush(Color.Black), 1.5f); // draw box tape if (ShowTape && faces[5].IsVisible(viewDir)) { // instantiate brush Brush brushTape = new SolidBrush(faces[5].ColorGraph(graphics, TapeColor)); // get tape points Point[] pts = graphics.TransformPoint(TapePoints); // fill polygon g.FillPolygon(brushTape, pts); // draw path for (int j = 1; j < pts.Length; ++j) { g.DrawLine(penBlack, pts[j - 1], pts[j]); } g.DrawLine(penBlack, pts[pts.Length - 1], pts[0]); } // draw strappers foreach (var sf in StrapperFaces) { if (sf.IsVisible(viewDir)) { // get color double cosA = Math.Abs(Vector3D.DotProduct(sf.Normal, graphics.VLight)); Color color = Color.FromArgb((int)(sf.ColorFill.R * cosA), (int)(sf.ColorFill.G * cosA), (int)(sf.ColorFill.B * cosA)); // instantiate brush Brush brushStrapper = new SolidBrush(color); // get face points Point[] pts = graphics.TransformPoint(sf.Points); // fill polygon g.FillPolygon(brushStrapper, pts); // draw path int ptCount = pts.Length; for (int j = 1; j < ptCount; ++j) { g.DrawLine(penBlack, pts[j - 1], pts[j]); } g.DrawLine(penBlack, pts[ptCount - 1], pts[0]); } } if (graphics.ShowBoxIds) { // draw box id Point ptId = graphics.TransformPoint(TopFace.Center); g.DrawString( PickId.ToString() , new Font("Arial", graphics.GridFontSize) , Brushes.Black , new Rectangle(ptId.X - 15, ptId.Y - 10, 30, 20) , StringFormat.GenericDefault); } }