uk.ac.ic.doc.automed.p2p.gui.graph
Class EclipseAndANodeComponent
java.lang.Object
uk.ac.ic.doc.automed.p2p.gui.graph.GShape
uk.ac.ic.doc.automed.p2p.gui.graph.GraphComponent
uk.ac.ic.doc.automed.p2p.gui.graph.EclipseAndANodeComponent
- All Implemented Interfaces:
- java.awt.Shape, java.io.Serializable, GVisualisable
public class EclipseAndANodeComponent
- extends GraphComponent
- implements java.io.Serializable
- See Also:
- Serialized Form
Fields inherited from class uk.ac.ic.doc.automed.p2p.gui.graph.GShape |
altDrawer, altDrawing, AUTO_COUNT, bound, brPoint, centrePoint, changed, color, cshape, data, defBound, displayScript, displayShape, enabled, handler, highlighted, hshape, icon, id, label, lblPoint, movable, name, onClick, PREFIX_CTRL, PREFIX_HIL, props, refresh, selectable, tlPoint, type, visible, visibleOnHighlighted, ZEROX |
Constructor Summary |
EclipseAndANodeComponent(java.lang.String label,
java.awt.Point cPoint,
java.awt.Dimension b,
GNode[] nodesToDraw,
java.util.Properties props)
The first node is the reference node |
Method Summary |
protected void |
addEdges(GEdge[] newEdges)
|
void |
addNodes(GNode[] nodes,
java.awt.Graphics g)
Add some more nodes to this component |
void |
preDraw(java.awt.Graphics g,
boolean updateOnly)
Prepare the coordinates of the nodes. |
java.util.Collection |
removeShape(GShape shape)
|
Methods inherited from class uk.ac.ic.doc.automed.p2p.gui.graph.GraphComponent |
addEdge, addNode, contains, drawAfter, drawAt, drawBefore, drawBound, drawMain, drawOverlay, drawTo, equals, getBaseCenterPoint, getBasePoint, getBooleanProperty, getBound, getEdges, getEdges, getEdgesArray, getIsGrouped, getNodes, getNodesArray, getNumericProperty, getProperty, getShapes, getShapesArray, getShapesForUpdate, init, redraw, redrawMain, setEdges, setEdgesArray, setIsChanged, setIsGrouped, setIsVisible, setNodes, setNodesArray, setUp, update, updateBound, updateControl, updateHighlighted |
Methods inherited from class uk.ac.ic.doc.automed.p2p.gui.graph.GShape |
clear, clear, contains, contains, contains, contains, copyProperties, cos, dcos, draw, drawAlternative, drawControl, drawHighlighted, dsin, dtan, getAutoID, getBounds, getBounds2D, getBrPoint, getCenter, getColor, getData, getDefaultBound, getDrawerInstance, getHandlerObject, getID, getIDShape, getIsVisible, getIsVisibleOnHighlighted, getLabel, getLabelBounds, getLabelPoint, getName, getPathIterator, getPathIterator, getPoint, getProperties, getProperty, getPropertyObject, getPropertyObjects, getStringBounds, getType, hashCode, highlightLabel, highlightLabel, intersects, intersects, isActive, isAltDrawing, isChanged, isEnabled, isHighlighted, isMovable, isMutableColor, isOnClick, isRefresh, isSelectable, newDrawerInstance, paintBlank, preDraw, redrawAfter, redrawBefore, refresh, setBound, setBound, setColorProperty, setColorProperty, setColorProperty, setEnabled, setHandlerObject, setIsAltDrawing, setIsHighlighted, setIsMovable, setIsOnClick, setIsRefresh, setIsSelectable, setLabel, setName, setProperties, setProperty, setPropertyObject, setStrokeStyle, setTLPoint, setTLPoint, setType, setUpHighlightedShape, setVisibleOnHighlighted, sin, tan, toString |
Methods inherited from class java.lang.Object |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
serialVersionUID
private static final long serialVersionUID
- See Also:
- Constant Field Values
nodeMap
private java.util.Map nodeMap
EclipseAndANodeComponent
public EclipseAndANodeComponent(java.lang.String label,
java.awt.Point cPoint,
java.awt.Dimension b,
GNode[] nodesToDraw,
java.util.Properties props)
- The first node is the reference node
- Parameters:
label
- cPoint
- b
- nodesToDraw
- props
-
removeShape
public java.util.Collection removeShape(GShape shape)
- Overrides:
removeShape
in class GraphComponent
preDraw
public void preDraw(java.awt.Graphics g,
boolean updateOnly)
- Prepare the coordinates of the nodes. For eclipse, we do this in three
conceptual steps:
(1) move the eclipse so that its centre point is C(0,0) and the semimajor
axis is the x-axis. We work in this coordinate system:
- in this we
calculate the tuple (l,x,y) for every point P(x,y), where l is the
distance between P and C
(2) we then transform the eclipse in step 1 by a rotation with an angle
theta (which is the angle of the base edge of the semipolygon):
-
adjust (l,x,y,alpha) -> (l,x,y, alpha + theta), where alpha is the angle
of the line (P,C)
(3) finally, we move the eclipse in step (2) back to the origin D(d1,d2),
which is the midpoint of the actual base-edge:
- adjust (l,x,y, alpha +
theta) -> (l, x+d1,y+d2, alpha+theta)
- Overrides:
preDraw
in class GShape
addNodes
public void addNodes(GNode[] nodes,
java.awt.Graphics g)
- Add some more nodes to this component
- Overrides:
addNodes
in class GraphComponent
- Parameters:
nodes
- g
-
addEdges
protected void addEdges(GEdge[] newEdges)