Skip to content
Snippets Groups Projects
Commit 2b523148 authored by Sverre Grønhaug Halvorsen's avatar Sverre Grønhaug Halvorsen
Browse files

Fix: Fix bug where stepCounter counter got doubled unnecessary

parent ac37398a
Branches
No related tags found
2 merge requests!41final delivery,!33Resolve "Fix bug where altering c in Julia with mouse lags"
...@@ -3,15 +3,12 @@ package edu.ntnu.idatt2003.controller; ...@@ -3,15 +3,12 @@ package edu.ntnu.idatt2003.controller;
import edu.ntnu.idatt2003.model.ChaosGame; import edu.ntnu.idatt2003.model.ChaosGame;
import edu.ntnu.idatt2003.model.ChaosGameDescription; import edu.ntnu.idatt2003.model.ChaosGameDescription;
import edu.ntnu.idatt2003.model.ChaosGameDescriptionFactory; import edu.ntnu.idatt2003.model.ChaosGameDescriptionFactory;
import edu.ntnu.idatt2003.model.ChaosGameDescriptionFactory.descriptionTypeEnum;
import edu.ntnu.idatt2003.model.ChaosGameFileHandler;
import edu.ntnu.idatt2003.model.ChaosGameFileHandler; import edu.ntnu.idatt2003.model.ChaosGameFileHandler;
import edu.ntnu.idatt2003.model.Complex; import edu.ntnu.idatt2003.model.Complex;
import edu.ntnu.idatt2003.model.JuliaTransform; import edu.ntnu.idatt2003.model.JuliaTransform;
import edu.ntnu.idatt2003.model.Transform2D; import edu.ntnu.idatt2003.model.Transform2D;
import edu.ntnu.idatt2003.model.Vector2d; import edu.ntnu.idatt2003.model.Vector2d;
import edu.ntnu.idatt2003.view.MainPageView; import edu.ntnu.idatt2003.view.MainPageView;
import edu.ntnu.idatt2003.view.MainPageView.TransformationType;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
...@@ -43,7 +40,7 @@ public class MainPageController { ...@@ -43,7 +40,7 @@ public class MainPageController {
private static final String TRANSFORMATIONS_PATH = "src/main/resources/transformations/"; private static final String TRANSFORMATIONS_PATH = "src/main/resources/transformations/";
private static final String SERIALIZED_GAME_PATH = "src/main/resources/savedTransformation.ser"; private static final String SERIALIZED_GAME_PATH = "src/main/resources/savedTransformation.ser";
private static final Logger LOGGER = Logger.getLogger(MainPageController.class.getName()); private static final Logger LOGGER = Logger.getLogger(MainPageController.class.getName());
private static int stepsCounter; private int stepsCounter;
static { static {
try { try {
...@@ -104,10 +101,6 @@ public class MainPageController { ...@@ -104,10 +101,6 @@ public class MainPageController {
LOGGER.log(Level.INFO, "Chaos game simulation ran {0} steps successfully.", steps); LOGGER.log(Level.INFO, "Chaos game simulation ran {0} steps successfully.", steps);
} }
public int getSteps() {
return stepsCounter;
}
/** /**
* Validates the file that is uploaded., and calls storeFile if the * Validates the file that is uploaded., and calls storeFile if the
* file exists and is formatted correctly. * file exists and is formatted correctly.
...@@ -234,7 +227,6 @@ public class MainPageController { ...@@ -234,7 +227,6 @@ public class MainPageController {
new ChaosGameDescription(minCoords, maxCoords, transform); new ChaosGameDescription(minCoords, maxCoords, transform);
chaosGameFileHandler chaosGameFileHandler
.writeToFile(newChaosGameDescription, TRANSFORMATIONS_PATH + transformationName + ".txt"); .writeToFile(newChaosGameDescription, TRANSFORMATIONS_PATH + transformationName + ".txt");
System.out.println(transformationName);
customTransformations.add(transformationName); customTransformations.add(transformationName);
view.render(); view.render();
} }
...@@ -266,6 +258,7 @@ public class MainPageController { ...@@ -266,6 +258,7 @@ public class MainPageController {
list.add(new JuliaTransform(complex, -1)); list.add(new JuliaTransform(complex, -1));
ChaosGameDescription chaosGameDescription = new ChaosGameDescription(min, max, list); ChaosGameDescription chaosGameDescription = new ChaosGameDescription(min, max, list);
game.setDescription(chaosGameDescription); game.setDescription(chaosGameDescription);
game.runSteps(stepsCounter);
} }
} }
......
...@@ -550,7 +550,6 @@ public class MainPageView extends Scene implements ChaosGameObserver { ...@@ -550,7 +550,6 @@ public class MainPageView extends Scene implements ChaosGameObserver {
*/ */
private void updateValues(double x, double y) { private void updateValues(double x, double y) {
controller.changeJuliaTransformationDynamic(x, y); controller.changeJuliaTransformationDynamic(x, y);
controller.runSteps(controller.getSteps());
xField.setText(String.format("X: %.1f", x)); xField.setText(String.format("X: %.1f", x));
yField.setText(String.format("Y: %.1f", y)); yField.setText(String.format("Y: %.1f", y));
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment