sub_arctic.output
Class isolation_drawable

java.lang.Object
  |
  +--java.awt.Graphics
        |
        +--sub_arctic.output.drawable
              |
              +--sub_arctic.output.drawable_wrapper
                    |
                    +--sub_arctic.output.conditional_drawable
                          |
                          +--sub_arctic.output.isolation_drawable

public class isolation_drawable
extends conditional_drawable

Subclass of conditional drawable that is used for drawing isolation. This keeps track of a set of interactors that are to be isolated, and basically shuts down all drawing calls (but not state changes such as color and clipping changes) that aren't part of drawing one of those interactors (but otherwise draws there as they would appear in a full drawing). This class wraps another drawing object rather than being a conventional drawable in and of itself. This allows isolation to be composed with other drawing effects.

See Also:
Graphics

Field Summary
protected  java.util.Stack _drawing_stack
          Stack of interactors currently in the process of drawing
protected  java.util.Hashtable _isolated_set
          A hash table holding the interactors we are limiting drawing to.
 
Fields inherited from class sub_arctic.output.conditional_drawable
_currently_drawing
 
Fields inherited from class sub_arctic.output.drawable_wrapper
_wrappee
 
Fields inherited from class sub_arctic.output.drawable
_ignore, g
 
Constructor Summary
isolation_drawable(drawable rappee)
          Constructor assuming an empty isolation set.
isolation_drawable(drawable rappee, interactor solo)
          Constructor for initializing the isolation set to one element.
isolation_drawable(drawable rappee, interactor[] init)
          Constructor for initializing the isolation set from an array of interactors.
isolation_drawable(drawable rappee, java.util.Vector init)
          Constructor for initializing the isolation set from an Vector of interactors.
isolation_drawable(java.awt.Graphics rappee)
          Constructor working from a Graphics.
 
Method Summary
 void add_to_isolated_set(interactor to_add)
          Add the given interactor to the isolated set.
 void clear_isolated_set()
          Clear the set of interactors we are isolating.
 java.awt.Graphics create()
          Override create() to create the properly typed wrapper around a copy of the object we wrap.
 java.awt.Graphics create(int x, int y, int w, int h)
          Override create() to create the properly typed wrapper around a copy of the object we wrap.
 void end_interactor_draw(interactor of_interactor)
          Method to be called to mark the end of output for a particular interactor.
 boolean in_isolated_set(interactor in_question)
          Determine if the given interactor is in the isolated set.
 java.util.Enumeration isolated_set()
          An Enumeration that will iterate over the elements of the set of interactors we are isolating.
 boolean mark_interactor_draw(interactor of_interactor, java.lang.Object mark_obj)
          Method to be called to mark a significant point during output for a particular interactor.
 void remove_from_isolated_set(interactor to_rm)
          Remove the given interactor from the isolated set.
 boolean start_interactor_draw(interactor of_interactor)
          Method to be called to mark the beginning of output for a particular interactor.
 java.lang.String toString()
          Convert to a human readable string.
 
Methods inherited from class sub_arctic.output.conditional_drawable
clearRect, copyArea, currently_drawing, draw_arrowhead, draw3DRect, drawArc, drawBytes, drawChars, drawImage, drawImage, drawImage, drawImage, drawImage, drawImage, drawImage, drawImage, drawLine, drawOval, drawPolygon, drawPolygon, drawRect, drawRoundRect, drawString, fill_arrowhead, fill3DRect, fillArc, fillOval, fillPolygon, fillPolygon, fillRect, fillRoundRect, set_currently_drawing, tileImage
 
Methods inherited from class sub_arctic.output.drawable_wrapper
arrowhead_bound, clipRect, copy, copy, dispose, finalize, getClipBounds, getColor, getFont, getFontMetrics, getFontMetrics, graphics, setClip, setColor, setFont, setPaintMode, setXORMode, translate, wrappee
 
Methods inherited from class sub_arctic.output.drawable
arrowhead_bound, clear_rect, clip_rect, copy_area, draw_3D_rect, draw_arc, draw_arrowhead, draw_bytes, draw_chars, draw_image, draw_image, draw_image, draw_image, draw_image, draw_image, draw_image, draw_image, draw_image, draw_image, draw_image, draw_image, draw_line, draw_oval, draw_polygon, draw_polygon, draw_polyline, draw_rect, draw_round_rect, draw_string, drawImage, drawImage, drawImage, drawImage, drawPolyline, drawString, fill_3D_rect, fill_arc, fill_arrowhead, fill_oval, fill_polygon, fill_polygon, fill_rect, fill_round_rect, get_clip_bounds, get_clip, get_color, get_font_metrics, get_font_metrics, get_font, getClip, set_clip, set_clip, set_color, set_font, set_paint_mode, set_XOR_mode, setClip, tile_image
 
Methods inherited from class java.awt.Graphics
getClipBounds, getClipRect, hitClip
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

_isolated_set

protected java.util.Hashtable _isolated_set
A hash table holding the interactors we are limiting drawing to.

_drawing_stack

protected java.util.Stack _drawing_stack
Stack of interactors currently in the process of drawing
Constructor Detail

isolation_drawable

public isolation_drawable(drawable rappee)
Constructor assuming an empty isolation set.
Parameters:
drawable - rappee the drawable we create a wrapper around.

