private void DrawPoints() { System.Drawing.Graphics objGraph = this.CitiesPanel.CreateGraphics(); for (int i = 0; i < Points.Count; i++) { PointF newPoint = new PointF(((Point)Points[i]).x, ((Point)Points[i]).y); //���սǶ�����voronoiͼ+�������ֲ�ͼ HashSet<PointF> hs_voronoiPoint = new HashSet<PointF>(); hs_voronoiPoint.Add(AngleToPoint(newPoint, 360 - 30, 1)); hs_voronoiPoint.Add(AngleToPoint(newPoint, 360 - 30 - 120, 1)); hs_voronoiPoint.Add(AngleToPoint(newPoint, 360 - 30 - 240, 1)); foreach (PointF voronoiPoint in hs_voronoiPoint) { points.Add(new Vector(voronoiPoint.X, voronoiPoint.Y)); temps.Add(new TemperatureLocation(voronoiPoint.X, voronoiPoint.Y, i)); } } //������С���ָ�ͼ VoronoiTemparature vt = new VoronoiTemparature(temps); vt.ColdColor = Color.Orange; vt.HotColor = Color.Red; Bitmap bmp = vt.GetMapTemperature(this.Width, this.Height); objGraph.DrawImage(bmp, new PointF(0, 0)); //����С���ָ�ͼ bmp = Fortune.GetVoronoyMap(this.Width, this.Height, points); objGraph.DrawImage(bmp, new PointF(0, 0)); for (int i = 0; i < Points.Count; i++) { PointF newPoint = new PointF(((Point)Points[i]).x, ((Point)Points[i]).y); objGraph.DrawEllipse(new System.Drawing.Pen(System.Drawing.Color.Black), newPoint.X, newPoint.Y, 6, 6); //���սǶ����� ֱ��+��ͷ HashSet<PointF> hs_endPoint = new HashSet<PointF>(); Pen p = new Pen(Color.Blue, 3); p.EndCap = System.Drawing.Drawing2D.LineCap.ArrowAnchor; hs_endPoint.Add(AngleToPoint(newPoint, 360 - 30, 20)); hs_endPoint.Add(AngleToPoint(newPoint, 360 - 30 - 120, 20)); hs_endPoint.Add(AngleToPoint(newPoint, 360 - 30 - 240, 20)); //С�����Ƿ���� foreach (PointF endPoint in hs_endPoint) objGraph.DrawLine(p, newPoint, endPoint); //д�ϱ�ʶ objGraph.DrawString((i + 1).ToString(), new System.Drawing.Font("Arial", 10), System.Drawing.Brushes.Brown, newPoint.X + 8, newPoint.Y); } }