sim.portrayal.simple
Class ShapePortrayal2D
java.lang.Object
sim.portrayal.SimplePortrayal2D
sim.portrayal.simple.ShapePortrayal2D
- All Implemented Interfaces:
- java.io.Serializable, Portrayal, Portrayal2D
- Direct Known Subclasses:
- HexagonalPortrayal2D
public class ShapePortrayal2D
- extends SimplePortrayal2D
A simple portrayal for 2D visualization of java.awt.Shapes and java.awt.Polygons. It extends the SimplePortrayal2D and
it manages the drawing and hit-testing for shapes.
- See Also:
- Serialized Form
Constructor Summary |
ShapePortrayal2D(double[] xpoints,
double[] ypoints)
|
ShapePortrayal2D(double[] xpoints,
double[] ypoints,
boolean filled)
|
ShapePortrayal2D(double[] xpoints,
double[] ypoints,
double scale)
|
ShapePortrayal2D(double[] xpoints,
double[] ypoints,
double scale,
boolean filled)
|
ShapePortrayal2D(double[] xpoints,
double[] ypoints,
java.awt.Paint paint)
|
ShapePortrayal2D(double[] xpoints,
double[] ypoints,
java.awt.Paint paint,
boolean filled)
|
ShapePortrayal2D(double[] xpoints,
double[] ypoints,
java.awt.Paint paint,
double scale)
|
ShapePortrayal2D(double[] xpoints,
double[] ypoints,
java.awt.Paint paint,
double scale,
boolean filled)
|
ShapePortrayal2D(java.awt.Shape shape)
|
ShapePortrayal2D(java.awt.Shape shape,
boolean filled)
|
ShapePortrayal2D(java.awt.Shape shape,
double scale)
|
ShapePortrayal2D(java.awt.Shape shape,
double scale,
boolean filled)
|
ShapePortrayal2D(java.awt.Shape shape,
java.awt.Paint paint)
|
ShapePortrayal2D(java.awt.Shape shape,
java.awt.Paint paint,
boolean filled)
|
ShapePortrayal2D(java.awt.Shape shape,
java.awt.Paint paint,
double scale)
|
ShapePortrayal2D(java.awt.Shape shape,
java.awt.Paint paint,
double scale,
boolean filled)
|
Method Summary |
void |
draw(java.lang.Object object,
java.awt.Graphics2D graphics,
DrawInfo2D info)
Draw a portrayed object centered at the origin in info, and
with the given scaling factors. |
boolean |
hitObject(java.lang.Object object,
DrawInfo2D range)
If drawing area intersects selected area, return true. |
void |
setStroke(java.awt.Stroke s)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
paint
public java.awt.Paint paint
scale
public double scale
shape
public java.awt.Shape shape
stroke
public java.awt.Stroke stroke
filled
public boolean filled
ShapePortrayal2D
public ShapePortrayal2D(double[] xpoints,
double[] ypoints)
ShapePortrayal2D
public ShapePortrayal2D(double[] xpoints,
double[] ypoints,
java.awt.Paint paint)
ShapePortrayal2D
public ShapePortrayal2D(double[] xpoints,
double[] ypoints,
double scale)
ShapePortrayal2D
public ShapePortrayal2D(double[] xpoints,
double[] ypoints,
java.awt.Paint paint,
double scale)
ShapePortrayal2D
public ShapePortrayal2D(double[] xpoints,
double[] ypoints,
boolean filled)
ShapePortrayal2D
public ShapePortrayal2D(double[] xpoints,
double[] ypoints,
java.awt.Paint paint,
boolean filled)
ShapePortrayal2D
public ShapePortrayal2D(double[] xpoints,
double[] ypoints,
double scale,
boolean filled)
ShapePortrayal2D
public ShapePortrayal2D(double[] xpoints,
double[] ypoints,
java.awt.Paint paint,
double scale,
boolean filled)
ShapePortrayal2D
public ShapePortrayal2D(java.awt.Shape shape)
ShapePortrayal2D
public ShapePortrayal2D(java.awt.Shape shape,
java.awt.Paint paint)
ShapePortrayal2D
public ShapePortrayal2D(java.awt.Shape shape,
double scale)
ShapePortrayal2D
public ShapePortrayal2D(java.awt.Shape shape,
java.awt.Paint paint,
double scale)
ShapePortrayal2D
public ShapePortrayal2D(java.awt.Shape shape,
boolean filled)
ShapePortrayal2D
public ShapePortrayal2D(java.awt.Shape shape,
java.awt.Paint paint,
boolean filled)
ShapePortrayal2D
public ShapePortrayal2D(java.awt.Shape shape,
double scale,
boolean filled)
ShapePortrayal2D
public ShapePortrayal2D(java.awt.Shape shape,
java.awt.Paint paint,
double scale,
boolean filled)
setStroke
public void setStroke(java.awt.Stroke s)
draw
public void draw(java.lang.Object object,
java.awt.Graphics2D graphics,
DrawInfo2D info)
- Description copied from interface:
Portrayal2D
- Draw a portrayed object centered at the origin in info, and
with the given scaling factors. It is possible that object
is null.
- Specified by:
draw
in interface Portrayal2D
- Overrides:
draw
in class SimplePortrayal2D
hitObject
public boolean hitObject(java.lang.Object object,
DrawInfo2D range)
- Description copied from class:
SimplePortrayal2D
- If drawing area intersects selected area, return true. The default computes
the intersection with the (-0.5,-0.5) to (0.5,0.5) rectangle.
- Overrides:
hitObject
in class SimplePortrayal2D