Add the detail of the line number in the Gui
This commit is contained in:
parent
c42855e8e2
commit
e154358d30
12 changed files with 63 additions and 3971 deletions
|
@ -66,7 +66,8 @@ public class App {
|
||||||
showLogo();
|
showLogo();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}else{
|
}
|
||||||
|
else{
|
||||||
testRelease();
|
testRelease();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -51,9 +51,9 @@ public class View extends JFrame {
|
||||||
|
|
||||||
private JMenuItem Lines;
|
private JMenuItem Lines;
|
||||||
private JPanel LinesPanel;
|
private JPanel LinesPanel;
|
||||||
private JLabel lineLabel;
|
private JLabel LineLabel;
|
||||||
private JComboBox linesComboBox;
|
private JComboBox LinesComboBox;
|
||||||
private JButton showLineButton;
|
private JButton ShowLineButton;
|
||||||
|
|
||||||
private JTextField TextCoord;
|
private JTextField TextCoord;
|
||||||
private JButton ButtonCoord;
|
private JButton ButtonCoord;
|
||||||
|
@ -137,23 +137,23 @@ public class View extends JFrame {
|
||||||
paneItinerary.add(tableItinerary);
|
paneItinerary.add(tableItinerary);
|
||||||
ItineraryPanel.add(paneItinerary);
|
ItineraryPanel.add(paneItinerary);
|
||||||
|
|
||||||
linesComboBox = new JComboBox();
|
LinesComboBox = new JComboBox();
|
||||||
linesComboBox.setMaximumSize(new Dimension(100, linesComboBox.getPreferredSize().height));
|
LinesComboBox.setMaximumSize(new Dimension(100, LinesComboBox.getPreferredSize().height));
|
||||||
linesComboBox.setPreferredSize(linesComboBox.getPreferredSize());
|
LinesComboBox.setPreferredSize(LinesComboBox.getPreferredSize());
|
||||||
lineLabel = new JLabel("Show line");
|
LineLabel = new JLabel("Show line");
|
||||||
lineLabel.setAlignmentX(Component.CENTER_ALIGNMENT);
|
LineLabel.setAlignmentX(Component.CENTER_ALIGNMENT);
|
||||||
showLineButton = new JButton("Open");
|
ShowLineButton = new JButton("Open");
|
||||||
showLineButton.setAlignmentX(Component.CENTER_ALIGNMENT);
|
ShowLineButton.setAlignmentX(Component.CENTER_ALIGNMENT);
|
||||||
|
|
||||||
LinesPanel = new JPanel();
|
LinesPanel = new JPanel();
|
||||||
LinesPanel.setLayout(new BoxLayout(LinesPanel, BoxLayout.Y_AXIS));
|
LinesPanel.setLayout(new BoxLayout(LinesPanel, BoxLayout.Y_AXIS));
|
||||||
LinesPanel.add(Box.createHorizontalGlue());
|
LinesPanel.add(Box.createHorizontalGlue());
|
||||||
LinesPanel.add(Box.createHorizontalStrut(2));
|
LinesPanel.add(Box.createHorizontalStrut(2));
|
||||||
LinesPanel.add(lineLabel);
|
LinesPanel.add(LineLabel);
|
||||||
LinesPanel.add(Box.createHorizontalStrut(10));
|
LinesPanel.add(Box.createHorizontalStrut(10));
|
||||||
LinesPanel.add(linesComboBox);
|
LinesPanel.add(LinesComboBox);
|
||||||
LinesPanel.add(Box.createHorizontalStrut(10));
|
LinesPanel.add(Box.createHorizontalStrut(10));
|
||||||
LinesPanel.add(showLineButton);
|
LinesPanel.add(ShowLineButton);
|
||||||
LinesPanel.add(Box.createHorizontalStrut(2));
|
LinesPanel.add(Box.createHorizontalStrut(2));
|
||||||
LinesPanel.add(Box.createHorizontalGlue());
|
LinesPanel.add(Box.createHorizontalGlue());
|
||||||
|
|
||||||
|
@ -188,41 +188,31 @@ public class View extends JFrame {
|
||||||
setVisible(true);
|
setVisible(true);
|
||||||
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
||||||
|
|
||||||
Home.addActionListener(new ActionListener() {
|
Home.addActionListener(e -> {
|
||||||
@Override
|
|
||||||
public void actionPerformed(ActionEvent e) {
|
|
||||||
CardPanel.removeAll();
|
CardPanel.removeAll();
|
||||||
CardPanel.add(HomePanel);
|
CardPanel.add(HomePanel);
|
||||||
CardPanel.repaint();
|
CardPanel.repaint();
|
||||||
CardPanel.revalidate();
|
CardPanel.revalidate();
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
Network.addActionListener(new ActionListener() {
|
Network.addActionListener(e -> {
|
||||||
@Override
|
|
||||||
public void actionPerformed(ActionEvent e) {
|
|
||||||
LoadSearchResult(s, modelStops);
|
LoadSearchResult(s, modelStops);
|
||||||
CardPanel.removeAll();
|
CardPanel.removeAll();
|
||||||
CardPanel.add(NetworkPanel);
|
CardPanel.add(NetworkPanel);
|
||||||
|
|
||||||
CardPanel.repaint();
|
CardPanel.repaint();
|
||||||
CardPanel.revalidate();
|
CardPanel.revalidate();
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
Itinerary.addActionListener(new ActionListener() {
|
Itinerary.addActionListener(e -> {
|
||||||
@Override
|
|
||||||
public void actionPerformed(ActionEvent e) {
|
|
||||||
LoadSearchResultItinerary(searchResPath, modelItinerary);
|
LoadSearchResultItinerary(searchResPath, modelItinerary);
|
||||||
CardPanel.removeAll();
|
CardPanel.removeAll();
|
||||||
CardPanel.add(ItineraryPanel);
|
CardPanel.add(ItineraryPanel);
|
||||||
|
|
||||||
CardPanel.repaint();
|
CardPanel.repaint();
|
||||||
CardPanel.revalidate();
|
CardPanel.revalidate();
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
Lines.addActionListener(e -> {
|
Lines.addActionListener(e -> {
|
||||||
CardPanel.removeAll();
|
CardPanel.removeAll();
|
||||||
CardPanel.add(LinesPanel);
|
CardPanel.add(LinesPanel);
|
||||||
|
@ -230,9 +220,9 @@ public class View extends JFrame {
|
||||||
CardPanel.revalidate();
|
CardPanel.revalidate();
|
||||||
});
|
});
|
||||||
|
|
||||||
CSVImageProvider.getLineImageMap().forEach(p -> linesComboBox.addItem(p));
|
CSVImageProvider.getLineImageMap().forEach(p -> LinesComboBox.addItem(p));
|
||||||
showLineButton.addActionListener(f -> {
|
ShowLineButton.addActionListener(f -> {
|
||||||
ImagePair item = (ImagePair) linesComboBox.getSelectedItem();
|
ImagePair item = (ImagePair) LinesComboBox.getSelectedItem();
|
||||||
openWebpage(item.getValue());
|
openWebpage(item.getValue());
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -281,6 +271,7 @@ public class View extends JFrame {
|
||||||
CardPanel.revalidate();
|
CardPanel.revalidate();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
tableStops.addMouseListener(new MouseAdapter() {
|
tableStops.addMouseListener(new MouseAdapter() {
|
||||||
@Override
|
@Override
|
||||||
public void mouseClicked(MouseEvent e) {
|
public void mouseClicked(MouseEvent e) {
|
||||||
|
@ -291,8 +282,6 @@ public class View extends JFrame {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
paneStops.addMouseListener(new MouseAdapter() {
|
paneStops.addMouseListener(new MouseAdapter() {
|
||||||
@Override
|
@Override
|
||||||
public void mouseClicked(MouseEvent e) {
|
public void mouseClicked(MouseEvent e) {
|
||||||
|
@ -326,15 +315,6 @@ public class View extends JFrame {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public static void main(String[] args) {
|
|
||||||
ArrayList<Stop> s = new ArrayList<>();
|
|
||||||
s.add(new Stop("M8", "Balard", 1.0315897, 3.0265513));
|
|
||||||
s.add(new Stop("M14", "Gare de Lyon", 2.4658452681, 3.0265513));
|
|
||||||
View v = new View(s);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void LoadSearchResult(ArrayList<Stop> stops, DefaultTableModel model) {
|
public void LoadSearchResult(ArrayList<Stop> stops, DefaultTableModel model) {
|
||||||
// Clear existing rows from the table
|
// Clear existing rows from the table
|
||||||
int cols = model.getColumnCount();
|
int cols = model.getColumnCount();
|
||||||
|
@ -435,4 +415,11 @@ public class View extends JFrame {
|
||||||
LOGGER.severe("Default desktop browser not set");
|
LOGGER.severe("Default desktop browser not set");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void main(String[] args) {
|
||||||
|
ArrayList<Stop> s = new ArrayList<>();
|
||||||
|
s.add(new Stop("M8", "Balard", 1.0315897, 3.0265513));
|
||||||
|
s.add(new Stop("M14", "Gare de Lyon", 2.4658452681, 3.0265513));
|
||||||
|
SwingUtilities.invokeLater(() -> new View(s));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,6 +22,7 @@ public final class CSVImageProvider {
|
||||||
|
|
||||||
private static final NumberFormat MINUTES_SECOND_FORMATTER = NumberFormat
|
private static final NumberFormat MINUTES_SECOND_FORMATTER = NumberFormat
|
||||||
.getInstance(Locale.ENGLISH);
|
.getInstance(Locale.ENGLISH);
|
||||||
|
|
||||||
static {
|
static {
|
||||||
MINUTES_SECOND_FORMATTER.setMinimumIntegerDigits(2);
|
MINUTES_SECOND_FORMATTER.setMinimumIntegerDigits(2);
|
||||||
}
|
}
|
||||||
|
@ -32,7 +33,7 @@ public final class CSVImageProvider {
|
||||||
|
|
||||||
private static ArrayList<ImagePair> lineImageMap;
|
private static ArrayList<ImagePair> lineImageMap;
|
||||||
|
|
||||||
public static final String FILE_NAME = "image.csv";
|
public static final String FILE_NAME = IDFMNetworkExtractor.IMAGES_FILE_NAME;
|
||||||
|
|
||||||
|
|
||||||
/** Create the stream provider */
|
/** Create the stream provider */
|
||||||
|
@ -53,6 +54,7 @@ public final class CSVImageProvider {
|
||||||
|
|
||||||
Transport element = this.current.next();
|
Transport element = this.current.next();
|
||||||
this.line[ImageFormat.LINE_INDEX] = element.name;
|
this.line[ImageFormat.LINE_INDEX] = element.name;
|
||||||
|
this.line[ImageFormat.LINE_DETAIL_INDEX] = element.type;
|
||||||
this.line[ImageFormat.IMAGE_URL_INDEX] = element.image_url;
|
this.line[ImageFormat.IMAGE_URL_INDEX] = element.image_url;
|
||||||
|
|
||||||
return Arrays.copyOf(this.line, this.line.length);
|
return Arrays.copyOf(this.line, this.line.length);
|
||||||
|
@ -62,12 +64,11 @@ public final class CSVImageProvider {
|
||||||
if (lineImageMap != null)
|
if (lineImageMap != null)
|
||||||
return lineImageMap;
|
return lineImageMap;
|
||||||
lineImageMap = new ArrayList<>();
|
lineImageMap = new ArrayList<>();
|
||||||
InputStream is = CSVImageProvider.class.getResourceAsStream(FILE_NAME);
|
|
||||||
System.out.println(is.toString());
|
|
||||||
try {
|
try {
|
||||||
CSVTools.readCSVFromInputStream(is,
|
CSVTools.readCSVFromFile(FILE_NAME,
|
||||||
(String[] line) -> lineImageMap.add(new ImagePair(
|
(String[] line) -> lineImageMap.add(new ImagePair(
|
||||||
line[ImageFormat.LINE_INDEX],
|
line[ImageFormat.LINE_INDEX],
|
||||||
|
line[ImageFormat.LINE_DETAIL_INDEX],
|
||||||
line[ImageFormat.IMAGE_URL_INDEX]
|
line[ImageFormat.IMAGE_URL_INDEX]
|
||||||
)));
|
)));
|
||||||
} catch(IOException e){
|
} catch(IOException e){
|
||||||
|
|
|
@ -85,7 +85,7 @@ public class IDFMNetworkExtractor {
|
||||||
|
|
||||||
private static final String HOURS_FILE_NAME = "hours.csv";
|
private static final String HOURS_FILE_NAME = "hours.csv";
|
||||||
|
|
||||||
private static final String IMAGES_FILE_NAME = "./images.csv";
|
public static final String IMAGES_FILE_NAME = "images.csv";
|
||||||
|
|
||||||
// Magically chosen values
|
// Magically chosen values
|
||||||
/**
|
/**
|
||||||
|
@ -112,7 +112,7 @@ public class IDFMNetworkExtractor {
|
||||||
|
|
||||||
public static void buildFiles() {
|
public static void buildFiles() {
|
||||||
|
|
||||||
if (checkFileExistence("./"+HOURS_FILE_NAME) && checkFileExistence("./"+TRACE_FILE_NAME)) {
|
if (checkFileExistence("./"+HOURS_FILE_NAME) && checkFileExistence("./"+TRACE_FILE_NAME) && checkFileExistence(("./"+IMAGES_FILE_NAME))) {
|
||||||
LOGGER.severe("Files already exists.");
|
LOGGER.severe("Files already exists.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -151,7 +151,7 @@ public class IDFMNetworkExtractor {
|
||||||
long startTime = System.currentTimeMillis();
|
long startTime = System.currentTimeMillis();
|
||||||
|
|
||||||
for (Transport entry : transports.values()) {
|
for (Transport entry : transports.values()) {
|
||||||
entry.buildBifurcationOptimzed();
|
entry.buildBifurcationOptimized();
|
||||||
}
|
}
|
||||||
|
|
||||||
long endTime = System.currentTimeMillis();
|
long endTime = System.currentTimeMillis();
|
||||||
|
@ -161,7 +161,7 @@ public class IDFMNetworkExtractor {
|
||||||
long seconds = (tempsPasse / 1000) % 60;
|
long seconds = (tempsPasse / 1000) % 60;
|
||||||
long milliseconds = tempsPasse % 1000;
|
long milliseconds = tempsPasse % 1000;
|
||||||
|
|
||||||
System.out.println("Temps écoulé : " + minutes + " minutess, " + seconds + " secndes et " + milliseconds + " millis");
|
System.out.println("Temps écoulé : " + minutes + " minutes, " + seconds + " secndes et " + milliseconds + " millis");
|
||||||
|
|
||||||
System.out.println("******************Fin Building bifurcations ************************");
|
System.out.println("******************Fin Building bifurcations ************************");
|
||||||
|
|
||||||
|
|
|
@ -8,8 +8,8 @@ public class ImagePair {
|
||||||
private final String label;
|
private final String label;
|
||||||
private final String value;
|
private final String value;
|
||||||
|
|
||||||
public ImagePair(String label, String value){
|
public ImagePair(String label, String label_detail, String value){
|
||||||
this.label = label;
|
this.label = label + " - " + label_detail;
|
||||||
this.value = value;
|
this.value = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -55,7 +55,7 @@ public class Transport {
|
||||||
/**
|
/**
|
||||||
* Build the bifurcation for all the descriptions but optimized
|
* Build the bifurcation for all the descriptions but optimized
|
||||||
*/
|
*/
|
||||||
public void buildBifurcationOptimzed() {
|
public void buildBifurcationOptimized() {
|
||||||
// int found = 0;
|
// int found = 0;
|
||||||
for (TraceDescription d : descriptions) {
|
for (TraceDescription d : descriptions) {
|
||||||
Stop debut = stopsMap.get(d.from);
|
Stop debut = stopsMap.get(d.from);
|
||||||
|
@ -92,7 +92,7 @@ public class Transport {
|
||||||
* @param currentStop the current stop we are visiting
|
* @param currentStop the current stop we are visiting
|
||||||
* @param last The last stop we are trying to go to
|
* @param last The last stop we are trying to go to
|
||||||
* @param alreadyVisited All the stop we already have visisted
|
* @param alreadyVisited All the stop we already have visisted
|
||||||
* @param bif All the bifurcation encountered from the first stop to the current
|
* @param bifurcation All the bifurcation encountered from the first stop to the current
|
||||||
* one
|
* one
|
||||||
* @return True and the bifurcation if we found our road to the last stop and
|
* @return True and the bifurcation if we found our road to the last stop and
|
||||||
* false if we didn't
|
* false if we didn't
|
||||||
|
@ -138,7 +138,7 @@ public class Transport {
|
||||||
* @param currentStop the current stop we are visiting
|
* @param currentStop the current stop we are visiting
|
||||||
* @param last The last stop we are trying to go to
|
* @param last The last stop we are trying to go to
|
||||||
* @param alreadyVisited All the stop we already have visisted
|
* @param alreadyVisited All the stop we already have visisted
|
||||||
* @param bif All the bifurcation encountered from the first stop to the current
|
* @param bifurcation All the bifurcation encountered from the first stop to the current
|
||||||
* one
|
* one
|
||||||
* @return True and the bifurcation if we found our road to the last stop and
|
* @return True and the bifurcation if we found our road to the last stop and
|
||||||
* false if we didn't
|
* false if we didn't
|
||||||
|
|
|
@ -12,10 +12,11 @@ import java.util.List;
|
||||||
* A tool class for the Image format.
|
* A tool class for the Image format.
|
||||||
*/
|
*/
|
||||||
public final class ImageFormat {
|
public final class ImageFormat {
|
||||||
public static final int NUMBER_COLUMNS = 2;
|
public static final int NUMBER_COLUMNS = 3;
|
||||||
|
|
||||||
public static final int LINE_INDEX = 0;
|
public static final int LINE_INDEX = 0;
|
||||||
public static final int IMAGE_URL_INDEX = 1;
|
public static final int LINE_DETAIL_INDEX = 1;
|
||||||
|
public static final int IMAGE_URL_INDEX = 2;
|
||||||
|
|
||||||
/** Hidden constructor for tool class */
|
/** Hidden constructor for tool class */
|
||||||
private ImageFormat() {
|
private ImageFormat() {
|
||||||
|
|
|
@ -239,6 +239,5 @@ public class Parse {
|
||||||
Graph graph = new Graph(nodes, connections);
|
Graph graph = new Graph(nodes, connections);
|
||||||
Finder finder = new Finder(graph);
|
Finder finder = new Finder(graph);
|
||||||
return finder.findPath(src, dst, startTime);
|
return finder.findPath(src, dst, startTime);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,7 +6,6 @@ package fr.u_paris.gla.project.utils;
|
||||||
import java.io.*;
|
import java.io.*;
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
import java.nio.charset.StandardCharsets;
|
import java.nio.charset.StandardCharsets;
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.function.Consumer;
|
import java.util.function.Consumer;
|
||||||
import java.util.stream.Stream;
|
import java.util.stream.Stream;
|
||||||
|
|
||||||
|
@ -75,8 +74,8 @@ public final class CSVTools {
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Save our current CSV variable's data into an actual file
|
/** Save our current CSV variable's data into an actual file
|
||||||
* @param filename the saved file's name and path
|
* @param filename saved file's name and path
|
||||||
* @param contentLineConsumer our data variable
|
* @param contentLinesConsumer our data variable
|
||||||
* @throws IOException if we can't write the data into the file
|
* @throws IOException if we can't write the data into the file
|
||||||
*/
|
*/
|
||||||
public static void writeCSVToFile(String filename,
|
public static void writeCSVToFile(String filename,
|
||||||
|
|
File diff suppressed because it is too large
Load diff
Reference in a new issue