public class SVGDocumentBuilder extends Object
SVGDocument
with the translation
of the IlvGraphic
instances of an IlvGraphicBag
.
It is used by the SVGInputStream
to translate the contents of
an IlvManager
to an SVG file.
However, you can also use this class by itself to build an
SVGDocument
from any kind of IlvGraphicBag
.
You can also subclass it to specialize its behavior.Constructor and Description |
---|
SVGDocumentBuilder(SVGDocumentBuilderConfigurator conf)
Builds an instance of
SVGDocumentBuilder from the given
configurator. |
Modifier and Type | Method and Description |
---|---|
protected void |
afterBuildingDocument()
Called after building the
SVGDocument to add additional
information to it. |
void |
appendStyle(String attribute,
String value)
Called to append a style value to the style list
of the currently written element.
|
org.w3c.dom.svg.SVGDocument |
buildDocument(IlvGraphicSet set)
Creates and fills an
SVGDocument with SVGElement
instances translated from the graphic objects of the
IlvGraphicSet . |
org.w3c.dom.svg.SVGDocument |
buildDocument(IlvManager manager)
Creates and fills an
SVGDocument with
SVGElement instances translated from the graphic objects
of the IlvManager . |
org.w3c.dom.svg.SVGElement |
buildSVGElement(org.w3c.dom.svg.SVGDocument document,
IlvManager manager)
Creates and fills an
SVGDocument with sub
SVGElement instances translated from the graphic objects
of the IlvManager . |
void |
endStylingElement()
Closes the styling session on the
current element.
|
SVGDocumentBuilderConfigurator |
getConfigurator()
Returns the
SVGDocumentBuilderConfigurator for this builder. |
org.w3c.dom.svg.SVGDefsElement |
getDefinition()
Returns the definition node of the SVG document.
|
org.w3c.dom.svg.SVGDocument |
getDocument()
Returns the SVG document.
|
org.w3c.dom.svg.SVGSVGElement |
getMainSVGElement()
Returns the main SVG element of the SVG document.
|
Element |
getMetadata()
Returns the metadata node of the SVG document.
|
void |
startStylingElement(Element element,
IlvGraphic graphic)
Called to initiate a styling session on the
given
Element . |
protected Element |
translate(IlvGraphic graphic,
IlvTransformer t)
Returns an
Element for the given graphic object. |
protected Element |
translate(IlvManagerLayer layer)
Returns an
Element for the given IlvManagerLayer . |
public SVGDocumentBuilder(SVGDocumentBuilderConfigurator conf)
SVGDocumentBuilder
from the given
configurator.public final org.w3c.dom.svg.SVGDocument getDocument()
Element
instances when specializing
SVGDocumentBuilder
or writing your own
SVGDocumentBuilderConfigurator.GraphicTranslator
.public final org.w3c.dom.svg.SVGDefsElement getDefinition()
SVGDocumentBuilder
or writing your own
SVGDocumentBuilderConfigurator.GraphicTranslator
.public final Element getMetadata()
SVGDocumentBuilder
or writing your own
SVGDocumentBuilderConfigurator.GraphicTranslator
.public final org.w3c.dom.svg.SVGSVGElement getMainSVGElement()
public final SVGDocumentBuilderConfigurator getConfigurator()
SVGDocumentBuilderConfigurator
for this builder.protected void afterBuildingDocument()
SVGDocument
to add additional
information to it. The default implementation does nothing.public org.w3c.dom.svg.SVGElement buildSVGElement(org.w3c.dom.svg.SVGDocument document, IlvManager manager)
SVGDocument
with sub
SVGElement
instances translated from the graphic objects
of the IlvManager
.public org.w3c.dom.svg.SVGDocument buildDocument(IlvManager manager)
SVGDocument
with
SVGElement
instances translated from the graphic objects
of the IlvManager
.public org.w3c.dom.svg.SVGDocument buildDocument(IlvGraphicSet set)
SVGDocument
with SVGElement
instances translated from the graphic objects of the
IlvGraphicSet
.protected Element translate(IlvManagerLayer layer)
Element
for the given IlvManagerLayer
.
If it returns null
, the layer will not be added to the generated
SVG Document
.layer
- The layer to be translated.protected Element translate(IlvGraphic graphic, IlvTransformer t)
Element
for the given graphic object. It calls
the SVGDocumentBuilderConfigurator.GraphicTranslator
specific to
the graphic object class.
You should not redefine this method to translate your own
graphic object. You should instead have a look at the
SVGDocumentBuilderConfigurator.putTranslator(java.lang.String, ilog.views.svg.SVGDocumentBuilderConfigurator.GraphicTranslator)
method.graphic
- The graphic to be translated.t
- The transformer to apply to the graphic before translating it.public final void startStylingElement(Element element, IlvGraphic graphic)
Element
. If the Element
that should be
styled represents an IlvGraphic
, you can pass it as
a parameter to add additional
styling information coming from a previous SVG import into the
IlvManager
.public final void appendStyle(String attribute, String value)
startStylingElement(Element,IlvGraphic)
and closed by endStylingElement()
.public final void endStylingElement()
appendStyle(String, String)
© Copyright 2024 Rogue Wave Software, Inc., a Perforce company.. All Rights Reserved.