Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Memory opt #51

Merged
merged 62 commits into from
Apr 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
62 commits
Select commit Hold shift + click to select a range
2c45534
Refactor XMLReader to OSMReader and update dependencies
johannes67890 Mar 7, 2024
994e590
Refactor FileParser and add tests
johannes67890 Mar 7, 2024
2cc006b
Fix center point bug and workon fileparser
johannes67890 Mar 9, 2024
241a855
Refactor code and fix method name
johannes67890 Mar 9, 2024
0d85330
Add test for isInBounds method
johannes67890 Mar 10, 2024
aade9fb
Add constructors to TagBound and TagNode classes
johannes67890 Mar 18, 2024
2955076
Fix bug in compasPoints and update test
johannes67890 Mar 19, 2024
bfc9d59
fix bug for inBounds method
johannes67890 Mar 21, 2024
3fbf7c7
workon writer
johannes67890 Mar 21, 2024
32b8293
Refactor XMLWriter class to initialize chunk files***
johannes67890 Mar 21, 2024
7e81ed0
Refactor XMLReader and FileParser classes
johannes67890 Mar 23, 2024
4f1aa1a
Add createXML metohds for Tags
johannes67890 Mar 23, 2024
aaa2ce2
Refactor XMLWriter class and add new method writeTagNode()
johannes67890 Mar 24, 2024
84fb66e
Add Comparable interface to TagBound class and refactor isInBounds me…
johannes67890 Mar 29, 2024
230e2e6
workin
johannes67890 Apr 2, 2024
104deed
Refactor XMLReader class and TagWay class
johannes67890 Apr 2, 2024
1091250
Update road types in Type enum
johannes67890 Apr 2, 2024
674a5be
Add new XML file and update XMLReader constructor
johannes67890 Apr 2, 2024
8058ed4
Refactor Tag class and XMLReader class
johannes67890 Apr 3, 2024
6c2cf59
Merge branch 'main' into filestreaming
johannes67890 Apr 8, 2024
cc19ddc
Fix flip error on quadrants
johannes67890 Apr 8, 2024
b185874
Merge pull request #40 from johannes67890/filestreaming
johannes67890 Apr 8, 2024
89d3502
Import alg4 lib
johannes67890 Apr 9, 2024
6e8df15
fix relation error for type parseing
johannes67890 Apr 9, 2024
72dfb85
workon splitting files
johannes67890 Apr 9, 2024
4f056a0
Merge branch 'Filestreaming' of https://github.com/johannes67890/MapO…
johannes67890 Apr 9, 2024
1c1a7fb
Refactor TagRelation class to include a new method getMembers() that …
johannes67890 Apr 9, 2024
43210c6
workon
johannes67890 Apr 14, 2024
a0ed384
Refactor TagRelation and TagWay classes to use HashMap instead of Arr…
johannes67890 Apr 14, 2024
dc49418
Add dependencies and import statements for new libraries
johannes67890 Apr 14, 2024
5b185aa
Refactor Tag.java to use HashMap instead of ArrayList for storing ref…
johannes67890 Apr 15, 2024
016ce3c
Refactor TagTest.java and XMLReaderTest.java to improve test coverage…
johannes67890 Apr 15, 2024
77c4e4b
Refactor XMLWriterTest.java to use BeforeAll annotation for setUp() m…
johannes67890 Apr 15, 2024
cc466f6
memory opt in tagway
AndreasLN Apr 18, 2024
bebddc6
Refactor MecatorProjection class to remove unused code and improve co…
johannes67890 Apr 18, 2024
8cc577f
Tagnode memory opt
AndreasLN Apr 18, 2024
0a2951d
changing doubles to floats
AndreasLN Apr 18, 2024
073a5b6
Merge branch 'main' into CustomStructures
johannes67890 Apr 18, 2024
188f9c9
node clearing
AndreasLN Apr 18, 2024
7c5a0cd
cleanup
johannes67890 Apr 19, 2024
1ec3bdb
Change hashmap
johannes67890 Apr 19, 2024
b4a635d
Refactor XMLReader method calls in TreeTest.java
johannes67890 Apr 19, 2024
de8334b
cleanup
johannes67890 Apr 19, 2024
3087fcf
TagNodes with integer field
AndreasLN Apr 20, 2024
07cc8fe
Merge branch 'memoryOpt' of https://github.com/johannes67890/MapOfDen…
AndreasLN Apr 20, 2024
3a8a276
Functional Graphicssettings
AndreasLN Apr 20, 2024
14f52d9
Merge branch 'main' into memoryOpt
AndreasLN Apr 20, 2024
9eafcea
Revert "Merge branch 'main' into memoryOpt"
AndreasLN Apr 20, 2024
77fd2f5
Reapply "Merge branch 'main' into memoryOpt"
AndreasLN Apr 20, 2024
0c71f22
Revert "Reapply "Merge branch 'main' into memoryOpt""
AndreasLN Apr 20, 2024
b3b8923
cleanup Mecator test
johannes67890 Apr 20, 2024
ef78519
Rename Mecator methods, implement some of "isInBounds", tests and cha…
johannes67890 Apr 20, 2024
a10060c
Merge branch 'memoryOpt' into Filestreaming
johannes67890 Apr 20, 2024
968f5bb
Refactor isInBounds method in Tag.java
johannes67890 Apr 20, 2024
d495907
Add old files and add serialization to Tag class
johannes67890 Apr 20, 2024
544bcf0
Change Mecator projection so negation of lat is in drawMap
johannes67890 Apr 21, 2024
5c1eb53
minor changes to chunks
johannes67890 Apr 21, 2024
81d4b53
fix tree merge error
johannes67890 Apr 22, 2024
2ee0f3b
comment out broken code
johannes67890 Apr 22, 2024
30734b1
Full fix of merge
johannes67890 Apr 22, 2024
b300c15
Refactor TreeTest class and XMLReaderTest class
johannes67890 Apr 22, 2024
6baf2cb
changes from filestreaming
AndreasLN Apr 22, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ test {

dependencies {
implementation files ("lib/algs4.jar")
implementation 'net.sf.trove4j:trove4j:3.0.3'
implementation fileTree(include: ['*.jar'], dir: 'lib')
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.8.1'
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.8.1'
Expand Down
9 changes: 9 additions & 0 deletions src/main/java/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ public class Main extends Application {
public void start(Stage stage) {

mainView = new MainView(stage);

stage.show();

}
Expand All @@ -33,6 +34,14 @@ public void stop(){
f.delete();
}
}

String destDirChunks = System.getProperty("user.dir").toString() + "\\src\\main\\resources\\chunks\\";
File chunkFile = new File(destDirChunks);
if(chunkFile.isDirectory()){
for(File f : chunkFile.listFiles()){
f.delete();
}
}
}

}
77 changes: 63 additions & 14 deletions src/main/java/gui/Controller.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,30 @@
import java.net.URL;
import java.util.ResourceBundle;

