mxGraph 2.5.0.3


com.mxgraph.shape
Class mxStencilShape

java.lang.Object
  extended by com.mxgraph.shape.mxBasicShape
      extended by com.mxgraph.shape.mxStencilShape
All Implemented Interfaces:
mxIShape

public class mxStencilShape
extends mxBasicShape

Stencil shape drawing that takes an XML definition of the shape and renders it. See http://projects.gnome.org/dia/custom-shapes for specs. See http://dia-installer.de/shapes_de.html for shapes.


Nested Class Summary
protected  class mxStencilShape.svgShape
           
 
Field Summary
protected  Rectangle2D boundingBox
           
protected  AffineTransform cachedTransform
          Transform cached to save instance created.
protected  String iconPath
           
protected  String name
           
protected  Node root
          Reference to the root node of the Dia shape description.
protected  mxStencilShape.svgShape rootShape
           
protected  GeneralPath shapePath
           
 
Constructor Summary
mxStencilShape()
           
mxStencilShape(Document document)
           
mxStencilShape(String shapeXml)
          Constructs a new stencil for the given Dia shape description.
 
Method Summary
 mxStencilShape.svgShape createElement(Node root)
          Forms an internal representation of the specified SVG element and returns that representation
 void createShape(Node root, mxStencilShape.svgShape shape)
           
 Rectangle2D getBoundingBox()
           
 String getIconPath()
           
 String getName()
           
protected static Map<String,Object> getStylenames(String style)
          Returns the stylenames in a style of the form stylename[;key=value] or an empty array if the given style does not contain any stylenames.
 void paintNode(mxGraphics2DCanvas canvas, mxCellState state, mxStencilShape.svgShape shape, double widthRatio, double heightRatio)
           
 void paintShape(mxGraphics2DCanvas canvas, mxCellState state)
           
 void setBoundingBox(Rectangle2D boundingBox)
           
 void setIconPath(String iconPath)
           
 void setName(String name)
           
protected  void transformShape(Shape shape, double transX, double transY, double widthRatio, double heightRatio)
          Scales the points composing this shape by the x and y ratios specified
 
Methods inherited from class com.mxgraph.shape.mxBasicShape
configureGraphics, createShape, getFillColor, getGradientBounds, getStrokeColor, hasGradient, hasShadow
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

shapePath

protected GeneralPath shapePath

root

protected Node root
Reference to the root node of the Dia shape description.


rootShape

protected mxStencilShape.svgShape rootShape

boundingBox

protected Rectangle2D boundingBox

name

protected String name

iconPath

protected String iconPath

cachedTransform

protected AffineTransform cachedTransform
Transform cached to save instance created. Used to scale the internal path of shapes where possible

Constructor Detail

mxStencilShape

public mxStencilShape()

mxStencilShape

public mxStencilShape(String shapeXml)
Constructs a new stencil for the given Dia shape description.


mxStencilShape

public mxStencilShape(Document document)
Method Detail

paintShape

public void paintShape(mxGraphics2DCanvas canvas,
                       mxCellState state)
Specified by:
paintShape in interface mxIShape
Overrides:
paintShape in class mxBasicShape

paintNode

public void paintNode(mxGraphics2DCanvas canvas,
                      mxCellState state,
                      mxStencilShape.svgShape shape,
                      double widthRatio,
                      double heightRatio)

transformShape

protected void transformShape(Shape shape,
                              double transX,
                              double transY,
                              double widthRatio,
                              double heightRatio)
Scales the points composing this shape by the x and y ratios specified

Parameters:
shape - the shape to scale
transX - the x translation
transY - the y translation
widthRatio - the x co-ordinate scale
heightRatio - the y co-ordinate scale

createShape

public void createShape(Node root,
                        mxStencilShape.svgShape shape)

createElement

public mxStencilShape.svgShape createElement(Node root)
Forms an internal representation of the specified SVG element and returns that representation

Parameters:
root - the SVG element to represent
Returns:
the internal representation of the element, or null if an error occurs

getStylenames

protected static Map<String,Object> getStylenames(String style)
Returns the stylenames in a style of the form stylename[;key=value] or an empty array if the given style does not contain any stylenames.

Parameters:
style - String of the form stylename[;stylename][;key=value].
Returns:
Returns the stylename from the given formatted string.

getName

public String getName()

setName

public void setName(String name)

getIconPath

public String getIconPath()

setIconPath

public void setIconPath(String iconPath)

getBoundingBox

public Rectangle2D getBoundingBox()

setBoundingBox

public void setBoundingBox(Rectangle2D boundingBox)

mxGraph 2.5.0.3


Copyright (c) 2010 Gaudenz Alder, David Benson. All rights reserved.