|
|||||||||
| Home >> All >> com >> xerox >> VTM >> [ svg overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
com.xerox.VTM.svg
Class SVGReader

java.lang.Objectcom.xerox.VTM.svg.SVGReader
- public class SVGReader
- extends java.lang.Object
An SVG interpreter for VTM - for now it covers a very limited subset of the specification (just enough to interpret GraphViz/Dot SVG output (Ellipse, Text, Path and Rectangle + limited support for Polygon)).
| Constructor Summary | |
SVGReader()
|
|
| Method Summary | |
static boolean |
checkSVGPath(java.lang.String svg)
check that an SVG path value is supported by the VTM. |
static com.xerox.VTM.glyphs.VCircle |
createCircle(org.w3c.dom.Element e)
create a VCircle from an SVG circle element |
static com.xerox.VTM.glyphs.VCircle |
createCircle(org.w3c.dom.Element e,
Context ctx)
create a VCircle from an SVG circle element |
static com.xerox.VTM.glyphs.VEllipse |
createEllipse(org.w3c.dom.Element e)
create a VEllipse from an SVG ellipse element |
static com.xerox.VTM.glyphs.VEllipse |
createEllipse(org.w3c.dom.Element e,
Context ctx)
create a VEllipse from an SVG ellipse element |
static com.xerox.VTM.glyphs.VPath |
createPath(org.w3c.dom.Element e,
com.xerox.VTM.glyphs.VPath ph)
create a VPath from an SVG text element |
static com.xerox.VTM.glyphs.VPath |
createPath(org.w3c.dom.Element e,
com.xerox.VTM.glyphs.VPath ph,
Context ctx)
create a VPath from an SVG text element |
static com.xerox.VTM.glyphs.VPath |
createPath(java.lang.String d,
com.xerox.VTM.glyphs.VPath ph)
create a VPath from an SVG text element |
static com.xerox.VTM.glyphs.VPath |
createPath(java.lang.String d,
com.xerox.VTM.glyphs.VPath ph,
Context ctx)
create a VPath from an SVG text element |
static com.xerox.VTM.glyphs.VPolygon |
createPolygon(org.w3c.dom.Element e)
create a VPolygon from an SVG polygon element |
static com.xerox.VTM.glyphs.VPolygon |
createPolygon(org.w3c.dom.Element e,
Context ctx)
create a VPolygon from an SVG polygon element |
static com.xerox.VTM.glyphs.VSegment[] |
createPolyline(org.w3c.dom.Element e)
create a set of VSegments from an SVG polyline element |
static com.xerox.VTM.glyphs.VSegment[] |
createPolyline(org.w3c.dom.Element e,
Context ctx)
create a set of VSegments from an SVG polyline element |
static com.xerox.VTM.glyphs.VRectangleOr |
createRectangle(org.w3c.dom.Element e)
create a VRectangle from an SVG rect element |
static com.xerox.VTM.glyphs.VRectangleOr |
createRectangle(org.w3c.dom.Element e,
Context ctx)
create a VRectangle from an SVG rect element |
static com.xerox.VTM.glyphs.VRectangleOr |
createRectangleFromPolygon(org.w3c.dom.Element e)
create a VRectangle from an SVG polygon element (after checking this is actually a rectangle - returns null if not) |
static com.xerox.VTM.glyphs.VRectangleOr |
createRectangleFromPolygon(org.w3c.dom.Element e,
Context ctx)
create a VRectangle from an SVG polygon element (after checking this is actually a rectangle - returns null if not) |
static com.xerox.VTM.glyphs.VRoundRect |
createRoundRectFromPolygon(org.w3c.dom.Element e)
create a VRoundRect from an SVG polygon element (after checking this is actually a rectangle - returns null if not) |
static com.xerox.VTM.glyphs.VRoundRect |
createRoundRectFromPolygon(org.w3c.dom.Element e,
Context ctx)
create a VRoundRect from an SVG polygon element (after checking this is actually a rectangle - returns null if not) |
static com.xerox.VTM.glyphs.VText |
createText(org.w3c.dom.Element e,
Context ctx,
com.xerox.VTM.engine.VirtualSpaceManager vsm)
create a VText from an SVG text element - warning if text uses attribute text-anchor and has a value different from start, it will not be taken into account (it is up to you to place the text correctly, as it requires information about the View's graphicscontext to compute the string's width/height) |
static com.xerox.VTM.glyphs.VText |
createText(org.w3c.dom.Element e,
com.xerox.VTM.engine.VirtualSpaceManager vsm)
create a VText from an SVG text element - warning if text uses attribute text-anchor and has a value different from start, it will not be taken into account (it is up to you to place the text correctly, as it requires information about the View's graphicscontext to compute the string's width/height) |
static java.awt.Color |
getColor(java.lang.String s)
|
(package private) static int |
getNextNumber(java.lang.StringBuffer sb)
|
static com.xerox.VTM.engine.LongPoint |
getPositionOffset()
get the position offset (0,0 means no offset) |
static SVGStyle |
getStyle(java.lang.String s)
|
static boolean |
isRectangle(java.util.Vector v)
|
static void |
load(org.w3c.dom.Document d,
com.xerox.VTM.engine.VirtualSpaceManager vsm,
java.lang.String vs)
Load a DOM-parsed SVG document d in VirtualSpace vs |
private static void |
processNextSVGCoords(java.lang.StringBuffer svg,
java.util.Vector res)
|
private static void |
processNextSVGPathCommand(java.lang.StringBuffer svg,
com.xerox.VTM.glyphs.VPath ph,
java.lang.StringBuffer lastCommand)
|
private static void |
processNode(org.w3c.dom.Element e,
com.xerox.VTM.engine.VirtualSpaceManager vsm,
java.lang.String vs,
Context ctx,
boolean mainFontSet)
|
private static void |
seekSecondCoord(java.lang.StringBuffer sb)
|
static void |
setPositionOffset(long dx,
long dy)
When this is set to something different than 0, all SVG objects will be translated by (dx,dy) in their VTM virtual space. |
private static boolean |
specialFont(java.awt.Font cFont,
java.awt.Font mFont)
|
static void |
translateSVGPolygon(java.lang.String s,
java.util.Vector res)
Translate an SVG polygon coordinates from the SVG space to the VTM space, taking position offset into account |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
_polyline
public static java.lang.String _polyline
_line
public static java.lang.String _line
_rect
public static java.lang.String _rect
_image
public static java.lang.String _image
_ellipse
public static java.lang.String _ellipse
_circle
public static java.lang.String _circle
_path
public static java.lang.String _path
_text
public static java.lang.String _text
_polygon
public static java.lang.String _polygon
_g
public static java.lang.String _g
_a
public static java.lang.String _a
_title
public static java.lang.String _title
_fill
public static java.lang.String _fill
_stroke
public static java.lang.String _stroke
_strokewidth
public static java.lang.String _strokewidth
_fillopacity
public static java.lang.String _fillopacity
_fontfamily
public static java.lang.String _fontfamily
_fontsize
public static java.lang.String _fontsize
_fontweight
public static java.lang.String _fontweight
_fontstyle
public static java.lang.String _fontstyle
_style
public static java.lang.String _style
_cx
public static java.lang.String _cx
_cy
public static java.lang.String _cy
_rx
public static java.lang.String _rx
_ry
public static java.lang.String _ry
_r
public static java.lang.String _r
_d
public static java.lang.String _d
_x
public static java.lang.String _x
_y
public static java.lang.String _y
_width
public static java.lang.String _width
_height
public static java.lang.String _height
_points
public static java.lang.String _points
_textanchor
public static java.lang.String _textanchor
_start
public static java.lang.String _start
_middle
public static java.lang.String _middle
_end
public static java.lang.String _end
_inherit
public static java.lang.String _inherit
xoffset
static long xoffset
yoffset
static long yoffset
RRARCR
public static float RRARCR
| Constructor Detail |
SVGReader
public SVGReader()
| Method Detail |
setPositionOffset
public static void setPositionOffset(long dx,
long dy)
- When this is set to something different than 0, all SVG objects will be translated by (dx,dy) in their VTM virtual space. This can be useful if you do not want all objects of the SVG file to all be in the south-east quadrant of the virtual space (SVG files often use positive coordinates only, and their coordinate system is inversed (vertically) w.r.t VTM's coordinate system)
getPositionOffset
public static com.xerox.VTM.engine.LongPoint getPositionOffset()
- get the position offset (0,0 means no offset)
checkSVGPath
public static boolean checkSVGPath(java.lang.String svg)
- check that an SVG path value is supported by the VTM. This does not test for well-formedness of the expression. It just verifies that all SVG commands are actually supported by the VTM (M,m,L,l,H,h,V,v,C,c,Q,q)
processNextSVGPathCommand
private static void processNextSVGPathCommand(java.lang.StringBuffer svg, com.xerox.VTM.glyphs.VPath ph, java.lang.StringBuffer lastCommand)
getColor
public static java.awt.Color getColor(java.lang.String s)
getStyle
public static SVGStyle getStyle(java.lang.String s)
translateSVGPolygon
public static void translateSVGPolygon(java.lang.String s, java.util.Vector res)
- Translate an SVG polygon coordinates from the SVG space to the VTM space, taking position offset into account
processNextSVGCoords
private static void processNextSVGCoords(java.lang.StringBuffer svg, java.util.Vector res)
seekSecondCoord
private static void seekSecondCoord(java.lang.StringBuffer sb)
getNextNumber
static int getNextNumber(java.lang.StringBuffer sb)
isRectangle
public static boolean isRectangle(java.util.Vector v)
createEllipse
public static com.xerox.VTM.glyphs.VEllipse createEllipse(org.w3c.dom.Element e)
- create a VEllipse from an SVG ellipse element
createEllipse
public static com.xerox.VTM.glyphs.VEllipse createEllipse(org.w3c.dom.Element e, Context ctx)
- create a VEllipse from an SVG ellipse element
createCircle
public static com.xerox.VTM.glyphs.VCircle createCircle(org.w3c.dom.Element e)
- create a VCircle from an SVG circle element
createCircle
public static com.xerox.VTM.glyphs.VCircle createCircle(org.w3c.dom.Element e, Context ctx)
- create a VCircle from an SVG circle element
createText
public static com.xerox.VTM.glyphs.VText createText(org.w3c.dom.Element e, com.xerox.VTM.engine.VirtualSpaceManager vsm)
- create a VText from an SVG text element - warning if text uses attribute text-anchor and has a value different from start, it will not be taken into account (it is up to you to place the text correctly, as it requires information about the View's graphicscontext to compute the string's width/height)
createText
public static com.xerox.VTM.glyphs.VText createText(org.w3c.dom.Element e, Context ctx, com.xerox.VTM.engine.VirtualSpaceManager vsm)
- create a VText from an SVG text element - warning if text uses attribute text-anchor and has a value different from start, it will not be taken into account (it is up to you to place the text correctly, as it requires information about the View's graphicscontext to compute the string's width/height)
createRectangleFromPolygon
public static com.xerox.VTM.glyphs.VRectangleOr createRectangleFromPolygon(org.w3c.dom.Element e)
- create a VRectangle from an SVG polygon element (after checking this is actually a rectangle - returns null if not)
createRectangleFromPolygon
public static com.xerox.VTM.glyphs.VRectangleOr createRectangleFromPolygon(org.w3c.dom.Element e, Context ctx)
- create a VRectangle from an SVG polygon element (after checking this is actually a rectangle - returns null if not)
createRoundRectFromPolygon
public static com.xerox.VTM.glyphs.VRoundRect createRoundRectFromPolygon(org.w3c.dom.Element e)
- create a VRoundRect from an SVG polygon element (after checking this is actually a rectangle - returns null if not)
createRoundRectFromPolygon
public static com.xerox.VTM.glyphs.VRoundRect createRoundRectFromPolygon(org.w3c.dom.Element e, Context ctx)
- create a VRoundRect from an SVG polygon element (after checking this is actually a rectangle - returns null if not)
createRectangle
public static com.xerox.VTM.glyphs.VRectangleOr createRectangle(org.w3c.dom.Element e)
- create a VRectangle from an SVG rect element
createRectangle
public static com.xerox.VTM.glyphs.VRectangleOr createRectangle(org.w3c.dom.Element e, Context ctx)
- create a VRectangle from an SVG rect element
createPolygon
public static com.xerox.VTM.glyphs.VPolygon createPolygon(org.w3c.dom.Element e)
- create a VPolygon from an SVG polygon element
createPolygon
public static com.xerox.VTM.glyphs.VPolygon createPolygon(org.w3c.dom.Element e, Context ctx)
- create a VPolygon from an SVG polygon element
createPolyline
public static com.xerox.VTM.glyphs.VSegment[] createPolyline(org.w3c.dom.Element e)
- create a set of VSegments from an SVG polyline element
createPolyline
public static com.xerox.VTM.glyphs.VSegment[] createPolyline(org.w3c.dom.Element e, Context ctx)
- create a set of VSegments from an SVG polyline element
createPath
public static com.xerox.VTM.glyphs.VPath createPath(org.w3c.dom.Element e, com.xerox.VTM.glyphs.VPath ph)
- create a VPath from an SVG text element
createPath
public static com.xerox.VTM.glyphs.VPath createPath(org.w3c.dom.Element e, com.xerox.VTM.glyphs.VPath ph, Context ctx)
- create a VPath from an SVG text element
createPath
public static com.xerox.VTM.glyphs.VPath createPath(java.lang.String d, com.xerox.VTM.glyphs.VPath ph)
- create a VPath from an SVG text element
createPath
public static com.xerox.VTM.glyphs.VPath createPath(java.lang.String d, com.xerox.VTM.glyphs.VPath ph, Context ctx)
- create a VPath from an SVG text element
load
public static void load(org.w3c.dom.Document d, com.xerox.VTM.engine.VirtualSpaceManager vsm, java.lang.String vs)
- Load a DOM-parsed SVG document d in VirtualSpace vs
processNode
private static void processNode(org.w3c.dom.Element e, com.xerox.VTM.engine.VirtualSpaceManager vsm, java.lang.String vs, Context ctx, boolean mainFontSet)
specialFont
private static boolean specialFont(java.awt.Font cFont, java.awt.Font mFont)
|
|||||||||
| Home >> All >> com >> xerox >> VTM >> [ svg overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
JAVADOC
com.xerox.VTM.svg.SVGReader