import gui.GraphicsHandler.GraphicStyle;
import gui.MainView.StageSelect;
import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
import javafx.event.ActionEvent;
import javafx.fxml.FXML;
import javafx.fxml.Initializable;
import javafx.scene.control.Button;
import javafx.scene.control.Label;
import javafx.scene.control.ChoiceBox;
import javafx.scene.control.TextField;
import javafx.scene.image.ImageView;
import javafx.scene.layout.BorderPane;
import javafx.scene.layout.HBox;
import javafx.scene.layout.Pane;
import javafx.scene.layout.VBox;

public class Controller implements Initializable, ControllerInterface{


ObservableList<String> style = FXCollections.observableArrayList(
"default", "dark", "gray scale");

@FXML private Button menuButton1;
@FXML private Button menuButton2;
@FXML private Button menuButton3;
@FXML private Button layerButton;
@FXML private Button searchButton;
@FXML private Pane leftBurgerMenu;
Expand All @@ -29,8 +36,11 @@ public class Controller implements Initializable, ControllerInterface{
@FXML private VBox graphicVBox;
@FXML private HBox mainUIHBox;
@FXML private BorderPane mainBorderPane;
@FXML private ImageView zoomLevelImage;
@FXML private Label zoomLevelText;
@FXML private ChoiceBox<String> styleChoiceBox;





private boolean isMenuOpen = false;
private static MainView mainView;
Expand All @@ -53,12 +63,12 @@ public void start(MainView mw){ // this is only ran after the stage is shown
c.widthProperty().bind(p.widthProperty());
c.heightProperty().bind(p.heightProperty());

System.out.println("DRAWING MAP");

panZoomInitialize();

}

private void panZoomInitialize(){

mainView.canvas.setOnMousePressed(e -> {
lastX = e.getX();
lastY = e.getY();
Expand All @@ -72,12 +82,7 @@ private void panZoomInitialize(){

mainView.getDrawingMap().zoom(Math.pow(zoomMultiplier,event.getDeltaY()), event.getX(), event.getY());

zoomLevelText.setText("50m");

String meters = zoomLevelText.getText().replaceAll("m", "");

// TODO: Fix
// zoomLevelImage.setFitWidth(mainView.getDrawingMap().metersToPixels(Integer.parseInt(meters)));


});

Expand All @@ -95,6 +100,46 @@ private void panZoomInitialize(){
@Override
public void initialize(URL location, ResourceBundle resources) { // This runs when the fxml is loaded and the canvas is injected (before stage is shown)

mainMenuVBox.setVisible(false);
leftBurgerMenu.setVisible(false);
graphicVBox.setVisible(false);

styleChoiceBox.setItems(style);
styleChoiceBox.setValue("default");

styleChoiceBox.setOnAction((ActionEvent e) -> {

switch(styleChoiceBox.getValue()){
case "default" : {

GraphicsHandler.setGraphicsStyle(GraphicStyle.DEFAULT);
mainView.draw();

System.out.println("HELLO");
break;
}
case "dark" : {
System.out.println("DARKMODE");
GraphicsHandler.setGraphicsStyle(GraphicStyle.DARKMODE);
mainView.draw();

break;

}
case "gray scale" : {
System.out.println("GRAY SCALE");
GraphicsHandler.setGraphicsStyle(GraphicStyle.GRAYSCALE);
mainView.draw();
break;


}
}


});


mainMenuButton.setOnAction((ActionEvent e) -> {
mainView.drawScene(StageSelect.MainMenu);
});
Expand All @@ -103,20 +148,24 @@ public void initialize(URL location, ResourceBundle resources) { // This runs wh
leftBurgerMenu.setVisible(!isMenuOpen);
mainMenuVBox.setVisible(!isMenuOpen);
isMenuOpen = !isMenuOpen;

});
menuButton2.setOnAction((ActionEvent e) -> {
leftBurgerMenu.setVisible(!isMenuOpen);
mainMenuVBox.setVisible(!isMenuOpen);
isMenuOpen = !isMenuOpen;

});
menuButton3.setOnAction((ActionEvent e) -> {
leftBurgerMenu.setVisible(!isMenuOpen);
graphicVBox.setVisible(!isMenuOpen);
isMenuOpen = !isMenuOpen;
});
layerButton.setOnAction((ActionEvent e) -> {
graphicVBox.setVisible(true);
mainMenuVBox.setVisible(false);

});


searchBarStart.setOnAction((ActionEvent e) -> {
System.out.println("Searching for startpoint: " + searchBarStart.getText());
searchForAdress(searchBarStart.getText());
Expand Down
Loading