Skip to content

Commit 635f3f5

Browse files
committed
Added getPositionCenterX/Y to the SmartGraphVertex interface.
This allows to programatically obtain current positions for displayed vertices.
1 parent dc12be0 commit 635f3f5

4 files changed

Lines changed: 25 additions & 1 deletion

File tree

releases/JavaFXSmartGraph-0.9.jar

67 Bytes
Binary file not shown.

releases/JavaFXSmartGraph-0.9.zip

1.71 KB
Binary file not shown.

src/com/brunomnsilva/smartgraph/graphview/SmartGraphVertex.java

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,20 @@ public interface SmartGraphVertex<V> extends SmartStylableNode {
5757
*/
5858
public void setPosition(double x, double y);
5959

60+
/**
61+
* Return the center x-coordinate of this vertex in panel coordinates.
62+
*
63+
* @return x-coordinate of the vertex
64+
*/
65+
public double getPositionCenterX();
66+
67+
/**
68+
* Return the center y-coordinate of this vertex in panel coordinates.
69+
*
70+
* @return y-coordinate of the vertex
71+
*/
72+
public double getPositionCenterY();
73+
6074
/**
6175
* Returns the circle radius used to represent this vertex.
6276
*

src/com/brunomnsilva/smartgraph/graphview/SmartGraphVertexNode.java

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@
3030
import javafx.scene.Cursor;
3131
import javafx.scene.input.MouseEvent;
3232
import javafx.scene.shape.Circle;
33-
import javafx.scene.text.Text;
3433
import com.brunomnsilva.smartgraph.graph.Vertex;
3534

3635
/**
@@ -154,6 +153,17 @@ public void setPosition(double x, double y) {
154153
setCenterX(x);
155154
setCenterY(y);
156155
}
156+
157+
@Override
158+
public double getPositionCenterX() {
159+
return getCenterX();
160+
}
161+
162+
@Override
163+
public double getPositionCenterY() {
164+
return getCenterY();
165+
}
166+
157167

158168
/**
159169
* Sets the position of the instance in pixels.

0 commit comments

Comments
 (0)