etomica.graphics
Class DisplayPolytope

java.lang.Object
  extended by etomica.graphics.Display
      extended by etomica.graphics.DisplayPolytope
All Implemented Interfaces:
IAction, GraphicalElement

public class DisplayPolytope
extends Display
implements IAction

Displays a picture of a polytope. Instantiates a DisplayCanvas for most of the work. DisplayPolytope is an input event (mouse and key) listener of the canvas.


Nested Class Summary
static class DisplayPolytope.Applet
           
 
Field Summary
static boolean _3dEnabled
           
 int[] align
           
static int BOTTOM
           
 DisplayCanvas canvas
           
static int CENTER
           
protected  int[] centralOrigin
          Coordinate origin for central image Explicit to 2D because drawing is done to 2D image
protected  int[] drawSize
          Size of drawing region of central image, in pixels
static int LEFT
           
protected  Polytope polytope
           
static int RIGHT
           
protected  double scale
          Factor used to scale the size of the image.
static int TOP
           
 
Fields inherited from class etomica.graphics.Display
label, support
 
Constructor Summary
DisplayPolytope(Polytope polytope)
           
 
Method Summary
 void actionPerformed()
          Completes the action defined by the class implementing this interface.
protected  void computeImageParameters()
           
 void computeImageParameters2(int w, int h)
           
 int computeOrigin(int alignX, int drawSizeX, int size)
           
 IVector dimensions()
          returns dimensions of polytope as the (max - min) value in each dimension for all the vertices.
 void doUpdate()
           
 int getAlign(int i)
           
 int[] getDrawSize()
           
static EtomicaInfo getEtomicaInfo()
           
 int[] getOrigin()
           
 Pixel getPixelUnit()
          Returns unit for conversion between simulation units and display pixels.
 Polytope getPolytope()
           
 double getScale()
           
 double getToPixels()
           
 Component graphic(Object obj)
          Simulation.GraphicalElement interface method.
 boolean isMovable()
           
 boolean isResizable()
           
 void repaint()
           
 void setAlign(int i, int value)
           
 void setBounds(int x, int y, int width, int height)
           
 void setMovable(boolean b)
           
 void setPixelUnit(Pixel pixel)
          Sets unit for conversion between simulation units and display pixels.
 void setPolytope(Polytope p)
          Specifies the polytope for this display.
 void setPolytopeCanvas(DisplayCanvas polytopeCanvas)
           
 void setResizable(boolean b)
           
 void setScale(double s)
           
 void setSize(int width, int height)
           
 
Methods inherited from class etomica.graphics.Display
addPropertyChangeListener, getLabel, graphic, removePropertyChangeListener, setLabel, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

LEFT

public static final int LEFT
See Also:
Constant Field Values

CENTER

public static final int CENTER
See Also:
Constant Field Values

RIGHT

public static final int RIGHT
See Also:
Constant Field Values

TOP

public static final int TOP
See Also:
Constant Field Values

BOTTOM

public static final int BOTTOM
See Also:
Constant Field Values

_3dEnabled

public static boolean _3dEnabled

canvas

public DisplayCanvas canvas

align

public final int[] align

drawSize

protected final int[] drawSize
Size of drawing region of central image, in pixels

See Also:
#computeDrawSize

centralOrigin

protected final int[] centralOrigin
Coordinate origin for central image Explicit to 2D because drawing is done to 2D image


scale

protected double scale
Factor used to scale the size of the image. May be used to scale up or down the image within one box without affecting those in other displays. Default value is 1.0.


polytope

protected Polytope polytope
Constructor Detail

DisplayPolytope

public DisplayPolytope(Polytope polytope)
Method Detail

getEtomicaInfo

public static EtomicaInfo getEtomicaInfo()

setSize

public void setSize(int width,
                    int height)

actionPerformed

public void actionPerformed()
Description copied from interface: IAction
Completes the action defined by the class implementing this interface.

Specified by:
actionPerformed in interface IAction

dimensions

public IVector dimensions()
returns dimensions of polytope as the (max - min) value in each dimension for all the vertices.


getOrigin

public int[] getOrigin()

getDrawSize

public int[] getDrawSize()

setBounds

public void setBounds(int x,
                      int y,
                      int width,
                      int height)

setAlign

public void setAlign(int i,
                     int value)

getAlign

public int getAlign(int i)

getToPixels

public double getToPixels()

getScale

public double getScale()

setScale

public void setScale(double s)

getPolytope

public final Polytope getPolytope()
Returns:
the polytope associated with this display

setPolytope

public void setPolytope(Polytope p)
Specifies the polytope for this display.


setPolytopeCanvas

public void setPolytopeCanvas(DisplayCanvas polytopeCanvas)

graphic

public Component graphic(Object obj)
Simulation.GraphicalElement interface method. Overrides Display method to return the DisplayBox.Canvas as the display object.

Specified by:
graphic in interface GraphicalElement
Overrides:
graphic in class Display
Parameters:
obj - ignored by this method.
Returns:
A Component that can be used in the GUI of a graphical simulation
See Also:
Device, Display

computeImageParameters

protected void computeImageParameters()

computeImageParameters2

public void computeImageParameters2(int w,
                                    int h)

computeOrigin

public int computeOrigin(int alignX,
                         int drawSizeX,
                         int size)

doUpdate

public void doUpdate()

repaint

public void repaint()
Overrides:
repaint in class Display

setMovable

public void setMovable(boolean b)

isMovable

public boolean isMovable()

setResizable

public void setResizable(boolean b)

isResizable

public boolean isResizable()

getPixelUnit

public Pixel getPixelUnit()
Returns unit for conversion between simulation units and display pixels.


setPixelUnit

public void setPixelUnit(Pixel pixel)
Sets unit for conversion between simulation units and display pixels.