# Diagram (Slick - The 2D Library)
Date: 2013-06-03

## org.newdawn.slick.svg
Class Diagram

    java.lang.Object
      org.newdawn.slick.svg.Diagram

Direct Known Subclasses:
  SVGMorph

    public class Diagram

extends java.lang.Object

A diagram read from SVG containing multiple figures

Author:
  kevin

Constructor Summary
`Diagram(float width, float height)` Create a new empty diagram

Method Summary
`void` `addFigure(Figure figure)` Add a figure to the diagram
`void` `addGradient(java.lang.String name, Gradient gradient)` Add gradient to the diagram
`void` `addPatternDef(java.lang.String name, java.lang.String href)` Add a pattern definition basd on a image
`Figure` `getFigure(int index)` Get the figure at a given index
`Figure` `getFigureByID(java.lang.String id)` Get a figure by a given ID
`int` `getFigureCount()` Get the number of figures in the diagram
`Gradient` `getGradient(java.lang.String name)` Get the gradient defined in this document
`float` `getHeight()` Get the height of the diagram
`java.lang.String` `getPatternDef(java.lang.String name)` Get a pattern definition from the diagram
`java.lang.String[]` `getPatternDefNames()` Get the names of the patterns defined
`float` `getWidth()` Get the width of the diagram
`void` `removeFigure(Figure figure)` Remove a figure from the diagram

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### Diagram

    public Diagram(float width,
                   float height)

  Create a new empty diagram

  Parameters:
    `width` - The width of the diagram
    `height` - The height of the diagram

Method Detail

### getWidth

    public float getWidth()

  Get the width of the diagram

  Returns:
    The width of the diagram

### getHeight

    public float getHeight()

  Get the height of the diagram

  Returns:
    The height of the diagram

### addPatternDef

    public void addPatternDef(java.lang.String name,
                              java.lang.String href)

  Add a pattern definition basd on a image

  Parameters:
    `name` - The name of the pattern
    `href` - The href to the image specified in the doc

### addGradient

    public void addGradient(java.lang.String name,
                            Gradient gradient)

  Add gradient to the diagram

  Parameters:
    `name` - The name of the gradient
    `gradient` - The gradient to be added

### getPatternDef

    public java.lang.String getPatternDef(java.lang.String name)

  Get a pattern definition from the diagram

  Parameters:
    `name` - The name of the pattern
  Returns:
    The href to the image that was specified for the given pattern

### getGradient

    public Gradient getGradient(java.lang.String name)

  Get the gradient defined in this document

  Parameters:
    `name` - The name of the gradient
  Returns:
    The gradient definition

### getPatternDefNames

    public java.lang.String[] getPatternDefNames()

  Get the names of the patterns defined

  Returns:
    The names of the pattern

### getFigureByID

    public Figure getFigureByID(java.lang.String id)

  Get a figure by a given ID

  Parameters:
    `id` - The ID of the figure
  Returns:
    The figure with the given ID

### addFigure

    public void addFigure(Figure figure)

  Add a figure to the diagram

  Parameters:
    `figure` - The figure to add

### getFigureCount

    public int getFigureCount()

  Get the number of figures in the diagram

  Returns:
    The number of figures in the diagram

### getFigure

    public Figure getFigure(int index)

  Get the figure at a given index

  Parameters:
    `index` - The index of the figure to retrieve
  Returns:
    The figure at the given index

### removeFigure

    public void removeFigure(Figure figure)

  Remove a figure from the diagram

  Parameters:
    `figure` - The figure to be removed

Copyright © 2006 New Dawn Software. All Rights Reserved.