yext.svg.view
Class SVGNodeRealizer

java.lang.Object
  extended byy.view.NodeRealizer
      extended byyext.svg.view.SVGNodeRealizer
All Implemented Interfaces:
NodeLayout

public class SVGNodeRealizer
extends NodeRealizer

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:

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()
          Creates a new SVGNodeRealizer with no SVG graphics associated with it.
SVGNodeRealizer(NodeRealizer argNodeRealizer)
          Creates a new SVGNodeRealizer whose attributes are copied from the given realizer.
SVGNodeRealizer(SVGModel model)
          Creates a new SVGIcon that displays the given SVG model.
SVGNodeRealizer(URL svgURL)
          Creates a new SVGNodeRealizer displaying the given SVG graphics.
 
Method Summary
 NodeRealizer createCopy(NodeRealizer nr)
          Creates and returns a new SVGNodeRealizer 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.
 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 write(ObjectOutputStream out)
          Deprecated. Use the GraphML format instead.
 
Methods inherited from class y.view.NodeRealizer
addLabel, addPort, boundsChanged, calcUnionRect, calcUnionRect, calcUnionRectImpl, calcUnionRectLabels, calcUnionRectPorts, contains, createCopy, createNodeLabel, findBBIntersection, getAutoBoundsFeature, getBoundingBox, getCenterX, getCenterY, getFillColor, getFillColor2, getHeight, getHotSpotColor, getLabel, getLabel, getLabelText, getLayer, getLineColor, getLineType, getMouseInputEditorProvider, getNode, getPort, getPortCandidates, getSizeConstraintProvider, getSloppySelectionColor, getWidth, getX, getY, hotSpotHit, intersects, invalidatePortPositions, isInBox, isSelected, isTransparent, isVisible, labelBoundsChanged, labelCount, moveBy, paint, paintHotSpots, paintLayer, paintLayerSloppy, paintPorts, paintSloppy, paintText, portCount, removeLabel, removePort, removePort, repaint, setCenter, setCenterX, setCenterY, setEdgesDirty, setFillColor, setFillColor2, setFrame, setFrame, setHeight, setHotSpotColor, setLabel, setLabelText, setLayer, setLayer, setLineColor, setLineType, setLocation, setSelected, setSize, setSloppySelectionColor, setTransparent, setVisible, setWidth, setX, setY
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SVGNodeRealizer

public SVGNodeRealizer()
Creates a new SVGNodeRealizer with no SVG graphics associated with it.


SVGNodeRealizer

public SVGNodeRealizer(SVGModel model)
Creates a new SVGIcon that displays the given SVG model.


SVGNodeRealizer

public SVGNodeRealizer(URL svgURL)
Creates a new SVGNodeRealizer displaying the given SVG graphics. The size of this node will be determined by the bounds of the SVG graphics.


SVGNodeRealizer

public SVGNodeRealizer(NodeRealizer argNodeRealizer)
Creates a new SVGNodeRealizer whose attributes are copied from the given realizer.

Method Detail

createCopy

public NodeRealizer createCopy(NodeRealizer nr)
Creates and returns a new SVGNodeRealizer whose attributes are copied from the given realizer.


findIntersection

public boolean findIntersection(double ix,
                                double iy,
                                double ox,
                                double oy,
                                Point2D result)

getSVGURL

public URL getSVGURL()
Returns the URL of the SVG graphics that will be displayed by this realizer.


setSVGURL

public void setSVGURL(URL svgURL)
Sets the URL of the SVG graphics that will be displayed by this realizer. The given URL must point to a resource in SVG format.


getModel

public SVGModel getModel()
Returns the underlying SVG model for this SVGNodeRealizer.


setModel

public void setModel(SVGModel model)
Sets the underlying SVG model for this SVGNodeRealizer.


setToOriginalSize

public void setToOriginalSize()
Sets the size of this realizer to the natural size of the svg graphics being displayed. This method will do nothing if the svg graphics do not include any shapes for which bounds can be calculated.


paintNode

public void paintNode(Graphics2D gfx)
Paints the node as scalable vector graphics on the given graphics context.


write

public void write(ObjectOutputStream out)
           throws IOException
Deprecated. Use the GraphML format instead.

Writes out this realizer in a serialized form. Note that unlike previous versions, 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).

Throws:
IOException

read

public void read(ObjectInputStream in)
          throws IOException,
                 ClassNotFoundException
Deprecated. Use the GraphML format instead.

Reads in the serialized form of this realizer. Note that unlike previous versions, 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).

Throws:
IOException
ClassNotFoundException

© Copyright 2002-2010,
yWorks GmbH.
All rights reserved.