isolation_drawable

public isolation_drawable(drawable rappee,
                          interactor solo)
Constructor for initializing the isolation set to one element.
Parameters:
drawable - rappee the drawable we create a wrapper around.
interactor - solo the single isolated interactor.

isolation_drawable

public isolation_drawable(drawable rappee,
                          interactor[] init)
Constructor for initializing the isolation set from an array of interactors.
Parameters:
drawable - rappee the drawable we create a wrapper around.
interactor[] - init the interactors to isolate.

isolation_drawable

public isolation_drawable(drawable rappee,
                          java.util.Vector init)
Constructor for initializing the isolation set from an Vector of interactors.
Parameters:
drawable - rappee the drawable we create a wrapper around.
Vector - init the interactors to isolate. This vector must contain only interactor objects, or an exception will be thrown.

isolation_drawable

public isolation_drawable(java.awt.Graphics rappee)
Constructor working from a Graphics. We will basically create a plain drawable wrapping the given Graphics object, then use that as the drawable we wrap. This initializes the isolation set to empty.
Parameters:
Graphics - rappee the object we are wrapper around.
Method Detail

isolated_set

public java.util.Enumeration isolated_set()
An Enumeration that will iterate over the elements of the set of interactors we are isolating. Note the order of objects returned by this enumeration is hash order (basically random) so you can't rely on it for anything.
Returns:
Enumeration giving access to all the interactors in the isolation set

clear_isolated_set

public void clear_isolated_set()
Clear the set of interactors we are isolating.

add_to_isolated_set

public void add_to_isolated_set(interactor to_add)
Add the given interactor to the isolated set.
Parameters:
interactor - to_add the interactor being added to the set.

in_isolated_set

public boolean in_isolated_set(interactor in_question)
Determine if the given interactor is in the isolated set.
Parameters:
interactor - in_question the interactor being asked about.
Returns:
boolean indicating whether the interactor was found in the set.

remove_from_isolated_set

public void remove_from_isolated_set(interactor to_rm)
Remove the given interactor from the isolated set. If the interactor is not in the set, nothing happens.
Parameters:
interactor - to_rm the interactor being added to the set.

create

public java.awt.Graphics create()
Override create() to create the properly typed wrapper around a copy of the object we wrap. Note: subclasses will typically need to do this also.
Returns:
Graphics a new isolation_drawable object copied from this one.
Overrides:
create in class conditional_drawable

create

public java.awt.Graphics create(int x,
                                int y,
                                int w,
                                int h)
Override create() to create the properly typed wrapper around a copy of the object we wrap. Note: subclasses will typically need to do this also.
Parameters:
int - x x component of origin of new drawable
int - y y component of origin of new drawable
int - w width of new drawable
int - h height of new drawable
Returns:
Graphics a new isolation_drawable object derived from this one.
Overrides:
create in class conditional_drawable

start_interactor_draw

public boolean start_interactor_draw(interactor of_interactor)
Method to be called to mark the beginning of output for a particular interactor. This is normally called (only) in draw_self(). The return value indicates whether the interactor (and its children) should be drawn (i.e., if false is returned, the drawing should be skipped and draw_self() should simply return). Here we always return true since we don't know if there is drawing to be done among the children or not.

In this subclass we use this to determine when to turn drawing on and off. Basically we keep a stack of currently drawing interactors and when we are drawing one in the isolation set we turn drawing operations on and otherwise we turn them off.

Parameters:
interactor - of_interactor the interactor we are starting to draw
boolean - whether the drawing of the interactor (and its children) should be performed.
Overrides:
start_interactor_draw in class drawable_wrapper
See Also:
mark_interactor_draw(sub_arctic.lib.interactor, java.lang.Object), end_interactor_draw(sub_arctic.lib.interactor)

mark_interactor_draw

public boolean mark_interactor_draw(interactor of_interactor,
                                    java.lang.Object mark_obj)
Method to be called to mark a significant point during output for a particular interactor. The return value indicates whether the remaining output for the interactor (and its children) should be drawn (i.e., if false is returned, the remaining drawing should be skipped). The type and effect of the mark_obj parameter to this routine (as well as the effect of the routine) is dependent on subclasses that implement special effects via this call. Here, this call is simply ignored and true is always returned.
Parameters:
interactor - of_interactor the interactor we are currently drawing
Object - mark_obj an object giving additional information about the mark
boolean - whether the drawing of the interactor (and its children) should be performed.
Overrides:
mark_interactor_draw in class drawable_wrapper
See Also:
start_interactor_draw(sub_arctic.lib.interactor), end_interactor_draw(sub_arctic.lib.interactor)

end_interactor_draw

public void end_interactor_draw(interactor of_interactor)
Method to be called to mark the end of output for a particular interactor. This is normally called (only) in draw_self().

Here we use this to turn drawing on or off as we reenter or leave an isolated interactor.

Parameters:
interactor - of_interactor the interactor we are starting to draw
Overrides:
end_interactor_draw in class drawable_wrapper
See Also:
mark_interactor_draw(sub_arctic.lib.interactor, java.lang.Object), start_interactor_draw(sub_arctic.lib.interactor)

toString

public java.lang.String toString()
Convert to a human readable string.
Overrides:
toString in class conditional_drawable