## com.bbn.openmap.omGraphics.awt
Class ShapeDecorator

    java.lang.Object
      com.bbn.openmap.omGraphics.awt.ShapeDecorator

All Implemented Interfaces:
  Revertable

public class ShapeDecorator
extends java.lang.Object
implements Revertable

The ShapeDecorator class : in charge of drawing repeatedly several stored decorations along a path (a polyline or a complex shape)

Version:
  26 juil. 2002
Author:
  Eric LEPICIER

Field Summary
`static double` `FLATNESS` The flatness used for Shape.getPathIterator()

Constructor Summary
`ShapeDecorator()` Default constructor

Method Summary
`void` `addDecoration(ShapeDecoration decoration)` Adds a Decoration at the end of the list.
`void` `draw(java.awt.Graphics g, float[] xcoords, float[] ycoords)` Draws a decorated polyline
`void` `draw(java.awt.Graphics g, int[] xcoords, int[] ycoords)` Draws a decorated polyline
`protected void` `draw(java.awt.Graphics g, java.util.LinkedList points)` Draws a decorated polyline Calls ShapeDecoration.draw(...) for each decoration on an subsetted polyline with the same length than the decoration, cycling until all the path is consumed.
`void` `draw(java.awt.Graphics g, java.awt.geom.Point2D[] points)` Draws a decorated polyline
`void` `draw(java.awt.Graphics g, java.awt.Shape s)` Draws a decorated shape
`java.util.List` `getDecorations()` Returns the decorations.
`void` `insertDecoration(int index, ShapeDecoration decoration)` Inserts a Decoration.
`ShapeDecoration` `removeDecoration(int index)` Removes a Decoration.
`boolean` `removeDecoration(ShapeDecoration decoration)` Removes a Decoration.
`void` `revert()` Reverts all the decorations

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

Field Detail

### FLATNESS

    public static double FLATNESS

  The flatness used for Shape.getPathIterator()

Constructor Detail

### ShapeDecorator

    public ShapeDecorator()

  Default constructor

Method Detail

### getDecorations

    public java.util.List getDecorations()

  Returns the decorations.

  Returns:
    List the list of decorations

### insertDecoration

    public void insertDecoration(int index,
                                 ShapeDecoration decoration)

  Inserts a Decoration.

  Parameters:
    `index` - the index where to insert the new decoration
    `decoration` - the new decoration

### addDecoration

    public void addDecoration(ShapeDecoration decoration)

  Adds a Decoration at the end of the list.

  Parameters:
    `decoration` - the new decoration

### removeDecoration

    public ShapeDecoration removeDecoration(int index)

  Removes a Decoration.

  Parameters:
    `index` - the index of the Decoration to be removed
  Returns:
    ShapeDecoration the removed Decoration

### removeDecoration

    public boolean removeDecoration(ShapeDecoration decoration)

  Removes a Decoration.

  Parameters:
    `decoration` - the decoration to remove
  Returns:
    boolean true if it was removed

### revert

    public void revert()

  Reverts all the decorations

  Specified by:
    `revert` in interface `Revertable`
  See Also:
    `Revertable.revert()`

### draw

    public void draw(java.awt.Graphics g,
                     java.awt.Shape s)

  Draws a decorated shape

  Parameters:
    `g` - the Graphics to use
    `s` - the shape to render

### draw

    public void draw(java.awt.Graphics g,
                     float[] xcoords,
                     float[] ycoords)

  Draws a decorated polyline

  Parameters:
    `g` - the Graphics to use
    `xcoords` - array of x floating coordinates
    `ycoords` - array of y floating coordinates

### draw

    public void draw(java.awt.Graphics g,
                     int[] xcoords,
                     int[] ycoords)

  Draws a decorated polyline

  Parameters:
    `g` - the Graphics to use
    `xcoords` - array of x integer coordinates
    `ycoords` - array of y integer coordinates

### draw

    public void draw(java.awt.Graphics g,
                     java.awt.geom.Point2D[] points)

  Draws a decorated polyline

  Parameters:
    `g` - the Graphics to use
    `points` - array of points

### draw

    protected void draw(java.awt.Graphics g,
                        java.util.LinkedList points)

  Draws a decorated polyline Calls ShapeDecoration.draw(...) for each decoration on an subsetted polyline with the same length than the decoration, cycling until all the path is consumed.

  Parameters:
    `g` - the Graphics to use
    `points` - array of points (instances of Point2D)

Copyright (C) BBNT Solutions LLC; See http://openmap.bbn.com/ for details