|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.ascape.model.event.DefaultScapeListener
org.eclipse.amp.escape.ascape.view.ModelScapeView
org.eclipse.amp.escape.ascape.view.EditPartFactoryScapeView
org.eclipse.amp.escape.ascape.view.EditPartScapeView
org.ascape.view.vis.GraphicsView
org.ascape.view.vis.AgentView
public abstract class AgentView
A generic base class for views that draw some kind of spatial view of a group of cells. Cell views have a default draw feature that draws a background for the cell, using the cell color feature.
Field Summary | |
---|---|
protected ColorFeature |
agentColorFeature
The generic color feature used to set the color for the primary agent type. |
protected VectorSelection |
drawSelection
The draw features that have been selected to draw. |
Fields inherited from class org.ascape.view.vis.GraphicsView |
---|
agentSize, image, imageFigure, imageGC, imageGraphics |
Fields inherited from class org.ascape.model.event.DefaultScapeListener |
---|
listeningToScape, scape |
Constructor Summary | |
---|---|
AgentView()
Instantiates a new agent view. |
|
AgentView(java.lang.String name)
Instantiates a new agent view. |
Method Summary | |
---|---|
void |
addDrawFeature(DrawFeature feature)
Adds the provided draw feature to this scape. |
int |
calculateAgentSizeForViewSize(org.eclipse.draw2d.geometry.Dimension d)
Calculate agent size for view size. |
org.eclipse.draw2d.geometry.Dimension |
calculateViewSizeForAgentSize(org.eclipse.draw2d.geometry.Dimension availableSize,
int agentSize)
Calculate view size for agent size. |
void |
createFeatures()
|
protected void |
drawSelectedAgent(org.eclipse.draw2d.Graphics graphics,
LocatedAgent a)
Draws a marker for the provided selected agent. |
Agent |
getAgentAtPixel(int x,
int y)
Returns the cell at the given pixel in this view. |
ColorFeature |
getAgentColorFeature()
Returns the color feature that will be used for determining agent color. |
int |
getAgentSize()
Returns a one-dimension size of pixels used to represent each cell. |
java.util.Vector<DrawFeature> |
getDrawFeatures()
Returns, as a vector, the draw features available for interpretation of members of this scape. |
protected java.util.Observable |
getDrawFeaturesObservable()
Returns an observable delegate that notifies users of draw features that a change has occurred. |
VectorSelection |
getDrawSelection()
Returns the selection of draw features for this view. |
org.eclipse.draw2d.geometry.Dimension |
getMiniumSizeWithin(org.eclipse.draw2d.geometry.Dimension d)
|
org.eclipse.draw2d.geometry.Dimension |
getPreferredSizeWithin(org.eclipse.draw2d.geometry.Dimension d)
|
boolean |
removeDrawFeature(DrawFeature feature)
Removes the provided draw feature. |
void |
setAgentColorFeature(ColorFeature agentColorFeature)
Set the color feature that will be used for determining agent color. |
void |
setAgentSize(int cellSize)
Sets the number of pixels used to represent each cell. |
void |
update(java.util.Observable o,
java.lang.Object arg)
Draws a marker for the agent, if any, currently being viewed by the agent customizer. |
Methods inherited from class org.ascape.view.vis.GraphicsView |
---|
addSelectionChangedListener, createEditPart, createImage, createImageFigure, getImage, getImageFigure, getMinimumSizeWithin, getSelection, getSize, refresh, removeSelectionChangedListener, scapeAdded, scapeIterated, setSelection, updateScapeGraphics |
Methods inherited from class org.eclipse.amp.escape.ascape.view.EditPartScapeView |
---|
createInput |
Methods inherited from class org.eclipse.amp.escape.ascape.view.EditPartFactoryScapeView |
---|
getAdapter, getRootPart |
Methods inherited from class org.eclipse.amp.escape.ascape.view.ModelScapeView |
---|
getModel, getName, toString |
Methods inherited from class org.ascape.model.event.DefaultScapeListener |
---|
clone, environmentQuiting, getScape, isGraphic, isLifeOfScape, isNotifyScapeAutomatically, notifyScapeUpdated, scapeClosing, scapeDeserialized, scapeInitialized, scapeNotification, scapeRemoved, scapeSetup, scapeStarted, scapeStopped, setName, setNotifyScapeAutomatically |
Methods inherited from class java.lang.Object |
---|
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected VectorSelection drawSelection
protected ColorFeature agentColorFeature
Constructor Detail |
---|
public AgentView()
public AgentView(java.lang.String name)
name
- the nameMethod Detail |
---|
protected java.util.Observable getDrawFeaturesObservable()
public void createFeatures()
createFeatures
in class GraphicsView
public void addDrawFeature(DrawFeature feature)
feature
- the featureDrawFeature
public boolean removeDrawFeature(DrawFeature feature)
feature
- the draw feature to be removed
public java.util.Vector<DrawFeature> getDrawFeatures()
DrawFeature
public VectorSelection getDrawSelection()
getDrawSelection
in interface IDrawSelection
public ColorFeature getAgentColorFeature()
public void setAgentColorFeature(ColorFeature agentColorFeature)
agentColorFeature
- the color feature, whose object is assumed to be an agent populating this latticepublic Agent getAgentAtPixel(int x, int y)
getAgentAtPixel
in class GraphicsView
x
- the horizontal pixel locationy
- the vertical pixel location
protected void drawSelectedAgent(org.eclipse.draw2d.Graphics graphics, LocatedAgent a)
drawSelectedAgent
in class GraphicsView
g
- the graphics context to draw toa
- the agent to drawpublic org.eclipse.draw2d.geometry.Dimension getPreferredSizeWithin(org.eclipse.draw2d.geometry.Dimension d)
getPreferredSizeWithin
in class GraphicsView
public org.eclipse.draw2d.geometry.Dimension getMiniumSizeWithin(org.eclipse.draw2d.geometry.Dimension d)
public org.eclipse.draw2d.geometry.Dimension calculateViewSizeForAgentSize(org.eclipse.draw2d.geometry.Dimension availableSize, int agentSize)
availableSize
- TODOagentSize
- the agent size
public int calculateAgentSizeForViewSize(org.eclipse.draw2d.geometry.Dimension d)
d
- the d
public int getAgentSize()
public void setAgentSize(int cellSize)
cellSize
- number of pixels per edgepublic void update(java.util.Observable o, java.lang.Object arg)
update
in interface java.util.Observer
g
- the graphics context to draw to
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |