Exemplo n.º 1
0
        public VectorGraphObject Copy()
        {
            var vo = new VectorGraphObject {
                pivotPoint = pivotPoint, alpha = alpha, width = width, height = height
            };

            foreach (var poly in lines)
            {
                vo.lines.Add(poly.Copy());
            }
            return(vo);
        }
Exemplo n.º 2
0
 public VectorGraphObject Copy()
 {
     var vo = new VectorGraphObject {pivotPoint = pivotPoint, alpha = alpha, width = width, height = height};
     foreach (var poly in lines)
     {
         vo.lines.Add(poly.Copy());
     }
     return vo;
 }
Exemplo n.º 3
0
        protected void DrawObject(RectangleD worldRect, Rectangle canvasRect, Graphics g, Pen pen,
            VectorGraphObject obj, PenStorage penDic)
        {
            PointD a = Conversion.WorldToScreen(linePoints[0], worldRect, canvasRect);
            PointD b = Conversion.WorldToScreen(linePoints[1], worldRect, canvasRect);
            var len = (float)Geometry.GetSpanLength(a, b);

            VectorGraphObject smb = obj.Copy();
            smb.PaintLines(lineColor);
            smb.PaintFills(ShapeFillColor);
            smb.Alpha = ShapeAlpha;
            float scale = len / smb.Width;
            // масштабирование
            smb.Scale(scale, scale);
            // перенос
            smb.Move2Point(a.ToPointF());
            // наклон
            smb.Rotate((float)Math.Atan2(b.Y - a.Y, b.X - a.X));
            // нарисовать
            smb.Draw(g, penDic, Selected ? PenWidth + 2 : PenWidth);
        }
Exemplo n.º 4
0
 protected bool IsInObject(PointD a, PointD b,
     VectorGraphObject obj, Point ptClient, float tolerance)
 {
     var len = (float)Geometry.GetSpanLength(a, b);
     VectorGraphObject smb = obj.Copy();
     float scale = len / smb.Width;
     // масштабирование
     smb.Scale(scale, scale);
     // перенос
     smb.Move2Point(a.ToPointF());
     // наклон
     smb.Rotate((float)Math.Atan2(b.Y - a.Y, b.X - a.X));
     // проверить попадание
     return smb.IsPointIn(ptClient, tolerance);
 }
Exemplo n.º 5
0
 protected void DrawBarSizedArrow(RectangleD worldRect, Rectangle canvasRect,
     Graphics g, Pen pen, VectorGraphObject obj)
 {
     var endPoint = Conversion.WorldToScreen(linePoints[1], worldRect, canvasRect);
     var marginPoint = Conversion.WorldToScreen(new PointD(linePoints[1].X + 1, linePoints[1].Y),
         worldRect, canvasRect);
     var width = (int)Math.Abs(marginPoint.X - endPoint.X);
     var scaleY = linePoints[0].Y > linePoints[1].Y ? 1 : -1;
     // нарисовать собственно стрелку - пересчитать координаты
     var points = new Point[pointsArrowCandle.Length];
     for (var i = 0; i < pointsArrowCandle.Length; i++)
     {
         var x = (int)endPoint.X + (int)(pointsArrowCandle[i].X * width);
         var y = (int)endPoint.Y + (int)(pointsArrowCandle[i].Y * width * scaleY);
         points[i] = new Point(x, y);
     }
     // нарисовать
     using (var b = new SolidBrush(Color.FromArgb(ShapeAlpha, ShapeFillColor)))
         g.FillPolygon(b, points);
     using (var p = new Pen(lineColor))
         g.DrawPolygon(p, points);
 }