GoDiagram Web Reference
GoSvgGenerator Class
Members 

Inherit from this base class to hold the specific SVG generator methods for each particular class that needs customized SVG output.
Syntax
'Declaration
 
Public Class GoSvgGenerator 
   Inherits Northwoods.GoWeb.Xml.GoXmlTransformer
   Implements Northwoods.GoWeb.Xml.IGoXmlTransformer 
Remarks

Let's say you have defined a class where you have overridden the Paint method:

            public class TriangleTextNode : GoTextNode {
              . . .
              public override void Paint(Graphics g, GoView view) {
                base.Paint(g, view);
                RectangleF r = this.Bounds;
                PointF[] pts = new PointF[3];
                pts[0] = new PointF(r.X+3, r.Y+3);
                pts[1] = new PointF(r.X+13, r.Y+3);
                pts[2] = new PointF(r.X+8, r.Y+13);
                g.FillPolygon(Brushes.Yellow, pts);
                g.DrawPolygon(Pens.Black, pts);
              }
            }
            

If you want to get the same results in the generated SVG, you would need to define a generator as follows:

            public class GeneratorTriangleTextNode : GoSvgGenerator {
              public GeneratorTriangleTextNode() {
                this.TransformerType = typeof(TriangleTextNode);
              }
            
              public override void GenerateBody(Object obj) {
                base.GenerateBody(obj);
                TriangleTextNode ttn = (TriangleTextNode)obj;
                RectangleF r = ttn.Bounds;
                PointF[] pts = new PointF[3];
                pts[0] = new PointF(r.X+3, r.Y+3);
                pts[1] = new PointF(r.X+13, r.Y+3);
                pts[2] = new PointF(r.X+8, r.Y+13);
                WritePolygon(Pens.Black, Brushes.Yellow, pts);
              }
            }
            
Note how the call to base.GenerateBody corresponds to a call to base.Paint, and how the call to WritePolygon corresponds to calls to Graphics.FillPolygon and Graphics.DrawPolygon.

Then you would need to add an instance of this custom SVG generator to the GoSvgWriter that you are using:

            GoSvgWriter w = new GoSvgWriter();
            w.AddTransformer(new GeneratorTriangleTextNode());
            w.View = goView1;
            w.Generate(. . .);
            

Inheritance Hierarchy

System.Object
   Northwoods.GoWeb.Xml.GoXmlTransformer
      Northwoods.GoWeb.Svg.GoSvgGenerator

Requirements

Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

See Also

Reference

GoSvgGenerator Members
Northwoods.GoWeb.Svg Namespace
GoSvgWriter Class

 

 


© 2013. Northwoods Software Corporation. All Rights Reserved.

Send Feedback