vmm.core3D
Class DotCloudSurface

java.lang.Object
  extended by vmm.core.Decoration
      extended by vmm.core3D.DotCloudSurface
Direct Known Subclasses:
SphericalCurve.DotCloudSphere, Viviani.DotCloudCylinder

public abstract class DotCloudSurface
extends Decoration


Field Summary
 
Fields inherited from class vmm.core.Decoration
decorationNeedsRedraw
 
Constructor Summary
DotCloudSurface()
           
 
Method Summary
 void computeDrawData(View view, boolean exhibitNeedsRedraw, Transform previousTransform, Transform newTransform)
          This method is called by the render method in the Exhibit class before it calls this Decoration's doDraw method, in order to give the Decoration a chance to recalculate any cached data that it needs in order to draw itself.
 void doDraw(java.awt.Graphics2D g, View view, Transform transform)
          This method is called by the render method of the Exhbit class to draw the Decoration.
 java.awt.Color getColor()
           
 int getDotCount()
           
protected abstract  Vector3D makeRandomPixel(java.util.Random randomNumberGenerator)
           
 void setColor(java.awt.Color color)
           
 void setDotCount(int count)
           
 
Methods inherited from class vmm.core.Decoration
addChangeListener, addExtraXML, fireDecorationChangeEvent, forceRedraw, getLayer, readExtraXML, removeChangeListener, setLayer
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DotCloudSurface

public DotCloudSurface()
Method Detail

makeRandomPixel

protected abstract Vector3D makeRandomPixel(java.util.Random randomNumberGenerator)

setDotCount

public void setDotCount(int count)

getDotCount

public int getDotCount()

getColor

public java.awt.Color getColor()

setColor

public void setColor(java.awt.Color color)

computeDrawData

public void computeDrawData(View view,
                            boolean exhibitNeedsRedraw,
                            Transform previousTransform,
                            Transform newTransform)
Description copied from class: Decoration
This method is called by the render method in the Exhibit class before it calls this Decoration's doDraw method, in order to give the Decoration a chance to recalculate any cached data that it needs in order to draw itself. (Note that subclasses of the View and Exhibit class are not necessarily required to follow this pattern.) Not all Decorations will need to "cache" computed data in this way. Decorations that do not cache data do not have to override this method. The method in this top-level exhibit class does nothing.

In general, a Decoration should check its decorationNeedsRedraw variable and also check the exhibitNeedsRedraw parameter. It should recompute cached data if either of these is true. A decoration might also need to compute data if the Transform has changed, if it has cached any data that depends on the Transform.

Overrides:
computeDrawData in class Decoration
Parameters:
view - The View that is drawing the Exhibit; this object contains other information that might be of use, such as the Display where the Exhibit is drawn and the the Exhibit that is being drawn.
exhibitNeedsRedraw - This parameter is set to "true" when the Exhibit changes. If it is true, then presumably the appearance of the Exhibit has changed, so any cached data for this decoration should probably be recomputed.
previousTransform - The Transform object that was used the last time the Exhibit was drawn. This can be null if the Exhibit is being drawn for the first time.
newTransform - The Transform object that is being used for this drawing of the Exhibit. Transform objects contain data about the window in the xy-plane where the Exhibit is being drawn and about the pixel coordinates on the drawing area. The two Transform objects are provided just in case any cached data depends on the xy-window or on the pixel coordinates.
See Also:
Exhibit.render(Graphics2D, View, Transform, ArrayList), Decoration.doDraw(Graphics2D, View, Transform)

doDraw

public void doDraw(java.awt.Graphics2D g,
                   View view,
                   Transform transform)
Description copied from class: Decoration
This method is called by the render method of the Exhbit class to draw the Decoration. The computeDrawData method is called by render before it calls this method, so any cached data should be valid by the time this method is called. (Note that subclasses of View and Exhibit are not necessarily required to follow this pattern.) The method in this class does nothing. Subclasses will ordinarily override this method to draw the Decoration.

Overrides:
doDraw in class Decoration
Parameters:
g - The graphics context where the Exhibit and its decorations are being drawn.
view - The View that is drawing the Exhibit; this object contains other information that might be of use, such as the Display, if any, associated with the View, and the the actual Exhibit that is being drawn.
transform - Contains information about the rectangular area in the xy-plane that is being drawn and about the rectangle of pixels in the graphics context where it is drawn. Note that at least for the top-level View class, transform.getX() and transform.getY() can be assumed to be zero.
See Also:
Exhibit.render(Graphics2D, View, Transform, ArrayList), Decoration.computeDrawData(View, boolean, Transform, Transform)