Author: kono
Date: 2012-01-11 10:51:25 -0800 (Wed, 11 Jan 2012)
New Revision: 27979
Modified:
core3/impl/trunk/ding-impl/ding-presentation-impl/src/main/java/org/cytoscape/ding/Handle.java
core3/impl/trunk/ding-impl/ding-presentation-impl/src/main/java/org/cytoscape/ding/impl/DEdgeView.java
core3/impl/trunk/ding-impl/ding-presentation-impl/src/main/java/org/cytoscape/ding/impl/DGraphView.java
core3/impl/trunk/ding-impl/ding-presentation-impl/src/main/java/org/cytoscape/ding/impl/HandleImpl.java
core3/impl/trunk/ding-impl/ding-presentation-impl/src/main/java/org/cytoscape/ding/impl/InnerCanvas.java
Log:
Method names had been modified.
Modified:
core3/impl/trunk/ding-impl/ding-presentation-impl/src/main/java/org/cytoscape/ding/Handle.java
===================================================================
---
core3/impl/trunk/ding-impl/ding-presentation-impl/src/main/java/org/cytoscape/ding/Handle.java
2012-01-11 18:08:01 UTC (rev 27978)
+++
core3/impl/trunk/ding-impl/ding-presentation-impl/src/main/java/org/cytoscape/ding/Handle.java
2012-01-11 18:51:25 UTC (rev 27979)
@@ -12,17 +12,17 @@
public interface Handle {
/**
- * Calculate absolute position of this handle.
+ * Calculate absolute position of this handle for the given edge view.
*
* @param graphView graph view for this handle
* @param edgeView The handle belongs to this edge view.
*
* @return Absolute position of this handle in the network view.
*/
- Point2D getPoint(final DEdgeView edgeView);
+ Point2D calculateHandleLocation(final DEdgeView edgeView);
/**
- * Set a new position of this handle.
+ * Define this handle. Handle will be described as a relative location
from source and target node.
*
* NOTE: in the implementation, the given (x, y) values will be
converted to relative position.
* The conversion equation is exchangeable.
@@ -32,5 +32,5 @@
* @param x Absolute value for X-location.
* @param y Absolute value for Y-location.
*/
- void setPoint(final DEdgeView edgeView, final double x, final double y);
+ void defineHandle(final DEdgeView edgeView, final double x, final
double y);
}
Modified:
core3/impl/trunk/ding-impl/ding-presentation-impl/src/main/java/org/cytoscape/ding/impl/DEdgeView.java
===================================================================
---
core3/impl/trunk/ding-impl/ding-presentation-impl/src/main/java/org/cytoscape/ding/impl/DEdgeView.java
2012-01-11 18:08:01 UTC (rev 27978)
+++
core3/impl/trunk/ding-impl/ding-presentation-impl/src/main/java/org/cytoscape/ding/impl/DEdgeView.java
2012-01-11 18:51:25 UTC (rev 27979)
@@ -355,12 +355,10 @@
m_view.m_selectedEdges.insert(m_inx);
final int numHandles =
m_view.m_edgeDetails.bend(m_inx).getAllHandles().size();
- for (int j = 0; j < numHandles; j++) {
- //getHandleInternal(j, m_view.m_anchorsBuff);
-
+ for (int j = 0; j < numHandles; j++) {
final Bend bend = m_view.m_edgeDetails.bend(m_inx);
final Handle handle = bend.getAllHandles().get(j);
- final Point2D newPoint = handle.getPoint(this);
+ final Point2D newPoint =
handle.calculateHandleLocation(this);
m_view.handleLocationBuffer[0] = (float)
newPoint.getX();
m_view.handleLocationBuffer[1] = (float)
newPoint.getY();
@@ -537,20 +535,12 @@
m_view.m_contentChanged = true;
}
}
-
-
-// public int numHandles() {
-// synchronized (m_view.m_lock) {
-// // Extract number of bends from bend object.
-// return
m_view.m_edgeDetails.bend(m_inx).getAllHandles().size();
-// }
-// }
- final void moveHandleInternal(final int inx, double x, double y) {
+ protected final void moveHandleInternal(final int inx, double x, double
y) {
final Bend bend = m_view.m_edgeDetails.bend(m_inx);
final Handle handle = bend.getAllHandles().get(inx);
- handle.setPoint(this, x, y);
+ handle.defineHandle(this, x, y);
if (m_view.m_spacialA.delete((m_inx << 6) | inx))
m_view.m_spacialA.insert((m_inx << 6) | inx,
@@ -567,7 +557,7 @@
* @param pt location of handle
* @return new handle index.
*/
- public int addHandlePoint(final Point2D pt) {
+ protected int addHandlePoint(final Point2D pt) {
synchronized (m_view.m_lock) {
final Bend bend = m_view.m_edgeDetails.bend(m_inx);
@@ -582,15 +572,15 @@
final Point2D sourcePt =
m_view.getDNodeView(getEdge().getSource()).getOffset();
final Point2D targetPt =
m_view.getDNodeView(getEdge().getTarget()).getOffset();
final Handle firstHandle = bend.getAllHandles().get(0);
- final Point2D point = firstHandle.getPoint(this);
+ final Point2D point =
firstHandle.calculateHandleLocation(this);
double bestDist = (pt.distance(sourcePt) +
pt.distance(point)) - sourcePt.distance(point);
int bestInx = 0;
for (int i = 1; i < bend.getAllHandles().size(); i++) {
final Handle handle1 =
bend.getAllHandles().get(i);
final Handle handle2 =
bend.getAllHandles().get(i-1);
- final Point2D point1 = handle1.getPoint(this);
- final Point2D point2 = handle2.getPoint(this);
+ final Point2D point1 =
handle1.calculateHandleLocation(this);
+ final Point2D point2 =
handle2.calculateHandleLocation(this);
final double distCand = (pt.distance(point2) +
pt.distance(point1)) - point1.distance(point2);
@@ -602,7 +592,7 @@
final int lastIndex = bend.getAllHandles().size() - 1;
final Handle lastHandle =
bend.getAllHandles().get(lastIndex);
- final Point2D lastPoint = lastHandle.getPoint(this);
+ final Point2D lastPoint =
lastHandle.calculateHandleLocation(this);
final double lastCand = (pt.distance(targetPt) +
pt.distance(lastPoint)) - targetPt.distance(lastPoint);
@@ -683,7 +673,7 @@
}
- void removeAllHandles() {
+ private void removeAllHandles() {
synchronized (m_view.m_lock) {
final Bend bend = m_view.m_edgeDetails.bend(m_inx);
@@ -713,6 +703,9 @@
return 2 * numHandles;
}
+ /**
+ * Actual method to be used in the Graph Renderer.
+ */
@Override
public void getAnchor(int anchorIndex, float[] anchorArr, int offset) {
final Bend bend = m_view.m_edgeDetails.bend(m_inx);
@@ -723,7 +716,7 @@
else
handle = bend.getAllHandles().get(anchorIndex/2);
- final Point2D newPoint = handle.getPoint(this);
+ final Point2D newPoint = handle.calculateHandleLocation(this);
anchorArr[offset] = (float) newPoint.getX();
anchorArr[offset + 1] = (float) newPoint.getY();
}
Modified:
core3/impl/trunk/ding-impl/ding-presentation-impl/src/main/java/org/cytoscape/ding/impl/DGraphView.java
===================================================================
---
core3/impl/trunk/ding-impl/ding-presentation-impl/src/main/java/org/cytoscape/ding/impl/DGraphView.java
2012-01-11 18:08:01 UTC (rev 27978)
+++
core3/impl/trunk/ding-impl/ding-presentation-impl/src/main/java/org/cytoscape/ding/impl/DGraphView.java
2012-01-11 18:51:25 UTC (rev 27979)
@@ -172,9 +172,11 @@
}
}
- static final float DEFAULT_ANCHOR_SIZE = 9.0f;
+ // Size of square for moving handle
+ static final float DEFAULT_ANCHOR_SIZE = 25.0f;
+
static final Paint DEFAULT_ANCHOR_SELECTED_PAINT = Color.red;
- static final Paint DEFAULT_ANCHOR_UNSELECTED_PAINT = Color.black;
+ static final Paint DEFAULT_ANCHOR_UNSELECTED_PAINT = Color.DARK_GRAY;
boolean calledFromGetSnapshot = false;
@@ -2455,25 +2457,16 @@
}
- public final float getAnchorSize() {
+ final float getAnchorSize() {
return DEFAULT_ANCHOR_SIZE;
}
- /**
- * DOCUMENT ME!
- *
- * @return DOCUMENT ME!
- */
- public final Paint getAnchorSelectedPaint() {
+
+ final Paint getAnchorSelectedPaint() {
return DEFAULT_ANCHOR_SELECTED_PAINT;
}
- /**
- * DOCUMENT ME!
- *
- * @return DOCUMENT ME!
- */
- public final Paint getAnchorUnselectedPaint() {
+ final Paint getAnchorUnselectedPaint() {
return DEFAULT_ANCHOR_UNSELECTED_PAINT;
}
Modified:
core3/impl/trunk/ding-impl/ding-presentation-impl/src/main/java/org/cytoscape/ding/impl/HandleImpl.java
===================================================================
---
core3/impl/trunk/ding-impl/ding-presentation-impl/src/main/java/org/cytoscape/ding/impl/HandleImpl.java
2012-01-11 18:08:01 UTC (rev 27978)
+++
core3/impl/trunk/ding-impl/ding-presentation-impl/src/main/java/org/cytoscape/ding/impl/HandleImpl.java
2012-01-11 18:51:25 UTC (rev 27979)
@@ -34,7 +34,7 @@
@Override
- public Point2D getPoint(final DEdgeView view) {
+ public Point2D calculateHandleLocation(final DEdgeView view) {
final DGraphView graphView = (DGraphView) view.getGraphView();
final CyNode source = view.getModel().getSource();
final CyNode target = view.getModel().getTarget();
@@ -81,7 +81,7 @@
@Override
- public void setPoint(final DEdgeView view, double x, double y) {
+ public void defineHandle(final DEdgeView view, double x, double y) {
final DGraphView graphView = (DGraphView) view.getGraphView();
this.x = x;
this.y = y;
Modified:
core3/impl/trunk/ding-impl/ding-presentation-impl/src/main/java/org/cytoscape/ding/impl/InnerCanvas.java
===================================================================
---
core3/impl/trunk/ding-impl/ding-presentation-impl/src/main/java/org/cytoscape/ding/impl/InnerCanvas.java
2012-01-11 18:08:01 UTC (rev 27978)
+++
core3/impl/trunk/ding-impl/ding-presentation-impl/src/main/java/org/cytoscape/ding/impl/InnerCanvas.java
2012-01-11 18:51:25 UTC (rev 27979)
@@ -476,7 +476,7 @@
final int anchorInx = chosenAnchor & 0x0000003f;
// Save remove handle
m_undoable_edit = new
ViewChangeEdit(m_view,ViewChangeEdit.SavedObjs.SELECTED_EDGES,"Remove Edge
Handle",m_undo);
- ((DEdgeView)
m_view.getDEdgeView(edge)).removeHandle(anchorInx);
+ m_view.getDEdgeView(edge).removeHandle(anchorInx);
m_button1NodeDrag = false;
} else {
final boolean wasSelected =
m_view.m_selectedAnchors.count(chosenAnchor) > 0;
@@ -1029,7 +1029,7 @@
final Bend bend = ev.getBend();
final Handle handle =
bend.getAllHandles().get(anchorInx);
- final Point2D newPoint = handle.getPoint(ev);
+ final Point2D newPoint =
handle.calculateHandleLocation(ev);
m_floatBuff1[0] = (float) newPoint.getX();
m_floatBuff1[1] = (float) newPoint.getY();
@@ -1370,7 +1370,7 @@
final Bend bend = ev.getBend();
final Handle handle =
bend.getAllHandles().get(anchorInx);
- final Point2D newPoint =
handle.getPoint(ev);
+ final Point2D newPoint =
handle.calculateHandleLocation(ev);
m_floatBuff1[0] = (float)
newPoint.getX();
m_floatBuff1[1] = (float)
newPoint.getY();
--
You received this message because you are subscribed to the Google Groups
"cytoscape-cvs" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/cytoscape-cvs?hl=en.