Environment for
DeveLoping
KDD-Applications
Supported by Index-Structures

de.lmu.ifi.dbs.elki.visualization.svg
Class SVGUtil

java.lang.Object
  extended by de.lmu.ifi.dbs.elki.visualization.svg.SVGUtil

public final class SVGUtil
extends Object

Utility class for SVG processing. Much of the classes are to allow easier attribute setting (conversion to string) and Namespace handling

Author:
Erich Schubert

Field Summary
static NumberFormat FMT
          Formatter to output numbers in a valid SVG number format.
 
Constructor Summary
SVGUtil()
           
 
Method Summary
static void addCSSClass(Element e, String cssclass)
          Add a CSS class to an Element.
static String fmt(double x)
          Format a double according to the SVG specs.
static Element makeStyleElement(Document document)
          Make a new CSS style element for the given Document.
static void removeCSSClass(Element e, String cssclass)
          Remove a CSS class from an Element.
static void setAtt(Element el, String name, double d)
          Set a SVG attribute
static void setAtt(Element el, String name, int d)
          Set a SVG attribute
static void setAtt(Element el, String name, String d)
          Set a SVG attribute
static Element svgElement(Document document, String name)
          Create a SVG element in appropriate namespace
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

FMT

public static final NumberFormat FMT
Formatter to output numbers in a valid SVG number format.

Constructor Detail

SVGUtil

public SVGUtil()
Method Detail

fmt

public static String fmt(double x)
Format a double according to the SVG specs.

Parameters:
x - number to format
Returns:
String representation

svgElement

public static Element svgElement(Document document,
                                 String name)
Create a SVG element in appropriate namespace

Parameters:
document - containing document
name - node name
Returns:
new SVG element.

setAtt

public static void setAtt(Element el,
                          String name,
                          double d)
Set a SVG attribute

Parameters:
el - element
name - attribute name
d - double value

setAtt

public static void setAtt(Element el,
                          String name,
                          int d)
Set a SVG attribute

Parameters:
el - element
name - attribute name
d - integer value

setAtt

public static void setAtt(Element el,
                          String name,
                          String d)
Set a SVG attribute

Parameters:
el - element
name - attribute name
d - string value

addCSSClass

public static void addCSSClass(Element e,
                               String cssclass)
Add a CSS class to an Element.

Parameters:
e - Element
cssclass - class to add.

removeCSSClass

public static void removeCSSClass(Element e,
                                  String cssclass)
Remove a CSS class from an Element.

Parameters:
e - Element
cssclass - class to remove.

makeStyleElement

public static Element makeStyleElement(Document document)
Make a new CSS style element for the given Document.

Parameters:
document - document (factory)
Returns:
new CSS style element.

Release 0.2.1 (2009-07-13_1605)