Class PLayer

java.lang.Object
edu.umd.cs.piccolo.PNode
edu.umd.cs.piccolo.PLayer
All Implemented Interfaces:
Printable, Serializable, Cloneable

public class PLayer extends PNode
PLayer is a node that can be viewed directly by multiple camera nodes. Generally child nodes are added to a layer to give the viewing cameras something to look at.

A single layer node may be viewed through multiple cameras with each camera using its own view transform. This means that any node (since layers can have children) may be visible through multiple cameras at the same time.

Version:
1.0
Author:
Jesse Grosjean
See Also:
  • Field Details

    • PROPERTY_CAMERAS

      public static final String PROPERTY_CAMERAS
      The property name that identifies a change in the set of this layer's cameras (see getCamera, getCameraCount, getCamerasReference). In any property change event the new value will be a reference to the list of cameras, but old value will always be null.
      See Also:
    • PROPERTY_CODE_CAMERAS

      public static final int PROPERTY_CODE_CAMERAS
      The property code that identifies a change in the set of this layer's cameras (see getCamera, getCameraCount, getCamerasReference). In any property change event the new value will be a reference to the list of cameras, but old value will always be null.
      See Also:
  • Constructor Details

    • PLayer

      public PLayer()
      Creates a PLayer without any cameras attached to it.
  • Method Details

    • getCamerasReference

      public List getCamerasReference()
      Get the list of cameras viewing this layer.
      Returns:
      direct reference to registered cameras
    • getCameraCount

      public int getCameraCount()
      Get the number of cameras viewing this layer.
      Returns:
      the number of cameras attached to this layer
    • getCamera

      public PCamera getCamera(int index)
      Get the camera in this layer's camera list at the specified index.
      Parameters:
      index - index of camera to fetch
      Returns:
      camera at the given index
    • addCamera

      public void addCamera(PCamera camera)
      Add a camera to this layer's camera list. This method it called automatically when a layer is added to a camera.
      Parameters:
      camera - the camera to add to this layer
    • addCamera

      public void addCamera(int index, PCamera camera)
      Add a camera to this layer's camera list at the specified index. This method it called automatically when a layer is added to a camera.
      Parameters:
      index - index at which the camera should be inserted
      camera - Camera to add to layer
    • removeCamera

      public PCamera removeCamera(PCamera camera)
      Remove the camera from this layer's camera list.
      Parameters:
      camera - the camera to remove from the layer, does nothing if not found
      Returns:
      camera that was passed in
    • removeCamera

      public PCamera removeCamera(int index)
      Remove the camera at the given index from this layer's camera list.
      Parameters:
      index - the index of the camera we wish to remove
      Returns:
      camera that was removed
    • repaintFrom

      public void repaintFrom(PBounds localBounds, PNode repaintSource)
      Override repaints and forward them to the cameras that are viewing this layer.
      Overrides:
      repaintFrom in class PNode
      Parameters:
      localBounds - bounds flagged as needing repainting
      repaintSource - the source of the repaint notification
    • notifyCameras

      protected void notifyCameras(PBounds parentBounds)
      Dispatches repaint notification to all registered cameras.
      Parameters:
      parentBounds - bounds needing repainting in parent coordinate system