aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/jcgp/gui/constants/Position.java2
-rw-r--r--src/jcgp/gui/population/ChromosomePane.java15
-rw-r--r--src/jcgp/gui/population/GUIOutput.java2
3 files changed, 9 insertions, 10 deletions
diff --git a/src/jcgp/gui/constants/Position.java b/src/jcgp/gui/constants/Position.java
index 0ea1299..a13d21e 100644
--- a/src/jcgp/gui/constants/Position.java
+++ b/src/jcgp/gui/constants/Position.java
@@ -29,6 +29,8 @@ public final class Position {
public static void place(GUIOutput output) {
output.relocate(((GUI.resources.columns() + 1) * (2 * Constants.NODE_RADIUS + Constants.SPACING)),
output.getOutput().getIndex() * (2 * Constants.NODE_RADIUS + Constants.SPACING));
+ output.getLine().setStartX(output.getLayoutX() - Constants.NODE_RADIUS);
+ output.getLine().setStartY(output.getLayoutY());
}
public static void connect(Line line, GUIGene target) {
diff --git a/src/jcgp/gui/population/ChromosomePane.java b/src/jcgp/gui/population/ChromosomePane.java
index 6a5b33f..bf9db72 100644
--- a/src/jcgp/gui/population/ChromosomePane.java
+++ b/src/jcgp/gui/population/ChromosomePane.java
@@ -80,15 +80,9 @@ public class ChromosomePane extends ScrollPane {
Line lines[] = new Line[GUI.resources.arity()];
for (int l = 0; l < lines.length; l++) {
lines[l] = new Line();
-
-// angle = ((((double) (l + 1)) / ((double) (lines.length + 1))) * Constants.THETA) - (Constants.THETA / 2);
-// xPos = (-Math.cos(angle) * Constants.NODE_RADIUS) + (((c + 1) * (2 * Constants.NODE_RADIUS + Constants.SPACING)) + Constants.NODE_RADIUS) + Constants.SOCKET_RADIUS;
-// yPos = (Math.sin(angle) * Constants.NODE_RADIUS) + ((r * (2 * Constants.NODE_RADIUS + Constants.SPACING)) + Constants.NODE_RADIUS);
-// lines[l].setStartX(xPos);
-// lines[l].setStartX(yPos);
-
+
Position.connect(lines[l], (GUIGene) ((Gene) node.getConnection(l)).getGUIObject());
-
+
lines[l].setMouseTransparent(true);
lines[l].setVisible(false);
connectionLines.add(lines[l]);
@@ -109,10 +103,13 @@ public class ChromosomePane extends ScrollPane {
*/
guiOutputs = new GUIOutput[GUI.resources.outputs()];
for (int i = 0; i < guiOutputs.length; i++) {
- Line line = new Line();
// get the backend output
Output output = chromosome.getOutput(i);
// make the GUI elements
+ Line line = new Line();
+ Position.connect(line, (GUIGene) ((Gene) output.getSource()).getGUIObject());
+ line.setVisible(false);
+ line.setMouseTransparent(true);
guiOutputs[i] = new GUIOutput(output, line);
// assign the GUI object to the associated backend element
output.setGUIObject(guiOutputs[i]);
diff --git a/src/jcgp/gui/population/GUIOutput.java b/src/jcgp/gui/population/GUIOutput.java
index ebc23d0..a07fd90 100644
--- a/src/jcgp/gui/population/GUIOutput.java
+++ b/src/jcgp/gui/population/GUIOutput.java
@@ -43,6 +43,6 @@ public class GUIOutput extends GUIGene implements GUIMutable {
@Override
protected void setLinesVisible(boolean value) {
- line.setVisible(true);
+ line.setVisible(value);
}
}