public class ObjectGridPortrayal2D extends FieldPortrayal2D
By default this portrayal describes objects as gray ovals (that's what getDefaultPortrayal() returns) and null values as empty regions (that's what getDefaultNullPortrayal() returns). You may wish to override this for your own purposes. The 'location' passed into the DrawInfo2D handed to the SimplePortryal2D is a MutableInt2D.
Modifier and Type | Class and Description |
---|---|
static class |
ObjectGridPortrayal2D.Message |
Modifier and Type | Field and Description |
---|---|
protected MutableInt2D |
locationToPass |
DEFAULT, DONT_USE_BUFFER, USE_BUFFER
classPortrayals, field, immutableField, portrayalForAll, portrayalForNonNull, portrayalForNull, portrayalForRemainder, portrayals
Constructor and Description |
---|
ObjectGridPortrayal2D() |
Modifier and Type | Method and Description |
---|---|
Portrayal |
getDefaultNullPortrayal()
Returns a default portrayal for null.
|
Portrayal |
getDefaultPortrayal()
Should return a portrayal which can portray any object regardless of
whether it's valid or not
|
java.awt.geom.Point2D.Double |
getLocationPosition(java.lang.Object location,
DrawInfo2D info)
Returns the position on-screen of the provided location in the underlying field.
|
java.lang.Object |
getObjectLocation(java.lang.Object object,
GUIState gui)
Returns the first location in the underlying field of the given object, if such a thing
is reasonable.
|
java.lang.Object |
getPositionLocation(java.awt.geom.Point2D.Double position,
DrawInfo2D info)
Returns the Location, in the parlance of the underlying Field, of the given position.
|
Double2D |
getScale(DrawInfo2D info)
Returns the width and height, in pixels, of 1.0 x 1.0 units in the underlying field.
|
LocationWrapper |
getWrapper(java.lang.Object object,
Int2D location) |
protected void |
hitOrDraw(java.awt.Graphics2D graphics,
DrawInfo2D info,
Bag putInHere)
Instead of overriding the draw and hitObjects methods, you can optionally override
this method to provide both the draw(...) and hitObjects(...)
functionality in a single method, as it's common that these two methods have nearly
identical code.
|
void |
setBorder(boolean on)
Turns border lines on or off.
|
void |
setBorderColor(java.awt.Color val)
Sets the border color.
|
void |
setBorderLineFraction(double val)
Sets the border line fraction.
|
void |
setBorderLineMinMaxWidth(double min,
double max)
Sets the minimum and maximum width of a border line in pixels.
|
void |
setField(java.lang.Object field)
Sets the field, and sets the dirtyField flag to true.
|
void |
setGridColor(java.awt.Color val)
Sets the grid color.
|
void |
setGridLineFraction(double val)
Sets the grid line fraction.
|
void |
setGridLineMinMaxWidth(double min,
double max)
Sets the minimum and maximum width of a grid line in pixels.
|
void |
setGridLines(boolean on)
Turns grid lines on or off.
|
void |
setGridMinSpacing(double val)
Sets the grid min spacing.
|
void |
setGridModulus(int val)
Sets the grid modulus.
|
boolean |
setSelected(LocationWrapper wrapper,
boolean selected)
Selects or deselects all of the provided objects.
|
draw, getBuffering, getClipLocation, getObjectPosition, getRelativeObjectPosition, hitObjects, setBuffering, setObjectPosition
getField, getInspector, getName, getPortrayalForAll, getPortrayalForNonNull, getPortrayalForNull, getPortrayalForObject, getPortrayalForRemainder, getStatus, isDirtyField, isImmutableField, reset, setDirtyField, setImmutableField, setObjectLocation, setPortrayalForAll, setPortrayalForClass, setPortrayalForNonNull, setPortrayalForNull, setPortrayalForObject, setPortrayalForRemainder, setSelected
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getInspector, getName, getStatus
protected final MutableInt2D locationToPass
public void setField(java.lang.Object field)
FieldPortrayal
setField
in class FieldPortrayal
public Portrayal getDefaultPortrayal()
FieldPortrayal
getDefaultPortrayal
in class FieldPortrayal2D
public Portrayal getDefaultNullPortrayal()
FieldPortrayal
getDefaultNullPortrayal
in class FieldPortrayal
public Double2D getScale(DrawInfo2D info)
FieldPortrayal2D
getScale
in class FieldPortrayal2D
public java.lang.Object getPositionLocation(java.awt.geom.Point2D.Double position, DrawInfo2D info)
FieldPortrayal2D
getPositionLocation
in class FieldPortrayal2D
public java.lang.Object getObjectLocation(java.lang.Object object, GUIState gui)
FieldPortrayal
getObjectLocation
in class FieldPortrayal
public java.awt.geom.Point2D.Double getLocationPosition(java.lang.Object location, DrawInfo2D info)
FieldPortrayal2D
getLocationPosition
in class FieldPortrayal2D
protected void hitOrDraw(java.awt.Graphics2D graphics, DrawInfo2D info, Bag putInHere)
FieldPortrayal2D
hitOrDraw
in class FieldPortrayal2D
public LocationWrapper getWrapper(java.lang.Object object, Int2D location)
public boolean setSelected(LocationWrapper wrapper, boolean selected)
FieldPortrayal
setSelected
in interface Portrayal
setSelected
in class FieldPortrayal
public void setGridLines(boolean on)
public void setGridColor(java.awt.Color val)
public void setGridModulus(int val)
public void setGridMinSpacing(double val)
public void setGridLineFraction(double val)
public void setGridLineMinMaxWidth(double min, double max)
public void setBorder(boolean on)
public void setBorderColor(java.awt.Color val)
public void setBorderLineFraction(double val)
public void setBorderLineMinMaxWidth(double min, double max)