コード例 #1
0
ファイル: LinesShape.cs プロジェクト: Shayan-To/OpenMesh
        public override void Draw(Graphics G, SubarrayProxy<PointF> Points, float Scale)
        {
            PointF T = new PointF();
            var Bl = false;
            var Path = new GraphicsPath();

            for (int i = 0; i < Points.Count; i++)
            {
                if (Bl)
                {
                    Path.StartFigure();
                    Path.AddLine(Points[i], T);
                    Path.CloseFigure();
                }
                else
                    T = Points[i];
                Bl = !Bl;
            }

            G.DrawPath(this.Pen, Path);
        }
コード例 #2
0
ファイル: Shape.cs プロジェクト: Shayan-To/OpenMesh
 public abstract void Draw(Graphics G, SubarrayProxy<PointF> Points, Single Scale);
コード例 #3
0
ファイル: IndicatorShape.cs プロジェクト: Shayan-To/OpenMesh
        public override void Draw(Graphics G, SubarrayProxy<PointF> Points, float Scale)
        {
            var Path = new GraphicsPath();

            var Sz = this.IndicatorsSize;
            var Sz2 = Sz * 2;

            switch (this.IndicatorsShape)
            {
                case ShapeOfIndicator.Square:
                    for (int i = 0; i < Points.Count; i++)
                    {
                        var T = Points[i];
                        Path.AddRectangle(new RectangleF((Single)T.X - Sz, (Single)T.Y - Sz, Sz2, Sz2));
                    }
                    break;
                case ShapeOfIndicator.Circle:
                    for (int i = 0; i < Points.Count; i++)
                    {
                        var T = Points[i];
                        Path.AddEllipse(new RectangleF((Single)T.X - Sz, (Single)T.Y - Sz, Sz2, Sz2));
                    }
                    break;
                case ShapeOfIndicator.SquareRotated:
                    var D = Sz * (Single)Math.Sqrt(2);
                    for (int i = 0; i < Points.Count; i++)
                    {
                        var T = Points[i];
                        Path.StartFigure();
                        Path.AddPolygon(new[] { new PointF(T.X - D, T.Y), new PointF(T.X, T.Y - D), new PointF(T.X + D, T.Y), new PointF(T.X, T.Y + D) });
                        Path.CloseFigure();
                    }
                    break;
                case ShapeOfIndicator.Triangle:
                    var H = 2 * Sz * (Single)Math.Cos(Math.PI / 6);
                    var C = Sz * (Single)Math.Tan(Math.PI / 6);
                    for (int i = 0; i < Points.Count; i++)
                    {
                        var T = Points[i];
                        var Y = T.Y + C;
                        Path.StartFigure();
                        Path.AddPolygon(new[] { new PointF(T.X, Y - H), new PointF(T.X - Sz, Y), new PointF(T.X + Sz, Y) });
                        Path.CloseFigure();
                    }
                    break;
                default:
                    break;
            }

            G.DrawPath(this.Pen, Path);
        }