Class SceneElement

java.lang.Object
  extended by SceneElement
Direct Known Subclasses:
SceneElementLayered, SceneElementPositioned

public abstract class SceneElement
extends Object

Represents an element that knows how to draw itself in a scene using a Turtle to do the drawing

Author:
Mark Guzdial, Barb Ericson

Constructor Summary
SceneElement()
           
 
Method Summary
 void add(SceneElement node)
          Add the input node after the last node in this list.
 int count()
          Return the number of elements in the list
 void drawFromMeOn(Picture bg)
          Method to draw from this node on in the list.
abstract  void drawWith(Turtle t)
           
 SceneElement getNext()
          Method to get the next element
 Picture getPicture()
          Returns the picture in the node.
 void insertAfter(SceneElement node)
          Insert the input node after this node.
 SceneElement last()
          Return the last element in the list
 void remove(SceneElement node)
          Method to remove node from list, fixing links appropriately.
 SceneElement reverse()
          Reverse the list starting at this, and return the last element of the list.
 void setNext(SceneElement nextOne)
          Method to set the next element
 void setPicture(Picture pict)
          Method to set the picture in the node
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SceneElement

public SceneElement()
Method Detail

setNext

public void setNext(SceneElement nextOne)
Method to set the next element

Parameters:
nextOne - next element in list

getNext

public SceneElement getNext()
Method to get the next element

Returns:
the next element

getPicture

public Picture getPicture()
Returns the picture in the node.

Returns:
the picture in the node

setPicture

public void setPicture(Picture pict)
Method to set the picture in the node

Parameters:
pict - the picture to use

drawFromMeOn

public void drawFromMeOn(Picture bg)
Method to draw from this node on in the list. For positioned elements, compute locations. Each new element has it's lower-left corner at the lower-right of the previous node. Starts drawing from left-bottom

Parameters:
bg - Picture to draw drawing on

drawWith

public abstract void drawWith(Turtle t)

remove

public void remove(SceneElement node)
Method to remove node from list, fixing links appropriately.

Parameters:
node - element to remove from list.

insertAfter

public void insertAfter(SceneElement node)
Insert the input node after this node.

Parameters:
node - element to insert after this.

last

public SceneElement last()
Return the last element in the list


count

public int count()
Return the number of elements in the list

Returns:
the number of elements in the list

reverse

public SceneElement reverse()
Reverse the list starting at this, and return the last element of the list. The last element becomes the FIRST element of the list, and THIS goes to null.


add

public void add(SceneElement node)
Add the input node after the last node in this list.

Parameters:
node - element to insert after this.