Exemplo n.º 1
0
        public override void RenderObject(Graphics g, DrawContext dcxt)
        {
            GraphicsPath path = new GraphicsPath();
            foreach (Object ch in pathes)
            {
                if (ch is VectorPathLine)
                {
                    VectorPathLine vpl = (VectorPathLine)ch;
                    path.AddLine(dcxt.X_V2S(vpl.x1), dcxt.Y_V2S(vpl.y1), dcxt.X_V2S(vpl.x2), dcxt.Y_V2S(vpl.y2));
                }
                else if (ch is VectorPathArc)
                {
                    VectorPathArc vpa = (VectorPathArc)ch;
                    path.AddArc(dcxt.X_V2S(vpa.x - vpa.w / 2), dcxt.Y_V2S(vpa.y - vpa.h/2), dcxt.W_V2S(vpa.w), dcxt.H_V2S(vpa.h), vpa.startagl, vpa.sweepagl);
                }
                else if (ch is VectorPathPie)
                {
                    VectorPathPie vpp = (VectorPathPie)ch;
                    path.AddArc(dcxt.X_V2S(vpp.x - vpp.w / 2), dcxt.Y_V2S(vpp.y - vpp.h/2), dcxt.W_V2S(vpp.w), dcxt.H_V2S(vpp.h), vpp.startagl, vpp.sweepagl);
                }
            }

            if (fill)
                g.FillPath(BrushWhenCxt(dcxt).Brush, path);
            else
                g.DrawPath(PenWhenCxt(dcxt).Pen, path);
        }
Exemplo n.º 2
0
 public override XmlElement ExportSvg(XmlDocument dom, DrawContext dcxt)
 {
     XmlElement box = dom.CreateElement("rect");
     box.SetAttribute("x", "" + dcxt.X_V2S(x));
     box.SetAttribute("y", "" + dcxt.Y_V2S(y));
     box.SetAttribute("width", "" + dcxt.W_V2S(w));
     box.SetAttribute("height", "" + dcxt.H_V2S(h));
     if (fill)
         box.SetAttribute("style", VectorSvgUtils.Brush2Style(BrushWhenCxt(dcxt).Brush));
     else
         box.SetAttribute("style", VectorSvgUtils.Pen2Style(PenWhenCxt(dcxt).Pen) + "fill:none;");
     return box;
 }
Exemplo n.º 3
0
        public override XmlElement ExportSvg(XmlDocument dom, DrawContext dcxt)
        {
            XmlElement text = dom.CreateElement("text");
            String style = VectorSvgUtils.Brush2Style(BrushWhenCxt(dcxt).Brush) + "font-size:" + FontWhenCxt(dcxt).Font.Size+";";
            text.SetAttribute("x", "" + dcxt.X_V2S(x));
            text.SetAttribute("y", "" + dcxt.Y_V2S(y + FontWhenCxt(dcxt).Font.Size + 2));
            //text.SetAttribute("y", "" + dcxt.Y_V2S(y));

            text.SetAttribute("style", style);
            if (this.text.Contains("\n"))
            {
                if (G == null)
                    G = Graphics.FromImage(new Bitmap(1, 1));
                Font font = FontWhenCxt(dcxt).Font;
                SizeF sf = new SizeF(0, 0);
                foreach (String l in this.text.Split('\n'))
                {
                    XmlElement xl = dom.CreateElement("tspan");
                    xl.SetAttribute("dx", "-" + dcxt.W_V2S(sf.Width));
                    xl.SetAttribute("dy", ""+ dcxt.H_V2S(sf.Height));
                    sf = G.MeasureString(l, font);
                    xl.InnerText = l;
                    text.AppendChild(xl);
                }
            }
            else
            {
                text.InnerText = this.text;
            }
            return text;
        }
Exemplo n.º 4
0
 public override void RenderObject(Graphics g, DrawContext dcxt)
 {
     if (fill)
         g.FillEllipse(BrushWhenCxt(dcxt).Brush, dcxt.X_V2S(x - w / 2), dcxt.Y_V2S(y - h / 2), dcxt.W_V2S(w), dcxt.H_V2S(h));
     else
         g.DrawEllipse(PenWhenCxt(dcxt).Pen, dcxt.X_V2S(x - w / 2), dcxt.Y_V2S(y - h / 2), dcxt.W_V2S(w), dcxt.H_V2S(h));
 }
Exemplo n.º 5
0
 public override XmlElement ExportSvg(XmlDocument dom, DrawContext dcxt)
 {
     XmlElement circle = dom.CreateElement("ellipse");
     circle.SetAttribute("cx", "" + dcxt.X_V2S(x));
     circle.SetAttribute("cy", "" + dcxt.Y_V2S(y));
     circle.SetAttribute("rx", "" + dcxt.W_V2S(w/2));
     circle.SetAttribute("ry", "" + dcxt.H_V2S(h/2));
     if (fill)
         circle.SetAttribute("style", VectorSvgUtils.Brush2Style(BrushWhenCxt(dcxt).Brush));
     else
         circle.SetAttribute("style", VectorSvgUtils.Pen2Style(PenWhenCxt(dcxt).Pen) + "fill:none;");
     return circle;
 }