GoDiagram Web Reference
GoSvgWriter Class
Members 

Write SVG representing a view to a file or to a stream.
Syntax
'Declaration
 
Public Class GoSvgWriter 
   Inherits Northwoods.GoWeb.Xml.GoXmlWriter
public class GoSvgWriter : Northwoods.GoWeb.Xml.GoXmlWriter 
Remarks

Typical usage can be like:

            GoSvgWriter w = new GoSvgWriter();
            w.View = view;
            w.Generate(@"C:\Temp\test.svg");
            

If you have defined your own customized painting (typically by having overridden GoObject.Paint), you may need to implement a GoSvgGenerator for your class, and inform this writer about it before calling Generate:

            w.AddTransformer(new MyCustomNodeGenerator());
            
See the description of GoSvgGenerator for an example.

At this time, there are some limitations in the quality of the generated SVG, compared to what you can see in a GoView. Some are due to limitations in SVG (such as PathGradientBrush and support for true zero-width Pens), some are due to SVG viewer implementations (the Adobe viewer and Corel viewer have different sets of deficiencies), some are just due to our incomplete implementation (such as limited GoText support and some shadows), and some are because we have no intention to support them (such as rendering the Windows Forms Controls that are displayed by instances of GoControl).

Support for limited interaction is achieved by means of event handlers, JavaScript functions, and additional SVG elements. This is how support for tooltips, custom panning and zooming, HREF links, and selection are implemented. Such support can be enabled/disabled by setting the ToolTips, PanAndZoomControls, ObjectsLimitedToDocExtent, and SupportsSelection properties, and by overriding the GetHref and GetSelectionId methods.

The ability to show selected objects is currently limited to displaying or hiding selection handles--i.e. SVG elements generated for GoHandles. The view's SecondarySelectionColor is used for all selection handles--the SVG code does not distinguish between primary and secondary selections. Furthermore, the GoGroup.PickableBackground property is not observed--it is assumed to be true; this is most noticeable for GoSubGraphs.

At this time there is no support for actually modifying the SVG elements representing the GoObjects, for example by being able to move or resize a node.

You can define your own interactivity for GoObjects by defining JavaScript event handlers for the SVG elements. The Demo1 sample defines a Demo1SvgWriter that overrides GetHref so that you can click on a node that has a label that starts with "http:" to view that URL.

That sample also defines a Properties form. Its SVG elements are produced by an override of RenderControlsAndForms; its JavaScript functions are produced by an override of GenerateScript. In your application you might need to override GetSelectionId too, so that you can provide a unique identifying string with each selectable object.

Inheritance Hierarchy

System.Object
   Northwoods.GoWeb.Xml.GoXmlReaderWriterBase
      Northwoods.GoWeb.Xml.GoXmlWriter
         Northwoods.GoWeb.Svg.GoSvgWriter

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

GoSvgWriter Members
Northwoods.GoWeb.Svg Namespace

 

 


© 2013. Northwoods Software Corporation. All Rights Reserved.

Send Feedback