|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object dip.gui.map.SVGUtils
Assorted utilities for altering the Batik SVG DOM.
The add/remove/replace methods are not only thread safe but also follow Batik guidelines for altering the DOM. If the SVGComponent has been set to dynamic prior to loading of the SVG document, then any DOM change will be rendered automatically.
Also note that for the title/descriptions setting methods, it would be faster to create a Title or Description SVG element and use add / remove / replace as appropriate. This could be an issue if there are frequent title or description changes.
Constructor Summary | |
SVGUtils()
|
Method Summary | |
static void |
appendFloat(java.lang.StringBuffer sb,
float v)
Formats a Floating-Point value into a StringBuffer, using the jDip default precision. |
static org.w3c.dom.svg.SVGUseElement |
createUseElement(org.w3c.dom.svg.SVGDocument document,
java.lang.String symbolName,
java.lang.String id,
java.lang.String attClass,
float x,
float y,
MapMetadata.SymbolSize symbolSize)
Creates an SVG <use> element. |
static org.w3c.dom.Node |
findNodeWithID(org.w3c.dom.Node node,
java.lang.String id)
Walks the DOM tree from root, until the first element with the same ID is found. |
static java.lang.String |
floatToString(float v)
Formats a Floating-Point value into a String, using the jDip default precision. |
static void |
getBestFit(org.apache.batik.swing.JSVGCanvas canvas)
Calculates the maximum possible stretching of a canvas, remaining inside the bounds of a given scrollPane. |
static org.w3c.dom.svg.SVGElement[] |
idFinderSVG(org.w3c.dom.Node root)
Returns all elements with IDs under the given root, as an array of SVGElement objects. |
static void |
setDescription(org.w3c.dom.svg.SVGDocument document,
org.w3c.dom.svg.SVGElement element,
java.lang.String description)
Sets the description of an SVG element. |
static void |
setTitle(org.w3c.dom.svg.SVGDocument document,
org.w3c.dom.svg.SVGElement element,
java.lang.String title)
Sets the title of an SVG element. |
static java.util.Map |
tagFinderSVG(java.util.List lookList,
org.w3c.dom.Node root)
Given a list of objects, finds the first SVG tag that has an ID that matches the object. |
static java.util.Map |
tagFinderSVG(java.util.List lookList,
org.w3c.dom.Node root,
boolean anySVGElement)
As above, but allows any SVG element to be returned |
static void |
tagFinderSVG(java.util.Map map,
java.util.List lookList,
org.w3c.dom.Node root)
Given a list of objects, finds the first SVG tag that has an ID that matches the object. |
static void |
tagFinderSVG(java.util.Map map,
java.util.List lookList,
org.w3c.dom.Node root,
boolean anySVGElement)
As above but allows any SVG element to be returned |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public SVGUtils()
Method Detail |
public static void setTitle(org.w3c.dom.svg.SVGDocument document, org.w3c.dom.svg.SVGElement element, java.lang.String title)
a null title is not valid.
public static void setDescription(org.w3c.dom.svg.SVGDocument document, org.w3c.dom.svg.SVGElement element, java.lang.String description)
A null description is not valid.
public static org.w3c.dom.svg.SVGUseElement createUseElement(org.w3c.dom.svg.SVGDocument document, java.lang.String symbolName, java.lang.String id, java.lang.String attClass, float x, float y, MapMetadata.SymbolSize symbolSize)
Allows insertion of a previously-defined <symbol> element. If id is null, no ID is used. If style is null, no style is used.
x,y are required.
SymbolSize will specify the width/height; if null, no width/height will be specified.
public static java.util.Map tagFinderSVG(java.util.List lookList, org.w3c.dom.Node root)
Null objects are ignored.
Supported Objects in the looklist are:
public static java.util.Map tagFinderSVG(java.util.List lookList, org.w3c.dom.Node root, boolean anySVGElement)
public static void tagFinderSVG(java.util.Map map, java.util.List lookList, org.w3c.dom.Node root)
The SVG elements found are put into the supplied java.util.Map object.
Null objects are ignored.
Supported Objects in the looklist are:
public static void tagFinderSVG(java.util.Map map, java.util.List lookList, org.w3c.dom.Node root, boolean anySVGElement)
public static org.w3c.dom.svg.SVGElement[] idFinderSVG(org.w3c.dom.Node root)
public static org.w3c.dom.Node findNodeWithID(org.w3c.dom.Node node, java.lang.String id)
public static void getBestFit(org.apache.batik.swing.JSVGCanvas canvas)
canvas
- the canvas to be fittedpublic static java.lang.String floatToString(float v)
public static void appendFloat(java.lang.StringBuffer sb, float v)
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |