public class SVGGeneratorContext extends java.lang.Object implements ErrorConstants
SVGGraphics2D
to
generate SVG from Java 2D primitives.
You can subclass it to change the defaults.Modifier and Type | Class and Description |
---|---|
static class |
SVGGeneratorContext.GraphicContextDefaults
Class to describe the GraphicContext defaults to
be used.
|
Modifier and Type | Field and Description |
---|---|
protected java.text.DecimalFormat |
decimalFormat
Current double value formatter
|
protected static java.text.DecimalFormat[] |
decimalFormats |
protected static java.text.DecimalFormatSymbols |
dsf |
ERR_ACI, ERR_CANNOT_USE_IMAGE_DIR, ERR_CANVAS_SIZE_NULL, ERR_CLIP_NULL, ERR_CONTEXT_NULL, ERR_DOM_FACTORY_NULL, ERR_DOMTREEMANAGER_NULL, ERR_ERROR_HANDLER_NULL, ERR_EXTENSION_HANDLER_NULL, ERR_FONT_NULL, ERR_GC_NULL, ERR_HINT_NULL, ERR_ID_GENERATOR_NULL, ERR_ILLEGAL_BUFFERED_IMAGE_LOOKUP_OP, ERR_ILLEGAL_BUFFERED_IMAGE_RESCALE_OP, ERR_IMAGE_DIR_DOES_NOT_EXIST, ERR_IMAGE_DIR_NULL, ERR_IMAGE_HANDLER_NOT_SUPPORTED, ERR_IMAGE_HANDLER_NULL, ERR_IMAGE_NULL, ERR_MAP_NULL, ERR_MAXGCOVERRIDES_OUTOFRANGE, ERR_PROXY, ERR_READ, ERR_SCALE_FACTORS_AND_OFFSETS_MISMATCH, ERR_STROKE_NULL, ERR_STYLE_HANDLER_NULL, ERR_TOP_LEVEL_GROUP_NOT_G, ERR_TOP_LEVEL_GROUP_NULL, ERR_TRANS_NULL, ERR_UNEXPECTED, ERR_WRITE, ERR_XOR, INVALID_NODE
Modifier | Constructor and Description |
---|---|
protected |
SVGGeneratorContext(Document domFactory)
Builds an instance of
SVGGeneratorContext with the given
domFactory but let the user set later the other contextual
information. |
Modifier and Type | Method and Description |
---|---|
static SVGGeneratorContext |
createDefault(Document domFactory)
Creates an instance of
SVGGeneratorContext with the
given domFactory and with the default values for the
other information. |
java.lang.String |
doubleString(double value)
Converts the input double value to a string with a number of
decimal places controlled by the precision attribute.
|
java.lang.String |
getComment()
Returns the comment to be generated in the SVG file.
|
Document |
getDOMFactory()
Returns the DOM Factory that
has been set.
|
ErrorHandler |
getErrorHandler()
Returns the
ErrorHandler that
has been set. |
ExtensionHandler |
getExtensionHandler()
Returns the
ExtensionHandler that
has been set. |
SVGGeneratorContext.GraphicContextDefaults |
getGraphicContextDefaults()
Returns the set of defaults which should be used for the
GraphicContext.
|
SVGIDGenerator |
getIDGenerator()
Returns the
SVGIDGenerator that
has been set. |
ImageHandler |
getImageHandler()
Returns the
ImageHandler that
has been set. |
int |
getPrecision()
Returns the current precision used by this context
|
StyleHandler |
getStyleHandler()
Returns the
StyleHandler that
has been set. |
boolean |
isEmbeddedFontsOn()
Returns
true if we should generate SVG Fonts for
texts. |
void |
setComment(java.lang.String generatorComment)
Sets the comment to be used.
|
void |
setDOMFactory(Document domFactory)
Sets the DOM Factory
to be used.
|
void |
setEmbeddedFontsOn(boolean svgFont)
Sets if we should generate SVG Fonts for texts.
|
void |
setErrorHandler(ErrorHandler errorHandler)
Sets the
ErrorHandler
to be used. |
void |
setExtensionHandler(ExtensionHandler extensionHandler)
Sets the
ExtensionHandler
to be used. |
void |
setGenericImageHandler(GenericImageHandler genericImageHandler)
Sets the
GenericImageHandler
to be used. |
void |
setGraphicContextDefaults(SVGGeneratorContext.GraphicContextDefaults gcDefaults)
Sets the default to be used for the graphic context.
|
void |
setIDGenerator(SVGIDGenerator idGenerator)
Sets the
SVGIDGenerator
to be used. |
void |
setImageHandler(ImageHandler imageHandler)
Sets the
ImageHandler
to be used. |
void |
setPrecision(int precision)
Sets the precision used by this context.
|
void |
setStyleHandler(StyleHandler styleHandler)
Sets the
StyleHandler
to be used. |
protected java.text.DecimalFormat decimalFormat
protected static java.text.DecimalFormatSymbols dsf
protected static java.text.DecimalFormat[] decimalFormats
protected SVGGeneratorContext(Document domFactory)
SVGGeneratorContext
with the given
domFactory
but let the user set later the other contextual
information. Please note that none of the parameter below should be
null
.public static SVGGeneratorContext createDefault(Document domFactory)
SVGGeneratorContext
with the
given domFactory
and with the default values for the
other information.public final SVGGeneratorContext.GraphicContextDefaults getGraphicContextDefaults()
public final void setGraphicContextDefaults(SVGGeneratorContext.GraphicContextDefaults gcDefaults)
public final SVGIDGenerator getIDGenerator()
SVGIDGenerator
that
has been set.public final void setIDGenerator(SVGIDGenerator idGenerator)
SVGIDGenerator
to be used. It should not be null
.public final Document getDOMFactory()
public final void setDOMFactory(Document domFactory)
null
.public final ExtensionHandler getExtensionHandler()
ExtensionHandler
that
has been set.public final void setExtensionHandler(ExtensionHandler extensionHandler)
ExtensionHandler
to be used. It should not be null
.public final ImageHandler getImageHandler()
ImageHandler
that
has been set.public final void setImageHandler(ImageHandler imageHandler)
ImageHandler
to be used. It should not be null
.public final void setGenericImageHandler(GenericImageHandler genericImageHandler)
GenericImageHandler
to be used.public final StyleHandler getStyleHandler()
StyleHandler
that
has been set.public final void setStyleHandler(StyleHandler styleHandler)
StyleHandler
to be used. It should not be null
.public final java.lang.String getComment()
public final void setComment(java.lang.String generatorComment)
null
if you
want to disable it.public final ErrorHandler getErrorHandler()
ErrorHandler
that
has been set.public final void setErrorHandler(ErrorHandler errorHandler)
ErrorHandler
to be used. It should not be null
.public final boolean isEmbeddedFontsOn()
true
if we should generate SVG Fonts for
texts.public final void setEmbeddedFontsOn(boolean svgFont)
false
.public final int getPrecision()
public final void setPrecision(int precision)
public final java.lang.String doubleString(double value)
Copyright © 2022 Apache Software Foundation. All Rights Reserved.