|
||||||||||
| PREV CLASS Documentation homepage NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
public static interface SVGDocumentBuilderConfigurator.RealToStringConverter
This interface must be implemented by classes that want to
define how the SVG DOM used by the 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);
}
}
| Method Summary | |
|---|---|
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. |
| Method Detail |
|---|
String floatToString(float value)
float value will be translated to
a String.
String doubleToString(double value)
double value will be translated to
a String.
|
||||||||||
| PREV CLASS Documentation homepage NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||