aboutsummaryrefslogtreecommitdiffstats
path: root/src/jcgp
diff options
context:
space:
mode:
authorEduardo Pedroni <e.pedroni91@gmail.com>2014-11-22 22:08:29 +0000
committerEduardo Pedroni <e.pedroni91@gmail.com>2014-11-22 22:08:29 +0000
commit80ed9dc59ece5913f7403dd669f74074080a3867 (patch)
tree33d9875e6d3bac9d8679c69e06fda53131653c69 /src/jcgp
parent9d24ea7759c58e7b1fd4b8c37acc7d16cb7e55fa (diff)
Steps 1-4 complete, generic handlers for inputs, nodes and outputs are working well. Output locking is next, also need to comment things.
Diffstat (limited to 'src/jcgp')
-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);
}
}