public static interface SVGDocumentBuilderConfigurator.RealToStringConverter
SVGDocumentBuilder
will
translate real number values to DOM strings.
You can set your instance using the SVGDocumentBuilderConfigurator.setRealToStringConverter(ilog.views.svg.SVGDocumentBuilderConfigurator.RealToStringConverter)
method; the default is of type DefaultRealToStringConverter
.
For example, if you want your real numbers in SVG files having only 3
decimals instead of the regular number of decimals that Java is producing,
you could use the following sample
RealToStringConverter
subclass:
class ThreeRealToStringConverter implements SVGDocumentBuilderConfigurator.RealToStringConverter { public String floatToString(float value) { return doubleToString((double)value); } public String doubleToString(double value) { // of course an improved version would be to test for no overflow when // multiplying by 1000. return Double.toString(((double)(int)(value*1000))/1000); } }
Modifier and Type | Method and Description |
---|---|
String |
doubleToString(double value)
Defines how a
double value will be translated to
a String . |
String |
floatToString(float value)
Defines how a
float value will be translated to
a String . |
© Copyright Rogue Wave Software, Inc. 1997, 2018. All Rights Reserved.