To configure the SVG stream factory:
-
Create the manager you will work on and the stream factory
import ilog.views.*;
import ilog.views.svg.*;
IlvManager manager = new IlvManager();
SVGStreamFactory factory = new SVGStreamFactory();
manager.setStreamFactory(factory);
-
Set the options on the stream factory appropriately to
change the way Rogue Wave JViews
loads and saves SVG files: how the file size should be reduced, whether
the reader should ignore some data, and so on.
-
After the stream factory is configured, it must be attached
to the manager by using:
manager.setStreamfactory(factory);
More options can be found in the Java API Reference Manual for the
class, such as other compaction techniques (remove invisible graphic
objects, and so forth) or the ability to choose between CSS or XML
styling.
The following example shows a stream factory configuration:
// When reading SVG, the parsing of the CSS style will include
// the definitions contained in the user.css file.
factory.getReaderConfigurator().setUserStyleSheetURL(“user.css”);
// When writing SVG, the following compaction techniques will be used:
// - style on graphic element will be factored
// - an algorithm will be applied to polyline to remove some points
factory.getBuilderConfigurator().
setCompactMode(SVGDocumentBuilderConfigurator.COMPACT_STYLE |
SVGDocumentBuilderConfigurator.COMPACT_POLY);
// With the option set to true on the reader configurator, when reading SVG,
// elements that cannot be processed will be memorized
// and with the option set to true on the builder configurator, this will
// allow regenerating them later.
factory.getReaderConfigurator().setFullDocumentOn(true);
factory.getBuilderConfigurator().setFullDocumentOn(true);
You can load an SVG file once a stream factory has been
set up.