|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object y.io.IOHandler yext.svg.io.SVGIOHandler
public class SVGIOHandler
Writes a Graph2D in SVG vector graphics format.
The size, viewport and zoom level of the output will be determined by the Graph2DView associated with the input graph.
The output SVG can be enhanced by providing a specialized implementation
of SVGGraph2DRenderer
.
Graph2DView
,
SVGGraph2DRenderer
Constructor Summary | |
---|---|
SVGIOHandler()
Instantiates a new SVGIOHandler. |
Method Summary | |
---|---|
void |
addRenderingHint(RenderingHints.Key key,
Object value)
Adds a rendering hint key-value-pair, that is passed to the underlying rendering subsystem. |
boolean |
canRead()
Returns false, since this class can't read a graph. |
Graph2DView |
createDefaultGraph2DView(Graph2D graph)
Creates the default view used as rendering context of this output handler in case there is no current view associated with the graph2D. |
protected Document |
createDocument()
Creates the document that is used as factory for the nodes in the DOM tree of the SVG that is generated by this SVGIOHandler instance. |
protected GraphicsContext |
createGraphicsContext(Graph2DView view,
Graphics2D g2d)
Creates the GraphicsContext that will be used
for the graphics object while rendering to the SVG document. |
Graph2DView |
getActiveGraph2DView()
|
Document |
getDocument()
Returns the document that is used as factory for the nodes in the DOM tree of the SVG that is generated by this SVGIOHandler instance. |
String |
getFileFormatString()
Returns the SVG file format string. |
String |
getFileNameExtension()
Returns the SVG file name extension, i.e. |
Graph2DView |
getGraph2DView()
|
SVGGraph2DRenderer |
getSVGGraph2DRenderer()
Returns the SVGGraph2DRenderer that will be used to render the graph. |
Object |
getSVGRenderingHintValue()
Returns the preferred rendering mode to be used when exporting SVG enhanced content (i.e. |
boolean |
isCanvasSizeAssigned()
Returns whether or not the <svg> element of the generated file will have the canvas width and height assigned. |
boolean |
isUseCSS()
Returns true if SVG element attributes will be generated as a
single CSS style attribute. |
void |
read(Graph2D graph,
InputStream in)
Throws always an UnsupportedOperationException , since
canRead() == false . |
void |
removeRenderingHint(RenderingHints.Key key)
Removes a rendering hint key-value-pair, so that it is no longer passed to the underlying rendering subsystem. |
void |
setCanvasSizeAssigned(boolean canvasSizeAssigned)
Sets whether or not the <svg> element of the generated file will have the canvas width and height assigned. |
void |
setGraph2DView(Graph2DView viewPort)
|
void |
setSVGGraph2DRenderer(SVGGraph2DRenderer renderer)
Sets the SVGGraph2DRenderer that will be used to render the graph. |
void |
setSVGRenderingHintValue(Object value)
Specifies the preferred rendering mode to be used when exporting SVG enhanced content (i.e. |
void |
setUseCSS(boolean useCSS)
Specifies whether SVG element attributes should be generated as a single CSS style attribute. |
void |
write(Graph2D graph,
OutputStream out)
|
Methods inherited from class y.io.IOHandler |
---|
canWrite, canWriteSubset, createObjectInputStream, createObjectOutputStream, hide, read, read, shouldSerialize, shouldSerialize, write, writeSubset, writeSubset |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public SVGIOHandler()
Method Detail |
---|
public String getFileFormatString()
getFileFormatString
in class IOHandler
public String getFileNameExtension()
getFileNameExtension
in class IOHandler
public boolean canRead()
canRead
in class IOHandler
public void setSVGGraph2DRenderer(SVGGraph2DRenderer renderer)
public SVGGraph2DRenderer getSVGGraph2DRenderer()
setSVGGraph2DRenderer(yext.svg.io.SVGGraph2DRenderer)
public void addRenderingHint(RenderingHints.Key key, Object value)
key
- the key of the hint to be setvalue
- the value indicating preferences for the specified hint
categorypublic void removeRenderingHint(RenderingHints.Key key)
key
- the key of the hint to be removepublic Object getSVGRenderingHintValue()
SVGModel
).
SVGModel.KEY_SVG_RENDERING
SVGModel.KEY_SVG_RENDERING
,
SVGModel.VALUE_SVG_RENDERING_DEFAULT
,
SVGModel.VALUE_SVG_RENDERING_FORCE_RASTERIZATION
,
SVGModel.VALUE_SVG_RENDERING_FORCE_VECTORIZATION
public void setSVGRenderingHintValue(Object value)
SVGModel
). The specified value has to be compatible
with SVGModel.KEY_SVG_RENDERING
.
If the specified value is null
, it is silently treated as
SVGModel.VALUE_SVG_RENDERING_DEFAULT
.
The default setting for SVGRenderingHintValue
is
SVGModel.VALUE_SVG_RENDERING_FORCE_VECTORIZATION
.
value
- the SVG rendering hint value
IllegalArgumentException
- iff the specified value is not
compatible with SVGModel.KEY_SVG_RENDERING
SVGModel.KEY_SVG_RENDERING
,
SVGModel.VALUE_SVG_RENDERING_DEFAULT
,
SVGModel.VALUE_SVG_RENDERING_FORCE_RASTERIZATION
,
SVGModel.VALUE_SVG_RENDERING_FORCE_VECTORIZATION
public boolean isUseCSS()
true
if SVG element attributes will be generated as a
single CSS style attribute.
true
if SVG element attributes will be generated as a
single CSS style attribute; false
otherwise.public void setUseCSS(boolean useCSS)
useCSS
- if true
SVG element attributes are generated
as a single CSS style attribute.public Graph2DView getActiveGraph2DView()
public void read(Graph2D graph, InputStream in) throws IOException
UnsupportedOperationException
, since
canRead() == false
.
read
in class IOHandler
IOException
public void write(Graph2D graph, OutputStream out) throws IOException
write
in class IOHandler
IOException
protected Document createDocument()
SVGIOHandler
instance.
Called from getDocument()
.
getDocument()
public Document getDocument()
SVGIOHandler
instance.
Note: Adding nodes to this document will have no effect regarding
the SVG that is generated by this SVGIOHandler
instance.
SVGDOMEnhancer
may be used to manipulate the DOM tree of the
generated SVG.
SVGDOMEnhancer
public Graph2DView createDefaultGraph2DView(Graph2D graph)
The returned view will be automatically registered as one of the graph's views. After the returned view is not needed anymore it is advisable to remove it from the list of registered view of the given graph.
Graph2D.removeView(View)
protected GraphicsContext createGraphicsContext(Graph2DView view, Graphics2D g2d)
GraphicsContext
that will be used
for the graphics object while rendering to the SVG document.
This implementation sets the GraphicsContext.isExportPainting()
property to true
.
view
- the view that will be used for the painting.g2d
- the graphics object to use for the painting
null
.public void setGraph2DView(Graph2DView viewPort)
public Graph2DView getGraph2DView()
public boolean isCanvasSizeAssigned()
By default the canvas size will be assigned.
public void setCanvasSizeAssigned(boolean canvasSizeAssigned)
By default the canvas size will be assigned.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |