Exemplo n.º 1
0
        public void Paint(Graphics g, PriceGraphicMapping priceGraphic, IPriceShape shape)
        {
            switch (shape.GetShapeType())
            {
            case PriceShapeType.Point:
                shapePainter_Point.Paint(g, priceGraphic, shape);
                break;

            case PriceShapeType.Line:
                shapePainter_Line.Paint(g, priceGraphic, shape);
                break;

            case PriceShapeType.PolyLine:
                shapePainter_PolyLine.Paint(g, priceGraphic, shape);
                break;

            case PriceShapeType.Label:
                shapePainter_Label.Paint(g, priceGraphic, shape);
                break;

            case PriceShapeType.Rect:
                shapePainter_Rect.Paint(g, priceGraphic, shape);
                break;
            }
        }
Exemplo n.º 2
0
        public void Paint(Graphics g, PriceGraphicMapping priceGraphic, IPriceShape shape)
        {
            PriceShape_Point point = (PriceShape_Point)shape;
            float            x1    = priceGraphic.CalcX(point.X);
            float            y1    = priceGraphic.CalcY(point.Y);
            float            w     = point.Width;

            g.FillEllipse(new SolidBrush(point.Color), x1 - point.Width / 2, y1 - point.Width / 2, point.Width, point.Width);
        }
Exemplo n.º 3
0
        public void Paint(Graphics g, PriceGraphicMapping priceGraphic, IPriceShape shape)
        {
            PriceShape_Label label = (PriceShape_Label)shape;
            float            x1    = priceGraphic.CalcX(label.Point.X);
            float            y1    = priceGraphic.CalcY(label.Point.Y);
            Font             font  = label.Font != null ? label.Font : new Font("宋体", 14.2f, FontStyle.Regular);
            StringFormat     sf    = label.StringFormat != null ? label.StringFormat : new StringFormat(StringFormatFlags.DirectionVertical);

            g.DrawString(label.Text, font, new SolidBrush(label.Color), new PointF(x1, y1), sf);
        }
Exemplo n.º 4
0
        public void Paint(Graphics g, PriceGraphicMapping priceGraphic, IPriceShape shape)
        {
            PriceShape_PolyLine line = (PriceShape_PolyLine)shape;

            PointF[] points = new PointF[line.Points.Count];
            for (int i = 0; i < line.Points.Count; i++)
            {
                points[i] = GetPointF(priceGraphic, line.Points[i]);
            }
            g.DrawLines(new Pen(line.Color, line.Width), points);
        }
Exemplo n.º 5
0
        public void Paint(Graphics g, PriceGraphicMapping priceGraphic, IPriceShape shape)
        {
            PriceShape_Line line = (PriceShape_Line)shape;
            float           x1   = priceGraphic.CalcX(line.StartPoint.X);
            float           y1   = priceGraphic.CalcY(line.StartPoint.Y);

            float x2 = priceGraphic.CalcX(line.EndPoint.X);
            float y2 = priceGraphic.CalcY(line.EndPoint.Y);

            g.DrawLine(new Pen(line.Color, line.Width), x1, y1, x2, y2);
        }
Exemplo n.º 6
0
        public virtual void Load(XmlElement xmlElem)
        {
            XmlNodeList nodes = xmlElem.GetElementsByTagName("shape");

            for (int i = 0; i < nodes.Count; i++)
            {
                XmlNode node = nodes[i];
                if (node is XmlElement)
                {
                    XmlElement  elem       = (XmlElement)node;
                    IPriceShape priceShape = PriceShapeFactory.CreatePriceShape(elem);
                    priceShape.Load(elem);
                    this.priceShapes.Add(priceShape);
                }
            }
        }
Exemplo n.º 7
0
        public void Paint(Graphics g, PriceGraphicMapping priceGraphic, IPriceShape shape)
        {
            PriceShape_Rect point = (PriceShape_Rect)shape;
            float           x1    = priceGraphic.CalcX(point.PriceLeft);
            float           y1    = priceGraphic.CalcY(point.PriceTop);
            float           x2    = priceGraphic.CalcX(point.PriceRight);
            float           y2    = priceGraphic.CalcY(point.PriceBottom);

            if (!point.FillRect)
            {
                g.DrawRectangle(new Pen(point.Color), x1, y1, x2 - x1, y2 - y1);
            }
            else
            {
                g.FillRectangle(new SolidBrush(point.Color), x1, y1, x2 - x1, y2 - y1);
            }
        }
Exemplo n.º 8
0
        private void DrawShape(IPriceShape shape)
        {
            if (shape is StrategyShape)
            {
                this.DrawShape2((StrategyShape)shape);
            }
            else
            {
                PriceRectangle priceRect = mapping.PriceRect;
                int            start     = priceRect.StartIndex;
                int            end       = priceRect.EndIndex;

                if (shape.GetShapeType() == PriceShapeType.Point)
                {
                    PriceShape_Point point = (PriceShape_Point)shape;
                    if (point.X < start || point.X > end)
                    {
                        return;
                    }
                }
                this.drawer.DrawPriceShape(shape);
            }
        }
Exemplo n.º 9
0
 public void RemoveShape(IPriceShape shape)
 {
     this.shapes.Remove(shape);
 }
Exemplo n.º 10
0
 public void DrawPriceShape(IPriceShape priceShape)
 {
     this.shapes.Add(priceShape);
 }
Exemplo n.º 11
0
 private void RecordShape(IPriceShape shape)
 {
     this.priceShapes.Add(shape);
     DrawShape(shape);
 }
Exemplo n.º 12
0
 public void RemovePriceShape(IPriceShape priceShape)
 {
     priceShapes.Remove(priceShape);
 }
Exemplo n.º 13
0
 public void AddPriceShape(IPriceShape priceShape)
 {
     priceShapes.Add(priceShape);
 }