|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object y.view.NodeRealizer yext.svg.view.SVGNodeRealizer
public class SVGNodeRealizer
A node realizer that displays a node as scalable vector graphics. The scalable vector graphics must be given in SVG format.
The visual representation of a SVGNodeRealizer
is essentially
determined by its associated SVG content.
As a consequence, the implementation of
paintNode(java.awt.Graphics2D)
ignores the following properties:
fillColor
fillColor2
lineColor
andlineType
This node realizer is based on the SVG implementation provided by the Batik project.
Field Summary |
---|
Fields inherited from class y.view.NodeRealizer |
---|
height, HOTSPOT_E, HOTSPOT_N, HOTSPOT_NE, HOTSPOT_NONE, HOTSPOT_NW, HOTSPOT_S, HOTSPOT_SE, HOTSPOT_SW, HOTSPOT_W, width, x, y |
Constructor Summary | |
---|---|
SVGNodeRealizer()
Initializes a new SVGNodeRealizer instance without associated
SVG graphics. |
|
SVGNodeRealizer(NodeRealizer argNodeRealizer)
Initializes a new SVGNodeRealizer instance whose
attributes are copied from the given prototype realizer. |
|
SVGNodeRealizer(SVGModel model)
Initializes a new SVGNodeRealizer instance that displays the
given scalable vector graphics. |
|
SVGNodeRealizer(URL svgURL)
Initializes a new SVGNodeRealizer instance that displays the
referenced SVG document. |
Method Summary | |
---|---|
boolean |
contains(double x,
double y)
Determines whether or not the specified point lies inside this realizer. |
NodeRealizer |
createCopy(NodeRealizer nr)
Creates and returns a new SVGNodeRealizer instance whose
attributes are copied from the given realizer. |
boolean |
findIntersection(double ix,
double iy,
double ox,
double oy,
Point2D result)
|
SVGModel |
getModel()
Returns the underlying SVG model for this SVGNodeRealizer . |
URL |
getSVGURL()
Returns the URL of the SVG graphics that will be displayed by this realizer. |
boolean |
isUsingVisualBounds()
Returns whether or not the visual bounds of the displayed vector graphic are used for contains tests. |
void |
paintNode(Graphics2D gfx)
Paints the node as scalable vector graphics on the given graphics context. |
void |
read(ObjectInputStream in)
Deprecated. Use the GraphML format instead. |
void |
setModel(SVGModel model)
Sets the underlying SVG model for this SVGNodeRealizer . |
void |
setSVGURL(URL svgURL)
Sets the URL of the SVG graphics that will be displayed by this realizer. |
void |
setToOriginalSize()
Sets the size of this realizer to the natural size of the svg graphics being displayed. |
void |
setUsingVisualBounds(boolean enabled)
Specifies whether or not the visual bounds of the displayed vector graphic are used for contains tests. |
void |
write(ObjectOutputStream out)
Deprecated. Use the GraphML format instead. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public SVGNodeRealizer()
SVGNodeRealizer
instance without associated
SVG graphics. Use setSVGURL(java.net.URL)
or
setModel(SVGModel)
to specify the vector graphics to display.
public SVGNodeRealizer(SVGModel model)
SVGNodeRealizer
instance that displays the
given scalable vector graphics.
model
- the scalable vector graphics to display.
May not be null
!public SVGNodeRealizer(URL svgURL)
SVGNodeRealizer
instance that displays the
referenced SVG document.
The size of this node will be determined by the bounds of the referenced
graphics.
svgURL
- the URL of the SVG document to display.public SVGNodeRealizer(NodeRealizer argNodeRealizer)
SVGNodeRealizer
instance whose
attributes are copied from the given prototype realizer.
argNodeRealizer
- the prototype realizer whose attributes are copied.Method Detail |
---|
public NodeRealizer createCopy(NodeRealizer nr)
SVGNodeRealizer
instance whose
attributes are copied from the given realizer.
createCopy
in class NodeRealizer
nr
- the prototype realizer whose attributes are copied.public boolean findIntersection(double ix, double iy, double ox, double oy, Point2D result)
findIntersection
in class NodeRealizer
public URL getSVGURL()
public void setSVGURL(URL svgURL)
public SVGModel getModel()
SVGNodeRealizer
.
public void setModel(SVGModel model)
SVGNodeRealizer
.
model
- the SVG model to use. May not be null
!public void setToOriginalSize()
public boolean isUsingVisualBounds()
Defaults to false
.
true
if the visual bounds of the displayed vector
graphic are used for contains tests and false
if the
realizer's rectangular bounding box is used for contains tests.setUsingVisualBounds(boolean)
,
contains(double, double)
public void setUsingVisualBounds(boolean enabled)
Defaults to false
.
enabled
- if true
the visual bounds of the displayed
vector graphic are used for contains tests; otherwise the realizer's
rectangular bounding box is used for contains tests.isUsingVisualBounds()
,
contains(double, double)
public boolean contains(double x, double y)
contains
in class NodeRealizer
x
- the x-coordinate of the point to check.y
- the y-coordinate of the point to check.
true
if the specified point lies inside this realizer;
false
otherwise.isUsingVisualBounds()
,
setUsingVisualBounds(boolean)
public void paintNode(Graphics2D gfx)
paintNode
in class NodeRealizer
public void write(ObjectOutputStream out) throws IOException
GraphML format
instead.
SVGNodeRealizer
now serializes the complete
information contained in the SVG DOM as well as the URL associated to the
realizer. As a side effect, serialization/deserialization no longer depends
on the location and content of the original SVG file
(if that existed at all).
write
in class NodeRealizer
IOException
public void read(ObjectInputStream in) throws IOException, ClassNotFoundException
GraphML format
instead.
SVGNodeRealizer
now deserializes the complete
information for the SVG DOM as well as the URL associated to the
realizer. As a side effect, serialization/deserialization no longer depends
on the location and content of the original SVG file
(if that existed at all).
read
in class NodeRealizer
IOException
ClassNotFoundException
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |