diff --git a/.gitignore b/.gitignore
new file mode 100644
index 00000000..7d2ffd95
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,3 @@
+/GO_Sync/nbproject.bak/private/
+/GO_Sync/build/
+/GO_Sync/target/
diff --git a/GO_Sync/build.xml b/GO_Sync/build.xml.bak
similarity index 100%
rename from GO_Sync/build.xml
rename to GO_Sync/build.xml.bak
diff --git a/GO_Sync/nbproject/build-impl.xml b/GO_Sync/nbproject.bak/build-impl.xml
similarity index 100%
rename from GO_Sync/nbproject/build-impl.xml
rename to GO_Sync/nbproject.bak/build-impl.xml
diff --git a/GO_Sync/nbproject/genfiles.properties b/GO_Sync/nbproject.bak/genfiles.properties
similarity index 100%
rename from GO_Sync/nbproject/genfiles.properties
rename to GO_Sync/nbproject.bak/genfiles.properties
diff --git a/GO_Sync/nbproject/profiler-build-impl.xml b/GO_Sync/nbproject.bak/profiler-build-impl.xml
similarity index 100%
rename from GO_Sync/nbproject/profiler-build-impl.xml
rename to GO_Sync/nbproject.bak/profiler-build-impl.xml
diff --git a/GO_Sync/nbproject/project.properties b/GO_Sync/nbproject.bak/project.properties
similarity index 100%
rename from GO_Sync/nbproject/project.properties
rename to GO_Sync/nbproject.bak/project.properties
diff --git a/GO_Sync/nbproject/project.xml b/GO_Sync/nbproject.bak/project.xml
similarity index 100%
rename from GO_Sync/nbproject/project.xml
rename to GO_Sync/nbproject.bak/project.xml
diff --git a/GO_Sync/pom.xml b/GO_Sync/pom.xml
index 3b1b3b98..e67c695b 100644
--- a/GO_Sync/pom.xml
+++ b/GO_Sync/pom.xml
@@ -8,6 +8,14 @@
1.0.1-SNAPSHOT
GO_Sync
https://github.com/CUTR-at-USF/gtfs-osm-sync/
+
+
+
+ project.local
+ project
+ file:${project.basedir}/repo
+
+
junit
@@ -45,8 +53,21 @@
commons-io
2.11.0
-
-
+
+ org.swinglabs
+ swingx-ws
+ 1.0
+
+
+ org.swinglabs
+ swingx-beaninfo
+ 1.6
+
+
+ org.swinglabs
+ swingx
+ 1.6
+
diff --git a/GO_Sync/swingx-ws-1.0-bin/lib/cobundle/swingx-beaninfo-1.6.jar b/GO_Sync/repo/org/swinglabs/swingx-beaninfo/1.6/swingx-beaninfo-1.6.jar
similarity index 100%
rename from GO_Sync/swingx-ws-1.0-bin/lib/cobundle/swingx-beaninfo-1.6.jar
rename to GO_Sync/repo/org/swinglabs/swingx-beaninfo/1.6/swingx-beaninfo-1.6.jar
diff --git a/GO_Sync/repo/org/swinglabs/swingx-beaninfo/1.6/swingx-beaninfo-1.6.jar.md5 b/GO_Sync/repo/org/swinglabs/swingx-beaninfo/1.6/swingx-beaninfo-1.6.jar.md5
new file mode 100644
index 00000000..ad1ebcb9
--- /dev/null
+++ b/GO_Sync/repo/org/swinglabs/swingx-beaninfo/1.6/swingx-beaninfo-1.6.jar.md5
@@ -0,0 +1 @@
+2a8c493c38892e406739a32e0f0c89ff
\ No newline at end of file
diff --git a/GO_Sync/repo/org/swinglabs/swingx-beaninfo/1.6/swingx-beaninfo-1.6.jar.sha1 b/GO_Sync/repo/org/swinglabs/swingx-beaninfo/1.6/swingx-beaninfo-1.6.jar.sha1
new file mode 100644
index 00000000..0416335b
--- /dev/null
+++ b/GO_Sync/repo/org/swinglabs/swingx-beaninfo/1.6/swingx-beaninfo-1.6.jar.sha1
@@ -0,0 +1 @@
+b3bc755a37ecb8aab573ab65a98f64ea57d09946
\ No newline at end of file
diff --git a/GO_Sync/repo/org/swinglabs/swingx-beaninfo/1.6/swingx-beaninfo-1.6.pom b/GO_Sync/repo/org/swinglabs/swingx-beaninfo/1.6/swingx-beaninfo-1.6.pom
new file mode 100644
index 00000000..ca4ff676
--- /dev/null
+++ b/GO_Sync/repo/org/swinglabs/swingx-beaninfo/1.6/swingx-beaninfo-1.6.pom
@@ -0,0 +1,8 @@
+
+
+ 4.0.0
+ org.swinglabs
+ swingx-beaninfo
+ 1.6
+
diff --git a/GO_Sync/repo/org/swinglabs/swingx-beaninfo/1.6/swingx-beaninfo-1.6.pom.md5 b/GO_Sync/repo/org/swinglabs/swingx-beaninfo/1.6/swingx-beaninfo-1.6.pom.md5
new file mode 100644
index 00000000..deab2727
--- /dev/null
+++ b/GO_Sync/repo/org/swinglabs/swingx-beaninfo/1.6/swingx-beaninfo-1.6.pom.md5
@@ -0,0 +1 @@
+5536f631248e5e6c7fe9b5acad1f5cac
\ No newline at end of file
diff --git a/GO_Sync/repo/org/swinglabs/swingx-beaninfo/1.6/swingx-beaninfo-1.6.pom.sha1 b/GO_Sync/repo/org/swinglabs/swingx-beaninfo/1.6/swingx-beaninfo-1.6.pom.sha1
new file mode 100644
index 00000000..9bc135a3
--- /dev/null
+++ b/GO_Sync/repo/org/swinglabs/swingx-beaninfo/1.6/swingx-beaninfo-1.6.pom.sha1
@@ -0,0 +1 @@
+97e7138fdfa658441a5de42438c857c94a25926f
\ No newline at end of file
diff --git a/GO_Sync/repo/org/swinglabs/swingx-beaninfo/maven-metadata.xml b/GO_Sync/repo/org/swinglabs/swingx-beaninfo/maven-metadata.xml
new file mode 100644
index 00000000..39637960
--- /dev/null
+++ b/GO_Sync/repo/org/swinglabs/swingx-beaninfo/maven-metadata.xml
@@ -0,0 +1,12 @@
+
+
+ org.swinglabs
+ swingx-beaninfo
+
+ 1.6
+
+ 1.6
+
+ 20230716102207
+
+
diff --git a/GO_Sync/repo/org/swinglabs/swingx-beaninfo/maven-metadata.xml.md5 b/GO_Sync/repo/org/swinglabs/swingx-beaninfo/maven-metadata.xml.md5
new file mode 100644
index 00000000..6cb8367e
--- /dev/null
+++ b/GO_Sync/repo/org/swinglabs/swingx-beaninfo/maven-metadata.xml.md5
@@ -0,0 +1 @@
+928051a2812fa68cb49bf3a709e1627e
\ No newline at end of file
diff --git a/GO_Sync/repo/org/swinglabs/swingx-beaninfo/maven-metadata.xml.sha1 b/GO_Sync/repo/org/swinglabs/swingx-beaninfo/maven-metadata.xml.sha1
new file mode 100644
index 00000000..79009a04
--- /dev/null
+++ b/GO_Sync/repo/org/swinglabs/swingx-beaninfo/maven-metadata.xml.sha1
@@ -0,0 +1 @@
+c62572c98e00bd8827eb6d90f7df4cb405bdf80f
\ No newline at end of file
diff --git a/GO_Sync/src/main/java/edu/usf/cutr/go_sync/gui/MainForm.form b/GO_Sync/src/main/java/edu/usf/cutr/go_sync/gui/MainForm.form
index 33940d74..d23b96fe 100644
--- a/GO_Sync/src/main/java/edu/usf/cutr/go_sync/gui/MainForm.form
+++ b/GO_Sync/src/main/java/edu/usf/cutr/go_sync/gui/MainForm.form
@@ -1,6 +1,6 @@
-
+
-
diff --git a/GO_Sync/src/main/java/edu/usf/cutr/go_sync/gui/MainForm.java b/GO_Sync/src/main/java/edu/usf/cutr/go_sync/gui/MainForm.java
index 465c23d6..543898b7 100644
--- a/GO_Sync/src/main/java/edu/usf/cutr/go_sync/gui/MainForm.java
+++ b/GO_Sync/src/main/java/edu/usf/cutr/go_sync/gui/MainForm.java
@@ -22,41 +22,42 @@
*/
package edu.usf.cutr.go_sync.gui;
-import java.awt.Toolkit;
-import java.awt.event.KeyEvent;
-import java.beans.PropertyChangeEvent;
-import java.beans.PropertyChangeListener;
-
-import javax.swing.*;
-
+import edu.usf.cutr.go_sync.io.DefaultOperatorReader;
+import edu.usf.cutr.go_sync.object.DefaultOperator;
import edu.usf.cutr.go_sync.object.OperatorInfo;
+import edu.usf.cutr.go_sync.object.ProcessingOptions;
+import edu.usf.cutr.go_sync.object.ProcessingParams;
import edu.usf.cutr.go_sync.task.CompareData;
import edu.usf.cutr.go_sync.task.OsmTask;
import edu.usf.cutr.go_sync.task.RevertChangeset;
-
-import java.io.*;
+import java.awt.Dimension;
+import java.awt.Toolkit;
+import java.awt.event.ItemEvent;
+import java.awt.event.KeyEvent;
+import java.awt.event.KeyListener;
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
+import java.io.BufferedInputStream;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.net.HttpURLConnection;
import java.net.MalformedURLException;
import java.net.URL;
-import java.net.HttpURLConnection;
import java.nio.file.Files;
import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.EnumSet;
import java.util.List;
import java.util.zip.ZipEntry;
import java.util.zip.ZipInputStream;
-
-import edu.usf.cutr.go_sync.io.DefaultOperatorReader;
-import edu.usf.cutr.go_sync.object.DefaultOperator;
-
-import java.awt.event.ItemEvent;
-import java.awt.event.KeyListener;
-
-import javax.swing.GroupLayout.Alignment;
-import javax.swing.LayoutStyle.ComponentPlacement;
-
-import java.awt.GridBagLayout;
-import java.awt.GridBagConstraints;
-import java.awt.Insets;
-import java.awt.Dimension;
+import javax.swing.JFileChooser;
+import javax.swing.JOptionPane;
+import javax.swing.ProgressMonitor;
+import javax.swing.UIManager;
+import javax.swing.UnsupportedLookAndFeelException;
//TODO add radius selection
/**
@@ -65,9 +66,13 @@
*/
public class MainForm extends javax.swing.JFrame implements PropertyChangeListener {
+ public static EnumSet processingOptions = EnumSet.noneOf(ProcessingOptions.class);
+ public static ProcessingParams processingParams = new ProcessingParams();
+
private String _operatorName;
private String _operatorNameAbbreviate;
private String _operatorAlias;
+ private String _operatorRegex;
private String _operatorNtdId = "";
private int _gtfsIdDigit;
private String _revertChangesetId;
@@ -77,6 +82,7 @@ public class MainForm extends javax.swing.JFrame implements PropertyChangeListen
private ProgressMonitor progressMonitor;
private OsmTask task;
private List ops;
+ List l;
/** Creates new form MainForm */
@@ -93,14 +99,16 @@ public MainForm() {
//TODO Fix textfield with ops is null (operators.csv doesn't exist)
- List l = new ArrayList(); //create a new list to store operator names
+ l = new ArrayList(); //create a new list to store operator names
l.add(""); //first entry in the list will be blank
if (ops != null) {
for (DefaultOperator op : ops) { //for each operator
l.add(op.getOperatorName()); //add their name to the list for autocompletion
}
}
- initComponents(l);
+ initComponents();
+ //operatorNameField = new edu.usf.cutr.go_sync.gui.object.AutoCompleteTextField(l);
+ operatorNameField.requestFocusInWindow();
if (ops != null) {
KeyListener listener = new KeyListener() { //create key listener for autocomple text field
@@ -154,343 +162,559 @@ public void keyReleased(KeyEvent e) {
*/
@SuppressWarnings("unchecked")
// //GEN-BEGIN:initComponents
- private void initComponents(List l) {
+ private void initComponents() {
+ java.awt.GridBagConstraints gridBagConstraints;
buttonGroup1 = new javax.swing.ButtonGroup();
- exitButton = new javax.swing.JButton();
jTabbedPane1 = new javax.swing.JTabbedPane();
compareDataPanel = new javax.swing.JPanel();
+ operatorPanel = new javax.swing.JPanel();
+ operatorNameLabel = new javax.swing.JLabel();
+ operatorNameField = new edu.usf.cutr.go_sync.gui.object.AutoCompleteTextField(l);
+ OperatorAbbLabel = new javax.swing.JLabel();
+ operatorNameAbbField = new javax.swing.JTextField();
+ operatorAliasLabel = new javax.swing.JLabel();
+ operatorAliasField = new javax.swing.JTextField();
+ operatorNTDIDLabel = new javax.swing.JLabel();
+ operatorNTDIDField = new javax.swing.JTextField();
+ operatorRegexLabel = new javax.swing.JLabel();
+ operatorRegexField = new javax.swing.JTextField();
+ optionsPanel = new javax.swing.JPanel();
+ geoZonePanel = new javax.swing.JPanel();
+ ignoreStopsHavintLatLonLabel = new javax.swing.JLabel();
+ lonPanel = new javax.swing.JPanel();
+ LonGTLabel = new javax.swing.JLabel();
+ LonGTField = new javax.swing.JTextField();
+ LonLTLabel = new javax.swing.JLabel();
+ LonLTField = new javax.swing.JTextField();
+ latPanel = new javax.swing.JPanel();
+ LatGTLabel = new javax.swing.JLabel();
+ LatGTField = new javax.swing.JTextField();
+ LatLTLabel = new javax.swing.JLabel();
+ LatLTField = new javax.swing.JTextField();
+ stopOptionsPanel = new javax.swing.JPanel();
+ gtfsStopIdLengthPanel = new javax.swing.JPanel();
+ gtfsIdDigitLabel = new javax.swing.JLabel();
+ gtfsIdDigitField = new javax.swing.JTextField();
+ distanceThresholdPanel = new javax.swing.JPanel();
+ threshold_label = new javax.swing.JLabel();
+ distanceThreshold = new javax.swing.JSpinner();
+ skipGtfsStationsCb = new javax.swing.JCheckBox();
+ routeOptionsPanel = new javax.swing.JPanel();
+ createAsPTv2Cb = new javax.swing.JCheckBox();
+ dontReplaceExistingOSMRouteColorCb = new javax.swing.JCheckBox();
+ dontAddGtfsRouteTextColorCb = new javax.swing.JCheckBox();
+ dontAddGtfsAgencyIdCb = new javax.swing.JCheckBox();
+ routeMemberOptionPanel = new javax.swing.JPanel();
+ skipNodesWithRoleEmptyCb = new javax.swing.JCheckBox();
+ skipNodesWithRoleStopCb = new javax.swing.JCheckBox();
+ skipNodesWithRoleStopWithoutMatchinPlatformCb = new javax.swing.JCheckBox();
+ removePlatformsNotInGtfsFromOSMRelationCb = new javax.swing.JCheckBox();
+ gtfsDataPanel = new javax.swing.JPanel();
+ rbURL = new javax.swing.JRadioButton();
+ rbFileFolder = new javax.swing.JRadioButton();
+ fileNameLabel = new javax.swing.JLabel();
+ fileDirTextField = new javax.swing.JTextField();
+ browseButton = new javax.swing.JButton();
+ netexPanel = new javax.swing.JPanel();
+ netexZipFileLabel = new javax.swing.JLabel();
+ netexZipFile = new javax.swing.JTextField();
+ netexBrowseButton = new javax.swing.JButton();
+ netexStopFilenameLabel = new javax.swing.JLabel();
+ netexStopFilename = new javax.swing.JTextField();
+ citiesWithoutTownPrefixPanel = new javax.swing.JPanel();
+ citiesWithoutTownPrefixLabel = new javax.swing.JLabel();
+ citiesWithoutTownPrefixField = new javax.swing.JTextField();
+ requiredFieldsLabel = new javax.swing.JLabel();
+ compareButton = new javax.swing.JButton();
revertChangesetPanel = new javax.swing.JPanel();
+ changesetLabel = new javax.swing.JLabel();
+ revertChangesetField = new javax.swing.JTextField();
+ revertButton = new javax.swing.JButton();
jScrollPane1 = new javax.swing.JScrollPane();
taskOutput = new javax.swing.JTextArea();
+ exitButton = new javax.swing.JButton();
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
setTitle("GO-Sync");
setName("mainForm"); // NOI18N
- setResizable(true); //false);
+ java.awt.GridBagLayout layout = new java.awt.GridBagLayout();
+ layout.columnWeights = new double[] {1.0};
+ layout.rowWeights = new double[] {0.0, 0.0, 0.0};
+ getContentPane().setLayout(layout);
- exitButton.setText("Exit");
- exitButton.addMouseListener(new java.awt.event.MouseAdapter() {
- public void mouseClicked(java.awt.event.MouseEvent evt) {
- exitButtonMouseClicked(evt);
+ java.awt.GridBagLayout compareDataPanelLayout = new java.awt.GridBagLayout();
+ compareDataPanelLayout.columnWeights = new double[] {0.1, 0.1, 0.1, 0.1, 0.5};
+ compareDataPanelLayout.rowWeights = new double[] {1.0, 1.0, 1.0, 1.0, 1.0};
+ compareDataPanel.setLayout(compareDataPanelLayout);
+
+ operatorPanel.setBorder(javax.swing.BorderFactory.createTitledBorder("Operator"));
+ java.awt.GridBagLayout jPanel1Layout = new java.awt.GridBagLayout();
+ jPanel1Layout.columnWidths = new int[] {50, 50, 50, 50};
+ jPanel1Layout.columnWeights = new double[] {0.1, 0.5, 0.1, 0.5};
+ operatorPanel.setLayout(jPanel1Layout);
+
+ operatorNameLabel.setFont(new java.awt.Font("Sans Serif", 0, 13)); // NOI18N
+ operatorNameLabel.setForeground(java.awt.Color.blue);
+ operatorNameLabel.setText("Op. Full Name (*)");
+ gridBagConstraints = new java.awt.GridBagConstraints();
+ gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_START;
+ operatorPanel.add(operatorNameLabel, gridBagConstraints);
+ gridBagConstraints = new java.awt.GridBagConstraints();
+ gridBagConstraints.gridx = 1;
+ gridBagConstraints.gridy = 0;
+ gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
+ gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
+ gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_START;
+ gridBagConstraints.weightx = 1.0;
+ operatorPanel.add(operatorNameField, gridBagConstraints);
+
+ OperatorAbbLabel.setFont(new java.awt.Font("Sans Serif", 0, 13)); // NOI18N
+ OperatorAbbLabel.setForeground(java.awt.Color.blue);
+ OperatorAbbLabel.setText("Op. Abbreviation (*)");
+ gridBagConstraints = new java.awt.GridBagConstraints();
+ gridBagConstraints.gridx = 0;
+ gridBagConstraints.gridy = 1;
+ gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_START;
+ operatorPanel.add(OperatorAbbLabel, gridBagConstraints);
+
+ operatorNameAbbField.setName("usernameField"); // NOI18N
+ gridBagConstraints = new java.awt.GridBagConstraints();
+ gridBagConstraints.gridx = 1;
+ gridBagConstraints.gridy = 1;
+ gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
+ gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_START;
+ operatorPanel.add(operatorNameAbbField, gridBagConstraints);
+ operatorNameAbbField.getAccessibleContext().setAccessibleName("operatorNameAbbField");
+
+ operatorAliasLabel.setText("Op. Aliases (separated by ';')");
+ gridBagConstraints = new java.awt.GridBagConstraints();
+ gridBagConstraints.gridx = 2;
+ gridBagConstraints.gridy = 1;
+ gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_START;
+ operatorPanel.add(operatorAliasLabel, gridBagConstraints);
+
+ operatorAliasField.setName("usernameField"); // NOI18N
+ gridBagConstraints = new java.awt.GridBagConstraints();
+ gridBagConstraints.gridx = 3;
+ gridBagConstraints.gridy = 1;
+ gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
+ gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
+ gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_START;
+ operatorPanel.add(operatorAliasField, gridBagConstraints);
+
+ operatorNTDIDLabel.setText("Op. NTD ID");
+ gridBagConstraints = new java.awt.GridBagConstraints();
+ gridBagConstraints.gridx = 0;
+ gridBagConstraints.gridy = 2;
+ gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_START;
+ operatorPanel.add(operatorNTDIDLabel, gridBagConstraints);
+
+ operatorNTDIDField.setName("usernameField"); // NOI18N
+ gridBagConstraints = new java.awt.GridBagConstraints();
+ gridBagConstraints.gridx = 1;
+ gridBagConstraints.gridy = 2;
+ gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
+ gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_START;
+ operatorPanel.add(operatorNTDIDField, gridBagConstraints);
+ operatorNTDIDField.getAccessibleContext().setAccessibleName("OperatorNTDIDField");
+
+ operatorRegexLabel.setText("Op. Alias Regex");
+ gridBagConstraints = new java.awt.GridBagConstraints();
+ gridBagConstraints.gridx = 2;
+ gridBagConstraints.gridy = 2;
+ gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_START;
+ operatorPanel.add(operatorRegexLabel, gridBagConstraints);
+ gridBagConstraints = new java.awt.GridBagConstraints();
+ gridBagConstraints.gridx = 3;
+ gridBagConstraints.gridy = 2;
+ gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
+ gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
+ gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_START;
+ operatorPanel.add(operatorRegexField, gridBagConstraints);
+
+ gridBagConstraints = new java.awt.GridBagConstraints();
+ gridBagConstraints.gridx = 0;
+ gridBagConstraints.gridy = 0;
+ gridBagConstraints.gridwidth = java.awt.GridBagConstraints.RELATIVE;
+ gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
+ gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
+ compareDataPanel.add(operatorPanel, gridBagConstraints);
+
+ java.awt.GridBagLayout optionsPanelLayout = new java.awt.GridBagLayout();
+ optionsPanelLayout.columnWeights = new double[] {0.5, 0.5};
+ optionsPanel.setLayout(optionsPanelLayout);
+
+ geoZonePanel.setBorder(javax.swing.BorderFactory.createTitledBorder("Geographical zone query"));
+ geoZonePanel.setLayout(new javax.swing.BoxLayout(geoZonePanel, javax.swing.BoxLayout.Y_AXIS));
+
+ ignoreStopsHavintLatLonLabel.setText("Ignore stops having (automatic if none is set, otherwise set one or more to filter by lat/lon):");
+ geoZonePanel.add(ignoreStopsHavintLatLonLabel);
+
+ lonPanel.setAlignmentX(0.0F);
+ lonPanel.setLayout(new javax.swing.BoxLayout(lonPanel, javax.swing.BoxLayout.LINE_AXIS));
+
+ LonGTLabel.setText("Longitude >");
+ lonPanel.add(LonGTLabel);
+ lonPanel.add(LonGTField);
+
+ LonLTLabel.setText("Lon. <");
+ lonPanel.add(LonLTLabel);
+ lonPanel.add(LonLTField);
+
+ geoZonePanel.add(lonPanel);
+
+ latPanel.setAlignmentX(0.0F);
+ latPanel.setLayout(new javax.swing.BoxLayout(latPanel, javax.swing.BoxLayout.LINE_AXIS));
+
+ LatGTLabel.setText("Latitude >");
+ latPanel.add(LatGTLabel);
+ latPanel.add(LatGTField);
+
+ LatLTLabel.setText("Lat. <");
+ latPanel.add(LatLTLabel);
+ latPanel.add(LatLTField);
+
+ geoZonePanel.add(latPanel);
+
+ gridBagConstraints = new java.awt.GridBagConstraints();
+ gridBagConstraints.gridx = 0;
+ gridBagConstraints.gridy = 0;
+ gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
+ gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
+ optionsPanel.add(geoZonePanel, gridBagConstraints);
+
+ stopOptionsPanel.setBorder(javax.swing.BorderFactory.createTitledBorder("Stop options"));
+ stopOptionsPanel.setLayout(new javax.swing.BoxLayout(stopOptionsPanel, javax.swing.BoxLayout.Y_AXIS));
+
+ gtfsStopIdLengthPanel.setAlignmentX(0.0F);
+ gtfsStopIdLengthPanel.setLayout(new javax.swing.BoxLayout(gtfsStopIdLengthPanel, javax.swing.BoxLayout.LINE_AXIS));
+
+ gtfsIdDigitLabel.setText("Length of GTFS Stop IDs");
+ gtfsStopIdLengthPanel.add(gtfsIdDigitLabel);
+
+ gtfsIdDigitField.setName("usernameField"); // NOI18N
+ gtfsStopIdLengthPanel.add(gtfsIdDigitField);
+
+ stopOptionsPanel.add(gtfsStopIdLengthPanel);
+
+ distanceThresholdPanel.setToolTipText("routeOptions");
+ distanceThresholdPanel.setAlignmentX(0.0F);
+ distanceThresholdPanel.setLayout(new javax.swing.BoxLayout(distanceThresholdPanel, javax.swing.BoxLayout.LINE_AXIS));
+
+ threshold_label.setText("Approximate Comparision Distance Threshold (m)");
+ distanceThresholdPanel.add(threshold_label);
+
+ distanceThreshold.setValue(400);
+ distanceThresholdPanel.add(distanceThreshold);
+
+ stopOptionsPanel.add(distanceThresholdPanel);
+
+ skipGtfsStationsCb.setText("Skip GTFS stops of location_type 'station'");
+ stopOptionsPanel.add(skipGtfsStationsCb);
+
+ gridBagConstraints = new java.awt.GridBagConstraints();
+ gridBagConstraints.gridx = 0;
+ gridBagConstraints.gridy = 1;
+ gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
+ gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
+ optionsPanel.add(stopOptionsPanel, gridBagConstraints);
+
+ routeOptionsPanel.setBorder(javax.swing.BorderFactory.createTitledBorder("Route options"));
+ routeOptionsPanel.setLayout(new javax.swing.BoxLayout(routeOptionsPanel, javax.swing.BoxLayout.Y_AXIS));
+
+ createAsPTv2Cb.setSelected(true);
+ createAsPTv2Cb.setText("Default to PTv2 route");
+ createAsPTv2Cb.setActionCommand("Move nodes before ways");
+ routeOptionsPanel.add(createAsPTv2Cb);
+
+ dontReplaceExistingOSMRouteColorCb.setText("Don't replace existing route color in OSM");
+ routeOptionsPanel.add(dontReplaceExistingOSMRouteColorCb);
+
+ dontAddGtfsRouteTextColorCb.setText("Don't add Gtfs 'route_text_color' to OSM");
+ routeOptionsPanel.add(dontAddGtfsRouteTextColorCb);
+
+ dontAddGtfsAgencyIdCb.setText("Don't add Gtfs 'agency_id' to OSM");
+ routeOptionsPanel.add(dontAddGtfsAgencyIdCb);
+
+ gridBagConstraints = new java.awt.GridBagConstraints();
+ gridBagConstraints.gridx = 1;
+ gridBagConstraints.gridy = 0;
+ gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
+ gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
+ optionsPanel.add(routeOptionsPanel, gridBagConstraints);
+
+ routeMemberOptionPanel.setBorder(javax.swing.BorderFactory.createTitledBorder("Route members options (applies only to PTv2 relations)"));
+ routeMemberOptionPanel.setLayout(new javax.swing.BoxLayout(routeMemberOptionPanel, javax.swing.BoxLayout.Y_AXIS));
+
+ skipNodesWithRoleEmptyCb.setSelected(true);
+ skipNodesWithRoleEmptyCb.setText("Remove nodes having empty role (mandatory for PTv2)");
+ skipNodesWithRoleEmptyCb.setEnabled(false);
+ routeMemberOptionPanel.add(skipNodesWithRoleEmptyCb);
+
+ skipNodesWithRoleStopCb.setText("Remove all nodes having role 'stop'");
+ skipNodesWithRoleStopCb.setActionCommand("Remove nodes with 'stop' role");
+ routeMemberOptionPanel.add(skipNodesWithRoleStopCb);
+
+ skipNodesWithRoleStopWithoutMatchinPlatformCb.setSelected(true);
+ skipNodesWithRoleStopWithoutMatchinPlatformCb.setText("Remove nodes having role 'stop' that don't match a platform (recommended)");
+ routeMemberOptionPanel.add(skipNodesWithRoleStopWithoutMatchinPlatformCb);
+
+ removePlatformsNotInGtfsFromOSMRelationCb.setSelected(true);
+ removePlatformsNotInGtfsFromOSMRelationCb.setText("Remove platforms without Gtfs match (recommended)");
+ routeMemberOptionPanel.add(removePlatformsNotInGtfsFromOSMRelationCb);
+
+ gridBagConstraints = new java.awt.GridBagConstraints();
+ gridBagConstraints.gridx = 1;
+ gridBagConstraints.gridy = 1;
+ gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
+ gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
+ optionsPanel.add(routeMemberOptionPanel, gridBagConstraints);
+
+ gridBagConstraints = new java.awt.GridBagConstraints();
+ gridBagConstraints.gridx = 0;
+ gridBagConstraints.gridy = 1;
+ gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
+ gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
+ compareDataPanel.add(optionsPanel, gridBagConstraints);
+
+ gtfsDataPanel.setBorder(javax.swing.BorderFactory.createTitledBorder("GTFS Data"));
+ gtfsDataPanel.setName("pnlGTFSData"); // NOI18N
+
+ buttonGroup1.add(rbURL);
+ rbURL.setText("URL");
+ rbURL.setName("rbURL"); // NOI18N
+ rbURL.addItemListener(new java.awt.event.ItemListener() {
+ public void itemStateChanged(java.awt.event.ItemEvent evt) {
+ rbURLItemStateChanged(evt);
}
});
- GridBagLayout gbl_compareDataPanel = new GridBagLayout();
- gbl_compareDataPanel.columnWidths = new int[]{151, 20, 161, 3, 126, 70, 57, 0, 0, 150, 0, 150, 0, 0};
- gbl_compareDataPanel.rowHeights = new int[]{19, 19, 95, 25, 0, 0};
- gbl_compareDataPanel.columnWeights = new double[]{1.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, Double.MIN_VALUE};
- gbl_compareDataPanel.rowWeights = new double[]{1.0, 1.0, 1.0, 1.0, 1.0, Double.MIN_VALUE};
- compareDataPanel.setLayout(gbl_compareDataPanel);
- operatorNameLabel = new javax.swing.JLabel();
-
- operatorNameLabel.setText("Operator Full Name (*)");
- GridBagConstraints gbc_operatorNameLabel = new GridBagConstraints();
- gbc_operatorNameLabel.anchor = GridBagConstraints.EAST;
- gbc_operatorNameLabel.insets = new Insets(0, 0, 5, 5);
- gbc_operatorNameLabel.gridwidth = 2;
- gbc_operatorNameLabel.gridx = 0;
- gbc_operatorNameLabel.gridy = 0;
- compareDataPanel.add(operatorNameLabel, gbc_operatorNameLabel);
-
- //create a new textfield with autocomplete for operator names
- operatorNameField = new edu.usf.cutr.go_sync.gui.object.AutoCompleteTextField(l);
- //add the textfield to the panel
- GridBagConstraints gbc_operatorNameField = new GridBagConstraints();
- gbc_operatorNameField.fill = GridBagConstraints.HORIZONTAL;
- gbc_operatorNameField.insets = new Insets(0, 0, 5, 5);
- gbc_operatorNameField.gridwidth = 4;
- gbc_operatorNameField.gridx = 2;
- gbc_operatorNameField.gridy = 0;
- compareDataPanel.add(operatorNameField, gbc_operatorNameField);
-
- operatorNameField.requestFocusInWindow(); //set the cursor in the operator name autocomplete text field
- OperatorAbbLabel = new javax.swing.JLabel();
-
- OperatorAbbLabel.setText("Operator Abbreviation (*)");
- GridBagConstraints gbc_OperatorAbbLabel = new GridBagConstraints();
- gbc_OperatorAbbLabel.anchor = GridBagConstraints.EAST;
- gbc_OperatorAbbLabel.insets = new Insets(0, 0, 5, 5);
- gbc_OperatorAbbLabel.gridwidth = 3;
- gbc_OperatorAbbLabel.gridx = 6;
- gbc_OperatorAbbLabel.gridy = 0;
- compareDataPanel.add(OperatorAbbLabel, gbc_OperatorAbbLabel);
- operatorNameAbbField = new javax.swing.JTextField();
-
- operatorNameAbbField.setName("usernameField");
- GridBagConstraints gbc_operatorNameAbbField = new GridBagConstraints();
- gbc_operatorNameAbbField.gridwidth = 3;
- gbc_operatorNameAbbField.fill = GridBagConstraints.HORIZONTAL;
- gbc_operatorNameAbbField.insets = new Insets(0, 0, 5, 5);
- gbc_operatorNameAbbField.gridx = 9;
- gbc_operatorNameAbbField.gridy = 0;
- compareDataPanel.add(operatorNameAbbField, gbc_operatorNameAbbField);
- operatorNameAbbField.getAccessibleContext().setAccessibleName("operatorNameAbbField");
- operatorAliasField = new javax.swing.JTextField();
-
- operatorAliasField.setName("usernameField"); // NOI18N
- GridBagConstraints gbc_operatorAliasField = new GridBagConstraints();
- gbc_operatorAliasField.fill = GridBagConstraints.HORIZONTAL;
- gbc_operatorAliasField.insets = new Insets(0, 0, 5, 5);
- gbc_operatorAliasField.gridwidth = 3;
- gbc_operatorAliasField.gridx = 1;
- gbc_operatorAliasField.gridy = 1;
- compareDataPanel.add(operatorAliasField, gbc_operatorAliasField);
- operatorAliasLabel = new javax.swing.JLabel();
-
- operatorAliasLabel.setText("Operator Alias");
- GridBagConstraints gbc_operatorAliasLabel = new GridBagConstraints();
- gbc_operatorAliasLabel.anchor = GridBagConstraints.EAST;
- gbc_operatorAliasLabel.insets = new Insets(0, 0, 5, 5);
- gbc_operatorAliasLabel.gridx = 0;
- gbc_operatorAliasLabel.gridy = 1;
- compareDataPanel.add(operatorAliasLabel, gbc_operatorAliasLabel);
- gtfsDataPanel = new javax.swing.JPanel();
-
- gtfsDataPanel.setBorder(javax.swing.BorderFactory.createTitledBorder("GTFS Data"));
- gtfsDataPanel.setName("pnlGTFSData"); // NOI18N
- operatorNTDIDLabel = new javax.swing.JLabel();
-
- operatorNTDIDLabel.setText("Operator NTD ID");
- GridBagConstraints gbc_operatorNTDIDLabel = new GridBagConstraints();
- gbc_operatorNTDIDLabel.gridwidth = 2;
- gbc_operatorNTDIDLabel.anchor = GridBagConstraints.WEST;
- gbc_operatorNTDIDLabel.insets = new Insets(0, 0, 5, 5);
- gbc_operatorNTDIDLabel.gridx = 4;
- gbc_operatorNTDIDLabel.gridy = 1;
- compareDataPanel.add(operatorNTDIDLabel, gbc_operatorNTDIDLabel);
- operatorNTDIDField = new javax.swing.JTextField();
-
- operatorNTDIDField.setName("usernameField"); // NOI18N
- GridBagConstraints gbc_operatorNTDIDField = new GridBagConstraints();
- gbc_operatorNTDIDField.fill = GridBagConstraints.HORIZONTAL;
- gbc_operatorNTDIDField.insets = new Insets(0, 0, 5, 5);
- gbc_operatorNTDIDField.gridx = 6;
- gbc_operatorNTDIDField.gridy = 1;
- compareDataPanel.add(operatorNTDIDField, gbc_operatorNTDIDField);
- operatorNTDIDField.getAccessibleContext().setAccessibleName("OperatorNTDIDField");
- gtfsIdDigitLabel = new javax.swing.JLabel();
-
- gtfsIdDigitLabel.setText("Length of GTFS Stop IDs");
- GridBagConstraints gbc_gtfsIdDigitLabel = new GridBagConstraints();
- gbc_gtfsIdDigitLabel.gridwidth = 3;
- gbc_gtfsIdDigitLabel.anchor = GridBagConstraints.EAST;
- gbc_gtfsIdDigitLabel.insets = new Insets(0, 0, 5, 5);
- gbc_gtfsIdDigitLabel.gridx = 7;
- gbc_gtfsIdDigitLabel.gridy = 1;
- compareDataPanel.add(gtfsIdDigitLabel, gbc_gtfsIdDigitLabel);
- gtfsIdDigitField = new javax.swing.JTextField();
- gtfsIdDigitField.setMinimumSize(new Dimension(25, 19));
-
- gtfsIdDigitField.setName("usernameField"); // NOI18N
- GridBagConstraints gbc_gtfsIdDigitField = new GridBagConstraints();
- gbc_gtfsIdDigitField.fill = GridBagConstraints.HORIZONTAL;
- gbc_gtfsIdDigitField.insets = new Insets(0, 0, 5, 5);
- gbc_gtfsIdDigitField.gridx = 11;
- gbc_gtfsIdDigitField.gridy = 1;
- compareDataPanel.add(gtfsIdDigitField, gbc_gtfsIdDigitField);
-
- GridBagConstraints gbc_gtfsDataPanel = new GridBagConstraints();
- gbc_gtfsDataPanel.fill = GridBagConstraints.HORIZONTAL;
- gbc_gtfsDataPanel.insets = new Insets(0, 0, 5, 5);
- gbc_gtfsDataPanel.gridwidth = 12;
- gbc_gtfsDataPanel.gridx = 0;
- gbc_gtfsDataPanel.gridy = 2;
- compareDataPanel.add(gtfsDataPanel, gbc_gtfsDataPanel);
- GridBagLayout gbl_gtfsDataPanel = new GridBagLayout();
- gbl_gtfsDataPanel.columnWidths = new int[]{100, 187, 158, 74, 0};
- gbl_gtfsDataPanel.rowHeights = new int[]{23, 25, 0};
- gbl_gtfsDataPanel.columnWeights = new double[]{0.0, 0.0, 0.0, 0.0, Double.MIN_VALUE};
- gbl_gtfsDataPanel.rowWeights = new double[]{0.0, 0.0, Double.MIN_VALUE};
- gtfsDataPanel.setLayout(gbl_gtfsDataPanel);
- browseButton = new javax.swing.JButton();
-
- browseButton.setText("Browse");
- browseButton.addActionListener(new java.awt.event.ActionListener() {
- public void actionPerformed(java.awt.event.ActionEvent evt) {
- browseButtonActionPerformed(evt);
- }
- });
- browseButton.getAccessibleContext().setAccessibleParent(gtfsDataPanel);
- fileNameLabel = new javax.swing.JLabel();
-
- fileNameLabel.setText("Folder or Zip File (*)");
-
- fileNameLabel.getAccessibleContext().setAccessibleParent(gtfsDataPanel);
- rbURL = new javax.swing.JRadioButton();
-
- buttonGroup1.add(rbURL);
- rbURL.setText("URL");
- rbURL.setName("rbURL"); // NOI18N
- rbURL.addItemListener(new java.awt.event.ItemListener() {
- public void itemStateChanged(java.awt.event.ItemEvent evt) {
- rbURLItemStateChanged(evt);
- }
- });
- rbFileFolder = new javax.swing.JRadioButton();
-
- buttonGroup1.add(rbFileFolder);
- rbFileFolder.setSelected(true);
- rbFileFolder.setText("Folder or Zip File");
- rbFileFolder.setName("rbFolderFile"); // NOI18N
- rbFileFolder.addItemListener(new java.awt.event.ItemListener() {
- public void itemStateChanged(java.awt.event.ItemEvent evt) {
- rbFileFolderItemStateChanged(evt);
- }
- });
- GridBagConstraints gbc_rbFileFolder = new GridBagConstraints();
- gbc_rbFileFolder.anchor = GridBagConstraints.NORTHEAST;
- gbc_rbFileFolder.insets = new Insets(0, 0, 5, 5);
- gbc_rbFileFolder.gridx = 1;
- gbc_rbFileFolder.gridy = 0;
- gtfsDataPanel.add(rbFileFolder, gbc_rbFileFolder);
- GridBagConstraints gbc_rbURL = new GridBagConstraints();
- gbc_rbURL.anchor = GridBagConstraints.NORTHWEST;
- gbc_rbURL.insets = new Insets(0, 0, 5, 5);
- gbc_rbURL.gridx = 2;
- gbc_rbURL.gridy = 0;
- gtfsDataPanel.add(rbURL, gbc_rbURL);
- GridBagConstraints gbc_fileNameLabel = new GridBagConstraints();
- gbc_fileNameLabel.fill = GridBagConstraints.HORIZONTAL;
- gbc_fileNameLabel.insets = new Insets(0, 0, 0, 5);
- gbc_fileNameLabel.gridx = 0;
- gbc_fileNameLabel.gridy = 1;
- gtfsDataPanel.add(fileNameLabel, gbc_fileNameLabel);
- fileDirTextField = new javax.swing.JTextField();
- fileDirTextField.getAccessibleContext().setAccessibleParent(gtfsDataPanel);
- GridBagConstraints gbc_fileDirTextField = new GridBagConstraints();
- gbc_fileDirTextField.fill = GridBagConstraints.HORIZONTAL;
- gbc_fileDirTextField.insets = new Insets(0, 0, 0, 5);
- gbc_fileDirTextField.gridwidth = 2;
- gbc_fileDirTextField.gridx = 1;
- gbc_fileDirTextField.gridy = 1;
- gtfsDataPanel.add(fileDirTextField, gbc_fileDirTextField);
- GridBagConstraints gbc_browseButton = new GridBagConstraints();
- gbc_browseButton.anchor = GridBagConstraints.NORTH;
- gbc_browseButton.fill = GridBagConstraints.HORIZONTAL;
- gbc_browseButton.gridx = 3;
- gbc_browseButton.gridy = 1;
- gtfsDataPanel.add(browseButton, gbc_browseButton);
- jTabbedPane1.addTab("Compare Data", compareDataPanel);
- jLabel1 = new javax.swing.JLabel();
-
- jLabel1.setText("Fields marked with an asterisk(*) are required");
- GridBagConstraints gbc_jLabel1 = new GridBagConstraints();
- gbc_jLabel1.fill = GridBagConstraints.HORIZONTAL;
- gbc_jLabel1.insets = new Insets(0, 0, 5, 5);
- gbc_jLabel1.gridwidth = 12;
- gbc_jLabel1.gridx = 0;
- gbc_jLabel1.gridy = 3;
+ buttonGroup1.add(rbFileFolder);
+ rbFileFolder.setSelected(true);
+ rbFileFolder.setText("Folder or Zip File");
+ rbFileFolder.setName("rbFolderFile"); // NOI18N
+ rbFileFolder.addItemListener(new java.awt.event.ItemListener() {
+ public void itemStateChanged(java.awt.event.ItemEvent evt) {
+ rbFileFolderItemStateChanged(evt);
+ }
+ });
- compareDataPanel.add(jLabel1, gbc_jLabel1);
+ fileNameLabel.setFont(new java.awt.Font("Sans Serif", 0, 13)); // NOI18N
+ fileNameLabel.setForeground(java.awt.Color.blue);
+ fileNameLabel.setText("Folder or Zip File (*)");
+ browseButton.setText("Browse");
+ browseButton.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(java.awt.event.ActionEvent evt) {
+ browseButtonActionPerformed(evt);
+ }
+ });
- distanceThreshold = new JSpinner();
- distanceThreshold.setValue(400);
- GridBagConstraints gbc_threshold = new GridBagConstraints();
- JLabel threshold_label = new JLabel("Approximate Comparision Distance Threshold (m)");
-// gbc_threshold.fill = GridBagConstraints.HORIZONTAL;
- gbc_threshold.insets = new Insets(0, 0, 5, 5);
- gbc_threshold.gridwidth = 12;
-
- gbc_threshold.gridy = 4;
- gbc_threshold.gridx = 0;
- compareDataPanel.add(threshold_label,gbc_threshold);
- gbc_threshold.gridx = 6;
- compareDataPanel.add(distanceThreshold, gbc_threshold);
-
- compareButton = new javax.swing.JButton();
-
- compareButton.setText("Run");
- compareButton.addActionListener(new java.awt.event.ActionListener() {
- public void actionPerformed(java.awt.event.ActionEvent evt) {
- compareButtonActionPerformed(evt);
- }
- });
- GridBagConstraints gbc_compareButton = new GridBagConstraints();
- gbc_compareButton.insets = new Insets(0, 0, 0, 5);
- gbc_compareButton.gridwidth = 12;
- gbc_compareButton.gridx = 0;
- gbc_compareButton.gridy = 5;
- compareDataPanel.add(compareButton, gbc_compareButton);
+ javax.swing.GroupLayout gtfsDataPanelLayout = new javax.swing.GroupLayout(gtfsDataPanel);
+ gtfsDataPanel.setLayout(gtfsDataPanelLayout);
+ gtfsDataPanelLayout.setHorizontalGroup(
+ gtfsDataPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(gtfsDataPanelLayout.createSequentialGroup()
+ .addContainerGap()
+ .addGroup(gtfsDataPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addComponent(rbFileFolder)
+ .addComponent(fileNameLabel))
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
+ .addGroup(gtfsDataPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(gtfsDataPanelLayout.createSequentialGroup()
+ .addComponent(fileDirTextField, javax.swing.GroupLayout.PREFERRED_SIZE, 345, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addComponent(browseButton))
+ .addComponent(rbURL))
+ .addContainerGap(540, Short.MAX_VALUE))
+ );
+
+ gtfsDataPanelLayout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {rbFileFolder, rbURL});
+
+ gtfsDataPanelLayout.setVerticalGroup(
+ gtfsDataPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, gtfsDataPanelLayout.createSequentialGroup()
+ .addGroup(gtfsDataPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
+ .addComponent(rbFileFolder)
+ .addComponent(rbURL))
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
+ .addGroup(gtfsDataPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
+ .addComponent(fileNameLabel)
+ .addComponent(fileDirTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addComponent(browseButton))
+ .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
+ );
+
+ fileNameLabel.getAccessibleContext().setAccessibleParent(gtfsDataPanel);
+ fileDirTextField.getAccessibleContext().setAccessibleParent(gtfsDataPanel);
+ browseButton.getAccessibleContext().setAccessibleParent(gtfsDataPanel);
+
+ gridBagConstraints = new java.awt.GridBagConstraints();
+ gridBagConstraints.gridx = 0;
+ gridBagConstraints.gridy = 2;
+ gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
+ gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
+ gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
+ compareDataPanel.add(gtfsDataPanel, gridBagConstraints);
+
+ netexPanel.setBorder(javax.swing.BorderFactory.createTitledBorder("Netex Data (for Stops label improvement)"));
+ java.awt.GridBagLayout netexPanelLayout = new java.awt.GridBagLayout();
+ netexPanelLayout.columnWeights = new double[] {0.1, 0.8, 0.1};
+ netexPanel.setLayout(netexPanelLayout);
+
+ netexZipFileLabel.setText("NetEx Zip file");
+ gridBagConstraints = new java.awt.GridBagConstraints();
+ gridBagConstraints.gridy = 0;
+ gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
+ gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
+ netexPanel.add(netexZipFileLabel, gridBagConstraints);
+ gridBagConstraints = new java.awt.GridBagConstraints();
+ gridBagConstraints.gridy = 0;
+ gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
+ netexPanel.add(netexZipFile, gridBagConstraints);
+
+ netexBrowseButton.setText("Browse");
+ netexBrowseButton.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(java.awt.event.ActionEvent evt) {
+ netexBrowseButtonActionPerformed(evt);
+ }
+ });
+ gridBagConstraints = new java.awt.GridBagConstraints();
+ gridBagConstraints.gridy = 0;
+ netexPanel.add(netexBrowseButton, gridBagConstraints);
+
+ netexStopFilenameLabel.setText("NetEx Stops filename");
+ gridBagConstraints = new java.awt.GridBagConstraints();
+ gridBagConstraints.gridy = 1;
+ gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
+ gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
+ netexPanel.add(netexStopFilenameLabel, gridBagConstraints);
+ gridBagConstraints = new java.awt.GridBagConstraints();
+ gridBagConstraints.gridy = 1;
+ gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
+ gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
+ netexPanel.add(netexStopFilename, gridBagConstraints);
+
+ citiesWithoutTownPrefixPanel.setAlignmentX(0.0F);
+ citiesWithoutTownPrefixPanel.setLayout(new javax.swing.BoxLayout(citiesWithoutTownPrefixPanel, javax.swing.BoxLayout.LINE_AXIS));
+
+ citiesWithoutTownPrefixLabel.setText("Cities for which station name should not be prefixed by town (separate names by ';')");
+ citiesWithoutTownPrefixPanel.add(citiesWithoutTownPrefixLabel);
+ citiesWithoutTownPrefixPanel.add(citiesWithoutTownPrefixField);
+
+ gridBagConstraints = new java.awt.GridBagConstraints();
+ gridBagConstraints.gridx = 0;
+ gridBagConstraints.gridy = 2;
+ gridBagConstraints.gridwidth = 2;
+ gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
+ netexPanel.add(citiesWithoutTownPrefixPanel, gridBagConstraints);
+
+ gridBagConstraints = new java.awt.GridBagConstraints();
+ gridBagConstraints.gridx = 0;
+ gridBagConstraints.gridy = 3;
+ gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
+ gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
+ gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
+ compareDataPanel.add(netexPanel, gridBagConstraints);
+
+ requiredFieldsLabel.setFont(new java.awt.Font("Sans Serif", 0, 13)); // NOI18N
+ requiredFieldsLabel.setForeground(java.awt.Color.blue);
+ requiredFieldsLabel.setText("Fields marked with an asterisk(*) are required");
+ gridBagConstraints = new java.awt.GridBagConstraints();
+ gridBagConstraints.gridx = 0;
+ gridBagConstraints.gridy = 4;
+ gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
+ gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
+ gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
+ compareDataPanel.add(requiredFieldsLabel, gridBagConstraints);
+
+ compareButton.setText("Run");
+ compareButton.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(java.awt.event.ActionEvent evt) {
+ compareButtonActionPerformed(evt);
+ }
+ });
+ gridBagConstraints = new java.awt.GridBagConstraints();
+ gridBagConstraints.gridx = 0;
+ gridBagConstraints.gridy = 6;
+ gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
+ compareDataPanel.add(compareButton, gridBagConstraints);
+
+ jTabbedPane1.addTab("Compare Data", compareDataPanel);
revertChangesetPanel.setName(""); // NOI18N
+ changesetLabel.setText("Changeset ID");
+
+ revertChangesetField.setName("usernameField"); // NOI18N
+
+ revertButton.setText("Run");
+ revertButton.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(java.awt.event.ActionEvent evt) {
+ revertButtonActionPerformed(evt);
+ }
+ });
+
+ javax.swing.GroupLayout revertChangesetPanelLayout = new javax.swing.GroupLayout(revertChangesetPanel);
+ revertChangesetPanel.setLayout(revertChangesetPanelLayout);
+ revertChangesetPanelLayout.setHorizontalGroup(
+ revertChangesetPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(revertChangesetPanelLayout.createSequentialGroup()
+ .addGroup(revertChangesetPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(revertChangesetPanelLayout.createSequentialGroup()
+ .addGap(25, 25, 25)
+ .addComponent(changesetLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 120, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addGap(18, 18, 18)
+ .addComponent(revertChangesetField, javax.swing.GroupLayout.PREFERRED_SIZE, 225, javax.swing.GroupLayout.PREFERRED_SIZE))
+ .addGroup(revertChangesetPanelLayout.createSequentialGroup()
+ .addGap(277, 277, 277)
+ .addComponent(revertButton, javax.swing.GroupLayout.PREFERRED_SIZE, 74, javax.swing.GroupLayout.PREFERRED_SIZE)))
+ .addContainerGap(724, Short.MAX_VALUE))
+ );
+ revertChangesetPanelLayout.setVerticalGroup(
+ revertChangesetPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(revertChangesetPanelLayout.createSequentialGroup()
+ .addGap(78, 78, 78)
+ .addGroup(revertChangesetPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
+ .addComponent(revertChangesetField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addComponent(changesetLabel))
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 376, Short.MAX_VALUE)
+ .addComponent(revertButton)
+ .addContainerGap())
+ );
+
jTabbedPane1.addTab("Revert Changeset", revertChangesetPanel);
- GridBagLayout gbl_revertChangesetPanel = new GridBagLayout();
- gbl_revertChangesetPanel.columnWidths = new int[]{120, 225, 0};
- gbl_revertChangesetPanel.rowHeights = new int[]{78, 19, 110, 25, 0};
- gbl_revertChangesetPanel.columnWeights = new double[]{0.0, 1.0, Double.MIN_VALUE};
- gbl_revertChangesetPanel.rowWeights = new double[]{0.0, 0.0, 0.0, 0.0, Double.MIN_VALUE};
- revertChangesetPanel.setLayout(gbl_revertChangesetPanel);
- changesetLabel = new javax.swing.JLabel();
-
- changesetLabel.setText("Changeset ID");
- GridBagConstraints gbc_changesetLabel = new GridBagConstraints();
- gbc_changesetLabel.anchor = GridBagConstraints.EAST;
- gbc_changesetLabel.insets = new Insets(0, 0, 5, 5);
- gbc_changesetLabel.gridx = 0;
- gbc_changesetLabel.gridy = 1;
- revertChangesetPanel.add(changesetLabel, gbc_changesetLabel);
- revertChangesetField = new javax.swing.JTextField();
-
- revertChangesetField.setName("usernameField"); // NOI18N
- GridBagConstraints gbc_revertChangesetField = new GridBagConstraints();
- gbc_revertChangesetField.anchor = GridBagConstraints.NORTH;
- gbc_revertChangesetField.fill = GridBagConstraints.HORIZONTAL;
- gbc_revertChangesetField.insets = new Insets(0, 0, 5, 0);
- gbc_revertChangesetField.gridx = 1;
- gbc_revertChangesetField.gridy = 1;
- revertChangesetPanel.add(revertChangesetField, gbc_revertChangesetField);
- revertButton = new javax.swing.JButton();
-
- revertButton.setText("Run");
- revertButton.addActionListener(new java.awt.event.ActionListener() {
- public void actionPerformed(java.awt.event.ActionEvent evt) {
- revertButtonActionPerformed(evt);
- }
- });
- GridBagConstraints gbc_revertButton = new GridBagConstraints();
- gbc_revertButton.gridwidth = 2;
- gbc_revertButton.anchor = GridBagConstraints.NORTH;
- gbc_revertButton.gridx = 0;
- gbc_revertButton.gridy = 3;
- revertChangesetPanel.add(revertButton, gbc_revertButton);
+
+ gridBagConstraints = new java.awt.GridBagConstraints();
+ gridBagConstraints.gridx = 0;
+ gridBagConstraints.gridy = 0;
+ gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
+ gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
+ getContentPane().add(jTabbedPane1, gridBagConstraints);
taskOutput.setColumns(20);
taskOutput.setRows(5);
jScrollPane1.setViewportView(taskOutput);
- javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
- layout.setHorizontalGroup(
- layout.createParallelGroup(Alignment.TRAILING)
- .addGroup(layout.createSequentialGroup()
- .addContainerGap()
- .addGroup(layout.createParallelGroup(Alignment.LEADING)
- .addGroup(layout.createSequentialGroup()
- .addGroup(layout.createParallelGroup(Alignment.TRAILING)
- .addComponent(jTabbedPane1, Alignment.LEADING, 0, 0, Short.MAX_VALUE)
- .addComponent(jScrollPane1, Alignment.LEADING, GroupLayout.DEFAULT_SIZE, 633, Short.MAX_VALUE))
- .addGap(12))
- .addGroup(layout.createSequentialGroup()
- .addGap(279)
- .addComponent(exitButton, GroupLayout.DEFAULT_SIZE, 86, Short.MAX_VALUE)
- .addGap(280)))
- .addContainerGap())
- );
- layout.setVerticalGroup(
- layout.createParallelGroup(Alignment.LEADING)
- .addGroup(layout.createSequentialGroup()
- .addContainerGap()
- .addComponent(jTabbedPane1, GroupLayout.PREFERRED_SIZE, 271, GroupLayout.PREFERRED_SIZE)
- .addPreferredGap(ComponentPlacement.RELATED)
- .addComponent(jScrollPane1, GroupLayout.DEFAULT_SIZE, 108, Short.MAX_VALUE)
- .addPreferredGap(ComponentPlacement.RELATED)
- .addComponent(exitButton)
- .addContainerGap())
- );
- getContentPane().setLayout(layout);
+ gridBagConstraints = new java.awt.GridBagConstraints();
+ gridBagConstraints.gridx = 0;
+ gridBagConstraints.gridy = 1;
+ gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
+ gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
+ gridBagConstraints.weighty = 0.5;
+ getContentPane().add(jScrollPane1, gridBagConstraints);
+ exitButton.setText("Exit");
+ exitButton.addMouseListener(new java.awt.event.MouseAdapter() {
+ public void mouseClicked(java.awt.event.MouseEvent evt) {
+ exitButtonMouseClicked(evt);
+ }
+ });
+ gridBagConstraints = new java.awt.GridBagConstraints();
+ gridBagConstraints.gridx = 0;
+ gridBagConstraints.gridy = 2;
+ getContentPane().add(exitButton, gridBagConstraints);
exitButton.getAccessibleContext().setAccessibleName("exitButton");
pack();
@@ -509,7 +733,7 @@ private void compareButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN
if (rbURL.isSelected()) { //if user selected a URL
try {
- if (!UnzipGTFS(null, new URL(fileDirTextField.getText()))) { //try to unzip from the URL
+ if (!UnzipGTFS(null, new URL(fileDirTextField.getText()), "GTFS")) { //try to unzip from the URL
JOptionPane.showMessageDialog(this, "Unable to unzip from URL. Please try again with another URL.");
return;
}
@@ -518,14 +742,14 @@ private void compareButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN
System.err.println("Error: " + ex.getLocalizedMessage());
return;
}
- _fileDir = new File("GTFS_Temp").getAbsolutePath() + System.getProperty("file.separator");//"\\"; //set the actual location to the GTFS_Temp folder
+ _fileDir = new File("TempUnzip").getAbsolutePath() + System.getProperty("file.separator");//"\\"; //set the actual location to the GTFS_Temp folder
} else if (rbFileFolder.isSelected()) { //else user selected a local file/folder
if (fileDirTextField.getText().toLowerCase().contains(".zip")) { //if a zip file was selected
- if (!UnzipGTFS(chooser.getSelectedFile(), null)) { //unzip it to a temporary folder
+ if (!UnzipGTFS(chooser.getSelectedFile(), null, "GTFS")) { //unzip it to a temporary folder
JOptionPane.showMessageDialog(this, "Unable to unzip from file. Please try again with another file.");
return;
}
- _fileDir = new File("GTFS_Temp").getAbsolutePath() + System.getProperty("file.separator");//"\\"; //set the actual location to the GTFS_Temp folder
+ _fileDir = new File("TempUnzip").getAbsolutePath() + System.getProperty("file.separator");//"\\"; //set the actual location to the GTFS_Temp folder
} else {
_fileDir = fileDirTextField.getText().replace("file://",""); //else use the folder selected with GTFS files in it
if (!(Files.isDirectory(new File(_fileDir).toPath())))
@@ -537,6 +761,23 @@ private void compareButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN
}
}
+ // unzip netex zip
+ if (!netexZipFile.getText().isEmpty()) {
+ if (netexZipFile.getText().toLowerCase().contains(".zip")) { //if a zip file was selected
+ if (!UnzipGTFS(new File(netexZipFile.getText()), null, "Netex")) { //unzip it to a temporary folder
+ JOptionPane.showMessageDialog(this, "Unable to unzip netex file. Please try again with another file.");
+ return;
+ }
+ _fileDir = new File("TempUnzip").getAbsolutePath() + System.getProperty("file.separator");//"\\"; //set the actual location to the GTFS_Temp folder
+ }
+ } else {
+ if (new File("TempUnzip").listFiles().length > 0) { //if the folder has old files in it
+ for (File f : new File("TempUnzip").listFiles()) {
+ f.delete(); //delete all the old files
+ }
+ }
+ }
+
//optional field
_operatorNtdId = operatorNTDIDField.getText();
if (gtfsIdDigitField.getText() != null && !gtfsIdDigitField.getText().equals("")) {
@@ -548,20 +789,69 @@ private void compareButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN
}
}
+ // Processing options
+ if (skipGtfsStationsCb.isSelected()) {
+ processingOptions.add(ProcessingOptions.SKIP_GTFS_STATIONS);
+ }
+ if (skipNodesWithRoleEmptyCb.isSelected()) {
+ processingOptions.add(ProcessingOptions.SKIP_NODES_HAVING_ROLE_EMPTY);
+ }
+ if (createAsPTv2Cb.isSelected()) {
+ processingOptions.add(ProcessingOptions.CREATE_ROUTE_AS_PTV2);
+ processingOptions.add(ProcessingOptions.SKIP_NODES_HAVING_ROLE_EMPTY);
+ }
+ if (removePlatformsNotInGtfsFromOSMRelationCb.isSelected()) {
+ processingOptions.add(ProcessingOptions.SKIP_NODES_HAVING_ROLE_PLATFORM_NOT_IN_GTFS_TRIP_FROM_OSM_RELATION);
+ }
+ if (dontReplaceExistingOSMRouteColorCb.isSelected()) {
+ processingOptions.add(ProcessingOptions.DONT_REPLACE_EXISING_OSM_ROUTE_COLOR);
+ }
+ if (skipNodesWithRoleStopCb.isSelected()) {
+ processingOptions.add(ProcessingOptions.SKIP_NODES_HAVING_ROLE_STOP_ALL);
+ }
+ if (skipNodesWithRoleStopWithoutMatchinPlatformCb.isSelected()) {
+ processingOptions.add(ProcessingOptions.SKIP_NODES_HAVING_ROLE_STOP_WITHOUT_MATCHING_PLATFORM);
+ }
+ if (dontAddGtfsRouteTextColorCb.isSelected()) {
+ processingOptions.add(ProcessingOptions.DONT_ADD_GTFS_ROUTE_TEXT_COLOR_TO_ROUTE);
+ }
+ if (dontAddGtfsAgencyIdCb.isSelected()) {
+ processingOptions.add(ProcessingOptions.DONT_ADD_GTFS_AGENCY_ID_TO_ROUTE);
+ }
+ if (!citiesWithoutTownPrefixField.getText().isEmpty()) {
+ String[] citiesArray = citiesWithoutTownPrefixField.getText().split(";");
+ ArrayList cities = new ArrayList<>(Arrays.asList(citiesArray));
+ cities.replaceAll(String::trim);
+ processingParams.setStopCities(cities);
+ }
+ if (!LatGTField.getText().isEmpty()) {
+ processingParams.setStopMinLat(LatGTField.getText());
+ }
+ if (!LatLTField.getText().isEmpty()) {
+ processingParams.setStopMaxLat(LatLTField.getText());
+ }
+ if (!LonGTField.getText().isEmpty()) {
+ processingParams.setStopMinLon(LonGTField.getText());
+ }
+ if (!LonLTField.getText().isEmpty()) {
+ processingParams.setStopMaxLon(LonLTField.getText());
+ }
+
//can't leave blank
try {
_operatorAlias = operatorAliasField.getText();
_operatorName = operatorNameField.getText();
_operatorNameAbbreviate = operatorNameAbbField.getText();
+ _operatorRegex = operatorRegexField.getText();
if (!_operatorName.isEmpty() && !_operatorNameAbbreviate.isEmpty() && !_fileDir.isEmpty()) {
- new OperatorInfo(_operatorName, _operatorNameAbbreviate, _operatorAlias, _operatorNtdId, _gtfsIdDigit, _fileDir);
+ new OperatorInfo(_operatorName, _operatorNameAbbreviate, _operatorAlias, _operatorRegex, _operatorNtdId, _gtfsIdDigit, _fileDir);
progressMonitor = new ProgressMonitor(MainForm.this, "Comparing GTFS and OSM data", "", 0, 100);
progressMonitor.setProgress(0);
compareButton.setEnabled(false);
- compareTask = new CompareData(progressMonitor, taskOutput);
+ compareTask = new CompareData(progressMonitor, taskOutput, netexStopFilename.getText());
compareTask.setRangeThreshold(Double.parseDouble(distanceThreshold.getValue().toString()));
task = compareTask;
task.addPropertyChangeListener(this);
@@ -616,13 +906,13 @@ private void browseButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-
* Pass either a file or URL and NULL for the other - do not send both
* Returns true if it successfully unzipped the file
*/
- private boolean UnzipGTFS(File zipFile, URL zipURL) {
+ private boolean UnzipGTFS(File zipFile, URL zipURL, String tempDirBasename) {
//TODO display a progress bar to user so they know a file is being unzipped
- File unzipFolder = new File("GTFS_Temp");
+ File unzipFolder = new File("TempUnzip" + File.separator + tempDirBasename);
String unzipLocation = unzipFolder.getAbsolutePath() + System.getProperty("file.separator"); //"\\"; //temporary folder to store unzipped files
try {
- unzipFolder.mkdir(); //create the directory if not already created
+ unzipFolder.mkdirs(); //create the directory if not already created
} catch (SecurityException ex) {
System.err.println("Unable to create temporary directory to unzip the GTFS data to. \n" + ex.getLocalizedMessage());
return false;
@@ -657,7 +947,8 @@ private boolean UnzipGTFS(File zipFile, URL zipURL) {
System.out.println(zipstr + " " );
zip = new ZipInputStream(new BufferedInputStream(zipstr));
} else {
- if (!(Files.probeContentType(zipFile.toPath())).equals("application/zip"))
+ String fileContentType = Files.probeContentType(zipFile.toPath());
+ if (!(fileContentType.equals("application/zip") || fileContentType.equals("application/x-zip-compressed")))
{System.out.println((Files.probeContentType(zipFile.toPath())));
return false;}
System.out.println("Unzipping " + zipFile.getAbsolutePath() + " to " + unzipLocation);
@@ -714,6 +1005,18 @@ private void rbURLItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:ev
}
}//GEN-LAST:event_rbURLItemStateChanged
+ private void netexBrowseButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_netexBrowseButtonActionPerformed
+ netexChooser = new JFileChooser();
+ netexChooser.setCurrentDirectory(new java.io.File("."));
+ netexChooser.setDialogTitle("Browse for Netex file...");
+ netexChooser.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES);
+ netexChooser.setMultiSelectionEnabled(true);
+ netexChooser.showOpenDialog(this);
+ if (netexChooser.getSelectedFile() != null) {
+ netexZipFile.setText(netexChooser.getSelectedFile().getAbsolutePath());
+ }
+ }//GEN-LAST:event_netexBrowseButtonActionPerformed
+
/**
* @param args the command line arguments
*/
@@ -761,36 +1064,77 @@ public void propertyChange(PropertyChangeEvent evt) {
}
taskOutput.setCaretPosition(taskOutput.getText().length());
}
- private edu.usf.cutr.go_sync.gui.object.AutoCompleteTextField operatorNameField;
private javax.swing.JFileChooser chooser;
+ private javax.swing.JFileChooser netexChooser;
// Variables declaration - do not modify//GEN-BEGIN:variables
+ private javax.swing.JTextField LatGTField;
+ private javax.swing.JLabel LatGTLabel;
+ private javax.swing.JTextField LatLTField;
+ private javax.swing.JLabel LatLTLabel;
+ private javax.swing.JTextField LonGTField;
+ private javax.swing.JLabel LonGTLabel;
+ private javax.swing.JTextField LonLTField;
+ private javax.swing.JLabel LonLTLabel;
private javax.swing.JLabel OperatorAbbLabel;
private javax.swing.JButton browseButton;
private javax.swing.ButtonGroup buttonGroup1;
private javax.swing.JLabel changesetLabel;
+ private javax.swing.JTextField citiesWithoutTownPrefixField;
+ private javax.swing.JLabel citiesWithoutTownPrefixLabel;
+ private javax.swing.JPanel citiesWithoutTownPrefixPanel;
private javax.swing.JButton compareButton;
+ private javax.swing.JPanel compareDataPanel;
+ private javax.swing.JCheckBox createAsPTv2Cb;
+ private javax.swing.JSpinner distanceThreshold;
+ private javax.swing.JPanel distanceThresholdPanel;
+ private javax.swing.JCheckBox dontAddGtfsAgencyIdCb;
+ private javax.swing.JCheckBox dontAddGtfsRouteTextColorCb;
+ private javax.swing.JCheckBox dontReplaceExistingOSMRouteColorCb;
private javax.swing.JButton exitButton;
private javax.swing.JTextField fileDirTextField;
private javax.swing.JLabel fileNameLabel;
- private javax.swing.JTextField gtfsIdDigitField;
- private javax.swing.JLabel jLabel1;
- private JSpinner distanceThreshold;
- private javax.swing.JPanel compareDataPanel;
- private javax.swing.JPanel revertChangesetPanel;
+ private javax.swing.JPanel geoZonePanel;
private javax.swing.JPanel gtfsDataPanel;
+ private javax.swing.JTextField gtfsIdDigitField;
+ private javax.swing.JLabel gtfsIdDigitLabel;
+ private javax.swing.JPanel gtfsStopIdLengthPanel;
+ private javax.swing.JLabel ignoreStopsHavintLatLonLabel;
private javax.swing.JScrollPane jScrollPane1;
private javax.swing.JTabbedPane jTabbedPane1;
+ private javax.swing.JPanel latPanel;
+ private javax.swing.JPanel lonPanel;
+ private javax.swing.JButton netexBrowseButton;
+ private javax.swing.JPanel netexPanel;
+ private javax.swing.JTextField netexStopFilename;
+ private javax.swing.JLabel netexStopFilenameLabel;
+ private javax.swing.JTextField netexZipFile;
+ private javax.swing.JLabel netexZipFileLabel;
private javax.swing.JTextField operatorAliasField;
+ private javax.swing.JLabel operatorAliasLabel;
private javax.swing.JTextField operatorNTDIDField;
+ private javax.swing.JLabel operatorNTDIDLabel;
private javax.swing.JTextField operatorNameAbbField;
+ private javax.swing.JTextField operatorNameField;
private javax.swing.JLabel operatorNameLabel;
- private javax.swing.JLabel operatorAliasLabel;
+ private javax.swing.JPanel operatorPanel;
+ private javax.swing.JTextField operatorRegexField;
+ private javax.swing.JLabel operatorRegexLabel;
+ private javax.swing.JPanel optionsPanel;
private javax.swing.JRadioButton rbFileFolder;
private javax.swing.JRadioButton rbURL;
+ private javax.swing.JCheckBox removePlatformsNotInGtfsFromOSMRelationCb;
+ private javax.swing.JLabel requiredFieldsLabel;
private javax.swing.JButton revertButton;
private javax.swing.JTextField revertChangesetField;
+ private javax.swing.JPanel revertChangesetPanel;
+ private javax.swing.JPanel routeMemberOptionPanel;
+ private javax.swing.JPanel routeOptionsPanel;
+ private javax.swing.JCheckBox skipGtfsStationsCb;
+ private javax.swing.JCheckBox skipNodesWithRoleEmptyCb;
+ private javax.swing.JCheckBox skipNodesWithRoleStopCb;
+ private javax.swing.JCheckBox skipNodesWithRoleStopWithoutMatchinPlatformCb;
+ private javax.swing.JPanel stopOptionsPanel;
private javax.swing.JTextArea taskOutput;
- private javax.swing.JLabel operatorNTDIDLabel;
- private javax.swing.JLabel gtfsIdDigitLabel;
+ private javax.swing.JLabel threshold_label;
// End of variables declaration//GEN-END:variables
}
diff --git a/GO_Sync/src/main/java/edu/usf/cutr/go_sync/gui/ReportViewer.form b/GO_Sync/src/main/java/edu/usf/cutr/go_sync/gui/ReportViewer.form
index 7e3bc37a..25e8328b 100644
--- a/GO_Sync/src/main/java/edu/usf/cutr/go_sync/gui/ReportViewer.form
+++ b/GO_Sync/src/main/java/edu/usf/cutr/go_sync/gui/ReportViewer.form
@@ -1,6 +1,6 @@
-
+
-
diff --git a/GO_Sync/src/main/java/edu/usf/cutr/go_sync/gui/ReportViewer.java b/GO_Sync/src/main/java/edu/usf/cutr/go_sync/gui/ReportViewer.java
index b3cfe351..54b6acc5 100644
--- a/GO_Sync/src/main/java/edu/usf/cutr/go_sync/gui/ReportViewer.java
+++ b/GO_Sync/src/main/java/edu/usf/cutr/go_sync/gui/ReportViewer.java
@@ -15,18 +15,24 @@
import edu.usf.cutr.go_sync.gui.object.RouteMemberTableModel;
import edu.usf.cutr.go_sync.gui.object.TagReportTableModel;
import edu.usf.cutr.go_sync.io.WriteFile;
+import edu.usf.cutr.go_sync.object.ProcessingOptions;
import edu.usf.cutr.go_sync.object.RelationMember;
import edu.usf.cutr.go_sync.object.Route;
import edu.usf.cutr.go_sync.object.Stop;
import edu.usf.cutr.go_sync.osm.HttpRequest;
+import edu.usf.cutr.go_sync.tag_defs;
+import edu.usf.cutr.go_sync.task.CompareData;
import edu.usf.cutr.go_sync.task.UploadData;
import edu.usf.cutr.go_sync.tools.OsmDistance;
import java.awt.Color;
import java.awt.Cursor;
import java.awt.Dimension;
+import java.awt.Event;
import java.awt.Graphics2D;
import java.awt.Point;
import java.awt.Rectangle;
+import java.awt.event.ActionEvent;
+import java.awt.event.KeyEvent;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.awt.geom.Point2D;
@@ -36,19 +42,28 @@
import java.io.File;
import java.util.ArrayList;
import java.util.Arrays;
+import java.util.EnumSet;
+import java.util.HashMap;
import java.util.HashSet;
import java.util.Hashtable;
import java.util.Iterator;
+import java.util.LinkedHashMap;
+import java.util.LinkedHashSet;
import java.util.LinkedList;
import java.util.List;
+import java.util.Map;
import java.util.Set;
+import java.util.TreeMap;
import java.util.TreeSet;
+import javax.swing.AbstractAction;
import javax.swing.DefaultComboBoxModel;
+import javax.swing.ImageIcon;
import javax.swing.JFrame;
import javax.swing.JOptionPane;
import javax.swing.JProgressBar;
import javax.swing.JTable;
import javax.swing.JTextArea;
+import javax.swing.KeyStroke;
import javax.swing.event.TableModelEvent;
import javax.swing.event.TableModelListener;
import javax.swing.table.JTableHeader;
@@ -56,39 +71,22 @@
import javax.swing.table.TableModel;
import org.jdesktop.swingx.JXMapViewer;
import org.jdesktop.swingx.mapviewer.DefaultTileFactory;
+import org.jdesktop.swingx.mapviewer.DefaultWaypoint;
import org.jdesktop.swingx.mapviewer.GeoPosition;
import org.jdesktop.swingx.mapviewer.TileFactory;
import org.jdesktop.swingx.mapviewer.TileFactoryInfo;
import org.jdesktop.swingx.mapviewer.Waypoint;
-import org.jdesktop.swingx.mapviewer.DefaultWaypoint;
import org.jdesktop.swingx.mapviewer.WaypointPainter;
import org.jdesktop.swingx.mapviewer.WaypointRenderer;
import org.jdesktop.swingx.painter.CompoundPainter;
import org.jdesktop.swingx.painter.Painter;
-import edu.usf.cutr.go_sync.tag_defs;
-import java.awt.GridBagLayout;
-import java.awt.GridBagConstraints;
-import java.awt.Insets;
-import java.awt.Event;
-import java.awt.event.ActionEvent;
-import java.awt.event.KeyEvent;
-import javax.swing.AbstractAction;
-import javax.swing.GroupLayout.Alignment;
-import javax.swing.ImageIcon;
-import javax.swing.KeyStroke;
-import javax.swing.LayoutStyle.ComponentPlacement;
-import javax.swing.GroupLayout;
-import javax.swing.JPanel;
-import javax.swing.BoxLayout;
-import javax.swing.JButton;
-import javax.swing.JCheckBox;
+
/**
*
* @author Khoa Tran
*/
public class ReportViewer extends javax.swing.JFrame implements TableModelListener, PropertyChangeListener {
-
protected static Color matchColor, selectedOSMColor, selectedGTFSColor;
protected String[] tagReportColumnHeaderToolTips = {
"Tag name",
@@ -97,7 +95,6 @@ public class ReportViewer extends javax.swing.JFrame implements TableModelListen
"Values to be added in OpenStreetMap"
};
protected ImageIcon busIcon;
- private JCheckBox routesCheckbox, stopsCheckbox, acceptedOnlyCheckbox;
// private Hashtable agencyTable;
private HttpRequest osmRequest;
@@ -118,6 +115,9 @@ public class ReportViewer extends javax.swing.JFrame implements TableModelListen
private Stop[] gtfsStops, gtfsAll, gtfsUploadConflict, gtfsUploadNoConflict, gtfsModify, gtfsNoUpload;
private Stop[] osmStops = new Stop[0];
private Route[] gtfsRoutes, gtfsRouteAll, gtfsRouteUploadNoConflict, gtfsRouteModify, gtfsRouteNoUpload;
+ private Route[] osmRoutes = new Route[0];
+ HashMap> reportRoutes = new HashMap<>();
+ HashMap> relMembersForGtfsOsmPair = new HashMap<>();
private JXMapViewer mainMap;
private Hashtable newStopsByGeoPos = new Hashtable(); // to interact with user on the map
private HashSet allStopsGeo;
@@ -142,12 +142,18 @@ public void run() {
}*/
// Variables declaration - do not modify//GEN-BEGIN:variables
+ private java.awt.Panel StopLabelPanel;
+ private javax.swing.JCheckBox acceptedOnlyCheckbox;
private javax.swing.JRadioButton allMembersRadioButton;
private javax.swing.JRadioButton allRoutesRadioButton;
private javax.swing.JRadioButton allStopsRadioButton;
private javax.swing.JRadioButton bothMembersRadioButton;
+ private javax.swing.JPanel busRoutePanel;
+ private javax.swing.JPanel busStopPanel;
private javax.swing.JTable dataTable;
private javax.swing.JButton donotUploadButton;
+ private javax.swing.JButton dontuploadAllBtn;
+ private javax.swing.JButton dontupremainButton;
private javax.swing.JButton dummyUploadButton;
private javax.swing.JRadioButton existingRoutesRadioButton;
private javax.swing.JRadioButton existingRoutesWithUpdatesRadioButton;
@@ -167,49 +173,52 @@ public void run() {
private javax.swing.JLabel jLabel10;
private javax.swing.JLabel jLabel11;
private javax.swing.JLabel jLabel12;
- private javax.swing.JLabel jLabel13;
- private javax.swing.JLabel jLabel14;
private javax.swing.JLabel jLabel15;
private javax.swing.JLabel jLabel16;
private javax.swing.JLabel jLabel17;
private javax.swing.JLabel jLabel18;
private javax.swing.JLabel jLabel19;
- private javax.swing.JLabel osmStopsComboBoxLabel;
+ private javax.swing.JLabel jLabel20;
private javax.swing.JLabel jLabel3;
private javax.swing.JLabel jLabel4;
private javax.swing.JLabel jLabel5;
- private javax.swing.JLabel jLabel6;
private javax.swing.JLabel jLabel7;
private javax.swing.JLabel jLabel8;
private javax.swing.JLabel jLabel9;
+ private javax.swing.JScrollPane jMemberScrollPane5;
private javax.swing.JMenu jMenu1;
private javax.swing.JMenu jMenu2;
private javax.swing.JMenu jMenu3;
private javax.swing.JMenu jMenu4;
private javax.swing.JMenuBar jMenuBar1;
- private javax.swing.JPanel busStopPanel;
- private javax.swing.JPanel busRoutePanel;
- private javax.swing.JScrollPane jStopsScrollPane1;
private javax.swing.JScrollPane jScrollPane2;
private javax.swing.JScrollPane jScrollPane3;
private javax.swing.JScrollPane jScrollPane4;
- private javax.swing.JScrollPane jMemberScrollPane5;
+ private javax.swing.JScrollPane jStopsScrollPane1;
private javax.swing.JTabbedPane jTabbedPane1;
private javax.swing.JLabel lastEditedLabel;
private org.jdesktop.swingx.JXMapKit mapJXMapKit;
private javax.swing.JTable memberTable;
private javax.swing.ButtonGroup membersButtonGroup;
+ private javax.swing.JLabel membersWarningLabel;
+ private javax.swing.JLabel newMemberListHasUpdatesLabel;
private javax.swing.JRadioButton newNoMatchStopsRadioButton;
private javax.swing.JRadioButton newRoutesRadioButton;
private javax.swing.JRadioButton newWithMatchStopsRadioButton;
+ private javax.swing.JButton nextButton;
private javax.swing.JRadioButton osmMembersRadioButton;
+ private javax.swing.JComboBox osmRoutesComboBox;
+ private javax.swing.JLabel osmRoutesLabel;
private javax.swing.JComboBox osmStopsComboBox;
+ private javax.swing.JLabel osmStopsComboBoxLabel;
private javax.swing.JTable routeTable;
private javax.swing.ButtonGroup routesButtonGroup;
+ private javax.swing.JCheckBox routesCheckbox;
private javax.swing.JButton saveChangeRouteButton;
private javax.swing.JButton searchButton;
private javax.swing.JTextField searchTextField;
private javax.swing.ButtonGroup stopsButtonGroup;
+ private javax.swing.JCheckBox stopsCheckbox;
private javax.swing.JButton tableStopButton;
private javax.swing.JLabel totalGtfsMembersLabel;
private javax.swing.JLabel totalGtfsRoutesLabel;
@@ -219,16 +228,9 @@ public void run() {
private javax.swing.JLabel totalOsmStopsLabel;
private javax.swing.JRadioButton updateStopsRadioButton;
private javax.swing.JButton uploadDataButton;
- private JPanel StopLabelPanel;
- private JButton dontuploadAllBtn;
- private JButton dontupremainButton;
- private JButton nextButton;
+ // End of variables declaration//GEN-END:variables
/** Creates new form ReportViewer */
-
-
-
-
/**
* @param aData GTFSstops
* @param r report
@@ -240,7 +242,7 @@ public void run() {
* @param eRoutes existingRoutes
* @param to taskOutput
*/
- public ReportViewer(List aData, Hashtable> r, HashSetu, HashSetm, HashSetd, Hashtable routes, Hashtable nRoutes, Hashtable eRoutes, JTextArea to) {
+ public ReportViewer(List aData, Hashtable> r, HashSet u, HashSet m, HashSet d, HashMap> reportRoute, Hashtable routes, Hashtable nRoutes, Hashtable eRoutes, JTextArea to) {
// public ReportViewer(List aData, Hashtable> r, HashSetu, HashSetm, HashSetd, Hashtable routes, Hashtable nRoutes, Hashtable eRoutes, JTextArea to) {
super("GO-Sync: Report");
@@ -284,6 +286,7 @@ public ReportViewer(List aData, Hashtable> r, HashSe
delete = new HashSet();
delete.addAll(d);
+ this.reportRoutes.putAll(reportRoute);
finalCheckboxes = new Hashtable>();
finalRouteCheckboxes = new Hashtable>();
@@ -412,13 +415,14 @@ public ReportViewer(List aData, Hashtable> r, HashSe
unci++;*/
if ((category.equals("MODIFY") || category.equals("NOTHING_NEW")) && numEquiv==1) {
//String stopID, String operatorName, String stopName, String lat, String lon
- Stop stopWithSelectedTags = new Stop(newStop.getStopID(), newStop.getOperatorName(), osmStop.getStopName(), osmStop.getLat(), osmStop.getLon());
+ List osmStopAltNamesList = Stop.stopAltNamesToList((String) osmStop.getStopAltName());
+ Stop stopWithSelectedTags = new Stop(osmStop.getPrimitiveType(), newStop.getStopID(), newStop.getOperatorName(), osmStop.getStopName(), osmStop.getLat(), osmStop.getLon(), null);
Stop agencyStop = agencyStops.get(newStop.getStopID());
Hashtable agencyTags = agencyStop.getTags();
Hashtable osmTags = osmStop.getTags();
ArrayList osmTagKeys = new ArrayList();
osmTagKeys.addAll(osmStop.keySet());
- osmTagKeys.remove(tag_defs.GTFS_OPERATOR_KEY);
+ osmTagKeys.remove(tag_defs.OSM_NETWORK_KEY);
// osmTagKeys.remove("highway");
osmTagKeys.remove("source");
boolean isDiff = false;
@@ -570,7 +574,9 @@ private void updateStopTable(Stop selectedNewStop, Stop selectedOsmStop){
tagKeys.addAll(aTags.keySet());
}
}
- if(selectedOsmStop!=null) tagKeys.addAll(selectedOsmStop.keySet());
+ if (selectedOsmStop != null && !selectedOsmStop.getStopID().equals("New")) {
+ tagKeys.addAll(selectedOsmStop.keySet());
+ }
// set new size to the table
stopTableModel = new TagReportTableModel(tagKeys.size()+2);
@@ -585,13 +591,21 @@ private void updateStopTable(Stop selectedNewStop, Stop selectedOsmStop){
Stop finalSt = finalStops.get(selectedNewStop.getStopID());
ArrayList finalCB = finalCheckboxes.get(selectedNewStop.getStopID());
- if(selectedOsmStop!=null) {
+ if (selectedOsmStop != null && !selectedOsmStop.getStopID().equals("New")) {
+ if (selectedOsmStop.getPrimitiveType().equals("way")) {
+ stopTableModel.setRowValueAt(new Object[] {"lat", agencyStop.getLat(), finalCB.get(0), "Item part of 'way'. Node of it has: " + selectedOsmStop.getLat(), finalCB.get(1), "Item part of 'way'. Value will not be set."}, 0);
+ stopTableModel.setRowValueAt(new Object[] {"lon", agencyStop.getLon(), finalCB.get(2), "Item part of 'way'. Node of it has: " + selectedOsmStop.getLon(), finalCB.get(3), "Item part of 'way'. Value will not be set."}, 1);
+ } else {
stopTableModel.setRowValueAt(new Object[] {"lat", agencyStop.getLat(), finalCB.get(0), selectedOsmStop.getLat(), finalCB.get(1), finalSt.getLat()}, 0);
stopTableModel.setRowValueAt(new Object[] {"lon", agencyStop.getLon(), finalCB.get(2), selectedOsmStop.getLon(), finalCB.get(3), finalSt.getLon()}, 1);
+ }
} else {
stopTableModel.setRowValueAt(new Object[] {"lat", agencyStop.getLat(), finalCB.get(0), "",finalCB.get(1), finalSt.getLat()}, 0);
stopTableModel.setRowValueAt(new Object[] {"lon", agencyStop.getLon(), finalCB.get(2), "", finalCB.get(3), finalSt.getLon()}, 1);
}
+
+ //tableIndex in index+2 because of lat and lon
+ int tableIndex = 2;
for(int i=0; i>>>>>> 1a58b026a52d1271696dac9c53450d65f773cf06
} else {
- stopTableModel.setRowValueAt(new Object[]{k, gtfsValue, gtfsCB, osmValue, osmCB, newValue}, i + 2);
+ stopTableModel.setRowValueAt(new Object[]{k, gtfsValue, gtfsCB, osmValue, osmCB, newValue}, tableIndex);
}
/*
if(selectedNewStop.getReportCategory().equals("UPLOAD_CONFLICT")) {
- stopTableModel.setRowValueAt(new Object[] {k, gtfsValue, true, osmValue, false, newValue}, i+2);
+ stopTableModel.setRowValueAt(new Object[] {k, gtfsValue, true, osmValue, false, newValue}, tableIndex);
} else {
- stopTableModel.setRowValueAt(new Object[] {k, gtfsValue, finalCB.get((i+2)*2), osmValue, finalCB.get((i+2)*2+1), finalSt.getTag(k)}, i+2);
+ stopTableModel.setRowValueAt(new Object[] {k, gtfsValue, finalCB.get((tableIndex)*2), osmValue, finalCB.get((tableIndex)*2+1), finalSt.getTag(k)}, tableIndex);
}*/
+ tableIndex++;
}
//set the column width with checkbox to minimum size
@@ -673,10 +691,10 @@ private void updateStopTable(Stop selectedNewStop, Stop selectedOsmStop){
dataTable.getModel().addTableModelListener(this);
if(selectedNewStop.getReportCategory().equals("UPLOAD_NO_CONFLICT") && !finalStopsAccepted.containsKey(selectedNewStop.getStopID()))
- updateButtonTableStop("Accept", true, "Add", true);
+ updateButtonTableStop("Accept", true, "Add", true);
else
updateButtonTableStop("Accept", true, "Save Change", false);
- if (selectedOsmStop!= null && usedOSMstops.containsKey(selectedOsmStop.getOsmId() )
+ if (selectedOsmStop != null && !selectedOsmStop.getStopID().equals("New") && usedOSMstops.containsKey(selectedOsmStop.getOsmId())
&& !usedOSMstops.get(selectedOsmStop.getOsmId()).getStopID().equals(agencyStop))
// && !finalStopsAccepted.get(selectedNewStop.getStopID()).getOsmId().equals(selectedOsmStop.getOsmId())) // TODO allow changing osm matches
updateButtonTableStop("Already Matched", false, "Already Matched", false);
@@ -685,7 +703,7 @@ private void updateStopTable(Stop selectedNewStop, Stop selectedOsmStop){
// set last edited information
String lastEditedUser = "N/A";
String lastEditedDate = "N/A";
- if(selectedOsmStop!=null) {
+ if (selectedOsmStop != null && !selectedOsmStop.getStopID().equals("New")) {
if(selectedOsmStop.getLastEditedOsmUser()!=null && !selectedOsmStop.getLastEditedOsmUser().equals(""))
lastEditedUser = selectedOsmStop.getLastEditedOsmUser();
if(selectedOsmStop.getLastEditedOsmDate()!=null && !selectedOsmStop.getLastEditedOsmDate().equals(""))
@@ -733,7 +751,13 @@ private void updateBusStop(Stop st){
tableStopButton.setVisible(true);
}
*/
- osmStops = new Stop[osmEquiv.size()];
+ if (st.getReportCategory().equals("UPLOAD_CONFLICT")) {
+ // Add an entry that can be selected to create a new stop instead of using an existing OSM stop
+ osmStops = new Stop[osmEquiv.size() + 1];
+ } else {
+ osmStops = new Stop[osmEquiv.size()];
+ }
+
for(int i=0; i() {
public void paint(Graphics2D g, JXMapViewer map, int w, int h) {
g = (Graphics2D) g.create();
@@ -949,7 +992,7 @@ public void paint(Graphics2D g, JXMapViewer map, int w, int h) {
selectedGtfsOverlayPainter = null;
}*/
- if(osmStop!=null){
+ if (osmStop != null && !osmStop.getStopID().equals("New")) {
final Stop tempStop = new Stop(osmStop);
selectedOsmOverlayPainter = new Painter() {
public void paint(Graphics2D g, JXMapViewer map, int w, int h) {
@@ -1007,25 +1050,32 @@ private void clearRouteTable(){
memberTable.setModel(memberTableModel);
}
- private void updateRouteTable(Route selectedNewRoute){
+ private void updateRouteTable(Route selectedNewRoute, Route selectedOsmRoute) {
// get all the possible tag names from gtfs data and osm data
Set tagKeys = new TreeSet();
Hashtable aTags = new Hashtable();
Hashtable eTags= new Hashtable();
Route aRoute = null, eRoute=null;
+ String finalRouteCheckboxesId;
if(selectedNewRoute!=null) {
tagKeys.addAll(selectedNewRoute.keySet());
aRoute = agencyRoutes.get(selectedNewRoute.getRouteId());
- eRoute = existingRoutes.get(selectedNewRoute.getRouteId());
-
- if(aRoute!=null) aTags.putAll(aRoute.getTags());
- if(eRoute!=null) eTags.putAll(eRoute.getTags());
+ finalRouteCheckboxesId = selectedNewRoute.getRouteId();
+ } else
+ return;
- tagKeys.addAll(aTags.keySet());
- tagKeys.addAll(eTags.keySet());
+ if (selectedOsmRoute != null) {
+ eRoute = selectedOsmRoute;
+ finalRouteCheckboxesId = finalRouteCheckboxesId + ";" + selectedOsmRoute.getOsmId();
+ } else {
+ eRoute = existingRoutes.get(selectedNewRoute.getRouteId());
}
- else return;
+
+ if(aRoute!=null) aTags.putAll(aRoute.getTags());
+ if(eRoute!=null) eTags.putAll(eRoute.getTags());
+ tagKeys.addAll(aTags.keySet());
+ tagKeys.addAll(eTags.keySet());
// set new size to the table
routeTableModel = new TagReportTableModel(tagKeys.size());
@@ -1038,8 +1088,15 @@ private void updateRouteTable(Route selectedNewRoute){
// add data to table
// first, add lat and lon
Route finalRt = finalRoutes.get(selectedNewRoute.getRouteId());
- ArrayList finalCB = finalRouteCheckboxes.get(selectedNewRoute.getRouteId());
- for(int i=0; i finalCB = finalRouteCheckboxes.get(finalRouteCheckboxesId);
+ boolean isFinalRouteAccepted;
+ if (selectedOsmRoute != null) {
+ isFinalRouteAccepted = finalRoutesAccepted.containsKey(selectedNewRoute.getRouteId())
+ && finalRoutesAccepted.get(selectedNewRoute.getRouteId()).getOsmId().equals(selectedOsmRoute.getOsmId());
+ } else {
+ isFinalRouteAccepted = finalRoutesAccepted.containsKey(selectedNewRoute.getRouteId());
+ }
+ for (int i = 0; i < tkeys.size(); i++) {
String k = tkeys.get(i);
boolean osmCB = false, gtfsCB = false;
//make sure there's null pointer
@@ -1051,7 +1108,7 @@ private void updateRouteTable(Route selectedNewRoute){
}
//add tag to table TODO finish
- if (finalRoutesAccepted.containsKey(selectedNewRoute.getRouteId())) {
+ if (isFinalRouteAccepted) {
routeTableModel.setRowValueAt(new Object[]{k, gtfsValue, finalCB.get(i * 2), osmValue, finalCB.get(i * 2 + 1), finalRt.getTag(k)}, i);
// stopTableModel.setRowValueAt(new Object[]{k, gtfsValue, finalCB.get((i + 2) * 2), osmValue, finalCB.get((i + 2) * 2 + 1), finalSt.getTag(k)}, i + 2);
@@ -1061,6 +1118,17 @@ private void updateRouteTable(Route selectedNewRoute){
}
}
+ if (finalRoutesAccepted.containsKey(selectedNewRoute.getRouteId())) {
+ if (selectedOsmRoute != null
+ && finalRoutesAccepted.get(selectedNewRoute.getRouteId()).getOsmId().equals(selectedOsmRoute.getOsmId())) {
+ saveChangeRouteButton.setEnabled(false);
+ } else {
+ saveChangeRouteButton.setEnabled(true);
+ }
+ } else {
+ saveChangeRouteButton.setEnabled(true);
+ }
+
//set the column width with checkbox to minimum size
routeTable.setAutoResizeMode(JTable.AUTO_RESIZE_NEXT_COLUMN);
TableColumn col = routeTable.getColumnModel().getColumn(2);
@@ -1082,27 +1150,208 @@ private void updateRouteTable(Route selectedNewRoute){
routeTable.getModel().addTableModelListener(this);
allMembersRadioButton.setSelected(true);
- updateMemberList(selectedNewRoute, "all");
+ updateMemberList(selectedNewRoute, selectedOsmRoute, "all");
}
- private void updateMemberList(Route selectedNewRoute, String criteria){
+ private void updateMemberList(Route selectedNewRoute, Route selectedOsmRoute, String criteria) {
Route aRoute = null, eRoute=null;
if(selectedNewRoute!=null) {
aRoute = agencyRoutes.get(selectedNewRoute.getRouteId());
- eRoute = existingRoutes.get(selectedNewRoute.getRouteId());
}
else return;
- // Member Table
- ArrayList newMembers = new ArrayList();
- newMembers.addAll(selectedNewRoute.getOsmMembers());
+ if (selectedOsmRoute != null) {
+ eRoute = selectedOsmRoute;
+ } else {
+ eRoute = existingRoutes.get(selectedNewRoute.getRouteId());
+ }
+
+ // Get PT version
+ String PTversion = "";
+ for (int i = 0; i < routeTableModel.getRowCount(); i++) {
+ String tagName = (String)routeTableModel.getValueAt(i, 0);
+ if (tagName.equals("public_transport:version")) {
+ PTversion = (String)routeTableModel.getValueAt(i, 5);
+ }
+ }
- ArrayList gtfsMembers = new ArrayList();
+ // Member Table
+ LinkedHashSet gtfsMembers = new LinkedHashSet();
if(aRoute!=null) gtfsMembers.addAll(aRoute.getOsmMembers());
- ArrayList osmMembers = new ArrayList();
+ LinkedHashSet osmMembers = new LinkedHashSet();
if(eRoute!=null) osmMembers.addAll(eRoute.getOsmMembers());
+ LinkedHashSet newMembers = new LinkedHashSet();
+ LinkedHashSet newMembersNodesOnly = new LinkedHashSet();
+ LinkedHashSet newMembersWaysOnly = new LinkedHashSet();
+ LinkedHashSet tempem = new LinkedHashSet();
+ ArrayList skippedMembersIndex = new ArrayList<>();
+
+ int indexInNewMember = 0;
+ newMembers.addAll(aRoute.getOsmMembers());
+
+ tempem.addAll(osmMembers);
+
+ for (RelationMember m : tempem) {
+ RelationMember matchMember = aRoute.getOsmMember(m.getRef());
+ if (matchMember != null) {
+ matchMember.setStatus("both GTFS dataset and OSM server");
+ } else {
+ if (PTversion != null && PTversion.equals("2")) {
+ // Rearrange nodes & ways so that nodes (platforms, stops...) come before ways (ways with empty role)
+ if (m.getType().equals("node")) {
+ newMembersNodesOnly.add(m);
+ }
+ if (m.getType().equals("way")) {
+ // Ways can also be set as platforms. Support this case too. They should be at the top with the other platforms/stops.
+ if (m.getRoleForFinalOutput().equals("platform") || m.getRoleForFinalOutput().equals("platform_exit_only") || m.getRoleForFinalOutput().equals("platform_entry_only")) {
+ newMembersNodesOnly.add(m);
+ } else {
+ newMembersWaysOnly.add(m);
+ }
+ }
+ } else {
+ newMembers.add(m);
+ }
+ }
+ }
+
+ if (PTversion != null && PTversion.equals("2")) {
+ // For PTv2 group platform/stops together
+ int index = 0;
+ LinkedHashSet platforms = new LinkedHashSet();
+ platforms.addAll(newMembers);
+ LinkedHashSet stops = new LinkedHashSet();
+ for (RelationMember m : newMembersNodesOnly) {
+
+ // Fix member role in case it doesn't match the real public_transport value of the member (eg. member having role stop, while it actually is a platform).
+ String roleSuffix = "";
+ if (m.getRole().endsWith("_exit_only")) {
+ roleSuffix = "_exit_only";
+ } else if (m.getRole().endsWith("_entry_only")) {
+ roleSuffix = "_entry_only";
+ }
+ switch (m.getRefOsmPublicTransportType()) {
+ case "stop_position":
+ if (!m.getRole().startsWith("stop")) {
+ m.setRole("stop" + roleSuffix);
+ }
+ break;
+ case "platform":
+ if (!m.getRole().startsWith("platform")) {
+ m.setRole("platform" + roleSuffix);
+ }
+ break;
+ default:
+ break;
+ }
+
+ if (m.getRoleForFinalOutput().equals("platform") || m.getRoleForFinalOutput().equals("platform_exit_only") || m.getRoleForFinalOutput().equals("platform_entry_only")) {
+ platforms.add(m);
+ }
+ if (m.getRoleForFinalOutput().equals("stop") || m.getRoleForFinalOutput().equals("stop_exit_only") || m.getRoleForFinalOutput().equals("stop_entry_only")) {
+ stops.add(m);
+ }
+ index++;
+ }
+
+ LinkedHashSet newMembersNodesOnlyGrouped = new LinkedHashSet();
+ LinkedHashSet addedStops = new LinkedHashSet();
+ for (RelationMember p : platforms) {
+ newMembersNodesOnlyGrouped.add(p);
+ if (shouldSkipMember(PTversion, p, null, aRoute.getOsmMembers())) {
+ // if p will be skipped (eg. if it is platform not in gtfs) don't proceed with trying to add the nearby stop.
+ // Otherwise if the stop matches a platform that is not part of the gtfs trip but currently present in the OSM relation,
+ // it will be kept, even if the platform is not in the final relation for upload (which is not wanted).
+ continue;
+ }
+ for (RelationMember s : stops) {
+ double dist = OsmDistance.distVincenty(p.getLat(), p.getLon(), s.getLat(), s.getLon());
+ if (dist < CompareData.MAX_PLATFORM_STOP_DISTANCE) {
+ newMembersNodesOnlyGrouped.add(s);
+ switch (p.getRole()) {
+ case "platform":
+ s.setRole("stop");
+ break;
+ case "platform_exit_only":
+ s.setRole("stop_exit_only");
+ break;
+ case "platform_entry_only":
+ s.setRole("stop_entry_only");
+ break;
+ default:
+ break;
+ }
+ addedStops.add(s);
+ }
+ }
+ }
+
+ LinkedHashSet remainingStops = new LinkedHashSet();
+ remainingStops.addAll(stops);
+ remainingStops.removeAll(addedStops);
+
+ // For PTv2: we must have first the nodes, then the ways.
+ newMembers.clear();
+ newMembers.addAll(newMembersNodesOnlyGrouped);
+ newMembers.addAll(remainingStops);
+ newMembers.addAll(newMembersWaysOnly);
+
+ // Mark members to be removed & apply other modifications as asked in processingOptions.
+ for (RelationMember m : newMembers) {
+ if (m.getType().equals("way") && (m.getRole().equals("backward") || m.getRole().equals("forward") || m.getRole().equals("reverse"))) {
+ // roles "backward", "forward" & "reverse" should not be used anymore on public transport PTv2 routes
+ // https://wiki.openstreetmap.org/wiki/Relation:route
+ m.setRole("");
+ }
+ if (shouldSkipMember(PTversion, m, remainingStops, aRoute.getOsmMembers())) {
+ skippedMembersIndex.add(indexInNewMember);
+ }
+ indexInNewMember++;
+ }
+ }
+
+ // Skip members the OSM id of which is negative
+ indexInNewMember = 0;
+ for (RelationMember m : newMembers) {
+ if (m.getRef().startsWith("-")) {
+ skippedMembersIndex.add(indexInNewMember);
+ }
+ indexInNewMember++;
+ }
+
+ indexInNewMember = newMembers.size();
+ if (!newMembers.containsAll(osmMembers)) {
+ //System.out.println("Adding osm members not yet in new Members.");
+ for (RelationMember m : osmMembers) {
+ boolean addToSkippedMembersIndex = shouldSkipMember(PTversion, m, null, aRoute.getOsmMembers());
+ if (newMembers.add(m)) {
+ if (addToSkippedMembersIndex) {
+ skippedMembersIndex.add(indexInNewMember);
+ }
+ indexInNewMember++;
+ }
+ }
+ }
+
+ String id;
+ if (selectedOsmRoute != null) {
+ id = aRoute.getRouteId() + ";" + eRoute.getOsmId();
+ } else {
+ id = aRoute.getRouteId();
+ }
+ relMembersForGtfsOsmPair.remove(id);
+ LinkedHashSet newMembersForSave = new LinkedHashSet();
+ int count = 0;
+ for (RelationMember mb : newMembers) {
+ if (!skippedMembersIndex.contains(count)) {
+ newMembersForSave.add(mb);
+ }
+ count++;
+ }
+ relMembersForGtfsOsmPair.put(id, newMembersForSave);
+
// set new size to the table
memberTableModel = new RouteMemberTableModel(newMembers.size());
memberTable.setModel(memberTableModel);
@@ -1110,47 +1359,111 @@ private void updateMemberList(Route selectedNewRoute, String criteria){
// create map
// hashGtfs stores all the relation members with the key of the gtfs id.
// if any relation member does not have gtfs id, the type would be taken as the key
- Hashtable hashGtfs = new Hashtable();
- for(int i=0; i hashGtfs = new LinkedHashMap();
+ for (RelationMember t : gtfsMembers) {
String v = t.getGtfsId();
- if (v!=null && !v.equals("none") && !v.equals("")) hashGtfs.put(t, v);
-// else hashGtfs.put(t, t.getType() + " (" + t.getRef()+")");
+ String suffix = " (" + t.getType() + "/" + t.getRole() + "/" + t.getRef() + ")";
+ if (v != null && !v.equals("none") && !v.equals("")) {
+ hashGtfs.put(t, v + suffix);
+ } else {
+ hashGtfs.put(t, suffix.trim());
+ }
}
- Hashtable hashOsm = new Hashtable();
- for(int i=0; i hashOsm = new LinkedHashMap();
+ for (RelationMember t : osmMembers) {
String v = t.getGtfsId();
- if (v!=null && !v.equals("none") && !v.equals("")) hashOsm.put(t, v);
-// else hashOsm.put(t, t.getType() + " (" + t.getRef()+")");
+ String suffix = " (" + t.getType() + "/" + t.getRole() + "/" + t.getRef() + ")";
+ if (v != null && !v.equals("none") && !v.equals("")) {
+ hashOsm.put(t, v + suffix);
+ } else {
+ hashOsm.put(t, suffix.trim());
+ }
}
int memberNewIndex = 0;
int memberGtfsIndex = 0, memberOsmIndex = 0;
- for(int i=0; i remainingStops, LinkedHashSet agencyMembers) {
+ if (!PTversion.equals("2")) {
+ return false;
+ }
+
+ if (remainingStops != null && remainingStops.contains(m)) {
+ if (MainForm.processingOptions.contains(ProcessingOptions.SKIP_NODES_HAVING_ROLE_STOP_WITHOUT_MATCHING_PLATFORM)) {
+ return true;
+ }
+ }
+ if (m.getType().equals("node")) {
+ if (MainForm.processingOptions.contains(ProcessingOptions.SKIP_NODES_HAVING_ROLE_EMPTY)) {
+ if (m.getRole().isEmpty()) {
+ return true;
+ }
+ }
+ if (MainForm.processingOptions.contains(ProcessingOptions.SKIP_NODES_HAVING_ROLE_STOP_ALL)) {
+ if (m.getRoleForFinalOutput().equals("stop") || m.getRoleForFinalOutput().equals("stop_exit_only") || m.getRoleForFinalOutput().equals("stop_entry_only")) {
+ return true;
+ }
+ }
+ if (MainForm.processingOptions.contains(ProcessingOptions.SKIP_NODES_HAVING_ROLE_PLATFORM_NOT_IN_GTFS_TRIP_FROM_OSM_RELATION)) {
+ if (!agencyMembers.contains(m)
+ && (m.getRoleForFinalOutput().equals("platform") || m.getRoleForFinalOutput().equals("platform_exit_only") || m.getRoleForFinalOutput().equals("platform_entry_only"))) {
+ return true;
+ }
+ }
+ }
+ if (m.getType().equals("way")) {
+ if (m.getRoleForFinalOutput().equals("platform") || m.getRoleForFinalOutput().equals("platform_exit_only") || m.getRoleForFinalOutput().equals("platform_entry_only")) {
+ if (MainForm.processingOptions.contains(ProcessingOptions.SKIP_NODES_HAVING_ROLE_PLATFORM_NOT_IN_GTFS_TRIP_FROM_OSM_RELATION)) {
+ if (!agencyMembers.contains(m)
+ && (m.getRoleForFinalOutput().equals("platform") || m.getRoleForFinalOutput().equals("platform_exit_only") || m.getRoleForFinalOutput().equals("platform_entry_only"))) {
+ return true;
+ }
+ }
+ }
+ }
+ return false;
}
private void updateRouteCategory(Route[] selectedCategory){
gtfsRoutes = selectedCategory;
+ Arrays.sort(gtfsRoutes);
gtfsRoutesComboBox.setModel(new DefaultComboBoxModel(gtfsRoutes));
totalGtfsRoutesLabel.setText(Integer.toString(gtfsRoutes.length));
if(gtfsRoutes.length!=0) updateBusRoute(gtfsRoutes[0]);
@@ -1159,11 +1472,37 @@ private void updateRouteCategory(Route[] selectedCategory){
// When user click on gtfs combobox
private void updateBusRoute(Route rt) {
- if (rt!=null) {
- updateRouteTable(rt);
+ osmRoutes = new Route[0];
+ if (rt != null) {
+ TreeMap scoreRoute = reportRoutes.get(rt);
+
+ if (scoreRoute != null) {
+ osmRoutes = new Route[scoreRoute.size()];
+
+ int i = 0;
+ for (Map.Entry route : scoreRoute.entrySet()) {
+ osmRoutes[i] = route.getValue();
+ i++;
+ }
+ }
+
+ if (osmRoutes.length == 0) {
+ updateRouteTable(rt, null);
+ } else {
+ updateRouteTable(rt, osmRoutes[0]);
+ }
} else {
clearRouteTable();
}
+
+ Route selectedGtfsRoute = (Route) gtfsRoutesComboBox.getSelectedItem();
+ if (selectedGtfsRoute != null && finalRoutesAccepted.containsKey(selectedGtfsRoute.getRouteId())) {
+ saveChangeRouteButton.setText("Accept & Save Change");
+ } else {
+ saveChangeRouteButton.setText("Accept");
+ }
+
+ osmRoutesComboBox.setModel(new DefaultComboBoxModel(osmRoutes));
}
/*
@@ -1190,7 +1529,7 @@ private void updateButtonTableStop(String uploadConflictCategoryText, boolean up
}
}
-
+ @Override
public void tableChanged(TableModelEvent e){
TableModel model = (TableModel)e.getSource();
int row = e.getFirstRow();
@@ -1203,8 +1542,7 @@ public void tableChanged(TableModelEvent e){
}
}
if (model.equals(routeTableModel) && (data instanceof Boolean)) {
- if (!tableStopButton.isEnabled() || tableStopButton.getText().equals("Accept")) {
-// Stop selectedGtfsStop = (Stop)gtfsStopsComboBox.getSelectedItem();
+ if (!saveChangeRouteButton.isEnabled() || saveChangeRouteButton.getText().equals("Accept")) {
saveChangeRouteButton.setEnabled(true);
saveChangeRouteButton.setText("Accept & Save Change");
}
@@ -1271,12 +1609,13 @@ private void generateStopsToUpload(Hashtable stops){
for(int i=0; i//GEN-BEGIN:initComponents
private void initComponents() {
+ java.awt.GridBagConstraints gridBagConstraints;
-
- setResizable(true); //false);
stopsButtonGroup = new javax.swing.ButtonGroup();
routesButtonGroup = new javax.swing.ButtonGroup();
membersButtonGroup = new javax.swing.ButtonGroup();
jTabbedPane1 = new javax.swing.JTabbedPane();
busStopPanel = new javax.swing.JPanel();
- final int osmMaxZoom = 19;
-
+ donotUploadButton = new javax.swing.JButton();
+ jStopsScrollPane1 = new javax.swing.JScrollPane();
+ dataTable = new JTable(){
+ public String getToolTipText(MouseEvent e){
+ String tip = null;
+ java.awt.Point p = e.getPoint();
+ int rowIndex = rowAtPoint(p);
+ int colIndex = columnAtPoint(p);
+ int realColumnIndex = convertColumnIndexToModel(colIndex);
+ int realRowIndex = convertRowIndexToModel(rowIndex);
+
+ TableModel model = this.getModel();
+ if((model instanceof TagReportTableModel) && (realRowIndex>=0) && (realColumnIndex>=0)){
+ Object o = model.getValueAt(realRowIndex, realColumnIndex);
+ if(o instanceof String) tip = (String)o;
+ }
+ return tip;//"This is the first line
This is the second line";
+ }
- TileFactoryInfo osmInfo = new TileFactoryInfo(1,osmMaxZoom-2,osmMaxZoom,
+ protected JTableHeader createDefaultTableHeader() {
+ return new JTableHeader(columnModel) {
+ public String getToolTipText(MouseEvent e) {
+ String tip = null;
+ java.awt.Point p = e.getPoint();
+ int index = columnModel.getColumnIndexAtX(p.x);
+ int realIndex =
+ columnModel.getColumn(index).getModelIndex();
+ return tagReportColumnHeaderToolTips[realIndex];
+ }
+ };
+ }
+ };
+ dataTable.setDefaultRenderer(Object.class, new edu.usf.cutr.go_sync.gui.object.TagReportTableCellRenderer());
+ dataTable.addMouseListener(new BooleanMouseListener(dataTable));
+ gtfsStopsComboBoxLabel = new javax.swing.JLabel();
+ osmStopsComboBoxLabel = new javax.swing.JLabel();
+ gtfsStopsComboBox = new javax.swing.JComboBox(gtfsStops);
+ osmStopsComboBox = new javax.swing.JComboBox(osmStops);
+ mapJXMapKit = new org.jdesktop.swingx.JXMapKit();
+ final int osmMaxZoom = 19;
+ TileFactoryInfo osmInfo = new TileFactoryInfo(1,osmMaxZoom-2,osmMaxZoom,
256, true, true, // tile size is 256 and x/y orientation is normal
"http://tile.openstreetmap.org",//5/15/10.png",
"x","y","z") {
@@ -1372,9 +1747,104 @@ public String getTileUrl(int x, int y, int zoom) {
}
};
osmTf = new DefaultTileFactory(osmInfo);
+ mapJXMapKit.setTileFactory(osmTf);
+ jLabel3 = new javax.swing.JLabel();
+ jLabel7 = new javax.swing.JLabel();
+ totalGtfsStopsLabel = new javax.swing.JLabel();
+ totalOsmStopsLabel = new javax.swing.JLabel();
+ jLabel4 = new javax.swing.JLabel();
+ jLabel5 = new javax.swing.JLabel();
+ jScrollPane2 = new javax.swing.JScrollPane();
+ generalInformationStopTextArea = new javax.swing.JTextArea();
+ generalInformationStopTextArea.setLineWrap(true);
+ generalInformationStopTextArea.setWrapStyleWord(true);
+ tableStopButton = new javax.swing.JButton();
+ StopLabelPanel = new java.awt.Panel();
+ newWithMatchStopsRadioButton = new javax.swing.JRadioButton();
+ newNoMatchStopsRadioButton = new javax.swing.JRadioButton();
+ updateStopsRadioButton = new javax.swing.JRadioButton();
+ existingStopRadioButton = new javax.swing.JRadioButton();
+ allStopsRadioButton = new javax.swing.JRadioButton();
+ jLabel15 = new javax.swing.JLabel();
+ jLabel16 = new javax.swing.JLabel();
+ jLabel17 = new javax.swing.JLabel();
+ jLabel18 = new javax.swing.JLabel();
+ searchButton = new javax.swing.JButton();
+ searchTextField = new javax.swing.JTextField();
+ finishProgressBar = new javax.swing.JProgressBar();
+ jLabel19 = new javax.swing.JLabel();
+ lastEditedLabel = new javax.swing.JLabel();
+ dontupremainButton = new javax.swing.JButton();
+ dontuploadAllBtn = new javax.swing.JButton();
+ nextButton = new javax.swing.JButton();
busRoutePanel = new javax.swing.JPanel();
+ osmRoutesLabel = new javax.swing.JLabel();
+ gtfsRoutesComboBox = new javax.swing.JComboBox(gtfsRoutes);
+ jLabel8 = new javax.swing.JLabel();
+ totalGtfsRoutesLabel = new javax.swing.JLabel();
+ jLabel9 = new javax.swing.JLabel();
+ allRoutesRadioButton = new javax.swing.JRadioButton();
+ newRoutesRadioButton = new javax.swing.JRadioButton();
+ existingRoutesWithUpdatesRadioButton = new javax.swing.JRadioButton();
+ existingRoutesRadioButton = new javax.swing.JRadioButton();
+ jLabel10 = new javax.swing.JLabel();
+ jScrollPane3 = new javax.swing.JScrollPane();
+ generalInformationRouteTextArea = new javax.swing.JTextArea();
+ jScrollPane4 = new javax.swing.JScrollPane();
+ routeTable = new JTable(){
+ public String getToolTipText(MouseEvent e){
+ String tip = null;
+ java.awt.Point p = e.getPoint();
+ int rowIndex = rowAtPoint(p);
+ int colIndex = columnAtPoint(p);
+ int realColumnIndex = convertColumnIndexToModel(colIndex);
+ int realRowIndex = convertRowIndexToModel(rowIndex);
+
+ TableModel model = this.getModel();
+ if((model instanceof TagReportTableModel) && (realRowIndex>=0) && (realColumnIndex>=0)){
+ Object o = model.getValueAt(realRowIndex, realColumnIndex);
+ if(o instanceof String) tip = (String)o;
+ }
+ return tip;//"This is the first line
This is the second line";
+ }
+
+ protected JTableHeader createDefaultTableHeader() {
+ return new JTableHeader(columnModel) {
+ public String getToolTipText(MouseEvent e) {
+ String tip = null;
+ java.awt.Point p = e.getPoint();
+ int index = columnModel.getColumnIndexAtX(p.x);
+ int realIndex =
+ columnModel.getColumn(index).getModelIndex();
+ return tagReportColumnHeaderToolTips[realIndex];
+ }
+ };
+ }
+ };
+ routeTable.setDefaultRenderer(Object.class, new edu.usf.cutr.go_sync.gui.object.TagReportTableCellRenderer());
+ routeTable.addMouseListener(new BooleanMouseListener(routeTable, this));
+ jMemberScrollPane5 = new javax.swing.JScrollPane();
+ memberTable = new javax.swing.JTable();
+ memberTable.setDefaultRenderer(Object.class, new edu.usf.cutr.go_sync.gui.object.RouteMemberTableCellRenderer());
+ jLabel11 = new javax.swing.JLabel();
+ allMembersRadioButton = new javax.swing.JRadioButton();
+ osmMembersRadioButton = new javax.swing.JRadioButton();
+ gtfsMembersRadioButton = new javax.swing.JRadioButton();
+ bothMembersRadioButton = new javax.swing.JRadioButton();
+ jLabel12 = new javax.swing.JLabel();
+ totalGtfsMembersLabel = new javax.swing.JLabel();
+ totalOsmMembersLabel = new javax.swing.JLabel();
+ totalNewMembersLabel = new javax.swing.JLabel();
+ saveChangeRouteButton = new javax.swing.JButton();
+ jLabel20 = new javax.swing.JLabel();
+ osmRoutesComboBox = new javax.swing.JComboBox(osmRoutes);
+ membersWarningLabel = new javax.swing.JLabel();
+ newMemberListHasUpdatesLabel = new javax.swing.JLabel();
dummyUploadButton = new javax.swing.JButton();
uploadDataButton = new javax.swing.JButton();
+ stopsCheckbox = new javax.swing.JCheckBox();
+ routesCheckbox = new javax.swing.JCheckBox();
+ acceptedOnlyCheckbox = new javax.swing.JCheckBox();
jMenuBar1 = new javax.swing.JMenuBar();
jMenu1 = new javax.swing.JMenu();
jMenu3 = new javax.swing.JMenu();
@@ -1387,280 +1857,247 @@ public String getTileUrl(int x, int y, int zoom) {
exportOsmValueStopsWithConflictsMenuItem = new javax.swing.JMenuItem();
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
+ setMinimumSize(new java.awt.Dimension(800, 600));
jTabbedPane1.setName("jTabbedPane1"); // NOI18N
- busStopPanel.setFont(new java.awt.Font("Tahoma", 0, 14));
+ busStopPanel.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
busStopPanel.setMaximumSize(new java.awt.Dimension(780, 780));
- busStopPanel.setName("jPanel1"); // NOI18N
+ busStopPanel.setName("busStopPanel"); // NOI18N
busStopPanel.setPreferredSize(new java.awt.Dimension(750, 617));
- GridBagLayout gbl_busStopPanel = new GridBagLayout();
- gbl_busStopPanel.columnWidths = new int[]{44, 0, 133, 15, 75, 64, 6, 20, 40, 59, 110, 70, 0};
- gbl_busStopPanel.rowHeights = new int[]{30, 28, 22, 17, 17, 25, 10, 20, 260, 0};
- gbl_busStopPanel.columnWeights = new double[]{0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, Double.MIN_VALUE};
- gbl_busStopPanel.rowWeights = new double[]{0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, Double.MIN_VALUE};
- busStopPanel.setLayout(gbl_busStopPanel);
- tableStopButton = new javax.swing.JButton();
-
- javax.swing.AbstractAction tableStopButtonActionListener = new javax.swing.AbstractAction() {
+ java.awt.GridBagLayout busStopPanelLayout = new java.awt.GridBagLayout();
+ busStopPanelLayout.columnWidths = new int[] {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
+ busStopPanelLayout.rowHeights = new int[] {0, 28, 0, 28, 0, 28, 0, 28, 0};
+ busStopPanelLayout.columnWeights = new double[] {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 4.9E-324};
+ busStopPanelLayout.rowWeights = new double[] {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 4.9E-324};
+ busStopPanel.setLayout(busStopPanelLayout);
+
+ donotUploadButton.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
+ donotUploadButton.setText("Don't Upload");
+ donotUploadButton.setName("donotUploadButton"); // NOI18N
+ donotUploadButton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
- tableStopButtonActionPerformed(evt);
+ donotUploadButtonActionPerformed(evt);
}
+ });
+ gridBagConstraints = new java.awt.GridBagConstraints();
+ gridBagConstraints.gridx = 5;
+ gridBagConstraints.gridy = 5;
+ gridBagConstraints.gridwidth = 3;
+ gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
+ gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
+ gridBagConstraints.insets = new java.awt.Insets(0, 0, 5, 5);
+ busStopPanel.add(donotUploadButton, gridBagConstraints);
- };
- tableStopButton.setFont(new java.awt.Font("Tahoma", 0, 12));
- tableStopButton.setText("setTextByCode");
- tableStopButton.setName("tableStopButton"); // NOI18N
- tableStopButton.addActionListener(tableStopButtonActionListener);
- tableStopButton.getInputMap(javax.swing.JComponent.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke(KeyEvent.VK_ENTER,Event.CTRL_MASK), "doSomething");
- tableStopButton.getActionMap().put("doSomething",tableStopButtonActionListener);
+ jStopsScrollPane1.setName("jStopsScrollPane1"); // NOI18N
- jStopsScrollPane1 = new javax.swing.JScrollPane();
- dataTable = new JTable(){
- public String getToolTipText(MouseEvent e){
- String tip = null;
- java.awt.Point p = e.getPoint();
- int rowIndex = rowAtPoint(p);
- int colIndex = columnAtPoint(p);
- int realColumnIndex = convertColumnIndexToModel(colIndex);
- int realRowIndex = convertRowIndexToModel(rowIndex);
-
- TableModel model = this.getModel();
- if((model instanceof TagReportTableModel) && (realRowIndex>=0) && (realColumnIndex>=0)){
- Object o = model.getValueAt(realRowIndex, realColumnIndex);
- if(o instanceof String) tip = (String)o;
- }
- return tip;//"This is the first line
This is the second line";
- }
+ dataTable.setFont(new java.awt.Font("Times New Roman", 0, 14)); // NOI18N
+ dataTable.setModel(stopTableModel);
+ dataTable.setName("dataTable"); // NOI18N
+ dataTable.getTableHeader().setReorderingAllowed(false);
+ jStopsScrollPane1.setViewportView(dataTable);
- protected JTableHeader createDefaultTableHeader() {
- return new JTableHeader(columnModel) {
- public String getToolTipText(MouseEvent e) {
- String tip = null;
- java.awt.Point p = e.getPoint();
- int index = columnModel.getColumnIndexAtX(p.x);
- int realIndex =
- columnModel.getColumn(index).getModelIndex();
- return tagReportColumnHeaderToolTips[realIndex];
- }
- };
- }
- };
- dataTable.setDefaultRenderer(Object.class, new edu.usf.cutr.go_sync.gui.object.TagReportTableCellRenderer());
- dataTable.addMouseListener(new BooleanMouseListener(dataTable));
+ gridBagConstraints = new java.awt.GridBagConstraints();
+ gridBagConstraints.gridx = 4;
+ gridBagConstraints.gridy = 3;
+ gridBagConstraints.gridwidth = 8;
+ gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
+ gridBagConstraints.insets = new java.awt.Insets(0, 0, 5, 0);
+ busStopPanel.add(jStopsScrollPane1, gridBagConstraints);
+
+ gtfsStopsComboBoxLabel.setFont(new java.awt.Font("Times New Roman", 1, 18)); // NOI18N
+ gtfsStopsComboBoxLabel.setText("GTFS Stops");
+ gtfsStopsComboBoxLabel.setName("gtfsStopsComboBoxLabel"); // NOI18N
+ gridBagConstraints = new java.awt.GridBagConstraints();
+ gridBagConstraints.gridx = 5;
+ gridBagConstraints.gridy = 0;
+ gridBagConstraints.gridwidth = 2;
+ gridBagConstraints.anchor = java.awt.GridBagConstraints.SOUTH;
+ gridBagConstraints.insets = new java.awt.Insets(0, 0, 5, 5);
+ busStopPanel.add(gtfsStopsComboBoxLabel, gridBagConstraints);
+
+ osmStopsComboBoxLabel.setFont(new java.awt.Font("Times New Roman", 1, 18)); // NOI18N
+ osmStopsComboBoxLabel.setText("OSM Stops");
+ osmStopsComboBoxLabel.setName("osmStopsComboBoxLabel"); // NOI18N
+ gridBagConstraints = new java.awt.GridBagConstraints();
+ gridBagConstraints.gridx = 8;
+ gridBagConstraints.gridy = 0;
+ gridBagConstraints.gridwidth = 2;
+ gridBagConstraints.anchor = java.awt.GridBagConstraints.SOUTHEAST;
+ gridBagConstraints.insets = new java.awt.Insets(0, 0, 5, 5);
+ busStopPanel.add(osmStopsComboBoxLabel, gridBagConstraints);
+
+ gtfsStopsComboBox.setFont(new java.awt.Font("Times New Roman", 1, 14)); // NOI18N
+ gtfsStopsComboBox.setMinimumSize(new java.awt.Dimension(100, 20));
+ gtfsStopsComboBox.setName("gtfsStopsComboBox"); // NOI18N
+ gtfsStopsComboBox.setPreferredSize(new java.awt.Dimension(100, 20));
+ gtfsStopsComboBox.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(java.awt.event.ActionEvent evt) {
+ gtfsStopsComboBoxActionPerformed(evt);
+ }
+ });
+ gridBagConstraints = new java.awt.GridBagConstraints();
+ gridBagConstraints.gridx = 5;
+ gridBagConstraints.gridy = 1;
+ gridBagConstraints.gridwidth = 2;
+ gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHEAST;
+ gridBagConstraints.insets = new java.awt.Insets(0, 0, 5, 5);
+ busStopPanel.add(gtfsStopsComboBox, gridBagConstraints);
+ gtfsStopsComboBox.getInputMap(javax.swing.JComponent.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke(KeyEvent.VK_LEFT,Event.CTRL_MASK), "gtfs_prev");
+ gtfsStopsComboBox.getActionMap().put("gtfs_prev", new AbstractAction() {
+ public void actionPerformed(ActionEvent evt) {
+ int currentindex = gtfsStopsComboBox.getSelectedIndex();
+ if (currentindex > 0)
+ gtfsStopsComboBox.setSelectedIndex(currentindex-1);
+ }
+ } );
+ gtfsStopsComboBox.getInputMap(javax.swing.JComponent.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke(KeyEvent.VK_RIGHT,Event.CTRL_MASK), "gtfs_next");
+ gtfsStopsComboBox.getActionMap().put("gtfs_next", new AbstractAction() {
+ public void actionPerformed(ActionEvent evt) {
+ int currentindex = gtfsStopsComboBox.getSelectedIndex();
+ if (currentindex < gtfsStopsComboBox.getItemCount() - 1)
+ gtfsStopsComboBox.setSelectedIndex(currentindex+1);
- jStopsScrollPane1.setName("jStopsScrollPane1"); // NOI18N
+ }
+ } );
+
+ osmStopsComboBox.setFont(new java.awt.Font("Times New Roman", 1, 14)); // NOI18N
+ osmStopsComboBox.setMinimumSize(new java.awt.Dimension(100, 20));
+ osmStopsComboBox.setName("osmStopsComboBox"); // NOI18N
+ osmStopsComboBox.setPreferredSize(new java.awt.Dimension(100, 20));
+ osmStopsComboBox.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(java.awt.event.ActionEvent evt) {
+ osmStopsComboBoxActionPerformed(evt);
+ }
+ });
+ gridBagConstraints = new java.awt.GridBagConstraints();
+ gridBagConstraints.gridx = 8;
+ gridBagConstraints.gridy = 1;
+ gridBagConstraints.gridwidth = 2;
+ gridBagConstraints.insets = new java.awt.Insets(0, 0, 5, 5);
+ busStopPanel.add(osmStopsComboBox, gridBagConstraints);
+
+ mapJXMapKit.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)));
+ mapJXMapKit.setDefaultProvider(org.jdesktop.swingx.JXMapKit.DefaultProviders.Custom);
+ mapJXMapKit.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
+ mapJXMapKit.setName("mapJXMapKit"); // NOI18N
+ gridBagConstraints = new java.awt.GridBagConstraints();
+ gridBagConstraints.gridx = 4;
+ gridBagConstraints.gridy = 8;
+ gridBagConstraints.gridwidth = 8;
+ gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
+ busStopPanel.add(mapJXMapKit, gridBagConstraints);
+ setupMapJXMapKitPostCreation();
+
+ jLabel3.setFont(new java.awt.Font("Times New Roman", 1, 18)); // NOI18N
+ jLabel3.setText("Display on Map:");
+ jLabel3.setName("jLabel3"); // NOI18N
+ gridBagConstraints = new java.awt.GridBagConstraints();
+ gridBagConstraints.gridx = 4;
+ gridBagConstraints.gridy = 6;
+ gridBagConstraints.gridwidth = 2;
+ gridBagConstraints.gridheight = 2;
+ gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
+ gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTH;
+ gridBagConstraints.insets = new java.awt.Insets(0, 0, 5, 5);
+ busStopPanel.add(jLabel3, gridBagConstraints);
+
+ jLabel7.setFont(new java.awt.Font("Times New Roman", 1, 18)); // NOI18N
+ jLabel7.setText("Total Stops:");
+ jLabel7.setName("jLabel7"); // NOI18N
+ gridBagConstraints = new java.awt.GridBagConstraints();
+ gridBagConstraints.gridx = 3;
+ gridBagConstraints.gridy = 2;
+ gridBagConstraints.gridwidth = 2;
+ gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
+ gridBagConstraints.insets = new java.awt.Insets(0, 0, 5, 5);
+ busStopPanel.add(jLabel7, gridBagConstraints);
+
+ totalGtfsStopsLabel.setFont(new java.awt.Font("Times New Roman", 0, 14)); // NOI18N
+ totalGtfsStopsLabel.setText("N/A"); // NOI18N
+ totalGtfsStopsLabel.setName("totalGtfsStopsLabel"); // NOI18N
+ gridBagConstraints = new java.awt.GridBagConstraints();
+ gridBagConstraints.gridx = 5;
+ gridBagConstraints.gridy = 2;
+ gridBagConstraints.anchor = java.awt.GridBagConstraints.SOUTHEAST;
+ gridBagConstraints.insets = new java.awt.Insets(0, 0, 5, 5);
+ busStopPanel.add(totalGtfsStopsLabel, gridBagConstraints);
+
+ totalOsmStopsLabel.setFont(new java.awt.Font("Times New Roman", 0, 14)); // NOI18N
+ totalOsmStopsLabel.setText("N/A");
+ totalOsmStopsLabel.setName("totalOsmStopsLabel"); // NOI18N
+ gridBagConstraints = new java.awt.GridBagConstraints();
+ gridBagConstraints.gridx = 9;
+ gridBagConstraints.gridy = 2;
+ gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
+ gridBagConstraints.insets = new java.awt.Insets(0, 0, 5, 5);
+ busStopPanel.add(totalOsmStopsLabel, gridBagConstraints);
+
+ jLabel4.setFont(new java.awt.Font("Times New Roman", 1, 18)); // NOI18N
+ jLabel4.setText("Stops to view:");
+ jLabel4.setName("jLabel4"); // NOI18N
+ gridBagConstraints = new java.awt.GridBagConstraints();
+ gridBagConstraints.gridx = 0;
+ gridBagConstraints.gridy = 1;
+ gridBagConstraints.gridwidth = 3;
+ gridBagConstraints.insets = new java.awt.Insets(0, 0, 5, 5);
+ busStopPanel.add(jLabel4, gridBagConstraints);
+
+ jLabel5.setFont(new java.awt.Font("Times New Roman", 1, 18)); // NOI18N
+ jLabel5.setText("General Information");
+ jLabel5.setName("jLabel5"); // NOI18N
+ gridBagConstraints = new java.awt.GridBagConstraints();
+ gridBagConstraints.gridx = 0;
+ gridBagConstraints.gridy = 6;
+ gridBagConstraints.gridwidth = 3;
+ gridBagConstraints.gridheight = 2;
+ gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHEAST;
+ gridBagConstraints.insets = new java.awt.Insets(0, 0, 5, 5);
+ busStopPanel.add(jLabel5, gridBagConstraints);
- dataTable.setFont(new java.awt.Font("Times New Roman", 0, 14));
- dataTable.setModel(stopTableModel);
- dataTable.setName("dataTable"); // NOI18N
- dataTable.setSelectionForeground(new java.awt.Color(0, 0, 0));
- dataTable.getTableHeader().setReorderingAllowed(false);
- jLabel19 = new javax.swing.JLabel();
-
- jLabel19.setFont(new java.awt.Font("Times New Roman", 0, 14));
- jLabel19.setText("Finish");
- jLabel19.setName("jLabel19"); // NOI18N
- GridBagConstraints gbc_jLabel19 = new GridBagConstraints();
- gbc_jLabel19.anchor = GridBagConstraints.NORTHEAST;
- gbc_jLabel19.insets = new Insets(0, 0, 5, 5);
- gbc_jLabel19.gridx = 0;
- gbc_jLabel19.gridy = 0;
- busStopPanel.add(jLabel19, gbc_jLabel19);
- finishProgressBar = new javax.swing.JProgressBar();
-
- finishProgressBar.setToolTipText("\nStops that you should visit before uploading into OSM
\nThese stops are either new stops that GO_Sync can't find a match for in OSM or existing stops in OSM that have new data to be inserted.\n"); // NOI18N
- finishProgressBar.setName("finishProgressBar"); // NOI18N
- finishProgressBar.setString("0"); // NOI18N
- finishProgressBar.setStringPainted(true);
- GridBagConstraints gbc_finishProgressBar = new GridBagConstraints();
- gbc_finishProgressBar.fill = GridBagConstraints.HORIZONTAL;
- gbc_finishProgressBar.anchor = GridBagConstraints.NORTH;
- gbc_finishProgressBar.insets = new Insets(0, 0, 5, 5);
- gbc_finishProgressBar.gridx = 2;
- gbc_finishProgressBar.gridy = 0;
- busStopPanel.add(finishProgressBar, gbc_finishProgressBar);
-
- dontupremainButton = new JButton("Don't Up Remain");
- GridBagConstraints gbc_dontupremainButton = new GridBagConstraints();
- gbc_dontupremainButton.gridwidth = 2;
- gbc_dontupremainButton.insets = new Insets(0, 0, 5, 5);
- gbc_dontupremainButton.gridx = 3;
- gbc_dontupremainButton.gridy = 0;
- busStopPanel.add(dontupremainButton, gbc_dontupremainButton);
- dontupremainButton.addActionListener(new java.awt.event.ActionListener() {
- public void actionPerformed(java.awt.event.ActionEvent evt) {
- donotUploadRemainingButtonActionPerformed(evt);
- }
- });
- gtfsStopsComboBoxLabel = new javax.swing.JLabel();
-
- gtfsStopsComboBoxLabel.setFont(new java.awt.Font("Times New Roman", 1, 18));
- gtfsStopsComboBoxLabel.setText("GTFS Stops");
- gtfsStopsComboBoxLabel.setName("jLabel1"); // NOI18N
- GridBagConstraints gbc_gtfsStopsComboBoxLabel = new GridBagConstraints();
- gbc_gtfsStopsComboBoxLabel.anchor = GridBagConstraints.SOUTH;
- gbc_gtfsStopsComboBoxLabel.insets = new Insets(0, 0, 5, 5);
- gbc_gtfsStopsComboBoxLabel.gridwidth = 2;
- gbc_gtfsStopsComboBoxLabel.gridx = 5;
- gbc_gtfsStopsComboBoxLabel.gridy = 0;
- busStopPanel.add(gtfsStopsComboBoxLabel, gbc_gtfsStopsComboBoxLabel);
- osmStopsComboBoxLabel = new javax.swing.JLabel();
-
- osmStopsComboBoxLabel.setFont(new java.awt.Font("Times New Roman", 1, 18));
- osmStopsComboBoxLabel.setText("OSM Stops");
- osmStopsComboBoxLabel.setName("jLabel2"); // NOI18N
- GridBagConstraints gbc_osmStopsComboBoxLabel = new GridBagConstraints();
- gbc_osmStopsComboBoxLabel.anchor = GridBagConstraints.SOUTHEAST;
- gbc_osmStopsComboBoxLabel.insets = new Insets(0, 0, 5, 5);
- gbc_osmStopsComboBoxLabel.gridwidth = 2;
- gbc_osmStopsComboBoxLabel.gridx = 8;
- gbc_osmStopsComboBoxLabel.gridy = 0;
- busStopPanel.add(osmStopsComboBoxLabel, gbc_osmStopsComboBoxLabel);
- osmStopsComboBox = new javax.swing.JComboBox(osmStops);
-
- osmStopsComboBox.setFont(new java.awt.Font("Times New Roman", 1, 14));
- osmStopsComboBox.setMinimumSize(new java.awt.Dimension(100, 20));
- osmStopsComboBox.setName("osmStopsComboBox"); // NOI18N
- osmStopsComboBox.setPreferredSize(new java.awt.Dimension(100, 20));
- osmStopsComboBox.addActionListener(new java.awt.event.ActionListener() {
- public void actionPerformed(java.awt.event.ActionEvent evt) {
- osmStopsComboBoxActionPerformed(evt);
- }
- });
- jLabel4 = new javax.swing.JLabel();
-
- jLabel4.setFont(new java.awt.Font("Times New Roman", 1, 18));
- jLabel4.setText("Stops to view:");
- jLabel4.setName("jLabel4"); // NOI18N
- GridBagConstraints gbc_jLabel4 = new GridBagConstraints();
- gbc_jLabel4.insets = new Insets(0, 0, 5, 5);
- gbc_jLabel4.gridwidth = 3;
- gbc_jLabel4.gridx = 0;
- gbc_jLabel4.gridy = 1;
- busStopPanel.add(jLabel4, gbc_jLabel4);
- gtfsStopsComboBox = new javax.swing.JComboBox(gtfsStops);
-
- gtfsStopsComboBox.setFont(new java.awt.Font("Times New Roman", 1, 14));
- gtfsStopsComboBox.setMinimumSize(new Dimension(100, 20));
- gtfsStopsComboBox.setName("gtfsStopsComboBox"); // NOI18N
- gtfsStopsComboBox.setPreferredSize(new Dimension(100, 20));
- gtfsStopsComboBox.addActionListener(new java.awt.event.ActionListener() {
- public void actionPerformed(java.awt.event.ActionEvent evt) {
- gtfsStopsComboBoxActionPerformed(evt);
- totalGtfsStopsLabel.setText(gtfsStopsComboBox.getSelectedIndex()+1 + "/" + gtfsStopsComboBox.getItemCount());
- }
- });
-
- dontuploadAllBtn = new JButton("Don't Up All");
- dontuploadAllBtn.addActionListener(new java.awt.event.ActionListener() {
- public void actionPerformed(java.awt.event.ActionEvent evt) {
- donotUploadAllButtonActionPerformed(evt);
- }
- });
- GridBagConstraints gbc_dontuploadAllBtn = new GridBagConstraints();
- gbc_dontuploadAllBtn.gridwidth = 2;
- gbc_dontuploadAllBtn.insets = new Insets(0, 0, 5, 5);
- gbc_dontuploadAllBtn.gridx = 3;
- gbc_dontuploadAllBtn.gridy = 1;
- busStopPanel.add(dontuploadAllBtn, gbc_dontuploadAllBtn);
- GridBagConstraints gbc_gtfsStopsComboBox = new GridBagConstraints();
- gbc_gtfsStopsComboBox.anchor = GridBagConstraints.NORTHEAST;
- gbc_gtfsStopsComboBox.insets = new Insets(0, 0, 5, 5);
- gbc_gtfsStopsComboBox.gridwidth = 2;
- gbc_gtfsStopsComboBox.gridx = 5;
- gbc_gtfsStopsComboBox.gridy = 1;
- busStopPanel.add(gtfsStopsComboBox, gbc_gtfsStopsComboBox);
-
-
- nextButton = new JButton("→");
-
- nextButton.addActionListener(new java.awt.event.ActionListener() {
- public void actionPerformed(java.awt.event.ActionEvent evt) {
-
- if (gtfsStopsComboBox.getSelectedIndex()+1 < gtfsStopsComboBox.getItemCount())
- {
- gtfsStopsComboBox.setSelectedIndex(gtfsStopsComboBox.getSelectedIndex()+1);
-
- }
- }
- });
-
- //TODO add addosmcocombobox refocus shortcuts?
- gtfsStopsComboBox.getInputMap(javax.swing.JComponent.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke(KeyEvent.VK_LEFT,Event.CTRL_MASK), "gtfs_prev");
- gtfsStopsComboBox.getActionMap().put("gtfs_prev", new AbstractAction() {
- public void actionPerformed(ActionEvent evt) {
- int currentindex = gtfsStopsComboBox.getSelectedIndex();
- if (currentindex > 0)
- gtfsStopsComboBox.setSelectedIndex(currentindex-1);
-
- }
- } );
- gtfsStopsComboBox.getInputMap(javax.swing.JComponent.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke(KeyEvent.VK_RIGHT,Event.CTRL_MASK), "gtfs_next");
- gtfsStopsComboBox.getActionMap().put("gtfs_next", new AbstractAction() {
- public void actionPerformed(ActionEvent evt) {
- int currentindex = gtfsStopsComboBox.getSelectedIndex();
- if (currentindex < gtfsStopsComboBox.getItemCount() - 1)
- gtfsStopsComboBox.setSelectedIndex(currentindex+1);
-
- }
- } );
- GridBagConstraints gbc_nextButton = new GridBagConstraints();
- gbc_nextButton.insets = new Insets(0, 0, 5, 5);
- gbc_nextButton.gridx = 7;
- gbc_nextButton.gridy = 1;
- busStopPanel.add(nextButton, gbc_nextButton);
- GridBagConstraints gbc_osmStopsComboBox = new GridBagConstraints();
- gbc_osmStopsComboBox.insets = new Insets(0, 0, 5, 5);
- gbc_osmStopsComboBox.gridwidth = 2;
- gbc_osmStopsComboBox.gridx = 8;
- gbc_osmStopsComboBox.gridy = 1;
- busStopPanel.add(osmStopsComboBox, gbc_osmStopsComboBox);
- searchButton = new javax.swing.JButton();
-
- searchButton.setFont(new java.awt.Font("Times New Roman", 0, 14));
- searchButton.setText("Search");
- searchButton.setIconTextGap(2);
- searchButton.setMargin(new java.awt.Insets(2, 7, 2, 7));
- searchButton.setName("searchButton"); // NOI18N
- searchButton.addActionListener(new java.awt.event.ActionListener() {
- public void actionPerformed(java.awt.event.ActionEvent evt) {
- searchButtonActionPerformed(evt);
- }
- });
- searchTextField = new javax.swing.JTextField();
+ jScrollPane2.setName("jScrollPane2"); // NOI18N
- searchTextField.setToolTipText("Input stop name or stop id to search for stop");
- searchTextField.setName("searchTextField"); // NOI18N
- GridBagConstraints gbc_searchTextField = new GridBagConstraints();
- gbc_searchTextField.anchor = GridBagConstraints.NORTH;
- gbc_searchTextField.fill = GridBagConstraints.HORIZONTAL;
- gbc_searchTextField.insets = new Insets(0, 0, 5, 5);
- gbc_searchTextField.gridx = 10;
- gbc_searchTextField.gridy = 1;
- busStopPanel.add(searchTextField, gbc_searchTextField);
- GridBagConstraints gbc_searchButton = new GridBagConstraints();
- gbc_searchButton.anchor = GridBagConstraints.SOUTHWEST;
- gbc_searchButton.insets = new Insets(0, 0, 5, 0);
- gbc_searchButton.gridx = 11;
- gbc_searchButton.gridy = 1;
- busStopPanel.add(searchButton, gbc_searchButton);
-
- StopLabelPanel = new JPanel();
- GridBagConstraints gbc_panel = new GridBagConstraints();
- gbc_panel.gridheight = 2;
- gbc_panel.insets = new Insets(0, 0, 5, 5);
- gbc_panel.fill = GridBagConstraints.BOTH;
- gbc_panel.gridx = 2;
- gbc_panel.gridy = 2;
- busStopPanel.add(StopLabelPanel, gbc_panel);
- StopLabelPanel.setLayout(new BoxLayout(StopLabelPanel, BoxLayout.Y_AXIS));
- newWithMatchStopsRadioButton = new javax.swing.JRadioButton();
- StopLabelPanel.add(newWithMatchStopsRadioButton);
+ generalInformationStopTextArea.setEditable(false);
+ generalInformationStopTextArea.setColumns(20);
+ generalInformationStopTextArea.setLineWrap(true);
+ generalInformationStopTextArea.setRows(5);
+ generalInformationStopTextArea.setWrapStyleWord(true);
+ generalInformationStopTextArea.setName("generalInformationStopTextArea"); // NOI18N
+ jScrollPane2.setViewportView(generalInformationStopTextArea);
+
+ gridBagConstraints = new java.awt.GridBagConstraints();
+ gridBagConstraints.gridx = 0;
+ gridBagConstraints.gridy = 8;
+ gridBagConstraints.gridwidth = 4;
+ gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
+ gridBagConstraints.insets = new java.awt.Insets(0, 0, 0, 5);
+ busStopPanel.add(jScrollPane2, gridBagConstraints);
+
+ tableStopButton.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
+ tableStopButton.setText("setTextByCode");
+ tableStopButton.setName("tableStopButton"); // NOI18N
+ tableStopButton.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(java.awt.event.ActionEvent evt) {
+ tableStopButtonActionPerformed(evt);
+ }
+ });
+ gridBagConstraints = new java.awt.GridBagConstraints();
+ gridBagConstraints.gridx = 8;
+ gridBagConstraints.gridy = 5;
+ gridBagConstraints.gridwidth = 3;
+ gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
+ gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTH;
+ gridBagConstraints.insets = new java.awt.Insets(0, 0, 5, 5);
+ busStopPanel.add(tableStopButton, gridBagConstraints);
+ tableStopButton.getInputMap(javax.swing.JComponent.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke(KeyEvent.VK_ENTER,Event.CTRL_MASK), "doSomething");
+ tableStopButton.getActionMap().put("doSomething",tableStopButtonActionListener);
+
+ StopLabelPanel.setName("StopLabelPanel"); // NOI18N
+ StopLabelPanel.setLayout(new javax.swing.BoxLayout(StopLabelPanel, javax.swing.BoxLayout.Y_AXIS));
stopsButtonGroup.add(newWithMatchStopsRadioButton);
- newWithMatchStopsRadioButton.setFont(new java.awt.Font("Times New Roman", 0, 14));
- newWithMatchStopsRadioButton.setText("New GTFS stops with"); // NOI18N
+ newWithMatchStopsRadioButton.setFont(new java.awt.Font("Times New Roman", 0, 14)); // NOI18N
+ newWithMatchStopsRadioButton.setText("New GTFS stops with Potential Matches in OSM"); // NOI18N
newWithMatchStopsRadioButton.setToolTipText("\nNew GTFS stops to be added to OpenStreetMap.
\nHowever, there are some existing stops in OSM within 400 meters that could be this GTFS stop.
\nPlease verify if the stop is already in OSM by clicking the Match button.
\nOtherwise, these GTFS stops would be uploaded with a FIXME tag.\n"); // NOI18N
newWithMatchStopsRadioButton.setName("newWithMatchStopsRadioButton"); // NOI18N
newWithMatchStopsRadioButton.addActionListener(new java.awt.event.ActionListener() {
@@ -1668,19 +2105,11 @@ public void actionPerformed(java.awt.event.ActionEvent evt) {
newWithMatchStopsRadioButtonActionPerformed(evt);
}
});
- jLabel14 = new javax.swing.JLabel();
- StopLabelPanel.add(jLabel14);
-
- jLabel14.setFont(new java.awt.Font("Times New Roman", 0, 14));
- jLabel14.setText("Potential Matches in OSM");
- jLabel14.setToolTipText("\nNew GTFS stops to be added to OpenStreetMap.
\nHowever, there are some existing stops in OSM within 400 meters that could be this GTFS stop.
\nPlease verify if the stop is already in OSM by clicking the Match button.
\nOtherwise, these GTFS stops would be uploaded with a FIXME tag.\n"); // NOI18N
- jLabel14.setName("jLabel14");
- newNoMatchStopsRadioButton = new javax.swing.JRadioButton();
- StopLabelPanel.add(newNoMatchStopsRadioButton);
+ StopLabelPanel.add(newWithMatchStopsRadioButton);
stopsButtonGroup.add(newNoMatchStopsRadioButton);
- newNoMatchStopsRadioButton.setFont(new java.awt.Font("Times New Roman", 0, 14));
- newNoMatchStopsRadioButton.setText("New GTFS stops with");
+ newNoMatchStopsRadioButton.setFont(new java.awt.Font("Times New Roman", 0, 14)); // NOI18N
+ newNoMatchStopsRadioButton.setText("New GTFS stops with No OSM Matches");
newNoMatchStopsRadioButton.setToolTipText("New GTFS stops to be added to OpenStreetMap."); // NOI18N
newNoMatchStopsRadioButton.setName("newNoMatchStopsRadioButton"); // NOI18N
newNoMatchStopsRadioButton.addActionListener(new java.awt.event.ActionListener() {
@@ -1688,18 +2117,10 @@ public void actionPerformed(java.awt.event.ActionEvent evt) {
newNoMatchStopsRadioButtonActionPerformed(evt);
}
});
- jLabel13 = new javax.swing.JLabel();
- StopLabelPanel.add(jLabel13);
-
- jLabel13.setFont(new java.awt.Font("Times New Roman", 0, 14));
- jLabel13.setText("No OSM Matches");
- jLabel13.setToolTipText("New GTFS stops to be added to OpenStreetMap."); // NOI18N
- jLabel13.setName("jLabel13");
- updateStopsRadioButton = new javax.swing.JRadioButton();
- StopLabelPanel.add(updateStopsRadioButton);
+ StopLabelPanel.add(newNoMatchStopsRadioButton);
stopsButtonGroup.add(updateStopsRadioButton);
- updateStopsRadioButton.setFont(new java.awt.Font("Times New Roman", 0, 14));
+ updateStopsRadioButton.setFont(new java.awt.Font("Times New Roman", 0, 14)); // NOI18N
updateStopsRadioButton.setText("Existing stops with Updates");
updateStopsRadioButton.setToolTipText("\nThese GTFS stops are already there in OpenStreetMap.
\nHowever, some tags are different.\n"); // NOI18N
updateStopsRadioButton.setName("updateStopsRadioButton"); // NOI18N
@@ -1708,11 +2129,10 @@ public void actionPerformed(java.awt.event.ActionEvent evt) {
updateStopsRadioButtonActionPerformed(evt);
}
});
- existingStopRadioButton = new javax.swing.JRadioButton();
- StopLabelPanel.add(existingStopRadioButton);
+ StopLabelPanel.add(updateStopsRadioButton);
stopsButtonGroup.add(existingStopRadioButton);
- existingStopRadioButton.setFont(new java.awt.Font("Times New Roman", 0, 14));
+ existingStopRadioButton.setFont(new java.awt.Font("Times New Roman", 0, 14)); // NOI18N
existingStopRadioButton.setText("Existing stops");
existingStopRadioButton.setToolTipText("\nThese GTFS stops are already in OpenStreetMap.
\nNo new information is added.\n"); // NOI18N
existingStopRadioButton.setName("existingStopRadioButton"); // NOI18N
@@ -1721,11 +2141,10 @@ public void actionPerformed(java.awt.event.ActionEvent evt) {
existingStopRadioButtonActionPerformed(evt);
}
});
- allStopsRadioButton = new javax.swing.JRadioButton();
- StopLabelPanel.add(allStopsRadioButton);
+ StopLabelPanel.add(existingStopRadioButton);
stopsButtonGroup.add(allStopsRadioButton);
- allStopsRadioButton.setFont(new java.awt.Font("Times New Roman", 0, 14));
+ allStopsRadioButton.setFont(new java.awt.Font("Times New Roman", 0, 14)); // NOI18N
allStopsRadioButton.setSelected(true);
allStopsRadioButton.setText("All");
allStopsRadioButton.setToolTipText("All GTFS stops from travel agency"); // NOI18N
@@ -1735,636 +2154,548 @@ public void actionPerformed(java.awt.event.ActionEvent evt) {
allStopsRadioButtonActionPerformed(evt);
}
});
- jLabel7 = new javax.swing.JLabel();
-
- jLabel7.setFont(new java.awt.Font("Times New Roman", 1, 18));
- jLabel7.setText("Total Stops:");
- jLabel7.setName("jLabel7"); // NOI18N
- GridBagConstraints gbc_jLabel7 = new GridBagConstraints();
- gbc_jLabel7.anchor = GridBagConstraints.NORTHWEST;
- gbc_jLabel7.insets = new Insets(0, 0, 5, 5);
- gbc_jLabel7.gridwidth = 2;
- gbc_jLabel7.gridx = 3;
- gbc_jLabel7.gridy = 2;
- busStopPanel.add(jLabel7, gbc_jLabel7);
- totalGtfsStopsLabel = new javax.swing.JLabel();
-
- totalGtfsStopsLabel.setFont(new java.awt.Font("Times New Roman", 0, 14));
- totalGtfsStopsLabel.setText("N/A"); // NOI18N
- totalGtfsStopsLabel.setName("totalGtfsStopsLabel"); // NOI18N
- GridBagConstraints gbc_totalGtfsStopsLabel = new GridBagConstraints();
- gbc_totalGtfsStopsLabel.anchor = GridBagConstraints.SOUTHEAST;
- gbc_totalGtfsStopsLabel.insets = new Insets(0, 0, 5, 5);
- gbc_totalGtfsStopsLabel.gridx = 5;
- gbc_totalGtfsStopsLabel.gridy = 2;
- busStopPanel.add(totalGtfsStopsLabel, gbc_totalGtfsStopsLabel);
- totalOsmStopsLabel = new javax.swing.JLabel();
-
- totalOsmStopsLabel.setFont(new java.awt.Font("Times New Roman", 0, 14));
- totalOsmStopsLabel.setText("N/A");
- totalOsmStopsLabel.setName("totalOsmStopsLabel"); // NOI18N
- GridBagConstraints gbc_totalOsmStopsLabel = new GridBagConstraints();
- gbc_totalOsmStopsLabel.anchor = GridBagConstraints.WEST;
- gbc_totalOsmStopsLabel.insets = new Insets(0, 0, 5, 5);
- gbc_totalOsmStopsLabel.gridx = 9;
- gbc_totalOsmStopsLabel.gridy = 2;
- busStopPanel.add(totalOsmStopsLabel, gbc_totalOsmStopsLabel);
- jStopsScrollPane1.setViewportView(dataTable);
-
- GridBagConstraints gbc_jScrollPane1 = new GridBagConstraints();
- gbc_jScrollPane1.fill = GridBagConstraints.BOTH;
- gbc_jScrollPane1.insets = new Insets(0, 0, 5, 0);
- gbc_jScrollPane1.gridwidth = 8;
- gbc_jScrollPane1.gridx = 4;
- gbc_jScrollPane1.gridy = 3;
- busStopPanel.add(jStopsScrollPane1, gbc_jScrollPane1);
- donotUploadButton = new javax.swing.JButton();
-
- donotUploadButton.setFont(new java.awt.Font("Tahoma", 0, 12));
- donotUploadButton.setText("Don't Upload");
- donotUploadButton.setName("donotUploadButton"); // NOI18N
- donotUploadButton.addActionListener(new java.awt.event.ActionListener() {
- public void actionPerformed(java.awt.event.ActionEvent evt) {
- donotUploadButtonActionPerformed(evt);
- }
- });
- lastEditedLabel = new javax.swing.JLabel();
-
- lastEditedLabel.setFont(new java.awt.Font("Times New Roman", 0, 14));
- lastEditedLabel.setText("N/A");
- lastEditedLabel.setName("lastEditedLabel"); // NOI18N
- GridBagConstraints gbc_lastEditedLabel = new GridBagConstraints();
- gbc_lastEditedLabel.anchor = GridBagConstraints.NORTH;
- gbc_lastEditedLabel.fill = GridBagConstraints.HORIZONTAL;
- gbc_lastEditedLabel.insets = new Insets(0, 0, 5, 0);
- gbc_lastEditedLabel.gridwidth = 6;
- gbc_lastEditedLabel.gridx = 6;
- gbc_lastEditedLabel.gridy = 4;
- busStopPanel.add(lastEditedLabel, gbc_lastEditedLabel);
- GridBagConstraints gbc_donotUploadButton = new GridBagConstraints();
- gbc_donotUploadButton.anchor = GridBagConstraints.NORTH;
- gbc_donotUploadButton.fill = GridBagConstraints.HORIZONTAL;
- gbc_donotUploadButton.insets = new Insets(0, 0, 5, 5);
- gbc_donotUploadButton.gridwidth = 3;
- gbc_donotUploadButton.gridx = 5;
- gbc_donotUploadButton.gridy = 5;
- busStopPanel.add(donotUploadButton, gbc_donotUploadButton);
- jLabel18 = new javax.swing.JLabel();
-
- jLabel18.setIcon(busIcon); // NOI18N
- jLabel18.setText("New Stop");
- jLabel18.setName("jLabel18"); // NOI18N
- GridBagConstraints gbc_jLabel18 = new GridBagConstraints();
- gbc_jLabel18.anchor = GridBagConstraints.SOUTH;
- gbc_jLabel18.fill = GridBagConstraints.HORIZONTAL;
- gbc_jLabel18.insets = new Insets(0, 0, 5, 5);
- gbc_jLabel18.gridheight = 2;
- gbc_jLabel18.gridwidth = 2;
- gbc_jLabel18.gridx = 7;
- gbc_jLabel18.gridy = 5;
- busStopPanel.add(jLabel18, gbc_jLabel18);
- GridBagConstraints gbc_tableStopButton = new GridBagConstraints();
- gbc_tableStopButton.anchor = GridBagConstraints.NORTH;
- gbc_tableStopButton.fill = GridBagConstraints.HORIZONTAL;
- gbc_tableStopButton.insets = new Insets(0, 0, 5, 5);
- gbc_tableStopButton.gridwidth = 3;
- gbc_tableStopButton.gridx = 8;
- gbc_tableStopButton.gridy = 5;
- busStopPanel.add(tableStopButton, gbc_tableStopButton);
- jLabel15 = new javax.swing.JLabel();
- jLabel15.setIcon(generateImageIcon(matchColor)); // NOI18N
- jLabel15.setText("Potential Match Stops");
- jLabel15.setName("jLabel15"); // NOI18N
- jLabel15.setOpaque(true);
- GridBagConstraints gbc_jLabel15 = new GridBagConstraints();
- gbc_jLabel15.anchor = GridBagConstraints.SOUTHWEST;
- gbc_jLabel15.insets = new Insets(0, 0, 5, 0);
- gbc_jLabel15.gridheight = 2;
- gbc_jLabel15.gridwidth = 2;
- gbc_jLabel15.gridx = 10;
- gbc_jLabel15.gridy = 5;
- busStopPanel.add(jLabel15, gbc_jLabel15);
- jLabel5 = new javax.swing.JLabel();
-
- jLabel5.setFont(new java.awt.Font("Times New Roman", 1, 18));
- jLabel5.setText("General Information");
- jLabel5.setName("jLabel5"); // NOI18N
- GridBagConstraints gbc_jLabel5 = new GridBagConstraints();
- gbc_jLabel5.anchor = GridBagConstraints.NORTHEAST;
- gbc_jLabel5.insets = new Insets(0, 0, 5, 5);
- gbc_jLabel5.gridheight = 2;
- gbc_jLabel5.gridwidth = 3;
- gbc_jLabel5.gridx = 0;
- gbc_jLabel5.gridy = 6;
- busStopPanel.add(jLabel5, gbc_jLabel5);
- jLabel3 = new javax.swing.JLabel();
-
- jLabel3.setFont(new java.awt.Font("Times New Roman", 1, 18));
- jLabel3.setText("Display on Map:");
- jLabel3.setName("jLabel3"); // NOI18N
- GridBagConstraints gbc_jLabel3 = new GridBagConstraints();
- gbc_jLabel3.fill = GridBagConstraints.HORIZONTAL;
- gbc_jLabel3.anchor = GridBagConstraints.NORTH;
- gbc_jLabel3.insets = new Insets(0, 0, 5, 5);
- gbc_jLabel3.gridheight = 2;
- gbc_jLabel3.gridwidth = 2;
- gbc_jLabel3.gridx = 4;
- gbc_jLabel3.gridy = 6;
- busStopPanel.add(jLabel3, gbc_jLabel3);
- jLabel16 = new javax.swing.JLabel();
-
- jLabel16.setIcon(generateImageIcon(selectedOSMColor)); // NOI18N
- jLabel16.setText("Selected Osm Stop");
- jLabel16.setName("jLabel16"); // NOI18N
- jLabel16.setOpaque(true);
- GridBagConstraints gbc_jLabel16 = new GridBagConstraints();
- gbc_jLabel16.anchor = GridBagConstraints.NORTHWEST;
- gbc_jLabel16.insets = new Insets(0, 0, 5, 5);
- gbc_jLabel16.gridwidth = 4;
- gbc_jLabel16.gridx = 7;
- gbc_jLabel16.gridy = 7;
- busStopPanel.add(jLabel16, gbc_jLabel16);
- jLabel17 = new javax.swing.JLabel();
-
-
- jLabel17.setIcon(generateImageIcon(selectedGTFSColor)); // NOI18N
- jLabel17.setText("Selected Gtfs Stop");
- jLabel17.setName("jLabel17"); // NOI18N
- jLabel17.setOpaque(true);
- GridBagConstraints gbc_jLabel17 = new GridBagConstraints();
- gbc_jLabel17.anchor = GridBagConstraints.NORTHWEST;
- gbc_jLabel17.insets = new Insets(0, 0, 5, 0);
- gbc_jLabel17.gridwidth = 2;
- gbc_jLabel17.gridx = 10;
- gbc_jLabel17.gridy = 7;
- busStopPanel.add(jLabel17, gbc_jLabel17);
- jScrollPane2 = new javax.swing.JScrollPane();
- generalInformationStopTextArea = new javax.swing.JTextArea();
- generalInformationStopTextArea.setLineWrap(true);
- generalInformationStopTextArea.setWrapStyleWord(true);
-
- jScrollPane2.setName("jScrollPane2"); // NOI18N
-
- generalInformationStopTextArea.setColumns(20);
- generalInformationStopTextArea.setEditable(false);
- generalInformationStopTextArea.setRows(5);
- generalInformationStopTextArea.setWrapStyleWord(true);
- generalInformationStopTextArea.setName("generalInformationStopTextArea"); // NOI18N
- jScrollPane2.setViewportView(generalInformationStopTextArea);
-
- GridBagConstraints gbc_jScrollPane2 = new GridBagConstraints();
- gbc_jScrollPane2.fill = GridBagConstraints.BOTH;
- gbc_jScrollPane2.insets = new Insets(0, 0, 0, 5);
- gbc_jScrollPane2.gridwidth = 4;
- gbc_jScrollPane2.gridx = 0;
- gbc_jScrollPane2.gridy = 8;
- busStopPanel.add(jScrollPane2, gbc_jScrollPane2);
- mapJXMapKit = new org.jdesktop.swingx.JXMapKit();
-
-
- //shortcuts
-
- //zoom
- mapJXMapKit.getInputMap(javax.swing.JComponent.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke(KeyEvent.VK_INSERT,0), "zoomin");
- mapJXMapKit.getInputMap(javax.swing.JComponent.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke(KeyEvent.VK_PLUS,0), "zoomin");
- mapJXMapKit.getActionMap().put("zoomin", mapJXMapKit.getZoomInAction());
- mapJXMapKit.getInputMap(javax.swing.JComponent.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke(KeyEvent.VK_DELETE,0), "zoomout");
- mapJXMapKit.getInputMap(javax.swing.JComponent.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke(KeyEvent.VK_MINUS,0), "zoomout");
- mapJXMapKit.getActionMap().put("zoomout", mapJXMapKit.getZoomOutAction());
-
- //recentre
- mapJXMapKit.getInputMap(javax.swing.JComponent.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke(KeyEvent.VK_NUMPAD5,0), "recentre_gtfs");
- mapJXMapKit.getActionMap().put("recentre_gtfs", new AbstractAction() {
- public void actionPerformed(ActionEvent evt) {
- GeoPosition gtfsLocation = new GeoPosition( Double.parseDouble(((Stop)gtfsStopsComboBox.getSelectedItem()).getLat()),
- Double.parseDouble(((Stop)gtfsStopsComboBox.getSelectedItem()).getLon()));
- mapJXMapKit.getMainMap().setCenterPosition(gtfsLocation);
- }
- } );
+ StopLabelPanel.add(allStopsRadioButton);
- mapJXMapKit.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)));
- mapJXMapKit.setDefaultProvider(org.jdesktop.swingx.JXMapKit.DefaultProviders.Custom);
- mapJXMapKit.setFont(new java.awt.Font("Tahoma", 0, 14));
- mapJXMapKit.setName("mapJXMapKit"); // NOI18N
- //mapJXMapKit.setScrollableTracksViewportWidth(false);
- GridBagConstraints gbc_mapJXMapKit = new GridBagConstraints();
- gbc_mapJXMapKit.fill = GridBagConstraints.BOTH;
- gbc_mapJXMapKit.gridwidth = 8;
- gbc_mapJXMapKit.gridx = 4;
- gbc_mapJXMapKit.gridy = 8;
- busStopPanel.add(mapJXMapKit, gbc_mapJXMapKit);
- mapJXMapKit.setTileFactory(osmTf);//comment out to use gui designer
+ gridBagConstraints = new java.awt.GridBagConstraints();
+ gridBagConstraints.gridx = 2;
+ gridBagConstraints.gridy = 2;
+ gridBagConstraints.gridheight = 2;
+ gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
+ gridBagConstraints.insets = new java.awt.Insets(0, 0, 5, 5);
+ busStopPanel.add(StopLabelPanel, gridBagConstraints);
+
+ jLabel15.setIcon(generateImageIcon(matchColor));
+ jLabel15.setText("Potential Match Stops");
+ jLabel15.setName("jLabel15"); // NOI18N
+ jLabel15.setOpaque(true);
+ gridBagConstraints = new java.awt.GridBagConstraints();
+ gridBagConstraints.gridx = 10;
+ gridBagConstraints.gridy = 6;
+ gridBagConstraints.gridwidth = 2;
+ gridBagConstraints.anchor = java.awt.GridBagConstraints.SOUTHWEST;
+ gridBagConstraints.insets = new java.awt.Insets(0, 0, 5, 0);
+ busStopPanel.add(jLabel15, gridBagConstraints);
+
+ jLabel16.setIcon(generateImageIcon(selectedOSMColor));
+ jLabel16.setText("Selected Osm Stop");
+ jLabel16.setName("jLabel16"); // NOI18N
+ jLabel16.setOpaque(true);
+ gridBagConstraints = new java.awt.GridBagConstraints();
+ gridBagConstraints.gridx = 7;
+ gridBagConstraints.gridy = 7;
+ gridBagConstraints.gridwidth = 4;
+ gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
+ gridBagConstraints.insets = new java.awt.Insets(0, 0, 5, 5);
+ busStopPanel.add(jLabel16, gridBagConstraints);
+
+ jLabel17.setIcon(generateImageIcon(selectedGTFSColor));
+ jLabel17.setText("Selected Gtfs Stop");
+ jLabel17.setName("jLabel17"); // NOI18N
+ jLabel17.setOpaque(true);
+ gridBagConstraints = new java.awt.GridBagConstraints();
+ gridBagConstraints.gridx = 10;
+ gridBagConstraints.gridy = 7;
+ gridBagConstraints.gridwidth = 2;
+ gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
+ gridBagConstraints.insets = new java.awt.Insets(0, 0, 5, 0);
+ busStopPanel.add(jLabel17, gridBagConstraints);
+
+ jLabel18.setIcon(new javax.swing.ImageIcon(getClass().getResource("/bus_icon.png"))); // NOI18N
+ jLabel18.setText("New Stop");
+ jLabel18.setName("jLabel18"); // NOI18N
+ gridBagConstraints = new java.awt.GridBagConstraints();
+ gridBagConstraints.gridx = 7;
+ gridBagConstraints.gridy = 6;
+ gridBagConstraints.gridwidth = 2;
+ gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
+ gridBagConstraints.anchor = java.awt.GridBagConstraints.SOUTH;
+ gridBagConstraints.insets = new java.awt.Insets(0, 0, 5, 5);
+ busStopPanel.add(jLabel18, gridBagConstraints);
+
+ searchButton.setFont(new java.awt.Font("Times New Roman", 0, 14)); // NOI18N
+ searchButton.setText("Search");
+ searchButton.setIconTextGap(2);
+ searchButton.setMargin(new java.awt.Insets(2, 7, 2, 7));
+ searchButton.setName("searchButton"); // NOI18N
+ searchButton.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(java.awt.event.ActionEvent evt) {
+ searchButtonActionPerformed(evt);
+ }
+ });
+ gridBagConstraints = new java.awt.GridBagConstraints();
+ gridBagConstraints.gridx = 11;
+ gridBagConstraints.gridy = 1;
+ gridBagConstraints.anchor = java.awt.GridBagConstraints.SOUTHWEST;
+ gridBagConstraints.insets = new java.awt.Insets(0, 0, 5, 0);
+ busStopPanel.add(searchButton, gridBagConstraints);
+ searchTextField.setToolTipText("Input stop name or stop id to search for stop");
+ searchTextField.setMinimumSize(new java.awt.Dimension(60, 20));
+ searchTextField.setName("searchTextField"); // NOI18N
+ gridBagConstraints = new java.awt.GridBagConstraints();
+ gridBagConstraints.gridx = 10;
+ gridBagConstraints.gridy = 1;
+ gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
+ gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTH;
+ gridBagConstraints.insets = new java.awt.Insets(0, 0, 5, 5);
+ busStopPanel.add(searchTextField, gridBagConstraints);
+
+ finishProgressBar.setToolTipText("\nStops that you should visit before uploading into OSM
\nThese stops are either new stops that GO_Sync can't find a match for in OSM or existing stops in OSM that have new data to be inserted.\n"); // NOI18N
+ finishProgressBar.setName("finishProgressBar"); // NOI18N
+ finishProgressBar.setString("0"); // NOI18N
+ finishProgressBar.setStringPainted(true);
+ gridBagConstraints = new java.awt.GridBagConstraints();
+ gridBagConstraints.gridx = 2;
+ gridBagConstraints.gridy = 0;
+ gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
+ gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTH;
+ gridBagConstraints.insets = new java.awt.Insets(0, 0, 5, 5);
+ busStopPanel.add(finishProgressBar, gridBagConstraints);
+
+ jLabel19.setFont(new java.awt.Font("Times New Roman", 0, 14)); // NOI18N
+ jLabel19.setText("Finish");
+ jLabel19.setName("jLabel19"); // NOI18N
+ gridBagConstraints = new java.awt.GridBagConstraints();
+ gridBagConstraints.gridx = 0;
+ gridBagConstraints.gridy = 0;
+ gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHEAST;
+ gridBagConstraints.insets = new java.awt.Insets(0, 0, 5, 5);
+ busStopPanel.add(jLabel19, gridBagConstraints);
+
+ lastEditedLabel.setFont(new java.awt.Font("Times New Roman", 0, 14)); // NOI18N
+ lastEditedLabel.setText("N/A");
+ lastEditedLabel.setName("lastEditedLabel"); // NOI18N
+ gridBagConstraints = new java.awt.GridBagConstraints();
+ gridBagConstraints.gridx = 6;
+ gridBagConstraints.gridy = 4;
+ gridBagConstraints.gridwidth = 6;
+ gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
+ gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTH;
+ gridBagConstraints.insets = new java.awt.Insets(0, 0, 5, 0);
+ busStopPanel.add(lastEditedLabel, gridBagConstraints);
+
+ dontupremainButton.setText("Don't Up Remain");
+ dontupremainButton.setName("dontupremainButton"); // NOI18N
+ dontupremainButton.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(java.awt.event.ActionEvent evt) {
+ donotUploadRemainingButtonActionPerformed(evt);
+ }
+ });
+ gridBagConstraints = new java.awt.GridBagConstraints();
+ gridBagConstraints.gridx = 3;
+ gridBagConstraints.gridy = 0;
+ gridBagConstraints.gridwidth = 2;
+ gridBagConstraints.insets = new java.awt.Insets(0, 0, 5, 5);
+ busStopPanel.add(dontupremainButton, gridBagConstraints);
+
+ dontuploadAllBtn.setText("Don't Up All");
+ dontuploadAllBtn.setName("dontuploadAllBtn"); // NOI18N
+ dontuploadAllBtn.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(java.awt.event.ActionEvent evt) {
+ dontuploadAllBtnActionPerformed(evt);
+ }
+ });
+ gridBagConstraints = new java.awt.GridBagConstraints();
+ gridBagConstraints.gridx = 3;
+ gridBagConstraints.gridy = 1;
+ gridBagConstraints.gridwidth = 2;
+ gridBagConstraints.insets = new java.awt.Insets(0, 0, 5, 5);
+ busStopPanel.add(dontuploadAllBtn, gridBagConstraints);
+
+ nextButton.setFont(new java.awt.Font("Times New Roman", 0, 12)); // NOI18N
+ nextButton.setText("next");
+ nextButton.setName("nextButton"); // NOI18N
+ nextButton.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(java.awt.event.ActionEvent evt) {
+ nextButtonActionPerformed(evt);
+ }
+ });
+ gridBagConstraints = new java.awt.GridBagConstraints();
+ gridBagConstraints.gridx = 7;
+ gridBagConstraints.gridy = 1;
+ gridBagConstraints.insets = new java.awt.Insets(0, 0, 5, 5);
+ busStopPanel.add(nextButton, gridBagConstraints);
jTabbedPane1.addTab("Bus Stop", busStopPanel);
- busRoutePanel.setFont(new java.awt.Font("Tahoma", 0, 14));
- busRoutePanel.setName("jPanel2");
- GridBagLayout gbl_busRoutePanel = new GridBagLayout();
- gbl_busRoutePanel.columnWidths = new int[]{216, 46, 23, 22, 3, 120, 3};
- gbl_busRoutePanel.columnWeights = new double[]{0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, Double.MIN_VALUE};
- gbl_busRoutePanel.rowHeights = new int[]{21, 23, 25, 25, 25, 85, 25, 34, 25, 25, 223,};
- gbl_busRoutePanel.rowWeights = new double[]{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, Double.MIN_VALUE};
- busRoutePanel.setLayout(gbl_busRoutePanel);
- existingRoutesWithUpdatesRadioButton = new javax.swing.JRadioButton();
+ busRoutePanel.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
+ busRoutePanel.setName("busRoutePanel"); // NOI18N
+ java.awt.GridBagLayout busRoutePanelLayout = new java.awt.GridBagLayout();
+ busRoutePanelLayout.columnWidths = new int[] {0, 46, 0, 46, 0, 46, 0, 46, 0};
+ busRoutePanelLayout.rowHeights = new int[] {0, 23, 0, 23, 0, 23, 0, 23, 0, 23, 0, 23, 0};
+ busRoutePanelLayout.columnWeights = new double[] {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 4.9E-324};
+ busRoutePanelLayout.rowWeights = new double[] {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 4.9E-324};
+ busRoutePanel.setLayout(busRoutePanelLayout);
+
+ osmRoutesLabel.setFont(new java.awt.Font("Times New Roman", 1, 18)); // NOI18N
+ osmRoutesLabel.setText("OSM Routes");
+ osmRoutesLabel.setName("osmRoutesLabel"); // NOI18N
+ gridBagConstraints = new java.awt.GridBagConstraints();
+ gridBagConstraints.gridx = 2;
+ gridBagConstraints.gridy = 0;
+ gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
+ gridBagConstraints.insets = new java.awt.Insets(0, 0, 5, 5);
+ busRoutePanel.add(osmRoutesLabel, gridBagConstraints);
+
+ gtfsRoutesComboBox.setFont(new java.awt.Font("Times New Roman", 1, 14)); // NOI18N
+ gtfsRoutesComboBox.setMinimumSize(new java.awt.Dimension(200, 20));
+ gtfsRoutesComboBox.setName("gtfsRoutesComboBox"); // NOI18N
+ gtfsRoutesComboBox.setPreferredSize(new java.awt.Dimension(200, 20));
+ gtfsRoutesComboBox.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(java.awt.event.ActionEvent evt) {
+ gtfsRoutesComboBoxActionPerformed(evt);
+ }
+ });
+ gridBagConstraints = new java.awt.GridBagConstraints();
+ gridBagConstraints.gridx = 1;
+ gridBagConstraints.gridy = 1;
+ gridBagConstraints.fill = java.awt.GridBagConstraints.VERTICAL;
+ gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
+ gridBagConstraints.insets = new java.awt.Insets(0, 0, 5, 5);
+ busRoutePanel.add(gtfsRoutesComboBox, gridBagConstraints);
+
+ jLabel8.setFont(new java.awt.Font("Times New Roman", 1, 18)); // NOI18N
+ jLabel8.setText("Total Routes:");
+ jLabel8.setName("jLabel8"); // NOI18N
+ gridBagConstraints = new java.awt.GridBagConstraints();
+ gridBagConstraints.gridx = 4;
+ gridBagConstraints.gridy = 0;
+ gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
+ gridBagConstraints.insets = new java.awt.Insets(0, 0, 5, 5);
+ busRoutePanel.add(jLabel8, gridBagConstraints);
+
+ totalGtfsRoutesLabel.setFont(new java.awt.Font("Times New Roman", 0, 14)); // NOI18N
+ totalGtfsRoutesLabel.setText("N/A"); // NOI18N
+ totalGtfsRoutesLabel.setName("totalGtfsRoutesLabel"); // NOI18N
+ gridBagConstraints = new java.awt.GridBagConstraints();
+ gridBagConstraints.gridx = 4;
+ gridBagConstraints.gridy = 1;
+ gridBagConstraints.insets = new java.awt.Insets(0, 0, 5, 5);
+ busRoutePanel.add(totalGtfsRoutesLabel, gridBagConstraints);
+
+ jLabel9.setFont(new java.awt.Font("Times New Roman", 1, 18)); // NOI18N
+ jLabel9.setText("Routes to view:");
+ jLabel9.setName("jLabel9"); // NOI18N
+ gridBagConstraints = new java.awt.GridBagConstraints();
+ gridBagConstraints.gridx = 0;
+ gridBagConstraints.gridy = 1;
+ gridBagConstraints.insets = new java.awt.Insets(0, 0, 5, 5);
+ busRoutePanel.add(jLabel9, gridBagConstraints);
- routesButtonGroup.add(existingRoutesWithUpdatesRadioButton);
- existingRoutesWithUpdatesRadioButton.setFont(new java.awt.Font("Times New Roman", 0, 14));
- existingRoutesWithUpdatesRadioButton.setText("Existing routes with Updates");
- existingRoutesWithUpdatesRadioButton.setName("existingRoutesWithUpdatesRadioButton"); // NOI18N
- existingRoutesWithUpdatesRadioButton.addActionListener(new java.awt.event.ActionListener() {
- public void actionPerformed(java.awt.event.ActionEvent evt) {
- existingRoutesWithUpdatesRadioButtonActionPerformed(evt);
- }
- });
- jLabel6 = new javax.swing.JLabel();
-
- jLabel6.setFont(new java.awt.Font("Times New Roman", 1, 18));
- jLabel6.setText("GTFS Routes");
- jLabel6.setName("jLabel6"); // NOI18N
- GridBagConstraints gbc_jLabel6 = new GridBagConstraints();
- gbc_jLabel6.anchor = GridBagConstraints.WEST;
- gbc_jLabel6.insets = new Insets(0, 0, 5, 5);
- gbc_jLabel6.gridwidth = 2;
- gbc_jLabel6.gridx = 1;
- gbc_jLabel6.gridy = 0;
- busRoutePanel.add(jLabel6, gbc_jLabel6);
- jLabel8 = new javax.swing.JLabel();
-
- jLabel8.setFont(new java.awt.Font("Times New Roman", 1, 18));
- jLabel8.setText("Total Routes:");
- jLabel8.setName("jLabel8"); // NOI18N
- GridBagConstraints gbc_jLabel8 = new GridBagConstraints();
- gbc_jLabel8.anchor = GridBagConstraints.NORTHWEST;
- gbc_jLabel8.insets = new Insets(0, 0, 5, 5);
- gbc_jLabel8.gridx = 4;
- gbc_jLabel8.gridy = 0;
- busRoutePanel.add(jLabel8, gbc_jLabel8);
- jLabel9 = new javax.swing.JLabel();
-
- jLabel9.setFont(new java.awt.Font("Times New Roman", 1, 18));
- jLabel9.setText("Routes to view:");
- jLabel9.setName("jLabel9"); // NOI18N
- GridBagConstraints gbc_jLabel9 = new GridBagConstraints();
- gbc_jLabel9.insets = new Insets(0, 0, 5, 5);
- gbc_jLabel9.gridx = 0;
- gbc_jLabel9.gridy = 1;
- busRoutePanel.add(jLabel9, gbc_jLabel9);
- newRoutesRadioButton = new javax.swing.JRadioButton();
+ routesButtonGroup.add(allRoutesRadioButton);
+ allRoutesRadioButton.setFont(new java.awt.Font("Times New Roman", 0, 14)); // NOI18N
+ allRoutesRadioButton.setSelected(true);
+ allRoutesRadioButton.setText("All");
+ allRoutesRadioButton.setName("allRoutesRadioButton"); // NOI18N
+ allRoutesRadioButton.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(java.awt.event.ActionEvent evt) {
+ allRoutesRadioButtonActionPerformed(evt);
+ }
+ });
+ gridBagConstraints = new java.awt.GridBagConstraints();
+ gridBagConstraints.gridx = 0;
+ gridBagConstraints.gridy = 5;
+ gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
+ gridBagConstraints.insets = new java.awt.Insets(0, 0, 5, 5);
+ busRoutePanel.add(allRoutesRadioButton, gridBagConstraints);
routesButtonGroup.add(newRoutesRadioButton);
- newRoutesRadioButton.setFont(new java.awt.Font("Times New Roman", 0, 14));
- newRoutesRadioButton.setText("New GTFS routes"); // NOI18N
- newRoutesRadioButton.setName("newRoutesRadioButton"); // NOI18N
- newRoutesRadioButton.addActionListener(new java.awt.event.ActionListener() {
- public void actionPerformed(java.awt.event.ActionEvent evt) {
- newRoutesRadioButtonActionPerformed(evt);
- }
- });
- gtfsRoutesComboBox = new javax.swing.JComboBox(gtfsStops);
-
- gtfsRoutesComboBox.setFont(new java.awt.Font("Times New Roman", 1, 14));
- gtfsRoutesComboBox.setMinimumSize(new Dimension(100, 20));
- gtfsRoutesComboBox.setName("gtfsRoutesComboBox"); // NOI18N
- gtfsRoutesComboBox.setPreferredSize(new Dimension(100, 20));
- gtfsRoutesComboBox.addActionListener(new java.awt.event.ActionListener() {
- public void actionPerformed(java.awt.event.ActionEvent evt) {
- gtfsRoutesComboBoxActionPerformed(evt);
- }
- });
- GridBagConstraints gbc_gtfsRoutesComboBox = new GridBagConstraints();
- gbc_gtfsRoutesComboBox.anchor = GridBagConstraints.WEST;
- gbc_gtfsRoutesComboBox.fill = GridBagConstraints.VERTICAL;
- gbc_gtfsRoutesComboBox.insets = new Insets(0, 0, 5, 5);
- gbc_gtfsRoutesComboBox.gridx = 1;
- gbc_gtfsRoutesComboBox.gridy = 1;
- busRoutePanel.add(gtfsRoutesComboBox, gbc_gtfsRoutesComboBox);
- totalGtfsRoutesLabel = new javax.swing.JLabel();
-
- totalGtfsRoutesLabel.setFont(new java.awt.Font("Times New Roman", 0, 14));
- totalGtfsRoutesLabel.setText("N/A"); // NOI18N
- totalGtfsRoutesLabel.setName("totalGtfsRoutesLabel"); // NOI18N
- GridBagConstraints gbc_totalGtfsRoutesLabel = new GridBagConstraints();
- gbc_totalGtfsRoutesLabel.insets = new Insets(0, 0, 5, 5);
- gbc_totalGtfsRoutesLabel.gridx = 4;
- gbc_totalGtfsRoutesLabel.gridy = 1;
- busRoutePanel.add(totalGtfsRoutesLabel, gbc_totalGtfsRoutesLabel);
- GridBagConstraints gbc_newRoutesRadioButton = new GridBagConstraints();
- gbc_newRoutesRadioButton.anchor = GridBagConstraints.NORTH;
- gbc_newRoutesRadioButton.fill = GridBagConstraints.HORIZONTAL;
- gbc_newRoutesRadioButton.insets = new Insets(0, 0, 5, 5);
- gbc_newRoutesRadioButton.gridx = 0;
- gbc_newRoutesRadioButton.gridy = 2;
- busRoutePanel.add(newRoutesRadioButton, gbc_newRoutesRadioButton);
- jScrollPane4 = new javax.swing.JScrollPane();
- routeTable = new JTable(){
- public String getToolTipText(MouseEvent e){
- String tip = null;
- java.awt.Point p = e.getPoint();
- int rowIndex = rowAtPoint(p);
- int colIndex = columnAtPoint(p);
- int realColumnIndex = convertColumnIndexToModel(colIndex);
- int realRowIndex = convertRowIndexToModel(rowIndex);
-
- TableModel model = this.getModel();
- if((model instanceof TagReportTableModel) && (realRowIndex>=0) && (realColumnIndex>=0)){
- Object o = model.getValueAt(realRowIndex, realColumnIndex);
- if(o instanceof String) tip = (String)o;
- }
- return tip;//"This is the first line
This is the second line";
- }
+ newRoutesRadioButton.setFont(new java.awt.Font("Times New Roman", 0, 14)); // NOI18N
+ newRoutesRadioButton.setText("New GTFS routes"); // NOI18N
+ newRoutesRadioButton.setName("newRoutesRadioButton"); // NOI18N
+ newRoutesRadioButton.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(java.awt.event.ActionEvent evt) {
+ newRoutesRadioButtonActionPerformed(evt);
+ }
+ });
+ gridBagConstraints = new java.awt.GridBagConstraints();
+ gridBagConstraints.gridx = 0;
+ gridBagConstraints.gridy = 2;
+ gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
+ gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTH;
+ gridBagConstraints.insets = new java.awt.Insets(0, 0, 5, 5);
+ busRoutePanel.add(newRoutesRadioButton, gridBagConstraints);
- protected JTableHeader createDefaultTableHeader() {
- return new JTableHeader(columnModel) {
- public String getToolTipText(MouseEvent e) {
- String tip = null;
- java.awt.Point p = e.getPoint();
- int index = columnModel.getColumnIndexAtX(p.x);
- int realIndex =
- columnModel.getColumn(index).getModelIndex();
- return tagReportColumnHeaderToolTips[realIndex];
- }
- };
- }
- };
- routeTable.setDefaultRenderer(Object.class, new edu.usf.cutr.go_sync.gui.object.TagReportTableCellRenderer());
- routeTable.addMouseListener(new BooleanMouseListener(routeTable));
+ routesButtonGroup.add(existingRoutesWithUpdatesRadioButton);
+ existingRoutesWithUpdatesRadioButton.setFont(new java.awt.Font("Times New Roman", 0, 14)); // NOI18N
+ existingRoutesWithUpdatesRadioButton.setText("Existing routes with Updates");
+ existingRoutesWithUpdatesRadioButton.setName("existingRoutesWithUpdatesRadioButton"); // NOI18N
+ existingRoutesWithUpdatesRadioButton.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(java.awt.event.ActionEvent evt) {
+ existingRoutesWithUpdatesRadioButtonActionPerformed(evt);
+ }
+ });
+ gridBagConstraints = new java.awt.GridBagConstraints();
+ gridBagConstraints.gridx = 0;
+ gridBagConstraints.gridy = 3;
+ gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
+ gridBagConstraints.insets = new java.awt.Insets(0, 0, 5, 5);
+ busRoutePanel.add(existingRoutesWithUpdatesRadioButton, gridBagConstraints);
- jScrollPane4.setName("jScrollPane4"); // NOI18N
+ routesButtonGroup.add(existingRoutesRadioButton);
+ existingRoutesRadioButton.setFont(new java.awt.Font("Times New Roman", 0, 14)); // NOI18N
+ existingRoutesRadioButton.setText("Existing routes");
+ existingRoutesRadioButton.setName("existingRoutesRadioButton"); // NOI18N
+ existingRoutesRadioButton.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(java.awt.event.ActionEvent evt) {
+ existingRoutesRadioButtonActionPerformed(evt);
+ }
+ });
+ gridBagConstraints = new java.awt.GridBagConstraints();
+ gridBagConstraints.gridx = 0;
+ gridBagConstraints.gridy = 4;
+ gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
+ gridBagConstraints.insets = new java.awt.Insets(0, 0, 5, 5);
+ busRoutePanel.add(existingRoutesRadioButton, gridBagConstraints);
+
+ jLabel10.setFont(new java.awt.Font("Times New Roman", 1, 18)); // NOI18N
+ jLabel10.setText("General Information");
+ jLabel10.setName("jLabel10"); // NOI18N
+ gridBagConstraints = new java.awt.GridBagConstraints();
+ gridBagConstraints.gridx = 0;
+ gridBagConstraints.gridy = 8;
+ gridBagConstraints.gridheight = 2;
+ gridBagConstraints.insets = new java.awt.Insets(0, 0, 5, 5);
+ busRoutePanel.add(jLabel10, gridBagConstraints);
- routeTable.setFont(new java.awt.Font("Times New Roman", 0, 14));
- routeTable.setModel(routeTableModel);
- routeTable.setName("routeTable"); // NOI18N
- routeTable.setSelectionForeground(new java.awt.Color(0, 0, 0));
- routeTable.getTableHeader().setReorderingAllowed(false);
- jScrollPane4.setViewportView(routeTable);
-
- GridBagConstraints gbc_jScrollPane4 = new GridBagConstraints();
- gbc_jScrollPane4.fill = GridBagConstraints.BOTH;
- gbc_jScrollPane4.insets = new Insets(0, 0, 5, 0);
- gbc_jScrollPane4.gridheight = 4;
- gbc_jScrollPane4.gridwidth = 7;
- gbc_jScrollPane4.gridx = 1;
- gbc_jScrollPane4.gridy = 2;
- busRoutePanel.add(jScrollPane4, gbc_jScrollPane4);
- GridBagConstraints gbc_existingRoutesWithUpdatesRadioButton = new GridBagConstraints();
- gbc_existingRoutesWithUpdatesRadioButton.anchor = GridBagConstraints.NORTHWEST;
- gbc_existingRoutesWithUpdatesRadioButton.insets = new Insets(0, 0, 5, 5);
- gbc_existingRoutesWithUpdatesRadioButton.gridx = 0;
- gbc_existingRoutesWithUpdatesRadioButton.gridy = 3;
- busRoutePanel.add(existingRoutesWithUpdatesRadioButton, gbc_existingRoutesWithUpdatesRadioButton);
- saveChangeRouteButton = new javax.swing.JButton();
+ jScrollPane3.setName("jScrollPane3"); // NOI18N
- saveChangeRouteButton.setText("Accept");
- saveChangeRouteButton.setEnabled(true);
- saveChangeRouteButton.setName("saveChangeRouteButton"); // NOI18N
- saveChangeRouteButton.addActionListener(new java.awt.event.ActionListener() {
- public void actionPerformed(java.awt.event.ActionEvent evt) {
- saveChangeRouteButtonActionPerformed(evt);
- }
- });
- existingRoutesRadioButton = new javax.swing.JRadioButton();
+ generalInformationRouteTextArea.setEditable(false);
+ generalInformationRouteTextArea.setColumns(20);
+ generalInformationRouteTextArea.setLineWrap(true);
+ generalInformationRouteTextArea.setRows(5);
+ generalInformationRouteTextArea.setWrapStyleWord(true);
+ generalInformationRouteTextArea.setName("generalInformationRouteTextArea"); // NOI18N
+ jScrollPane3.setViewportView(generalInformationRouteTextArea);
+
+ gridBagConstraints = new java.awt.GridBagConstraints();
+ gridBagConstraints.gridx = 0;
+ gridBagConstraints.gridy = 10;
+ gridBagConstraints.gridheight = 2;
+ gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
+ gridBagConstraints.insets = new java.awt.Insets(0, 0, 0, 5);
+ busRoutePanel.add(jScrollPane3, gridBagConstraints);
- routesButtonGroup.add(existingRoutesRadioButton);
- existingRoutesRadioButton.setFont(new java.awt.Font("Times New Roman", 0, 14));
- existingRoutesRadioButton.setText("Existing routes");
- existingRoutesRadioButton.setName("existingRoutesRadioButton"); // NOI18N
- existingRoutesRadioButton.addActionListener(new java.awt.event.ActionListener() {
- public void actionPerformed(java.awt.event.ActionEvent evt) {
- existingRoutesRadioButtonActionPerformed(evt);
- }
- });
- GridBagConstraints gbc_existingRoutesRadioButton = new GridBagConstraints();
- gbc_existingRoutesRadioButton.anchor = GridBagConstraints.NORTHWEST;
- gbc_existingRoutesRadioButton.insets = new Insets(0, 0, 5, 5);
- gbc_existingRoutesRadioButton.gridx = 0;
- gbc_existingRoutesRadioButton.gridy = 4;
- busRoutePanel.add(existingRoutesRadioButton, gbc_existingRoutesRadioButton);
- allRoutesRadioButton = new javax.swing.JRadioButton();
+ jScrollPane4.setName("jScrollPane4"); // NOI18N
- routesButtonGroup.add(allRoutesRadioButton);
- allRoutesRadioButton.setFont(new java.awt.Font("Times New Roman", 0, 14));
- allRoutesRadioButton.setSelected(true);
- allRoutesRadioButton.setText("All");
- allRoutesRadioButton.setName("allRoutesRadioButton"); // NOI18N
- allRoutesRadioButton.addActionListener(new java.awt.event.ActionListener() {
- public void actionPerformed(java.awt.event.ActionEvent evt) {
- allRoutesRadioButtonActionPerformed(evt);
- }
- });
- GridBagConstraints gbc_allRoutesRadioButton = new GridBagConstraints();
- gbc_allRoutesRadioButton.anchor = GridBagConstraints.NORTHWEST;
- gbc_allRoutesRadioButton.insets = new Insets(0, 0, 5, 5);
- gbc_allRoutesRadioButton.gridx = 0;
- gbc_allRoutesRadioButton.gridy = 5;
- busRoutePanel.add(allRoutesRadioButton, gbc_allRoutesRadioButton);
- GridBagConstraints gbc_saveChangeRouteButton = new GridBagConstraints();
- gbc_saveChangeRouteButton.anchor = GridBagConstraints.NORTHWEST;
- gbc_saveChangeRouteButton.insets = new Insets(0, 0, 5, 5);
- gbc_saveChangeRouteButton.gridwidth = 3;
- gbc_saveChangeRouteButton.gridx = 4;
- gbc_saveChangeRouteButton.gridy = 6;
- busRoutePanel.add(saveChangeRouteButton, gbc_saveChangeRouteButton);
- jLabel10 = new javax.swing.JLabel();
+ routeTable.setFont(new java.awt.Font("Times New Roman", 0, 14)); // NOI18N
+ routeTable.setModel(routeTableModel);
+ routeTable.setName("routeTable"); // NOI18N
+ routeTable.getTableHeader().setReorderingAllowed(false);
+ jScrollPane4.setViewportView(routeTable);
+
+ gridBagConstraints = new java.awt.GridBagConstraints();
+ gridBagConstraints.gridx = 1;
+ gridBagConstraints.gridy = 2;
+ gridBagConstraints.gridwidth = 7;
+ gridBagConstraints.gridheight = 4;
+ gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
+ gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTH;
+ gridBagConstraints.weighty = 0.1;
+ gridBagConstraints.insets = new java.awt.Insets(0, 0, 5, 0);
+ busRoutePanel.add(jScrollPane4, gridBagConstraints);
- jLabel10.setFont(new java.awt.Font("Times New Roman", 1, 18));
- jLabel10.setText("General Information");
- jLabel10.setName("jLabel10"); // NOI18N
- GridBagConstraints gbc_jLabel10 = new GridBagConstraints();
- gbc_jLabel10.insets = new Insets(0, 0, 5, 5);
- gbc_jLabel10.gridheight = 2;
- gbc_jLabel10.gridx = 0;
- gbc_jLabel10.gridy = 8;
- busRoutePanel.add(jLabel10, gbc_jLabel10);
- jLabel11 = new javax.swing.JLabel();
+ jMemberScrollPane5.setName("jMemberScrollPane5"); // NOI18N
- jLabel11.setFont(new java.awt.Font("Times New Roman", 1, 18));
- jLabel11.setText("Members to view:");
- jLabel11.setName("jLabel11"); // NOI18N
- GridBagConstraints gbc_jLabel11 = new GridBagConstraints();
- gbc_jLabel11.anchor = GridBagConstraints.WEST;
- gbc_jLabel11.insets = new Insets(0, 0, 5, 5);
- gbc_jLabel11.gridheight = 2;
- gbc_jLabel11.gridx = 1;
- gbc_jLabel11.gridy = 8;
- busRoutePanel.add(jLabel11, gbc_jLabel11);
- allMembersRadioButton = new javax.swing.JRadioButton();
+ memberTable.setFont(new java.awt.Font("Times New Roman", 0, 14)); // NOI18N
+ memberTable.setModel(stopTableModel);
+ memberTable.setName("memberTable"); // NOI18N
+ memberTable.getTableHeader().setReorderingAllowed(false);
+ jMemberScrollPane5.setViewportView(memberTable);
+
+ gridBagConstraints = new java.awt.GridBagConstraints();
+ gridBagConstraints.gridx = 1;
+ gridBagConstraints.gridy = 10;
+ gridBagConstraints.gridwidth = 7;
+ gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
+ gridBagConstraints.weighty = 0.1;
+ gridBagConstraints.insets = new java.awt.Insets(0, 0, 5, 0);
+ busRoutePanel.add(jMemberScrollPane5, gridBagConstraints);
+
+ jLabel11.setFont(new java.awt.Font("Times New Roman", 1, 18)); // NOI18N
+ jLabel11.setText("Members to view:");
+ jLabel11.setName("jLabel11"); // NOI18N
+ gridBagConstraints = new java.awt.GridBagConstraints();
+ gridBagConstraints.gridx = 1;
+ gridBagConstraints.gridy = 8;
+ gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
+ gridBagConstraints.insets = new java.awt.Insets(0, 0, 5, 5);
+ busRoutePanel.add(jLabel11, gridBagConstraints);
membersButtonGroup.add(allMembersRadioButton);
- allMembersRadioButton.setFont(new java.awt.Font("Times New Roman", 0, 14));
- allMembersRadioButton.setSelected(true);
- allMembersRadioButton.setText("All");
- allMembersRadioButton.setName("allMembersRadioButton"); // NOI18N
- allMembersRadioButton.addActionListener(new java.awt.event.ActionListener() {
- public void actionPerformed(java.awt.event.ActionEvent evt) {
- allMembersRadioButtonActionPerformed(evt);
- }
- });
- GridBagConstraints gbc_allMembersRadioButton = new GridBagConstraints();
- gbc_allMembersRadioButton.anchor = GridBagConstraints.NORTHWEST;
- gbc_allMembersRadioButton.insets = new Insets(0, 0, 5, 5);
- gbc_allMembersRadioButton.gridwidth = 1;
- gbc_allMembersRadioButton.gridx = 3;
- gbc_allMembersRadioButton.gridy = 8;
- busRoutePanel.add(allMembersRadioButton, gbc_allMembersRadioButton);
- osmMembersRadioButton = new javax.swing.JRadioButton();
+ allMembersRadioButton.setFont(new java.awt.Font("Times New Roman", 0, 14)); // NOI18N
+ allMembersRadioButton.setSelected(true);
+ allMembersRadioButton.setText("All");
+ allMembersRadioButton.setActionCommand("all");
+ allMembersRadioButton.setName("allMembersRadioButton"); // NOI18N
+ allMembersRadioButton.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(java.awt.event.ActionEvent evt) {
+ allMembersRadioButtonActionPerformed(evt);
+ }
+ });
+ gridBagConstraints = new java.awt.GridBagConstraints();
+ gridBagConstraints.gridx = 3;
+ gridBagConstraints.gridy = 8;
+ gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
+ gridBagConstraints.insets = new java.awt.Insets(0, 0, 5, 5);
+ busRoutePanel.add(allMembersRadioButton, gridBagConstraints);
membersButtonGroup.add(osmMembersRadioButton);
- osmMembersRadioButton.setFont(new java.awt.Font("Times New Roman", 0, 14));
- osmMembersRadioButton.setText("From OSM only"); // NOI18N
- osmMembersRadioButton.setName("osmMembersRadioButton"); // NOI18N
- osmMembersRadioButton.addActionListener(new java.awt.event.ActionListener() {
- public void actionPerformed(java.awt.event.ActionEvent evt) {
- osmMembersRadioButtonActionPerformed(evt);
- }
- });
- GridBagConstraints gbc_osmMembersRadioButton = new GridBagConstraints();
- gbc_osmMembersRadioButton.anchor = GridBagConstraints.NORTH;
- gbc_osmMembersRadioButton.fill = GridBagConstraints.HORIZONTAL;
- gbc_osmMembersRadioButton.insets = new Insets(0, 0, 5, 5);
- gbc_osmMembersRadioButton.gridwidth = 1;
- gbc_osmMembersRadioButton.gridx = 3;
- gbc_osmMembersRadioButton.gridy = 9;
- busRoutePanel.add(osmMembersRadioButton, gbc_osmMembersRadioButton);
- gtfsMembersRadioButton = new javax.swing.JRadioButton();
+ osmMembersRadioButton.setFont(new java.awt.Font("Times New Roman", 0, 14)); // NOI18N
+ osmMembersRadioButton.setText("From OSM only"); // NOI18N
+ osmMembersRadioButton.setActionCommand("OSM server");
+ osmMembersRadioButton.setName("osmMembersRadioButton"); // NOI18N
+ osmMembersRadioButton.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(java.awt.event.ActionEvent evt) {
+ osmMembersRadioButtonActionPerformed(evt);
+ }
+ });
+ gridBagConstraints = new java.awt.GridBagConstraints();
+ gridBagConstraints.gridx = 3;
+ gridBagConstraints.gridy = 9;
+ gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
+ gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTH;
+ gridBagConstraints.insets = new java.awt.Insets(0, 0, 5, 5);
+ busRoutePanel.add(osmMembersRadioButton, gridBagConstraints);
membersButtonGroup.add(gtfsMembersRadioButton);
- gtfsMembersRadioButton.setFont(new java.awt.Font("Times New Roman", 0, 14));
- gtfsMembersRadioButton.setText("From GTFS only");
- gtfsMembersRadioButton.setName("gtfsMembersRadioButton"); // NOI18N
- gtfsMembersRadioButton.addActionListener(new java.awt.event.ActionListener() {
- public void actionPerformed(java.awt.event.ActionEvent evt) {
- gtfsMembersRadioButtonActionPerformed(evt);
- }
- });
- GridBagConstraints gbc_gtfsMembersRadioButton = new GridBagConstraints();
- gbc_gtfsMembersRadioButton.anchor = GridBagConstraints.NORTHWEST;
- gbc_gtfsMembersRadioButton.insets = new Insets(0, 0, 5, 5);
- gbc_gtfsMembersRadioButton.gridwidth = 1;
- gbc_gtfsMembersRadioButton.gridx = 4;
- gbc_gtfsMembersRadioButton.gridy = 8;
- busRoutePanel.add(gtfsMembersRadioButton, gbc_gtfsMembersRadioButton);
-
- jMemberScrollPane5 = new javax.swing.JScrollPane();
- memberTable = new javax.swing.JTable();
- memberTable.setDefaultRenderer(Object.class, new edu.usf.cutr.go_sync.gui.object.RouteMemberTableCellRenderer());
-
- jMemberScrollPane5.setName("jMemberScrollPane5"); // NOI18N
-
- memberTable.setFont(new java.awt.Font("Times New Roman", 0, 14));
- memberTable.setModel(stopTableModel);
- memberTable.setName("memberTable"); // NOI18N
- memberTable.setSelectionForeground(new java.awt.Color(0, 0, 0));
- memberTable.getTableHeader().setReorderingAllowed(false);
- bothMembersRadioButton = new javax.swing.JRadioButton();
+ gtfsMembersRadioButton.setFont(new java.awt.Font("Times New Roman", 0, 14)); // NOI18N
+ gtfsMembersRadioButton.setText("From GTFS only");
+ gtfsMembersRadioButton.setActionCommand("GTFS dataset");
+ gtfsMembersRadioButton.setName("gtfsMembersRadioButton"); // NOI18N
+ gtfsMembersRadioButton.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(java.awt.event.ActionEvent evt) {
+ gtfsMembersRadioButtonActionPerformed(evt);
+ }
+ });
+ gridBagConstraints = new java.awt.GridBagConstraints();
+ gridBagConstraints.gridx = 4;
+ gridBagConstraints.gridy = 8;
+ gridBagConstraints.anchor = java.awt.GridBagConstraints.SOUTHWEST;
+ gridBagConstraints.insets = new java.awt.Insets(0, 0, 5, 5);
+ busRoutePanel.add(gtfsMembersRadioButton, gridBagConstraints);
membersButtonGroup.add(bothMembersRadioButton);
- bothMembersRadioButton.setFont(new java.awt.Font("Times New Roman", 0, 14));
- bothMembersRadioButton.setText("From both dataset");
- bothMembersRadioButton.setName("bothMembersRadioButton"); // NOI18N
- bothMembersRadioButton.addActionListener(new java.awt.event.ActionListener() {
- public void actionPerformed(java.awt.event.ActionEvent evt) {
- bothMembersRadioButtonActionPerformed(evt);
- }
- });
- GridBagConstraints gbc_bothMembersRadioButton = new GridBagConstraints();
- gbc_bothMembersRadioButton.anchor = GridBagConstraints.NORTHWEST;
- gbc_bothMembersRadioButton.insets = new Insets(0, 0, 5, 5);
- gbc_bothMembersRadioButton.gridwidth = 1;
- gbc_bothMembersRadioButton.gridx = 4;
- gbc_bothMembersRadioButton.gridy = 9;
- busRoutePanel.add(bothMembersRadioButton, gbc_bothMembersRadioButton);
- jScrollPane3 = new javax.swing.JScrollPane();
- generalInformationRouteTextArea = new javax.swing.JTextArea();
-
- jScrollPane3.setName("jScrollPane3"); // NOI18N
-
- generalInformationRouteTextArea.setColumns(20);
- generalInformationRouteTextArea.setLineWrap(true);
- generalInformationRouteTextArea.setRows(5);
- generalInformationRouteTextArea.setWrapStyleWord(true);
- generalInformationRouteTextArea.setName("generalInformationRouteTextArea"); // NOI18N
- jScrollPane3.setViewportView(generalInformationRouteTextArea);
-
- GridBagConstraints gbc_jScrollPane3 = new GridBagConstraints();
- gbc_jScrollPane3.fill = GridBagConstraints.BOTH;
- gbc_jScrollPane3.insets = new Insets(0, 0, 0, 5);
- gbc_jScrollPane3.gridheight = 2;
- gbc_jScrollPane3.gridx = 0;
- gbc_jScrollPane3.gridy = 10;
- busRoutePanel.add(jScrollPane3, gbc_jScrollPane3);
-
-
- jMemberScrollPane5.setViewportView(memberTable);
- GridBagConstraints gbc_jScrollPane5 = new GridBagConstraints();
- gbc_jScrollPane5.fill = GridBagConstraints.BOTH;
- gbc_jScrollPane5.insets = new Insets(0, 0, 5, 0);
- gbc_jScrollPane5.gridwidth = 6;
- gbc_jScrollPane5.gridx = 1;
- gbc_jScrollPane5.gridy = 10;
- busRoutePanel.add(jMemberScrollPane5, gbc_jScrollPane5);
-
- jLabel12 = new javax.swing.JLabel();
- jLabel12.setFont(new java.awt.Font("Times New Roman", 1, 18));
- jLabel12.setText("Total:");
- jLabel12.setName("jLabel12"); // NOI18N
- GridBagConstraints gbc_jLabel12 = new GridBagConstraints();
- gbc_jLabel12.anchor = GridBagConstraints.WEST;
- gbc_jLabel12.insets = new Insets(0, 0, 0, 5);
- gbc_jLabel12.gridx = 1;
- gbc_jLabel12.gridy = 11;
- busRoutePanel.add(jLabel12, gbc_jLabel12);
- totalGtfsMembersLabel = new javax.swing.JLabel();
-
- totalGtfsMembersLabel.setFont(new java.awt.Font("Times New Roman", 0, 14));
- totalGtfsMembersLabel.setText("N/A"); // NOI18N
- totalGtfsMembersLabel.setName("totalGtfsMembersLabel"); // NOI18N
- GridBagConstraints gbc_totalGtfsMembersLabel = new GridBagConstraints();
- gbc_totalGtfsMembersLabel.anchor = GridBagConstraints.WEST;
-// gbc_totalGtfsMembersLabel.fill = GridBagConstraints.VERTICAL;
- gbc_totalGtfsMembersLabel.insets = new Insets(0, 0, 0, 5);
- gbc_totalGtfsMembersLabel.gridx = 2;
- gbc_totalGtfsMembersLabel.gridy = 11;
- busRoutePanel.add(totalGtfsMembersLabel, gbc_totalGtfsMembersLabel);
- totalOsmMembersLabel = new javax.swing.JLabel();
+ bothMembersRadioButton.setFont(new java.awt.Font("Times New Roman", 0, 14)); // NOI18N
+ bothMembersRadioButton.setText("From both dataset");
+ bothMembersRadioButton.setActionCommand("both GTFS dataset and OSM server");
+ bothMembersRadioButton.setName("bothMembersRadioButton"); // NOI18N
+ bothMembersRadioButton.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(java.awt.event.ActionEvent evt) {
+ bothMembersRadioButtonActionPerformed(evt);
+ }
+ });
+ gridBagConstraints = new java.awt.GridBagConstraints();
+ gridBagConstraints.gridx = 4;
+ gridBagConstraints.gridy = 9;
+ gridBagConstraints.insets = new java.awt.Insets(0, 0, 5, 5);
+ busRoutePanel.add(bothMembersRadioButton, gridBagConstraints);
+
+ jLabel12.setFont(new java.awt.Font("Times New Roman", 1, 18)); // NOI18N
+ jLabel12.setText("Total:");
+ jLabel12.setName("jLabel12"); // NOI18N
+ gridBagConstraints = new java.awt.GridBagConstraints();
+ gridBagConstraints.gridx = 1;
+ gridBagConstraints.gridy = 11;
+ gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
+ gridBagConstraints.insets = new java.awt.Insets(0, 0, 0, 5);
+ busRoutePanel.add(jLabel12, gridBagConstraints);
+
+ totalGtfsMembersLabel.setFont(new java.awt.Font("Times New Roman", 0, 14)); // NOI18N
+ totalGtfsMembersLabel.setText("N/A"); // NOI18N
+ totalGtfsMembersLabel.setName("totalGtfsMembersLabel"); // NOI18N
+ gridBagConstraints = new java.awt.GridBagConstraints();
+ gridBagConstraints.gridx = 2;
+ gridBagConstraints.gridy = 11;
+ gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
+ gridBagConstraints.insets = new java.awt.Insets(0, 0, 0, 5);
+ busRoutePanel.add(totalGtfsMembersLabel, gridBagConstraints);
+
+ totalOsmMembersLabel.setFont(new java.awt.Font("Times New Roman", 0, 14)); // NOI18N
+ totalOsmMembersLabel.setText("N/A"); // NOI18N
+ totalOsmMembersLabel.setName("totalOsmMembersLabel"); // NOI18N
+ gridBagConstraints = new java.awt.GridBagConstraints();
+ gridBagConstraints.gridx = 3;
+ gridBagConstraints.gridy = 11;
+ gridBagConstraints.insets = new java.awt.Insets(0, 0, 0, 5);
+ busRoutePanel.add(totalOsmMembersLabel, gridBagConstraints);
+
+ totalNewMembersLabel.setFont(new java.awt.Font("Times New Roman", 0, 14)); // NOI18N
+ totalNewMembersLabel.setText("N/A"); // NOI18N
+ totalNewMembersLabel.setName("totalNewMembersLabel"); // NOI18N
+ gridBagConstraints = new java.awt.GridBagConstraints();
+ gridBagConstraints.gridx = 4;
+ gridBagConstraints.gridy = 11;
+ gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST;
+ busRoutePanel.add(totalNewMembersLabel, gridBagConstraints);
- totalOsmMembersLabel.setFont(new java.awt.Font("Times New Roman", 0, 14));
- totalOsmMembersLabel.setText("N/A"); // NOI18N
- totalOsmMembersLabel.setName("totalOsmMembersLabel"); // NOI18N
- GridBagConstraints gbc_totalOsmMembersLabel = new GridBagConstraints();
- gbc_totalOsmMembersLabel.anchor = GridBagConstraints.CENTER;
-// gbc_totalOsmMembersLabel.fill = GridBagConstraints.VERTICAL;
- gbc_totalOsmMembersLabel.insets = new Insets(0, 0, 0, 5);
- gbc_totalOsmMembersLabel.gridx = 3;
- gbc_totalOsmMembersLabel.gridy = 11;
- busRoutePanel.add(totalOsmMembersLabel, gbc_totalOsmMembersLabel);
+ saveChangeRouteButton.setText("Accept");
+ saveChangeRouteButton.setName("saveChangeRouteButton"); // NOI18N
+ saveChangeRouteButton.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(java.awt.event.ActionEvent evt) {
+ saveChangeRouteButtonActionPerformed(evt);
+ }
+ });
+ gridBagConstraints = new java.awt.GridBagConstraints();
+ gridBagConstraints.gridx = 4;
+ gridBagConstraints.gridy = 6;
+ gridBagConstraints.gridwidth = 3;
+ gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
+ gridBagConstraints.insets = new java.awt.Insets(0, 0, 5, 5);
+ busRoutePanel.add(saveChangeRouteButton, gridBagConstraints);
+
+ jLabel20.setFont(new java.awt.Font("Times New Roman", 1, 18)); // NOI18N
+ jLabel20.setText("GTFS Routes");
+ jLabel20.setName("jLabel20"); // NOI18N
+ gridBagConstraints = new java.awt.GridBagConstraints();
+ gridBagConstraints.gridx = 1;
+ gridBagConstraints.gridy = 0;
+ gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
+ gridBagConstraints.insets = new java.awt.Insets(0, 0, 5, 5);
+ busRoutePanel.add(jLabel20, gridBagConstraints);
+
+ osmRoutesComboBox.setFont(new java.awt.Font("Times New Roman", 1, 14)); // NOI18N
+ osmRoutesComboBox.setMinimumSize(new java.awt.Dimension(150, 20));
+ osmRoutesComboBox.setName("osmRoutesComboBox"); // NOI18N
+ osmRoutesComboBox.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(java.awt.event.ActionEvent evt) {
+ osmRoutesComboBoxActionPerformed(evt);
+ }
+ });
+ gridBagConstraints = new java.awt.GridBagConstraints();
+ gridBagConstraints.gridx = 2;
+ gridBagConstraints.gridy = 1;
+ gridBagConstraints.fill = java.awt.GridBagConstraints.VERTICAL;
+ gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
+ gridBagConstraints.insets = new java.awt.Insets(0, 0, 5, 5);
+ busRoutePanel.add(osmRoutesComboBox, gridBagConstraints);
+
+ membersWarningLabel.setForeground(java.awt.Color.magenta);
+ membersWarningLabel.setText("For members correctness, required GTFS stops must be present in OSM prior to using this feature.");
+ membersWarningLabel.setToolTipText("");
+ membersWarningLabel.setName("membersWarningLabel"); // NOI18N
+ gridBagConstraints = new java.awt.GridBagConstraints();
+ gridBagConstraints.gridx = 1;
+ gridBagConstraints.gridy = 7;
+ gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
+ gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
+ gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
+ busRoutePanel.add(membersWarningLabel, gridBagConstraints);
+
+ newMemberListHasUpdatesLabel.setForeground(java.awt.Color.red);
+ newMemberListHasUpdatesLabel.setText("'New Member List' differs from OSM member list.");
+ newMemberListHasUpdatesLabel.setName("newMemberListHasUpdatesLabel"); // NOI18N
+ gridBagConstraints = new java.awt.GridBagConstraints();
+ gridBagConstraints.gridx = 1;
+ gridBagConstraints.gridy = 9;
+ gridBagConstraints.gridwidth = 2;
+ gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
+ gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
+ busRoutePanel.add(newMemberListHasUpdatesLabel, gridBagConstraints);
jTabbedPane1.addTab("Bus Route", busRoutePanel);
- totalNewMembersLabel = new javax.swing.JLabel();
- totalNewMembersLabel.setFont(new java.awt.Font("Times New Roman", 0, 14));
- totalNewMembersLabel.setText("N/A"); // NOI18N
- totalNewMembersLabel.setName("totalNewMembersLabel"); // NOI18N
- GridBagConstraints gbc_totalNewMembersLabel = new GridBagConstraints();
- gbc_totalNewMembersLabel.anchor = GridBagConstraints.EAST;
-// gbc_totalOsmMembersLabel.fill = GridBagConstraints.VERTICAL;
- gbc_totalNewMembersLabel.gridx = 4;
- gbc_totalNewMembersLabel.gridy = 11;
- busRoutePanel.add(totalNewMembersLabel, gbc_totalNewMembersLabel);
-
-
- stopsCheckbox = new JCheckBox("Stops");stopsCheckbox.setSelected(true);
- routesCheckbox = new JCheckBox("Routes");routesCheckbox.setSelected(true);
- acceptedOnlyCheckbox = new JCheckBox("Only Accepted");acceptedOnlyCheckbox.setSelected(true);
-// routesCheckbox.setMnemonic(KeyEvent.VK_C);
-
-/* routesCheckbox.addActionListener(new java.awt.event.ActionListener() {
- public void actionPerformed(java.awt.event.ActionEvent evt) {
- dummyUploadButtonActionPerformed(evt);
- }
- });*/
-
- dummyUploadButton.setFont(new java.awt.Font("Tahoma", 0, 14));
+ dummyUploadButton.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
dummyUploadButton.setText("Export OSMChange");
dummyUploadButton.setName("dummyUploadButton"); // NOI18N
dummyUploadButton.addActionListener(new java.awt.event.ActionListener() {
@@ -2373,17 +2704,27 @@ public void actionPerformed(java.awt.event.ActionEvent evt) {
}
});
- uploadDataButton.setFont(new java.awt.Font("Tahoma", 0, 14));
+ uploadDataButton.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
uploadDataButton.setText("Upload Data To OSM");
+ uploadDataButton.setEnabled(false);
uploadDataButton.setName("uploadDataButton"); // NOI18N
uploadDataButton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
uploadDataButtonActionPerformed(evt);
}
});
- //TODO remove button
- uploadDataButton.setEnabled(false);
- uploadDataButton.setVisible(false);
+
+ stopsCheckbox.setSelected(true);
+ stopsCheckbox.setText("Stops");
+ stopsCheckbox.setName("stopsCheckbox"); // NOI18N
+
+ routesCheckbox.setSelected(true);
+ routesCheckbox.setText("Routes");
+ routesCheckbox.setName("routesCheckbox"); // NOI18N
+
+ acceptedOnlyCheckbox.setSelected(true);
+ acceptedOnlyCheckbox.setText("Only Accepted");
+ acceptedOnlyCheckbox.setName("acceptedOnlyCheckbox"); // NOI18N
jMenuBar1.setName("jMenuBar1"); // NOI18N
@@ -2455,36 +2796,40 @@ public void actionPerformed(java.awt.event.ActionEvent evt) {
setJMenuBar(jMenuBar1);
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
+ getContentPane().setLayout(layout);
layout.setHorizontalGroup(
- layout.createParallelGroup(Alignment.TRAILING)
- .addGroup(layout.createSequentialGroup()
- .addComponent(stopsCheckbox)
- .addContainerGap(100, Short.MAX_VALUE)
- .addComponent(routesCheckbox)
- .addContainerGap(100, Short.MAX_VALUE)
- .addComponent(acceptedOnlyCheckbox)
- .addContainerGap(100, Short.MAX_VALUE)
- .addComponent(dummyUploadButton)
- .addPreferredGap(ComponentPlacement.UNRELATED)
- .addComponent(uploadDataButton)
- .addGap(218))
- .addComponent(jTabbedPane1, GroupLayout.DEFAULT_SIZE, 771, Short.MAX_VALUE)
+ layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(layout.createSequentialGroup()
+ .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
+ .addComponent(stopsCheckbox)
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
+ .addComponent(routesCheckbox)
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
+ .addComponent(acceptedOnlyCheckbox)
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
+ .addComponent(dummyUploadButton)
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
+ .addComponent(uploadDataButton)
+ .addGap(257, 257, 257))
+ .addComponent(jTabbedPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE)
);
layout.setVerticalGroup(
- layout.createParallelGroup(Alignment.LEADING)
- .addGroup(layout.createSequentialGroup()
- .addComponent(jTabbedPane1, GroupLayout.DEFAULT_SIZE, 676, Short.MAX_VALUE)
- .addPreferredGap(ComponentPlacement.RELATED)
- .addGroup(layout.createParallelGroup(Alignment.BASELINE)
- .addComponent(stopsCheckbox)
- .addComponent(routesCheckbox)
- .addComponent(acceptedOnlyCheckbox)
-
- .addComponent(uploadDataButton)
- .addComponent(dummyUploadButton))
- .addContainerGap())
+ layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(layout.createSequentialGroup()
+ .addComponent(jTabbedPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 676, Short.MAX_VALUE)
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
+ .addComponent(uploadDataButton)
+ .addComponent(dummyUploadButton))
+ .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
+ .addComponent(stopsCheckbox)
+ .addComponent(routesCheckbox)
+ .addComponent(acceptedOnlyCheckbox)))
+ .addContainerGap())
);
- getContentPane().setLayout(layout);
+
+ uploadDataButton.setVisible(false);
pack();
}// //GEN-END:initComponents
@@ -2522,155 +2867,6 @@ private Stop[] removeOneStopFromArray(Stop[] arrayStops, Stop s){
return arrayStops;
- }
-
- private void donotUploadAllButtonActionPerformed(java.awt.event.ActionEvent evt)
- {
-
- System.out.println("upload\tmodify\tdelete\tfinalStops");
- System.out.println(upload.size() + "\t" + modify.size() + "\t" +delete.size() + "\t" +finalStops.size());
-
-
-// GtfsArrayList.remove(o)
- Stop s = (Stop)gtfsStopsComboBox.getSelectedItem();
- if (s == null) {
- return;
- }
- String category = s.getReportCategory();
- // ArrayList GtfsAllArrayList = new ArrayList() ;
- LinkedList GtfsAllLinkedList = new LinkedList(Arrays.asList(gtfsAll));
-
-
-
- System.out.println(gtfsUploadConflict.length+"\t" + gtfsUploadNoConflict.length+"\t" + gtfsModify.length+"\t" + gtfsUploadConflict.length+"\t" + gtfsAll.length+"\t" );
- System.out.println(GtfsAllLinkedList.size()+"\t");
-
-// GtfsAlGtfsAll
-
- Stop[] gtfsarraynew;
- List gtfsListnew;
- if(category.equals("UPLOAD_CONFLICT")){
- // gtfsUploadConflict = removeOneStopFromArray(gtfsUploadConflict, s);
- List gtfsUploadConflictList = Arrays.asList(gtfsUploadConflict);
- GtfsAllLinkedList.removeAll(gtfsUploadConflictList);
-
-// if index > gtfsUploadConflict.length //FIXME case where index > array after removal
-/* if (allStopsRadioButton.isSelected())
- updateStopCategory(gtfsAll, index);
- else*/
-
-// String sid = s.getStopID();
-// finalStops.remove(sid);
- finalStops.entrySet().removeAll(gtfsUploadConflictList);
- osmDefaultFinalStops.entrySet().removeAll(gtfsUploadConflictList);
- osmDefaultOnlyChangedFinalStops.entrySet().removeAll(gtfsUploadConflictList);
- finalCheckboxes.entrySet().removeAll(gtfsUploadConflictList);
- upload.removeAll(gtfsUploadConflictList);
- modify.removeAll(gtfsUploadConflictList);
- delete.removeAll(gtfsUploadConflictList);
-// osmDefaultFinalStops.remove(sid);
-// osmDefaultOnlyChangedFinalStops.remove(sid);
-// finalCheckboxes.remove(sid);
- gtfsUploadConflict = new Stop[0];
- updateStopCategory(gtfsUploadConflict, 0);
- } else if(category.equals("UPLOAD_NO_CONFLICT")) {
- List gtfsUploadNoConflictList = Arrays.asList(gtfsUploadNoConflict);
- GtfsAllLinkedList.removeAll(gtfsUploadNoConflictList);
-
-// gtfsUploadNoConflict = removeOneStopFromArray(gtfsUploadNoConflict, s);
-/* if (allStopsRadioButton.isSelected())
- updateStopCategory(gtfsAll, 0);
- else*/
-
- finalStops.entrySet().removeAll(gtfsUploadNoConflictList);
- osmDefaultFinalStops.entrySet().removeAll(gtfsUploadNoConflictList);
- osmDefaultOnlyChangedFinalStops.entrySet().removeAll(gtfsUploadNoConflictList);
- finalCheckboxes.entrySet().removeAll(gtfsUploadNoConflictList);
- upload.removeAll(gtfsUploadNoConflictList);
- modify.removeAll(gtfsUploadNoConflictList);
- delete.removeAll(gtfsUploadNoConflictList);
-
- gtfsUploadNoConflict = new Stop[0];
- //Arrays.fill(gtfsUploadNoConflict, null);
- updateStopCategory(gtfsUploadNoConflict, 0);
- } else if(category.equals("MODIFY")){
- List gtfsModifyConflictList = Arrays.asList(gtfsModify);
- GtfsAllLinkedList.removeAll(gtfsModifyConflictList);
-
-
- finalStops.entrySet().removeAll(gtfsModifyConflictList);
- osmDefaultFinalStops.entrySet().removeAll(gtfsModifyConflictList);
- osmDefaultOnlyChangedFinalStops.entrySet().removeAll(gtfsModifyConflictList);
- finalCheckboxes.entrySet().removeAll(gtfsModifyConflictList);
-
- upload.removeAll(gtfsModifyConflictList);
- modify.removeAll(gtfsModifyConflictList);
- delete.removeAll(gtfsModifyConflictList);
-
- gtfsModify = new Stop[0];
- updateStopCategory(gtfsModify, 0);
- }
- gtfsAll = Arrays.copyOf(GtfsAllLinkedList.toArray(gtfsAll), GtfsAllLinkedList.size());
-
-/*
- finalStops.entrySet().removeAll(gtfsListnew);
- osmDefaultFinalStops.entrySet().removeAll(gtfsListnew);
- osmDefaultOnlyChangedFinalStops.entrySet().removeAll(gtfsListnew);
- finalCheckboxes.entrySet().removeAll(gtfsListnew);
-*/ // finalStops.remove(sid);
-
-
- // TODO: use HashSets insteaf of list
-
-/* private void updateStopCategory(Stop[] selectedCategory, int index){
- gtfsStops = selectedCategory;
- gtfsStopsComboBox.setModel(new DefaultComboBoxModel(gtfsStops));
- totalGtfsStopsLabel.setText(Integer.toString(gtfsStops.length));
- if(gtfsStops.length!=0 && index < gtfsStops.length) updateBusStop(gtfsStops[index]);
- else updateBusStop(null);
- }*/
-/* Stop s = (Stop)gtfsStopsComboBox.getSelectedItem();
- String category = s.getReportCategory();
- Stop[] stoplist;
-
- if(category.equals("UPLOAD_CONFLICT"))
- stoplist = gtfsUploadConflict;
- else if(category.equals("UPLOAD_NO_CONFLICT"))
- stoplist = gtfsUploadNoConflict;
- else if(category.equals("MODIFY"))
- stoplist = gtfsModify;
- else
- stoplist = gtfsModify;*/
-
-// while (stoplist.length > 0)
-
- // FIXME only works properly when none in cat have been accepted
-// while (gtfsStopsComboBox.getItemCount() > 1) //works with >1 but not >0
-// donotUploadButtonActionPerformed(evt);
-
-/* int currentitem = 0;
- gtfsStopsComboBox.setSelectedIndex(0);
- while (gtfsStopsComboBox.getItemCount() > 1)
- donotUploadButtonActionPerformed(evt);*/
-
- //FIXME broken when some already do not uploads?
- System.out.println("\t"+GtfsAllLinkedList.size());
- System.out.println("upload\tmodify\tdelete\tfinalStops");
- System.out.println(upload.size() + "\t" + modify.size() + "\t" +delete.size() + "\t" +finalStops.size());
-
-
- }
-
- private void donotUploadRemainingButtonActionPerformed(java.awt.event.ActionEvent evt)
- {
- int currentitem = gtfsStopsComboBox.getSelectedIndex();
- gtfsStopsComboBox.setSelectedIndex(gtfsStopsComboBox.getItemCount()-1);
- while (gtfsStopsComboBox.getItemCount() > (currentitem + 1))
- donotUploadButtonActionPerformed(evt);
-
- //FIXME broken when some already do not uploads?
-
-
}
private void donotUploadButtonActionPerformed(java.awt.event.ActionEvent evt)
@@ -2731,6 +2927,7 @@ private void donotUploadButtonActionPerformed(java.awt.event.ActionEvent evt)
private void gtfsStopsComboBoxActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_gtfsStopsComboBoxActionPerformed
updateBusStop((Stop)gtfsStopsComboBox.getSelectedItem());
+ totalGtfsStopsLabel.setText(gtfsStopsComboBox.getSelectedIndex()+1 + "/" + gtfsStopsComboBox.getItemCount());
}//GEN-LAST:event_gtfsStopsComboBoxActionPerformed
private void uploadDataButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_uploadDataButtonActionPerformed
@@ -2790,7 +2987,7 @@ private void osmStopsComboBoxActionPerformed(java.awt.event.ActionEvent evt) {//
}//GEN-LAST:event_osmStopsComboBoxActionPerformed
private void gtfsRoutesComboBoxActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_gtfsRoutesComboBoxActionPerformed
- updateRouteTable((Route)gtfsRoutesComboBox.getSelectedItem());
+ updateBusRoute((Route) gtfsRoutesComboBox.getSelectedItem());
}//GEN-LAST:event_gtfsRoutesComboBoxActionPerformed
private void allRoutesRadioButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_allRoutesRadioButtonActionPerformed
@@ -2810,21 +3007,25 @@ private void existingRoutesRadioButtonActionPerformed(java.awt.event.ActionEvent
}//GEN-LAST:event_existingRoutesRadioButtonActionPerformed
private void allMembersRadioButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_allMembersRadioButtonActionPerformed
- updateMemberList((Route)gtfsRoutesComboBox.getSelectedItem(),"all");
+ updateMemberList((Route) gtfsRoutesComboBox.getSelectedItem(), (Route) osmRoutesComboBox.getSelectedItem(), "all");
}//GEN-LAST:event_allMembersRadioButtonActionPerformed
private void osmMembersRadioButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_osmMembersRadioButtonActionPerformed
- updateMemberList((Route)gtfsRoutesComboBox.getSelectedItem(),"OSM server");
+ updateMemberList((Route) gtfsRoutesComboBox.getSelectedItem(), (Route) osmRoutesComboBox.getSelectedItem(), "OSM server");
}//GEN-LAST:event_osmMembersRadioButtonActionPerformed
private void gtfsMembersRadioButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_gtfsMembersRadioButtonActionPerformed
- updateMemberList((Route)gtfsRoutesComboBox.getSelectedItem(),"GTFS dataset");
+ updateMemberList((Route) gtfsRoutesComboBox.getSelectedItem(), (Route) osmRoutesComboBox.getSelectedItem(), "GTFS dataset");
}//GEN-LAST:event_gtfsMembersRadioButtonActionPerformed
private void bothMembersRadioButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_bothMembersRadioButtonActionPerformed
- updateMemberList((Route)gtfsRoutesComboBox.getSelectedItem(),"both GTFS dataset and OSM server");
+ updateMemberList((Route) gtfsRoutesComboBox.getSelectedItem(), (Route) osmRoutesComboBox.getSelectedItem(), "both GTFS dataset and OSM server");
}//GEN-LAST:event_bothMembersRadioButtonActionPerformed
+ public void PTVersionChanged() {
+ updateMemberList((Route) gtfsRoutesComboBox.getSelectedItem(), (Route) osmRoutesComboBox.getSelectedItem(), membersButtonGroup.getSelection().getActionCommand());
+ }
+
/** Use modified stop data to save data into finalStops
* Does not create new object
*/
@@ -2863,12 +3064,14 @@ private void tableStopButtonActionPerformed(java.awt.event.ActionEvent evt) {//G
// Save to final Stops
Stop st = saveAcceptedDataToFinalStops(selectedGtfs);
- if (selectedOSMStop!= null) {
+ if (selectedOSMStop != null && !selectedOSMStop.getStopID().equals("New")) {
st.setOsmId(selectedOSMStop.getOsmId());
usedOSMstops.put(selectedOSMStop.getOsmId(),st); //TODO do this properly
//broken
// int newOSMVersion = Integer.parseInt(selectedOSMStop.getOsmVersion());
// st.setOsmVersion(Integer.toString(newOSMVersion + 1));
+ st.setPrimitiveType(selectedOSMStop.getPrimitiveType());
+ st.setWayNdRefs(selectedOSMStop.getWayNdRefs());
}
generateStopsToUploadFlag=false;
//finalStopsAccepted.put(selectedGtfs,selectedGtfsStop);
@@ -2878,12 +3081,15 @@ private void tableStopButtonActionPerformed(java.awt.event.ActionEvent evt) {//G
if(tableStopButtonText.contains("Accept") || tableStopButtonText.contains("Add"))
{
if ( !selectedGtfsStop.getReportCategory().equals("MODIFY")
- && !selectedGtfsStop.getReportCategory().equals("UPLOAD_NO_CONFLICT") )
+ && !selectedGtfsStop.getReportCategory().equals("UPLOAD_NO_CONFLICT")
+ && selectedOSMStop!= null && !selectedOSMStop.getStopID().equals("New"))
{
selectedGtfsStop.setOsmId(selectedOSMStop.getOsmId());
int newOSMVersion = Integer.parseInt(selectedOSMStop.getOsmVersion());
selectedGtfsStop.setOsmVersion(Integer.toString(newOSMVersion + 1));
+ selectedGtfsStop.setPrimitiveType(selectedOSMStop.getPrimitiveType());
+ selectedGtfsStop.setWayNdRefs(selectedOSMStop.getWayNdRefs());
}// stops to finish
if(stopsToFinish.contains(selectedGtfsStop.toString()))
{
@@ -2911,7 +3117,7 @@ private void tableStopButtonActionPerformed(java.awt.event.ActionEvent evt) {//G
Stop st = saveAcceptedDataToFinalStops(selectedGtfs);
Stop selectedOsmStop = (Stop) osmStopsComboBox.getSelectedItem();
// set osmId and version number
- if (selectedOsmStop != null) {
+ if (selectedOsmStop != null && !selectedOsmStop.getStopID().equals("New")) {
if (st.getOsmId() == null) {
st.setOsmId(selectedOsmStop.getOsmId());
}
@@ -2920,6 +3126,8 @@ private void tableStopButtonActionPerformed(java.awt.event.ActionEvent evt) {//G
// int newOSMVersion = Integer.parseInt(selectedOSMStop.getOsmVersion());
st.setOsmVersion(selectedOsmStop.getOsmVersion());
}
+ st.setPrimitiveType(selectedOsmStop.getPrimitiveType());
+ st.setWayNdRefs(selectedOsmStop.getWayNdRefs());
st.setReportCategory("MODIFY");
usedOSMstops.put(selectedOSMStop.getOsmId(),st); //TODO do this properly
}
@@ -2957,7 +3165,7 @@ private void tableStopButtonActionPerformed(java.awt.event.ActionEvent evt) {//G
if(selectedNewStop.getReportCategory().equals("UPLOAD_NO_CONFLICT") && !finalStopsAccepted.containsKey(selectedNewStop.getStopID()))
updateButtonTableStop("Accept", true, "Add", true);
} else */if(selectedNewStop.getReportCategory().equals("UPLOAD_NO_CONFLICT") && !finalStopsAccepted.containsKey(selectedNewStop.getStopID()))
- updateButtonTableStop("Accept", true, "Add", true);
+ updateButtonTableStop("Accept", true, "Add", true);
else
{
updateButtonTableStop("Accept", true, "Save Change", false);
@@ -2970,6 +3178,7 @@ private void saveChangeRouteButtonActionPerformed(java.awt.event.ActionEvent evt
saveChangeRouteButton.setEnabled(false);
Route selectedGtfsRoute = (Route) gtfsRoutesComboBox.getSelectedItem();
+ Route selectedOsmRoute = (Route) osmRoutesComboBox.getSelectedItem();
String selectedGtfs = selectedGtfsRoute.getRouteId();
if (saveChangeRouteButton.getText().contains("Save Change") || !finalRoutesAccepted.contains(selectedGtfs)) {
@@ -2980,10 +3189,14 @@ private void saveChangeRouteButtonActionPerformed(java.awt.event.ActionEvent evt
saveValues.add((Boolean) routeTableModel.getValueAt(i, 2)); //gtfs
saveValues.add((Boolean) routeTableModel.getValueAt(i, 4)); //osm
}
- finalRouteCheckboxes.put(selectedGtfs, saveValues);
+ if (selectedOsmRoute != null) {
+ finalRouteCheckboxes.put(selectedGtfs + ";" + selectedOsmRoute.getOsmId(), saveValues);
+ } else {
+ finalRouteCheckboxes.put(selectedGtfs, saveValues);
+ }
// Save to final Stops
- Route rt = finalRoutes.get(selectedGtfs); //not creating new object
+ Route rt = new Route(finalRoutes.get(selectedGtfs));
/* if (selectedOSMStop!= null) {
st.setOsmId(selectedOSMStop.getOsmId());
//broken
@@ -2999,12 +3212,35 @@ private void saveChangeRouteButtonActionPerformed(java.awt.event.ActionEvent evt
rt.addAndOverwriteTag(tagName, tagValue);
// }
}
+
+ // Add OSM attributes and replace existing members with the new ones.
+ String id;
+ if (selectedOsmRoute != null) {
+ id = selectedGtfsRoute.getRouteId() + ";" + selectedOsmRoute.getOsmId();
+ rt.setOsmId(selectedOsmRoute.getOsmId());
+ rt.setOsmVersion(selectedOsmRoute.getOsmVersion());
+
+ rt.setOsmMembers(relMembersForGtfsOsmPair.get(id));
+
+ rt.setStatus("m");
+ } else {
+ id = selectedGtfsRoute.getRouteId();
+ rt.setStatus("n");
+ }
+
generateStopsToUploadFlag = false;
finalRoutes.put(selectedGtfs, rt);
finalRoutesAccepted.put(selectedGtfs, rt);
if (!saveChangeRouteButton.getText().contains("Accept"))
JOptionPane.showMessageDialog(this, "Changes have been made!");
}
+
+ // Move to next route.
+ if (gtfsRoutesComboBox.getSelectedIndex() < gtfsRoutesComboBox.getItemCount() - 1) {
+ gtfsRoutesComboBox.setSelectedIndex(gtfsRoutesComboBox.getSelectedIndex() + 1);
+ gtfsRoutesComboBox.requestFocusInWindow();
+ }
+
}//GEN-LAST:event_saveChangeRouteButtonActionPerformed
private void exportGtfsValueGtfsDataOnlyMenuItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_exportGtfsValueGtfsDataOnlyMenuItemActionPerformed
@@ -3078,6 +3314,185 @@ private void searchButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-
JOptionPane.showMessageDialog(this, "No stop found!\nPlease check your spelling!");
}//GEN-LAST:event_searchButtonActionPerformed
- // End of variables declaration//GEN-END:variables
+ private void donotUploadRemainingButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_donotUploadRemainingButtonActionPerformed
+ int currentitem = gtfsStopsComboBox.getSelectedIndex();
+ gtfsStopsComboBox.setSelectedIndex(gtfsStopsComboBox.getItemCount()-1);
+ while (gtfsStopsComboBox.getItemCount() > (currentitem + 1))
+ donotUploadButtonActionPerformed(evt);
+
+ //FIXME broken when some already do not uploads?
+ }//GEN-LAST:event_donotUploadRemainingButtonActionPerformed
+
+ private void dontuploadAllBtnActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_dontuploadAllBtnActionPerformed
+
+ System.out.println("upload\tmodify\tdelete\tfinalStops");
+ System.out.println(upload.size() + "\t" + modify.size() + "\t" +delete.size() + "\t" +finalStops.size());
+
+
+// GtfsArrayList.remove(o)
+ Stop s = (Stop)gtfsStopsComboBox.getSelectedItem();
+ if (s == null) {
+ return;
+ }
+ String category = s.getReportCategory();
+ // ArrayList GtfsAllArrayList = new ArrayList() ;
+ LinkedList GtfsAllLinkedList = new LinkedList(Arrays.asList(gtfsAll));
+
+
+
+ System.out.println(gtfsUploadConflict.length+"\t" + gtfsUploadNoConflict.length+"\t" + gtfsModify.length+"\t" + gtfsUploadConflict.length+"\t" + gtfsAll.length+"\t" );
+ System.out.println(GtfsAllLinkedList.size()+"\t");
+
+// GtfsAlGtfsAll
+
+ Stop[] gtfsarraynew;
+ List gtfsListnew;
+ if(category.equals("UPLOAD_CONFLICT")){
+ // gtfsUploadConflict = removeOneStopFromArray(gtfsUploadConflict, s);
+ List gtfsUploadConflictList = Arrays.asList(gtfsUploadConflict);
+ GtfsAllLinkedList.removeAll(gtfsUploadConflictList);
+
+// if index > gtfsUploadConflict.length //FIXME case where index > array after removal
+/* if (allStopsRadioButton.isSelected())
+ updateStopCategory(gtfsAll, index);
+ else*/
+
+// String sid = s.getStopID();
+// finalStops.remove(sid);
+ finalStops.entrySet().removeAll(gtfsUploadConflictList);
+ osmDefaultFinalStops.entrySet().removeAll(gtfsUploadConflictList);
+ osmDefaultOnlyChangedFinalStops.entrySet().removeAll(gtfsUploadConflictList);
+ finalCheckboxes.entrySet().removeAll(gtfsUploadConflictList);
+ upload.removeAll(gtfsUploadConflictList);
+ modify.removeAll(gtfsUploadConflictList);
+ delete.removeAll(gtfsUploadConflictList);
+// osmDefaultFinalStops.remove(sid);
+// osmDefaultOnlyChangedFinalStops.remove(sid);
+// finalCheckboxes.remove(sid);
+ gtfsUploadConflict = new Stop[0];
+ updateStopCategory(gtfsUploadConflict, 0);
+ } else if(category.equals("UPLOAD_NO_CONFLICT")) {
+ List gtfsUploadNoConflictList = Arrays.asList(gtfsUploadNoConflict);
+ GtfsAllLinkedList.removeAll(gtfsUploadNoConflictList);
+
+// gtfsUploadNoConflict = removeOneStopFromArray(gtfsUploadNoConflict, s);
+/* if (allStopsRadioButton.isSelected())
+ updateStopCategory(gtfsAll, 0);
+ else*/
+
+ finalStops.entrySet().removeAll(gtfsUploadNoConflictList);
+ osmDefaultFinalStops.entrySet().removeAll(gtfsUploadNoConflictList);
+ osmDefaultOnlyChangedFinalStops.entrySet().removeAll(gtfsUploadNoConflictList);
+ finalCheckboxes.entrySet().removeAll(gtfsUploadNoConflictList);
+ upload.removeAll(gtfsUploadNoConflictList);
+ modify.removeAll(gtfsUploadNoConflictList);
+ delete.removeAll(gtfsUploadNoConflictList);
+
+ gtfsUploadNoConflict = new Stop[0];
+ //Arrays.fill(gtfsUploadNoConflict, null);
+ updateStopCategory(gtfsUploadNoConflict, 0);
+ } else if(category.equals("MODIFY")){
+ List gtfsModifyConflictList = Arrays.asList(gtfsModify);
+ GtfsAllLinkedList.removeAll(gtfsModifyConflictList);
+
+
+ finalStops.entrySet().removeAll(gtfsModifyConflictList);
+ osmDefaultFinalStops.entrySet().removeAll(gtfsModifyConflictList);
+ osmDefaultOnlyChangedFinalStops.entrySet().removeAll(gtfsModifyConflictList);
+ finalCheckboxes.entrySet().removeAll(gtfsModifyConflictList);
+
+ upload.removeAll(gtfsModifyConflictList);
+ modify.removeAll(gtfsModifyConflictList);
+ delete.removeAll(gtfsModifyConflictList);
+
+ gtfsModify = new Stop[0];
+ updateStopCategory(gtfsModify, 0);
+ }
+ gtfsAll = Arrays.copyOf(GtfsAllLinkedList.toArray(gtfsAll), GtfsAllLinkedList.size());
+
+/*
+ finalStops.entrySet().removeAll(gtfsListnew);
+ osmDefaultFinalStops.entrySet().removeAll(gtfsListnew);
+ osmDefaultOnlyChangedFinalStops.entrySet().removeAll(gtfsListnew);
+ finalCheckboxes.entrySet().removeAll(gtfsListnew);
+*/ // finalStops.remove(sid);
+
+
+ // TODO: use HashSets insteaf of list
+
+/* private void updateStopCategory(Stop[] selectedCategory, int index){
+ gtfsStops = selectedCategory;
+ gtfsStopsComboBox.setModel(new DefaultComboBoxModel(gtfsStops));
+ totalGtfsStopsLabel.setText(Integer.toString(gtfsStops.length));
+ if(gtfsStops.length!=0 && index < gtfsStops.length) updateBusStop(gtfsStops[index]);
+ else updateBusStop(null);
+ }*/
+/* Stop s = (Stop)gtfsStopsComboBox.getSelectedItem();
+ String category = s.getReportCategory();
+ Stop[] stoplist;
+
+ if(category.equals("UPLOAD_CONFLICT"))
+ stoplist = gtfsUploadConflict;
+ else if(category.equals("UPLOAD_NO_CONFLICT"))
+ stoplist = gtfsUploadNoConflict;
+ else if(category.equals("MODIFY"))
+ stoplist = gtfsModify;
+ else
+ stoplist = gtfsModify;*/
+
+// while (stoplist.length > 0)
+
+ // FIXME only works properly when none in cat have been accepted
+// while (gtfsStopsComboBox.getItemCount() > 1) //works with >1 but not >0
+// donotUploadButtonActionPerformed(evt);
+
+/* int currentitem = 0;
+ gtfsStopsComboBox.setSelectedIndex(0);
+ while (gtfsStopsComboBox.getItemCount() > 1)
+ donotUploadButtonActionPerformed(evt);*/
+
+ //FIXME broken when some already do not uploads?
+ System.out.println("\t"+GtfsAllLinkedList.size());
+ System.out.println("upload\tmodify\tdelete\tfinalStops");
+ System.out.println(upload.size() + "\t" + modify.size() + "\t" +delete.size() + "\t" +finalStops.size());
+ }//GEN-LAST:event_dontuploadAllBtnActionPerformed
+
+ private void nextButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_nextButtonActionPerformed
+ if (gtfsStopsComboBox.getSelectedIndex() + 1 < gtfsStopsComboBox.getItemCount()) {
+ gtfsStopsComboBox.setSelectedIndex(gtfsStopsComboBox.getSelectedIndex() + 1);
+ }
+ }//GEN-LAST:event_nextButtonActionPerformed
+
+ private void osmRoutesComboBoxActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_osmRoutesComboBoxActionPerformed
+ updateRouteTable((Route) gtfsRoutesComboBox.getSelectedItem(), (Route) osmRoutesComboBox.getSelectedItem());
+ }//GEN-LAST:event_osmRoutesComboBoxActionPerformed
+
+ javax.swing.AbstractAction tableStopButtonActionListener = new javax.swing.AbstractAction() {
+ public void actionPerformed(java.awt.event.ActionEvent evt) {
+ tableStopButtonActionPerformed(evt);
+ }
+ };
+
+ private void setupMapJXMapKitPostCreation() {
+ //shortcuts
+
+ //zoom
+ mapJXMapKit.getInputMap(javax.swing.JComponent.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke(KeyEvent.VK_INSERT, 0), "zoomin");
+ mapJXMapKit.getInputMap(javax.swing.JComponent.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke(KeyEvent.VK_PLUS, 0), "zoomin");
+ mapJXMapKit.getActionMap().put("zoomin", mapJXMapKit.getZoomInAction());
+ mapJXMapKit.getInputMap(javax.swing.JComponent.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke(KeyEvent.VK_DELETE, 0), "zoomout");
+ mapJXMapKit.getInputMap(javax.swing.JComponent.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke(KeyEvent.VK_MINUS, 0), "zoomout");
+ mapJXMapKit.getActionMap().put("zoomout", mapJXMapKit.getZoomOutAction());
+
+ //recentre
+ mapJXMapKit.getInputMap(javax.swing.JComponent.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke(KeyEvent.VK_NUMPAD5, 0), "recentre_gtfs");
+ mapJXMapKit.getActionMap().put("recentre_gtfs", new AbstractAction() {
+ public void actionPerformed(ActionEvent evt) {
+ GeoPosition gtfsLocation = new GeoPosition(Double.parseDouble(((Stop) gtfsStopsComboBox.getSelectedItem()).getLat()),
+ Double.parseDouble(((Stop) gtfsStopsComboBox.getSelectedItem()).getLon()));
+ mapJXMapKit.getMainMap().setCenterPosition(gtfsLocation);
+ }
+ });
+ }
}
diff --git a/GO_Sync/src/main/java/edu/usf/cutr/go_sync/gui/object/BooleanMouseListener.java b/GO_Sync/src/main/java/edu/usf/cutr/go_sync/gui/object/BooleanMouseListener.java
index c309d201..72a7fa42 100644
--- a/GO_Sync/src/main/java/edu/usf/cutr/go_sync/gui/object/BooleanMouseListener.java
+++ b/GO_Sync/src/main/java/edu/usf/cutr/go_sync/gui/object/BooleanMouseListener.java
@@ -17,11 +17,14 @@
package edu.usf.cutr.go_sync.gui.object;
+import edu.usf.cutr.go_sync.gui.ReportViewer;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import javax.swing.JTable;
import javax.swing.table.TableColumnModel;
import edu.usf.cutr.go_sync.gui.object.StopTableInfo;
+import java.util.ArrayList;
+import java.util.Arrays;
/**
*
@@ -29,6 +32,7 @@
*/
public class BooleanMouseListener implements MouseListener{
private JTable dataTable;
+ private ReportViewer reportViewer;
private void checkBoxEvent(MouseEvent e) {
TableColumnModel columnModel = dataTable.getColumnModel();
@@ -47,30 +51,36 @@ private void checkBoxEvent(MouseEvent e) {
// add appropriate data to New Values
String dataValue = (String)dataTable.getValueAt(row, column-1);
- if((dataValue!=null) && !(dataValue.equals(""))){
- Boolean otherCheckBox;
- String otherData, insertData=dataValue;
- int otherCheckColumn;
- int dataColumn = column - 1;
- int otherDataColumn;
+ Boolean otherCheckBox;
+ String otherData, insertData = dataValue;
+ int otherCheckColumn;
+ int otherDataColumn;
+
+ // look at data, checkBox info for other columns
+ // FIXME: needs some cleaning up for better readability
+ if (column == StopTableInfo.GTFS_CHECK_COL) {
+ otherCheckColumn = StopTableInfo.OSM_CHECK_COL;
+ otherDataColumn = otherCheckColumn - 1;
+ otherCheckBox = (Boolean) dataTable.getValueAt(row, otherCheckColumn);
+ otherData = (String) dataTable.getValueAt(row, otherDataColumn);
+ } else { // column == StopTableInfo.OSM_CHECK_COL
+ otherCheckColumn = StopTableInfo.GTFS_CHECK_COL;
+ otherDataColumn = otherCheckColumn - 1;
+ otherCheckBox = (Boolean) dataTable.getValueAt(row, otherCheckColumn);
+ otherData = (String) dataTable.getValueAt(row, otherDataColumn);
+ }
+
+ if((dataValue!=null) && !(dataValue.equals(""))){
// look at data, checkBox info for other columns
// FIXME: needs some cleaning up for better readability
if(column==StopTableInfo.GTFS_CHECK_COL) {
- otherCheckColumn = StopTableInfo.OSM_CHECK_COL;
- otherDataColumn = otherCheckColumn - 1;
- otherCheckBox = (Boolean)dataTable.getValueAt(row, otherCheckColumn);
- otherData = (String)dataTable.getValueAt(row, otherDataColumn);
if(otherData!=null && !(otherData.equals("")))
- insertData = dataValue+";"+otherData;
+ insertData = addToOSMMultiValue(dataValue, otherData);
} else { // column == StopTableInfo.OSM_CHECK_COL
- otherCheckColumn = StopTableInfo.GTFS_CHECK_COL;
- otherDataColumn = otherCheckColumn - 1;
- otherCheckBox = (Boolean)dataTable.getValueAt(row, otherCheckColumn);
- otherData = (String)dataTable.getValueAt(row, otherDataColumn);
if(otherCheckBox) {
if (otherData!=null && !(otherData.equals("")))
- insertData = otherData+";"+dataValue;
+ insertData = addToOSMMultiValue(dataValue, otherData);
else {
insertData = dataValue;
otherCheckBox = false;
@@ -113,12 +123,27 @@ private void checkBoxEvent(MouseEvent e) {
}
}
}
+
+ if ((dataValue == null || dataValue.isEmpty()) && (otherData == null || otherData.isEmpty())) {
+ insertData = null;
+ dataTable.setValueAt(insertData, row, StopTableInfo.NEW_VALUE_DATA_COL);
+ }
+
+ String tagName = (String)dataTable.getValueAt(row, 0);
+ if (tagName.equals("public_transport:version")) {
+ reportViewer.PTVersionChanged();
+ }
}
public BooleanMouseListener(JTable table) {
dataTable = table;
}
+ public BooleanMouseListener(JTable table, ReportViewer rviewer) {
+ dataTable = table;
+ reportViewer = rviewer;
+ }
+
public void mouseClicked(MouseEvent e) {
checkBoxEvent(e);
}
@@ -139,4 +164,17 @@ public void mousePressed(MouseEvent e) {
public void mouseReleased(MouseEvent e) {
// checkBoxEvent(e);
}
+
+ private String addToOSMMultiValue(String dataValue, String otherData) {
+ ArrayList dataValueList = new ArrayList<>(Arrays.asList(dataValue.split(";")));
+ ArrayList otherDataList = new ArrayList<>(Arrays.asList(otherData.split(";")));
+ dataValueList.replaceAll(String::trim);
+ otherDataList.replaceAll(String::trim);
+ for (String data : otherDataList) {
+ if (!dataValueList.contains(data)) {
+ dataValueList.add(data);
+ }
+ }
+ return String.join(";", dataValueList);
+ }
}
diff --git a/GO_Sync/src/main/java/edu/usf/cutr/go_sync/gui/object/RouteMemberTableCellRenderer.java b/GO_Sync/src/main/java/edu/usf/cutr/go_sync/gui/object/RouteMemberTableCellRenderer.java
index de107200..afd24b08 100644
--- a/GO_Sync/src/main/java/edu/usf/cutr/go_sync/gui/object/RouteMemberTableCellRenderer.java
+++ b/GO_Sync/src/main/java/edu/usf/cutr/go_sync/gui/object/RouteMemberTableCellRenderer.java
@@ -5,11 +5,13 @@
package edu.usf.cutr.go_sync.gui.object;
+import java.awt.Color;
import java.awt.Component;
import javax.swing.JTable;
import javax.swing.SwingConstants;
import javax.swing.table.DefaultTableCellRenderer;
import javax.swing.table.TableCellRenderer;
+import javax.swing.table.TableModel;
/**
*
@@ -22,6 +24,17 @@ public Component getTableCellRendererComponent(JTable table, Object value, boole
tableRenderer = (DefaultTableCellRenderer) tableRenderer.getTableCellRendererComponent(table,
value, isSelected, hasFocus, row, column);
+ // set different background colors to same data vs. different data
+ TableModel model = table.getModel();
+ String gtfs = (String) model.getValueAt(row, 0);
+ String osm = (String) model.getValueAt(row, 1);
+ if (!isSelected) {
+ if ((osm != null && gtfs != null && osm.equalsIgnoreCase(gtfs))) {
+ tableRenderer.setBackground(Color.LIGHT_GRAY);
+ } else {
+ tableRenderer.setBackground(table.getBackground());
+ }
+ }
tableRenderer.setHorizontalAlignment(SwingConstants.CENTER);
return tableRenderer;
diff --git a/GO_Sync/src/main/java/edu/usf/cutr/go_sync/gui/object/RouteMemberTableModel.java b/GO_Sync/src/main/java/edu/usf/cutr/go_sync/gui/object/RouteMemberTableModel.java
index f718d8ce..19366626 100644
--- a/GO_Sync/src/main/java/edu/usf/cutr/go_sync/gui/object/RouteMemberTableModel.java
+++ b/GO_Sync/src/main/java/edu/usf/cutr/go_sync/gui/object/RouteMemberTableModel.java
@@ -26,7 +26,7 @@
*/
public class RouteMemberTableModel extends AbstractTableModel {
private String[] columnNames = {"GTFS Member List",
- "OSM Member List",
+ "OSM Member List (ordered by 'New Member List' if PTv2)",
"New Member List"};
private Object[][] data;
diff --git a/GO_Sync/src/main/java/edu/usf/cutr/go_sync/gui/object/TagReportTableCellRenderer.java b/GO_Sync/src/main/java/edu/usf/cutr/go_sync/gui/object/TagReportTableCellRenderer.java
index 2fba48e4..60faf5ad 100644
--- a/GO_Sync/src/main/java/edu/usf/cutr/go_sync/gui/object/TagReportTableCellRenderer.java
+++ b/GO_Sync/src/main/java/edu/usf/cutr/go_sync/gui/object/TagReportTableCellRenderer.java
@@ -42,10 +42,18 @@ public Component getTableCellRendererComponent(JTable table, Object value, boole
String gtfs = (String)model.getValueAt(row, 1);
String osm = (String)model.getValueAt(row, 3);
// if((gtfs==null) || (gtfs.equals("")) || (osm!=null && osm.contains(gtfs))) {
- if ((osm != null && gtfs != null && osm.equalsIgnoreCase(gtfs))) {
- tableRenderer.setBackground(Color.LIGHT_GRAY);
- } else {
- tableRenderer.setBackground(Color.WHITE);
+ if (!isSelected) {
+ if ((osm != null && gtfs != null && osm.equalsIgnoreCase(gtfs))) {
+ tableRenderer.setBackground(Color.LIGHT_GRAY);
+ } else {
+ // For lat/lon, in case of a 'way' display with different color
+ if ((((String) model.getValueAt(row, 0)).equals("lat") || ((String) model.getValueAt(row, 0)).equals("lon"))
+ && osm != null && osm.matches("(?i).*way.*")) {
+ tableRenderer.setBackground(new Color(0xCCFFCC));
+ } else {
+ tableRenderer.setBackground(table.getBackground());
+ }
+ }
}
tableRenderer.setHorizontalAlignment(SwingConstants.CENTER);
diff --git a/GO_Sync/src/main/java/edu/usf/cutr/go_sync/io/GTFSReadIn.java b/GO_Sync/src/main/java/edu/usf/cutr/go_sync/io/GTFSReadIn.java
index a5750beb..1109c1c7 100644
--- a/GO_Sync/src/main/java/edu/usf/cutr/go_sync/io/GTFSReadIn.java
+++ b/GO_Sync/src/main/java/edu/usf/cutr/go_sync/io/GTFSReadIn.java
@@ -20,11 +20,18 @@
import java.util.*;
import java.util.regex.Pattern;
+import edu.usf.cutr.go_sync.gui.MainForm;
import edu.usf.cutr.go_sync.tag_defs;
import edu.usf.cutr.go_sync.object.OperatorInfo;
import edu.usf.cutr.go_sync.object.Route;
+import edu.usf.cutr.go_sync.object.RouteVariant;
import edu.usf.cutr.go_sync.object.Stop;
import edu.usf.cutr.go_sync.tools.OsmFormatter;
+import edu.usf.cutr.go_sync.object.NetexQuay;
+import edu.usf.cutr.go_sync.object.NetexStopElement;
+import edu.usf.cutr.go_sync.object.NetexStopPlace;
+import edu.usf.cutr.go_sync.object.ProcessingOptions;
+import javax.xml.parsers.SAXParserFactory;
import org.apache.commons.csv.CSVFormat;
import org.apache.commons.csv.CSVParser;
import org.apache.commons.csv.CSVRecord;
@@ -35,14 +42,25 @@ public class GTFSReadIn {
private static final String ROUTE_KEY = "route_ref";
private static final String NTD_ID_KEY = "ntd_id";
+ // Since we don't save all trip_id in RouteVariant, we have to maintain a list that says which RouteVariant
+ // has the same trip as the Gtfs trip_id in file
+ HashMap gtfsTripIdToRouteVariantMap = new HashMap<>();
+
private List stops;
+ private HashMap stopsMap;
+ HashMap netexQuaysByGtfsId;
+ HashMap netexQuaysByQuayId;
+ HashMap netexLogicalSites;
+ HashMap netexParentSitesByGtfsId;
+ HashMap netexAllStopPlacesByGtfsId;
+ HashMap netexAllStopPlacesByStopPlaceId;
public GTFSReadIn() {
stops = new ArrayList();
+ stopsMap = new HashMap();
allRoutes = new Hashtable();
// readBusStop("C:\\Users\\Khoa Tran\\Desktop\\Summer REU\\Khoa_transit\\stops.txt");
}
-
public static Set getAllRoutesID(){
return allRoutes.keySet();
}
@@ -55,10 +73,10 @@ public String readAgency(String agency_fName){
for (CSVRecord csvRecord : parser) {
String agencyName;
- if (csvRecord.get(tag_defs.GTFS_NETWORK_KEY) == null ||
- csvRecord.get(tag_defs.GTFS_NETWORK_KEY).isEmpty())
- agencyName = csvRecord.get(tag_defs.GTFS_NETWORK_ID_KEY);
- else agencyName = csvRecord.get(tag_defs.GTFS_NETWORK_KEY);
+ if (csvRecord.get(tag_defs.GTFS_AGENCY_NAME_KEY) == null ||
+ csvRecord.get(tag_defs.GTFS_AGENCY_NAME_KEY).isEmpty())
+ agencyName = csvRecord.get(tag_defs.GTFS_AGENCY_ID_KEY);
+ else agencyName = csvRecord.get(tag_defs.GTFS_AGENCY_NAME_KEY);
br.close();
return agencyName;
}
@@ -70,14 +88,18 @@ public String readAgency(String agency_fName){
return null;
}
- public List readBusStop(String fName, String agencyName, String routes_fName, String trips_fName, String stop_times_fName){
+ public List readBusStop(String fName, String agencyName, String routes_fName, String trips_fName, String stop_times_fName, String netexStopsFilename){
long tStart = System.currentTimeMillis();
Hashtable> id = matchRouteToStop(routes_fName, trips_fName, stop_times_fName);
Hashtable> stopIDs = new Hashtable>(id);
+ if (netexStopsFilename != null && !netexStopsFilename.isEmpty()) {
+ readNetexStopsFile(netexStopsFilename);
+ }
+
String thisLine;
String [] elements;
- int stopIdKey=-1, stopNameKey=-1, stopLatKey=-1, stopLonKey=-1;
+ int stopIdKey=-1, stopNameKey=-1, stopLatKey=-1, stopLonKey=-1, locationTypeKey=-1, parentStationKey=-1;
try {
BufferedReader br = new BufferedReader(new InputStreamReader(new BOMInputStream(new FileInputStream(fName)),"UTF-8"));
HashMap keysIndex = new HashMap ();
@@ -106,14 +128,19 @@ public List readBusStop(String fName, String agencyName, String routes_fNa
stopLonKey = i;
break;
case tag_defs.GTFS_STOP_URL_KEY:
- keysIndex.put(tag_defs.OSM_URL_KEY, i);
+ keysIndex.put(tag_defs.OSM_STOP_URL_KEY, i);
break;
case tag_defs.GTFS_ZONE_KEY:
keysIndex.put(tag_defs.OSM_ZONE_KEY, i);
break;
case tag_defs.GTFS_STOP_TYPE_KEY:
+ locationTypeKey = i;
keysIndex.put(tag_defs.OSM_STOP_TYPE_KEY, i);
break;
+ case tag_defs.GTFS_PARENT_STATION_KEY:
+ parentStationKey = i;
+ keysIndex.put(tag_defs.OSM_PARENT_STATION_KEY, i);
+ break;
case tag_defs.GTFS_WHEELCHAIR_KEY:
keysIndex.put(tag_defs.OSM_WHEELCHAIR_KEY, i);
break;
@@ -131,9 +158,12 @@ public List readBusStop(String fName, String agencyName, String routes_fNa
Map hm = csvRecord.toMap();
elements = new String[hm.size()];
elements = hm.values().toArray(elements);
+ String public_transport_type = "";
//add leading 0's to gtfs_id
String tempStopId = OsmFormatter.getValidBusStopId(elements[stopIdKey]);
- Stop s = new Stop(tempStopId, agencyName, elements[stopNameKey],elements[stopLatKey],elements[stopLonKey]);
+ //System.out.println("Reading stop from gtfs: " + tempStopId.toString());
+ NetexStopElement netexObject = getMatchingNetexObject(elements[locationTypeKey], elements[stopIdKey], elements[parentStationKey], elements[stopLatKey],elements[stopLonKey], elements[stopNameKey]);
+ Stop s = new Stop("node", tempStopId, agencyName, elements[stopNameKey],elements[stopLatKey],elements[stopLonKey], netexObject);
HashSet keysn = new HashSet(keysIndex.keySet());
Iterator it = keysn.iterator();
try {
@@ -147,8 +177,12 @@ public List readBusStop(String fName, String agencyName, String routes_fNa
if (k.equals(tag_defs.OSM_STOP_TYPE_KEY)) {
switch(Integer.parseInt(v)) {
// https://developers.google.com/transit/gtfs/reference/stops-file
- case 0: v="platform";break;
- case 1: v="station"; break;
+ case 0:
+ v = public_transport_type = "platform";
+ break;
+ case 1:
+ v = public_transport_type = "station";
+ break;
default: break;
}
}
@@ -175,7 +209,7 @@ public List readBusStop(String fName, String agencyName, String routes_fNa
s.addTag(k, v);
}
} else
- s.addTag(k, v);
+ s.addTag(k, v.replace(" ", " ").trim());
}
//System.out.print(k+":" + v +" ");
}
@@ -201,8 +235,9 @@ public List readBusStop(String fName, String agencyName, String routes_fNa
if(asdf!=null)s.addRoutes(stopIDs.get(tempStopId));
stops.add(s);
+ stopsMap.put(tempStopId,s);
- HashMap modes = getModeTagsByBusStop(stopIDs.get(tempStopId));
+ HashMap modes = getModeTagsByBusStop(stopIDs.get(tempStopId), public_transport_type);
if (!r.isEmpty()) s.addTags(modes);
// System.out.println(thisLine);
}
@@ -242,7 +277,7 @@ public Hashtable readRoutes(String routes_fName){
routeIdKey = i;
break;
case tag_defs.GTFS_ROUTE_URL_KEY:
- keysIndex.put(tag_defs.OSM_URL_KEY, i);
+ keysIndex.put(tag_defs.OSM_ROUTE_URL_KEY, i);
break;
case "route_type":
keysIndex.put(tag_defs.OSM_ROUTE_TYPE_KEY, i);
@@ -251,11 +286,11 @@ public Hashtable readRoutes(String routes_fName){
case tag_defs.GTFS_COLOR_KEY:
keysIndex.put(tag_defs.OSM_COLOUR_KEY, i);
break;
- case tag_defs.GTFS_ROUTE_NUM:
+ case tag_defs.GTFS_ROUTE_NUM_KEY:
routeShortNameKey = i;
break;
- case tag_defs.GTFS_ROUTE_NAME:
- routeLongNameKey = i;
+ case tag_defs.GTFS_ROUTE_NAME_KEY:
+ keysIndex.put(tag_defs.OSM_ROUTE_NAME_KEY, i);
break;
default:
String t = "gtfs_" + keysn[i];
@@ -263,9 +298,6 @@ public Hashtable readRoutes(String routes_fName){
break;
}
}
- if (routeLongNameKey != -1)
- keysIndex.put("name",routeLongNameKey);
-// System.out.println(stopIdKey+","+stopNameKey+","+stopLatKey+","+stopLonKey);
{
final Pattern colourPattern = Pattern.compile("^[a-fA-F0-9]+$");
@@ -315,9 +347,23 @@ public Hashtable readRoutes(String routes_fName){
// if (k.equals(tag_defs.OSM_COLOUR_KEY))
// System.out.println(tag_defs.OSM_COLOUR_KEY + " "+ v + " #"+v);
if (k.equals(tag_defs.OSM_COLOUR_KEY) && ((v.length() == 3 || v.length() == 6) && colourPattern.matcher(v).matches()))/*^[a-fA-F0-9]+$")))*/ {
+ if (v.equalsIgnoreCase("FFFFFF")) {
+ // If value is not set, it defaults to FFFFFF (ie. white). If value is set to FFFFFF, we consider that color is not set.
+ continue;
+ }
v = "#".concat(v);
}
- r.addTag(k, v);
+ if (k.equals("gtfs_route_text_color")) {
+ if (MainForm.processingOptions.contains(ProcessingOptions.DONT_ADD_GTFS_ROUTE_TEXT_COLOR_TO_ROUTE)) {
+ continue;
+ }
+ }
+ if (k.equals("gtfs_agency_id")) {
+ if (MainForm.processingOptions.contains(ProcessingOptions.DONT_ADD_GTFS_AGENCY_ID_TO_ROUTE)) {
+ continue;
+ }
+ }
+ r.addTag(k, v.replace(" ", " ").trim());
}
}
} catch(Exception e){
@@ -335,9 +381,132 @@ public Hashtable readRoutes(String routes_fName){
return routes;
}
- public Hashtable> matchRouteToStop(String routes_fName, String trips_fName, String stop_times_fName){
- allRoutes.putAll(readRoutes(routes_fName));
- HashMap tripIDs = new HashMap();
+ private void insertRouteVariantToAllRouteVariants(String prev_trip_id, RouteVariant rv, HashMap allRouteVariants) {
+ String duplicate_route = null;
+ // If we start reading a new trip, save the previous trip to allRouteVariants
+
+ // Search if there is any RouteVariant in allRouteVariants having the same sequence.
+ for (HashMap.Entry rv_check : allRouteVariants.entrySet()) {
+ String key = rv_check.getKey();
+ RouteVariant value = rv_check.getValue();
+
+ if (value.equalsSequenceOf(rv)) {
+ duplicate_route = key;
+ //System.out.println(String.format("Duplicate trips: Existing:%s vs New:%s", key, rv.getTrip_id()));
+ break;
+ }
+ }
+ if (duplicate_route == null) {
+ allRouteVariants.put(prev_trip_id, rv);
+ gtfsTripIdToRouteVariantMap.put(prev_trip_id, prev_trip_id);
+ } else {
+ //System.out.println(String.format("Adding equal %s to existing trip %s", rv.getTrip_id(), duplicate_route));
+ allRouteVariants.get(duplicate_route).addSame_trip_sequence(rv.getTrip_id());
+ gtfsTripIdToRouteVariantMap.put(prev_trip_id, duplicate_route);
+ }
+ }
+
+ public HashMap readRouteVariants(String stop_times_fName, String trips_fName, String routes_fName) {
+ //assert (!stopsMap.isEmpty()) : "no stops. Is this called after having read the stops.txt file?";
+
+ HashMap allRouteVariants = new HashMap();
+ String thisLine;
+
+ try {
+ BufferedReader br = new BufferedReader(new InputStreamReader(new BOMInputStream(new FileInputStream(stop_times_fName)), "UTF-8"));
+ HashMap keysIndex = new HashMap();
+ thisLine = br.readLine();
+ StringReader sr = new StringReader(thisLine);
+ CSVParser headerParser = CSVParser.parse(sr, CSVFormat.DEFAULT.withHeader( //"route_id","route_short_name","route_long_name","route_desc","route_type","route_url","color","route_text_color"
+ ));
+ List CSVkeysList = headerParser.getHeaderNames();
+ String[] keysn = new String[CSVkeysList.size()];
+ keysn = CSVkeysList.toArray(keysn);
+ for (int i = 0; i < keysn.length; i++) {
+ //read keys
+ switch (keysn[i]) {
+ default:
+ keysIndex.put(keysn[i], i);
+ break;
+ }
+ }
+
+ String prev_trip_id = null;
+ String trip_id = null;
+ RouteVariant rv = null;
+
+ CSVParser parser = CSVParser.parse(br, CSVFormat.DEFAULT.withHeader(keysn));
+ for (CSVRecord csvRecord : parser) {
+ // Create route variant if it doesn't exist, or fetch the existing one.
+ trip_id = csvRecord.get(keysIndex.get("trip_id"));
+
+ if (prev_trip_id == null) {
+ rv = new RouteVariant(trip_id);
+ } else {
+ if (!trip_id.equals(prev_trip_id)) {
+ insertRouteVariantToAllRouteVariants(prev_trip_id, rv, allRouteVariants);
+ rv = new RouteVariant(trip_id);
+ }
+ }
+
+ prev_trip_id = trip_id;
+
+ Integer sequence_id = Integer.valueOf(csvRecord.get(keysIndex.get("stop_sequence")));
+ String stop_id = csvRecord.get(keysIndex.get("stop_id"));
+ String arrival_time = csvRecord.get(keysIndex.get("arrival_time"));
+ String departure_time = csvRecord.get(keysIndex.get("departure_time"));
+ String pickup_type = csvRecord.get(keysIndex.get("pickup_type"));
+ String drop_off_type = csvRecord.get(keysIndex.get("drop_off_type"));
+
+ rv.addStop(sequence_id, stop_id, stopsMap.get(stop_id).getStopNameWithTown(), arrival_time, departure_time, pickup_type, drop_off_type);
+ }
+ // We finished reading the file, save the last trip we read.
+ insertRouteVariantToAllRouteVariants(prev_trip_id, rv, allRouteVariants);
+
+ // Read trips & routes files
+ Hashtable routes = readRoutes(routes_fName);
+ HashMap tripIDs = getTripIDs(trips_fName);
+
+ // Now fill the routeVariants with the route_id & route_short_name
+ for (HashMap.Entry rv_entry : allRouteVariants.entrySet()) {
+ RouteVariant current_rv = rv_entry.getValue();
+ String route_id = tripIDs.get(current_rv.getTrip_id());
+ current_rv.setRoute_id(route_id);
+ current_rv.setRoute(routes.get(route_id));
+ }
+
+ } catch (IOException e) {
+ System.err.println("Error: " + e);
+ }
+
+ return allRouteVariants;
+ }
+
+ public static HashMap> getAllRouteVariantsByRoute(HashMap allRouteVariants) {
+ HashMap> allRouteVariantsByRoute = new HashMap<>();
+
+ for (HashMap.Entry rv_entry : allRouteVariants.entrySet()) {
+ RouteVariant current_rv = rv_entry.getValue();
+ String route_id = current_rv.getRoute_id();
+
+ if (allRouteVariantsByRoute.containsKey(route_id)) {
+ allRouteVariantsByRoute.get(route_id).add(current_rv);
+ } else {
+ ArrayList rvlist = new ArrayList<>();
+ rvlist.add(current_rv);
+ allRouteVariantsByRoute.put(route_id, rvlist);
+ }
+ }
+ return allRouteVariantsByRoute;
+ }
+
+ public HashMap getGtfsTripIdToRouteVariantMap() {
+ //System.out.println(String.format("gtfsTripIdToRouteVariantMap content: %s", gtfsTripIdToRouteVariantMap.toString()));
+ return gtfsTripIdToRouteVariantMap;
+ }
+
+ public HashMap getTripIDs(String trips_fName) {
+ HashMap tripIDs = new HashMap<>();
// trips.txt read-in
try {
@@ -356,6 +525,12 @@ public Hashtable> matchRouteToStop(String routes_fName, S
catch (IOException e) {
System.err.println("Error: " + e);
}
+ return tripIDs;
+ }
+
+ public Hashtable> matchRouteToStop(String routes_fName, String trips_fName, String stop_times_fName){
+ allRoutes.putAll(readRoutes(routes_fName));
+ HashMap tripIDs = getTripIDs(trips_fName);
// hashtable String(stop_id) vs. HashSet(routes)
Hashtable> stopIDs = new Hashtable>();
@@ -372,7 +547,7 @@ public Hashtable> matchRouteToStop(String routes_fName, S
Route tr = null;
if (tripIDs.get(trip) != null) tr = allRoutes.get(tripIDs.get(trip));
if (tr != null) routes.add(tr);
- String sid = OsmFormatter.getValidBusStopId(csvRecord.get(tag_defs.GTFS_TRIPS_STOP_ID_KEY));
+ String sid = OsmFormatter.getValidBusStopId(csvRecord.get(tag_defs.GTFS_STOP_ID_KEY));
if (stopIDs.containsKey(sid)) {
routes.addAll(stopIDs.get(sid));
stopIDs.remove(sid);
@@ -388,22 +563,59 @@ public Hashtable> matchRouteToStop(String routes_fName, S
//TODO implement this
// https://wiki.openstreetmap.org/wiki/Public_transport
- public HashMap getModeTagsByBusStop(HashSet r) {
+ public HashMap getModeTagsByBusStop(HashSet r, String public_transport_type) {
HashMap keys = new HashMap();
if (r!=null) {
//convert from hashset to arraylist
ArrayList routes = new ArrayList(r);
- for (Route rr:routes) {
- if (rr.containsKey(tag_defs.OSM_ROUTE_TYPE_KEY)) {
+ for (Route rr : routes) {
+ if (public_transport_type.equals("platform")) {
+ if (rr.containsKey(tag_defs.OSM_ROUTE_TYPE_KEY)) {
+ switch (rr.getTag(tag_defs.OSM_ROUTE_TYPE_KEY)) {
+ case "bus":
+ case "trolley_bus":
+ case "share_taxi":
+ keys.put("highway", "bus_stop");
+ break;
+ case "railway":
+ case "tram":
+ case "subway":
+ case "light_rail":
+ keys.put("railway", "paltform");
+ break;
+ default:
+ break;
+ }
+ }
+
+ } else if (public_transport_type.equals("stop_position")) {
keys.put(rr.getTag(tag_defs.OSM_ROUTE_TYPE_KEY), "yes");
- if (rr.getTag(tag_defs.OSM_ROUTE_TYPE_KEY) == "ferry")
- keys.put("amenity","ferry_terminal");
- }
- if (rr.containsKey("aerialway"))
- keys.put("aerialway","station");
- if (rr.containsKey("railway") && rr.getTag("railway") == "funicular") {
- keys.put("railway","station");
- keys.put("station","funicular");
+ } else if (public_transport_type.equals("station")) {
+ if (rr.containsKey(tag_defs.OSM_ROUTE_TYPE_KEY)) {
+ switch (rr.getTag(tag_defs.OSM_ROUTE_TYPE_KEY)) {
+ case "bus":
+ keys.put("amenity", "bus_station");
+ break;
+ case "railway":
+ case "tram":
+ case "subway":
+ case "light_rail":
+ keys.put("railway", "station");
+ break;
+ case "ferry":
+ keys.put("amenity", "ferry_terminal");
+ break;
+ default:
+ break;
+ }
+ }
+ if (rr.containsKey("railway") && rr.getTag("railway").equals("funicular")) {
+ keys.put("railway", "station");
+ keys.put("station", "funicular");
+ }
+ if (rr.containsKey("aerialway")) {
+ keys.put("aerialway", "station");
+ }
}
}
}
@@ -432,4 +644,164 @@ public String getRoutesInTextByBusStop(HashSet r) {
}
return text;
}
-}
\ No newline at end of file
+
+ private NetexStopElement getMatchingNetexObject(String gtfsLocationType, String gtfsId, String parentSite, String lat, String lon, String gtfsStopName) {
+ NetexStopElement matchingObject = null;
+ if (gtfsLocationType == null) {
+ return null;
+ }
+
+ if (gtfsLocationType.isEmpty() || gtfsLocationType.equals("0")) {
+ // 0: Stop (or Platform) in gtfs, corresponds to a Quay in Netex
+ matchingObject = getMatchingNetexQuay(gtfsId, parentSite, lat, lon, gtfsStopName);
+ }
+
+ if (gtfsLocationType.isEmpty() || gtfsLocationType.equals("1")) {
+ // 1: station in gtfs, corresponds to a StopPlace in Netex
+ matchingObject = getMatchingNetexStopPlace(gtfsId, parentSite, lat, lon, gtfsStopName);
+ }
+
+ return matchingObject;
+ }
+
+ private NetexStopPlace getMatchingNetexStopPlace(String gtfsId, String parentSite, String lat, String lon, String gtfsStopName) {
+ if (netexAllStopPlacesByGtfsId == null) {
+ return null;
+ }
+
+ // Check if there is a matching the gtfsId
+ // If it exists, return this value.
+ NetexStopPlace stopPlace = netexAllStopPlacesByGtfsId.get(gtfsId);
+ if (stopPlace != null) {
+ return stopPlace;
+ }
+
+ // TODO: implement the case where nothing was found.
+ // iterate on all stopPlaces to find the ones with the same lat/lon
+ // if only one, return that one
+ // if more that one, check by name
+ // if only one with that name, return that one
+ // else return the first one with that name
+ ArrayList stopPlaceMatchingLatLon = new ArrayList<>();
+ for (NetexStopPlace sp : netexAllStopPlacesByGtfsId.values()) {
+ if (lat.equals(sp.getLat()) && lon.equals(sp.getLon())) {
+ stopPlaceMatchingLatLon.add(sp);
+ }
+ }
+ if (stopPlaceMatchingLatLon.size() == 1) {
+ return stopPlaceMatchingLatLon.get(0);
+ }
+
+ ArrayList stopPlaceMatchingName = new ArrayList<>();
+ if (stopPlaceMatchingLatLon.size() > 1) {
+ for (NetexStopPlace sp : stopPlaceMatchingLatLon) {
+ if (gtfsStopName.equals(sp.getName())) {
+ stopPlaceMatchingName.add(sp);
+ }
+ }
+ }
+ if (!stopPlaceMatchingName.isEmpty()) {
+ return stopPlaceMatchingName.get(0);
+ }
+
+ // if there is no match found, return null
+ System.out.println("Warning: No matching StopPlace found in netex for gtfs stop_id: " + gtfsId);
+ return null;
+ }
+
+ private NetexQuay getMatchingNetexQuay(String gtfsId, String parentSite, String lat, String lon, String gtfsStopName) {
+ if (netexQuaysByGtfsId == null) {
+ return null;
+ }
+
+ // Check if there is a matching the gtfsId
+ // If it exists, return this value.
+ NetexQuay quay = netexQuaysByGtfsId.get(gtfsId);
+ if (quay != null) {
+ return quay;
+ }
+
+ // Find the "parent StopPlace" that matches the parentSite and determine the StopPlace holding the Quays
+ // Then, with these "child StopPlace"s:
+ // get all the Quay the refer to (QuayRef)
+ // if there is only one Quay, return that one.
+ // if there are more than one, return the one that matches the lat/lon.
+ // if more than one matches the lat/lon return the one whose name is same as gtfs' stop_name
+ // if more than one matches the gtfs stop_name return the 1st one
+ // If still not found, search all the Quays for a match (by lat/lon)
+ ArrayList quayMatches = new ArrayList<>();
+
+ NetexStopPlace parentStopPlace = netexParentSitesByGtfsId.get(parentSite);
+ ArrayList childStopPlaces = new ArrayList<>();
+ if (parentStopPlace != null) {
+ for (String childSiteRef : parentStopPlace.getChildSiteRef()) {
+ childStopPlaces.add(netexAllStopPlacesByStopPlaceId.get(childSiteRef));
+ }
+ for (NetexStopPlace childStopPlace : childStopPlaces) {
+ for (String quayRef : childStopPlace.getQuayRefs()) {
+ quayMatches.add(netexQuaysByQuayId.get(quayRef));
+ }
+ }
+ }
+
+ if (quayMatches.size() == 1) {
+ return quayMatches.get(0);
+ }
+
+ ArrayList quayMatchingLatLon = new ArrayList<>();
+ if (quayMatches.size() > 1) {
+ for (NetexQuay q : quayMatches) {
+ if (lat.equals(q.getLat()) && lon.equals(q.getLon())) {
+ quayMatchingLatLon.add(q);
+ }
+ }
+ }
+
+ if (quayMatchingLatLon.isEmpty()) {
+ // Finally search in all Quays if any matches lat/lon
+ for (NetexQuay q : netexQuaysByQuayId.values()) {
+ if (lat.equals(q.getLat()) && lon.equals(q.getLon())) {
+ quayMatchingLatLon.add(q);
+ }
+ }
+ }
+
+ if (quayMatchingLatLon.size() == 1) {
+ return quayMatchingLatLon.get(0);
+ }
+
+ ArrayList quayMatchingName = new ArrayList<>();
+ if (quayMatchingLatLon.size() > 1) {
+ for (NetexQuay qmll : quayMatchingLatLon) {
+ if (gtfsStopName.equals(qmll.getName())) {
+ quayMatchingName.add(qmll);
+ }
+ }
+ }
+ if (!quayMatchingName.isEmpty()) {
+ return quayMatchingName.get(0);
+ }
+
+ // if there is no match found, return null
+ System.out.println("Warning: No matching Quay found in netex for gtfs stop_id: " + gtfsId);
+ return null;
+ }
+
+ private void readNetexStopsFile(String netexFilePath) {
+ try {
+ File nextFile = new File(netexFilePath);
+ NetexParser netexParser = new NetexParser();
+ SAXParserFactory.newInstance().newSAXParser().parse(nextFile, netexParser);
+ netexQuaysByGtfsId = netexParser.getQuayListByGtfsId();
+ netexQuaysByQuayId = netexParser.getQuayListByQuayId();
+ netexLogicalSites = netexParser.getLogicalSiteListByGtfsId();
+ netexParentSitesByGtfsId = netexParser.getParentSiteListByGtfsId();
+ netexAllStopPlacesByGtfsId = netexParser.getAllStopPlaceListByGtfsId();
+ netexAllStopPlacesByStopPlaceId = netexParser.getAllStopPlaceListByStopPlaceId();
+ } catch (UnsupportedOperationException e) {
+ throw e;
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+}
diff --git a/GO_Sync/src/main/java/edu/usf/cutr/go_sync/io/NetexParser.java b/GO_Sync/src/main/java/edu/usf/cutr/go_sync/io/NetexParser.java
new file mode 100644
index 00000000..42fced95
--- /dev/null
+++ b/GO_Sync/src/main/java/edu/usf/cutr/go_sync/io/NetexParser.java
@@ -0,0 +1,295 @@
+/**
+ * Copyright (C) 2023 University of South Florida and individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package edu.usf.cutr.go_sync.io;
+
+import edu.usf.cutr.go_sync.object.NetexQuay;
+import edu.usf.cutr.go_sync.object.NetexStopPlace;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import org.xml.sax.Attributes;
+import org.xml.sax.SAXException;
+import org.xml.sax.helpers.DefaultHandler;
+
+public class NetexParser extends DefaultHandler {
+
+ HashMap quayListByGtfsId;
+ HashMap quayListByQuayId;
+ HashMap stopPlaceListByGtfsId;
+ HashMap stopPlaceListByStopPlaceId;
+ HashMap parentSiteListByGtfsId;
+ HashMap parentSiteListByStopPlaceId;
+ HashMap logicalSiteListByGtfsId;
+ HashMap stopPlaceIdByLatLon;
+
+ NetexQuay quay = null;
+ NetexStopPlace stopPlace = null;
+
+ private StringBuilder tagTextContent = new StringBuilder();
+
+ List xPath;
+ String pathBegin = "PublicationDelivery/dataObjects/GeneralFrame/members/";
+
+ public NetexParser() {
+ xPath = new ArrayList();
+ quayListByGtfsId = new HashMap();
+ quayListByQuayId = new HashMap();
+ stopPlaceListByGtfsId = new HashMap();
+ stopPlaceListByStopPlaceId = new HashMap();
+ parentSiteListByGtfsId = new HashMap();
+ parentSiteListByStopPlaceId = new HashMap();
+ logicalSiteListByGtfsId = new HashMap();
+ }
+
+ @Override
+ public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException {
+ super.startElement(uri, localName, qName, attributes); // Generated from nbfs://nbhost/SystemFileSystem/Templates/Classes/Code/OverriddenMethodBody
+
+ xPath.add(qName);
+
+ if (qName.equals("Quay")) {
+ quay = new NetexQuay(attributes.getValue("id"));
+ }
+
+ if (qName.equals("StopPlace")) {
+ stopPlace = new NetexStopPlace(attributes.getValue("id"));
+ }
+
+ if (qName.equals("Name")) {
+ if (String.join("/", xPath).equals(pathBegin + "Quay/Name")) {
+ tagTextContent.setLength(0);
+ }
+
+ if (String.join("/", xPath).equals(pathBegin + "Quay/alternativeNames/AlternativeName/Name")) {
+ tagTextContent.setLength(0);
+ }
+
+ if (String.join("/", xPath).equals(pathBegin + "StopPlace/Name")) {
+ tagTextContent.setLength(0);
+ }
+ }
+
+ if (qName.equals("Town")) {
+ if (String.join("/", xPath).equals(pathBegin + "Quay/PostalAddress/Town")) {
+ tagTextContent.setLength(0);
+
+ }
+ if (String.join("/", xPath).equals(pathBegin + "StopPlace/PostalAddress/Town")) {
+ tagTextContent.setLength(0);
+ }
+ }
+
+ if (qName.equals("alternativeNames")) {
+ // Quay/alternativeNames
+ }
+
+ if (qName.equals("AlternativeName")) {
+ // Quay/alternativeNames/AlternativeName
+ }
+
+ if (qName.equals("PostalAddress")) {
+ // Quay/PostalAddress
+
+ // StopPlace/PostalAddress
+ }
+
+ if (qName.equals("quays")) {
+ // StopPlace/quays
+ }
+
+ if (qName.equals("QuayRef")) {
+ if (String.join("/", xPath).equals(pathBegin + "StopPlace/quays/QuayRef")) {
+ stopPlace.addQuayRef(attributes.getValue("ref"));
+ }
+ }
+
+ if (qName.equals("ParentSiteRef")) {
+ if (String.join("/", xPath).equals(pathBegin + "StopPlace/ParentSiteRef")) {
+ stopPlace.setParentSiteRef(attributes.getValue("ref"));
+ }
+ }
+
+ if (qName.equals("Longitude") || qName.equals("Latitude")) {
+ if (String.join("/", xPath).equals(pathBegin + "StopPlace/Centroid/Location/" + qName)) {
+ tagTextContent.setLength(0);
+ }
+ if (String.join("/", xPath).equals(pathBegin + "Quay/Centroid/Location/" + qName)) {
+ tagTextContent.setLength(0);
+ }
+ }
+ }
+
+ @Override
+ public void characters(char[] ch, int start, int length) throws SAXException {
+ super.characters(ch, start, length); // Generated from nbfs://nbhost/SystemFileSystem/Templates/Classes/Code/OverriddenMethodBody
+ tagTextContent.append(ch, start, length);
+ }
+
+ @Override
+ public void endElement(String uri, String localName, String qName) throws SAXException {
+ super.endElement(uri, localName, qName); // Generated from nbfs://nbhost/SystemFileSystem/Templates/Classes/Code/OverriddenMethodBody
+
+ if (qName.equals("Quay")) {
+ quayListByGtfsId.put(quay.getIdAsGtfs(), quay);
+ quayListByQuayId.put(quay.getId(), quay);
+ }
+
+ if (qName.equals("StopPlace")) {
+ // Store stopPlace to different list depending on whether it is a parentSite or not.
+ if (stopPlace.getParentSiteRef() == null) {
+ parentSiteListByGtfsId.put(stopPlace.getGtfsEquivalentId(), stopPlace);
+ parentSiteListByStopPlaceId.put(stopPlace.getId(), stopPlace);
+ } else {
+ stopPlaceListByGtfsId.put(stopPlace.getGtfsEquivalentId(), stopPlace);
+ stopPlaceListByStopPlaceId.put(stopPlace.getId(), stopPlace);
+ }
+ }
+
+ if (qName.equals("Name")) {
+ if (String.join("/", xPath).equals(pathBegin + "Quay/Name")) {
+ quay.setName(tagTextContent.toString());
+ }
+
+ if (String.join("/", xPath).equals(pathBegin + "Quay/alternativeNames/AlternativeName/Name")) {
+ quay.addAltName(tagTextContent.toString());
+ }
+
+ if (String.join("/", xPath).equals(pathBegin + "StopPlace/Name")) {
+ stopPlace.setName(tagTextContent.toString());
+ }
+ }
+
+ if (qName.equals("Town")) {
+ if (String.join("/", xPath).equals(pathBegin + "Quay/PostalAddress/Town")) {
+ quay.setTown(tagTextContent.toString());
+
+ }
+ if (String.join("/", xPath).equals(pathBegin + "StopPlace/PostalAddress/Town")) {
+ stopPlace.setTown(tagTextContent.toString());
+ }
+ }
+
+ if (qName.equals("Latitude")) {
+ if (String.join("/", xPath).equals(pathBegin + "StopPlace/Centroid/Location/" + qName)) {
+ stopPlace.setLat(tagTextContent.toString());
+ }
+ if (String.join("/", xPath).equals(pathBegin + "Quay/Centroid/Location/" + qName)) {
+ quay.setLat(tagTextContent.toString());
+ }
+ }
+
+ if (qName.equals("Longitude")) {
+ if (String.join("/", xPath).equals(pathBegin + "StopPlace/Centroid/Location/" + qName)) {
+ stopPlace.setLon(tagTextContent.toString());
+ }
+ if (String.join("/", xPath).equals(pathBegin + "Quay/Centroid/Location/" + qName)) {
+ quay.setLon(tagTextContent.toString());
+ }
+ }
+
+ if (xPath.get(xPath.size() - 1).equals(qName)) {
+ xPath.remove(xPath.size() - 1);
+ }
+
+ }
+
+ @Override
+ public void endDocument() throws SAXException {
+ super.endDocument(); // Generated from nbfs://nbhost/SystemFileSystem/Templates/Classes/Code/OverriddenMethodBody
+
+ boolean found = false;
+ // create logical stop place based on the stopPlaceListByGtfsId
+ for (NetexStopPlace p : parentSiteListByGtfsId.values()) {
+ found = false;
+ for (NetexStopPlace c : stopPlaceListByGtfsId.values()) {
+ if (p.getId().equals(c.getParentSiteRef())) {
+ found = true;
+ p.addChildSiteRef(c.getId());
+ // Save current Id to childSiteRef
+ c.addChildSiteRef(c.getId());
+ c.setParentSiteRef(null);
+ // Use id of parentSite
+ c.setId(p.getId());
+ // Use name of parentSite as altName
+ c.addAltName(p.getName());
+ logicalSiteListByGtfsId.put(c.getGtfsEquivalentId(), c);
+ break;
+ }
+ // We consider a StopPlace can only have one StopPlacechild (to be checked)
+ }
+ if (!found) {
+ // Case where no match found:
+ System.out.println("No child stopPlace in netext for : " + p.getId());
+ logicalSiteListByGtfsId.put(p.getGtfsEquivalentId(), p);
+ }
+ }
+
+ //printResult();
+ }
+
+ public void printResult() {
+ System.out.println("All logical stopPlaces after parsing:");
+ for (Map.Entry set : logicalSiteListByGtfsId.entrySet()) {
+ System.out.println(set.getKey() + "> " + set.getValue().printContent());
+ }
+ System.out.println("All Quay after parsing:");
+ for (Map.Entry set : quayListByGtfsId.entrySet()) {
+ System.out.println(set.getKey() + "> " + set.getValue().printContent());
+ }
+ }
+
+ public HashMap getQuayListByGtfsId() {
+ return quayListByGtfsId;
+ }
+
+ public HashMap getQuayListByQuayId() {
+ return quayListByQuayId;
+ }
+
+ public HashMap getLogicalSiteListByGtfsId() {
+ return logicalSiteListByGtfsId;
+ }
+
+ public HashMap getParentSiteListByGtfsId() {
+ return parentSiteListByGtfsId;
+ }
+
+ public HashMap getStopPlaceListByGtfsId() {
+ return stopPlaceListByGtfsId;
+ }
+
+ public HashMap getStopPlaceListByStopPlaceId() {
+ return stopPlaceListByStopPlaceId;
+ }
+
+ public HashMap getAllStopPlaceListByStopPlaceId() {
+ HashMap allStopPlaceListByStopPlaceId = new HashMap<>();
+ allStopPlaceListByStopPlaceId.putAll(stopPlaceListByStopPlaceId);
+ allStopPlaceListByStopPlaceId.putAll(parentSiteListByStopPlaceId);
+ return allStopPlaceListByStopPlaceId;
+ }
+
+ public HashMap getAllStopPlaceListByGtfsId() {
+ HashMap allStopPlaceListByGtfsId = new HashMap<>();
+ allStopPlaceListByGtfsId.putAll(stopPlaceListByGtfsId);
+ allStopPlaceListByGtfsId.putAll(parentSiteListByGtfsId);
+ return allStopPlaceListByGtfsId;
+ }
+
+}
diff --git a/GO_Sync/src/main/java/edu/usf/cutr/go_sync/io/OsmPrinter.java b/GO_Sync/src/main/java/edu/usf/cutr/go_sync/io/OsmPrinter.java
index c2611f4a..aaf4fe04 100644
--- a/GO_Sync/src/main/java/edu/usf/cutr/go_sync/io/OsmPrinter.java
+++ b/GO_Sync/src/main/java/edu/usf/cutr/go_sync/io/OsmPrinter.java
@@ -77,7 +77,7 @@ public String writeBusStop(String changeSetID, String lat, String lon) {
if (!changeSetID.equals("DUMMY"))
changesetText = "changeset='" + changeSetID+ "'";
return "\n" +
- "\n" +
+ "\n" +
"";
}
@@ -87,20 +87,42 @@ public String writeBusStop(String changeSetID, String nodeID, Stop st) {
changesetText = "changeset='" + changeSetID+ "'";
String text="";
Stop s = new Stop(st);
+ String geoAddress;
+ String primitiveType;
+ switch (st.getPrimitiveType()) {
+ case "way":
+ primitiveType = "way";
+ geoAddress = "";
+ break;
+ case "node":
+ default:
+ primitiveType = "node";
+ geoAddress = "lat='" + st.getLat() + "' lon='" + st.getLon() + "'";
+ break;
+ }
+
// if modify, we need version number
if(st.getOsmVersion()!=null) {
- text += "\n";
+ text += "<" + primitiveType + " " + changesetText + " id='" + nodeID + "' "
+ + geoAddress
+ + " version='"+st.getOsmVersion() + "' action='modify'>\n";
}
// mainly for create new node
else {
- text += "\n";
+ text += "<" + primitiveType + " " + changesetText + " id='" + nodeID + "' "
+ + geoAddress + " action='modify'>\n";
if(st.getTag(APPLICATION_CREATOR_KEY)!=null && !st.getTag(APPLICATION_CREATOR_KEY).equals("none")) {
text += "\n";
}
}
+ // Ad tags for ways
+ if (st.getPrimitiveType().equals("way")) {
+ //System.out.println("Adding " + st.getWayNdRefs().size() + " tag to ways...: Count: st ");
+ for (String ref : st.getWayNdRefs()) {
+ text += "\n";
+ }
+ }
+
//add tag
HashSet keys = new HashSet(s.keySet().size());
keys.addAll(s.keySet());
@@ -111,7 +133,7 @@ public String writeBusStop(String changeSetID, String nodeID, Stop st) {
text += "\n";
}
}
- text += "\n";
+ text += "" + primitiveType + ">\n";
return text;
}
@@ -124,12 +146,12 @@ public String writeBusRoute(String changeSetID, String routeID, Route r) {
// if modify, we need version number
if(r.getOsmVersion()!=null) {
text += "\n";
+ + "' version='"+route.getOsmVersion() + "' action='modify'>\n";
}
// mainly for create new relation
else {
text += "\n";
+ + "' version='"+ routeID +"' action='modify'>\n";
text += "\n";
}
//add member
diff --git a/GO_Sync/src/main/java/edu/usf/cutr/go_sync/io/WriteFile.java b/GO_Sync/src/main/java/edu/usf/cutr/go_sync/io/WriteFile.java
index a4c8b736..308552cd 100644
--- a/GO_Sync/src/main/java/edu/usf/cutr/go_sync/io/WriteFile.java
+++ b/GO_Sync/src/main/java/edu/usf/cutr/go_sync/io/WriteFile.java
@@ -264,7 +264,7 @@ else if(keys[j].equals("transport:zone")){
//if last key
else {
if(!isGtfsFormat){
- st.removeTag(tag_defs.GTFS_OPERATOR_KEY);
+ st.removeTag(tag_defs.OSM_NETWORK_KEY);
st.removeTag("name");
st.removeTag("source");
st.removeTag("highway");
diff --git a/GO_Sync/src/main/java/edu/usf/cutr/go_sync/object/NetexQuay.java b/GO_Sync/src/main/java/edu/usf/cutr/go_sync/object/NetexQuay.java
new file mode 100644
index 00000000..e63a2c09
--- /dev/null
+++ b/GO_Sync/src/main/java/edu/usf/cutr/go_sync/object/NetexQuay.java
@@ -0,0 +1,65 @@
+/**
+ * Copyright (C) 2023 University of South Florida and individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package edu.usf.cutr.go_sync.object;
+
+public class NetexQuay extends NetexStopElement {
+
+ public NetexQuay(String id) {
+ super(id);
+ }
+
+ public String getIdAsGtfs() {
+ String return_value = null;
+ switch (OperatorInfo.getFullName()) {
+ case "Fluo Grand Est 67":
+ case "FLUO 68":
+ case "Fluo88":
+ return_value = getIdAsGtfsFRFluo();
+ break;
+ case "MOBIGO (58)":
+ return_value = getIdAsGtfsFRMobigo();
+ break;
+ default:
+ throw new UnsupportedOperationException(String.format("Method to extract gtfs id inside netex file not set for %s. Please set it in code nearby the NO_METHOD_TO_FIND_GTFSID_IN_NETEX_QUAY_ID or don't use the netex file.", OperatorInfo.getFullName()));
+ }
+ return return_value;
+ }
+
+ private String getIdAsGtfsFRFluo() {
+ // Example:
+ if (id.split(":").length >= 4) {
+ return id.split(":")[3];
+ }
+ System.out.println(String.format("Unexpected format for Quay id %s", id));
+ return null;
+ }
+
+ private String getIdAsGtfsFRMobigo() {
+ // Example:
+ if (id.split(":").length >= 3) {
+ return id.split(":")[2];
+ }
+ System.out.println(String.format("Unexpected format for Quay id %s", id));
+ return null;
+ }
+
+ public String printContent() {
+ return String.format("id: [%s] name: [%s] altNames: %s town: [%s]", id, name, altNames.toString(), town);
+ }
+
+}
diff --git a/GO_Sync/src/main/java/edu/usf/cutr/go_sync/object/NetexStopElement.java b/GO_Sync/src/main/java/edu/usf/cutr/go_sync/object/NetexStopElement.java
new file mode 100644
index 00000000..6afc2303
--- /dev/null
+++ b/GO_Sync/src/main/java/edu/usf/cutr/go_sync/object/NetexStopElement.java
@@ -0,0 +1,254 @@
+/**
+ * Copyright (C) 2023 University of South Florida and individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package edu.usf.cutr.go_sync.object;
+
+import java.util.ArrayList;
+import java.util.function.UnaryOperator;
+import java.util.regex.Pattern;
+
+public class NetexStopElement {
+
+ String id;
+ String town;
+ String name;
+ String lat;
+ String lon;
+ ArrayList altNames;
+
+ public NetexStopElement(String id) {
+ this.id = id;
+ altNames = new ArrayList();
+ }
+
+ public String getId() {
+ return id;
+ }
+
+ public void setId(String id) {
+ this.id = id;
+ }
+
+ public String getTown() {
+ return town;
+ }
+
+ public void setTown(String town) {
+ this.town = town;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public String getLat() {
+ return lat;
+ }
+
+ public void setLat(String lat) {
+ this.lat = lat;
+ }
+
+ public String getLon() {
+ return lon;
+ }
+
+ public void setLon(String lon) {
+ this.lon = lon;
+ }
+
+ public ArrayList getAltNames() {
+ return altNames;
+ }
+
+ public String getAltNamesJoined() {
+ return String.join(";", altNames);
+ }
+
+ public void setAltNames(ArrayList altNames) {
+ this.altNames = altNames;
+ }
+
+ public void addAltName(String altName) {
+ this.altNames.add(altName.replace(';', '_'));
+ }
+
+ public String getLogicalName(ArrayList cities) {
+ // cities contains the list of cities for which we don't wan't to prefix the station name with the town name.
+ if (cities != null) {
+ cities.replaceAll(String::toLowerCase);
+ }
+ if (cities != null && cities.contains(town.toLowerCase())) {
+ return getLogicalNameWithoutTown(cities);
+ } else {
+ return getLogicalNameWithTown(cities);
+ }
+ }
+
+ public String getLogicalNameWithTown(ArrayList cities) {
+ // Return the logical name as format: "TOWN - Name (without town prefix)"
+
+ if (town == null || town.isEmpty()) {
+ return nameCleanup(name);
+ } else {
+ String nameWithoutTown = removeLeadingTownFromName(name, town);
+ nameWithoutTown = removeTrailingTownFromName(nameWithoutTown, town);
+ String logicalName = nameCleanup(prependTown(nameWithoutTown, town));
+
+ return logicalName;
+ }
+ }
+
+ public String getLogicalNameWithoutTown(ArrayList cities) {
+ // Return the logical name as format: "Name" (with TOWN prefix or suffix removed"
+
+ if (town == null || town.isEmpty()) {
+ return nameCleanup(name);
+ } else {
+ String nameWithoutTown = removeLeadingTownFromName(name, town);
+ nameWithoutTown = removeTrailingTownFromName(nameWithoutTown, town);
+
+ return nameCleanup(nameWithoutTown);
+ }
+ }
+
+ public ArrayList getLogicalAltNames(ArrayList cities) {
+ if (cities != null) {
+ cities.replaceAll(String::toLowerCase);
+ }
+ if (cities != null && cities.contains(town.toLowerCase())) {
+ return getLogicalAltNamesWithTown(cities);
+ } else {
+ return getLogicalAltNamesWithoutTown(cities);
+ }
+ }
+
+ public ArrayList getLogicalAltNamesWithoutTown(ArrayList cities) {
+ ArrayList _altNames = new ArrayList<>();
+
+ // Add the name of the stop to _altNames if it doesn't match the logicalName
+ if (!equalsAfterSimplify(name, getLogicalName(cities))) {
+ _altNames.add(name);
+ }
+
+ for (String altName : altNames) {
+ if (town == null || town.isEmpty()) {
+ if (!equalsAfterSimplify(nameCleanup(altName), getLogicalName(cities))) {
+ _altNames.add(nameCleanup(altName));
+ }
+ } else {
+ // Cleanup alternativeName: remove TOWN (since we added it in getLogiclName())
+ String nameWithoutTown = removeLeadingTownFromName(altName, town);
+ nameWithoutTown = removeTrailingTownFromName(nameWithoutTown, town);
+ if (!equalsAfterSimplify(nameWithoutTown, getLogicalName(cities)) && !_altNames.contains(nameWithoutTown)) {
+ _altNames.add(nameWithoutTown);
+ }
+ }
+ }
+
+ return _altNames;
+ }
+
+ public ArrayList getLogicalAltNamesWithTown(ArrayList cities) {
+ ArrayList _altNames = new ArrayList<>();
+
+ // Add the name of the stop to _altNames if it doesn't match the logicalName
+ if (!equalsAfterSimplify(name, getLogicalName(cities))) {
+ _altNames.add(name);
+ }
+
+ for (String altName : altNames) {
+ if (town == null || town.isEmpty()) {
+ if (!equalsAfterSimplify(nameCleanup(altName), getLogicalName(cities))) {
+ _altNames.add(nameCleanup(altName));
+ }
+ } else {
+ // Cleanup alternativeName: remove TOWN (since we added it in getLogiclName())
+ String nameWithoutTown = removeLeadingTownFromName(altName, town);
+ nameWithoutTown = removeTrailingTownFromName(nameWithoutTown, town);
+ nameWithoutTown = nameCleanup(prependTown(nameWithoutTown, town));
+ if (!equalsAfterSimplify(nameWithoutTown, getLogicalName(cities)) && !_altNames.contains(nameWithoutTown)) {
+ _altNames.add(nameWithoutTown);
+ }
+ }
+ }
+ return _altNames;
+ }
+
+ private static String removeLeadingTownFromName(String name, String town) {
+ String n_town = removeAccents(town);
+ String n_name = removeAccents(name);
+
+ String nameWithoutTown = n_name.replaceAll("(?i)^\\s*" + Pattern.quote(n_town), "");
+ nameWithoutTown = nameWithoutTown.replaceAll("(?i)^\\s*" + Pattern.quote(n_town.replace("Å“", "oe").replace("Å’", "OE")), "");
+ nameWithoutTown = nameWithoutTown.replaceAll("^\\s*-\\s*", "");
+
+ // To preserve accents of the initial string, rebuild the name with a substring.
+ nameWithoutTown = name.substring(name.length() - nameWithoutTown.length());
+ nameWithoutTown = nameCleanup(nameWithoutTown);
+
+ return nameWithoutTown;
+ }
+
+ private static String removeTrailingTownFromName(String name, String town) {
+ String n_town = removeAccents(town);
+ String n_name = removeAccents(name);
+
+ String nameWithoutTown = n_name.replaceAll("(?i)\\s*" + Pattern.quote(n_town) + "$", "");
+ nameWithoutTown = nameWithoutTown.replaceAll("(?i)\\s*" + Pattern.quote(n_town.replace("Å“", "oe").replace("Å’", "OE")) + "$", "");
+ nameWithoutTown = nameWithoutTown.replaceAll("^\\s*-\\s*", "");
+
+ // To preserve accents of the initial string, rebuild the name with a substring.
+ nameWithoutTown = name.substring(0, nameWithoutTown.length());
+ nameWithoutTown = nameCleanup(nameWithoutTown);
+
+ return nameWithoutTown;
+ }
+
+ private String prependTown(String nameWithoutTown, String town) {
+ ArrayList townsWithoutPrepend = new ArrayList();
+ // TODO move this to configuration.
+
+ if (townsWithoutPrepend.contains(town.toLowerCase())) {
+ return nameWithoutTown;
+ } else {
+ return town.toUpperCase() + " - " + nameWithoutTown;
+ }
+ }
+
+ private static String normalize(String input) {
+ return input == null ? null : java.text.Normalizer.normalize(input, java.text.Normalizer.Form.NFKD);
+ }
+
+ static String removeAccents(String input) {
+ return normalize(input).replaceAll("\\p{M}", "");
+ }
+
+ private static String nameCleanup(String label) {
+ return label.replace(" ", " ").trim();
+ }
+
+ private static boolean equalsAfterSimplify(String a, String b) {
+ String na = nameCleanup(removeAccents(a).replace("Å“", "oe").replace("Å’", "OE"));
+ String nb = nameCleanup(removeAccents(b).replace("Å“", "oe").replace("Å’", "OE"));
+ return na.equals(nb);
+ }
+}
diff --git a/GO_Sync/src/main/java/edu/usf/cutr/go_sync/object/NetexStopPlace.java b/GO_Sync/src/main/java/edu/usf/cutr/go_sync/object/NetexStopPlace.java
new file mode 100644
index 00000000..65bd503a
--- /dev/null
+++ b/GO_Sync/src/main/java/edu/usf/cutr/go_sync/object/NetexStopPlace.java
@@ -0,0 +1,126 @@
+/**
+ * Copyright (C) 2023 University of South Florida and individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package edu.usf.cutr.go_sync.object;
+
+import java.util.ArrayList;
+
+public class NetexStopPlace extends NetexStopElement {
+
+ String parentSiteRef;
+ ArrayList childSiteRef;
+
+ ArrayList quayRefs;
+
+ public NetexStopPlace(String id) {
+ super(id);
+ parentSiteRef = null;
+ quayRefs = new ArrayList();
+ childSiteRef = new ArrayList();
+ }
+
+ public String getParentSiteRef() {
+ return parentSiteRef;
+ }
+
+ public String getGtfsEquivalentId() {
+ String return_value = null;
+ switch (OperatorInfo.getFullName()) {
+ case "Fluo Grand Est 67":
+ case "FLUO 68":
+ case "Fluo88":
+ return_value = getGtfsEquivalentIdFRFluo();
+ break;
+ case "MOBIGO (58)":
+ return_value = getGtfsEquivalentIdFRMobigo();
+ break;
+ default:
+ throw new UnsupportedOperationException(String.format("Method to extract gtfs id inside netex file not set for %s. Please set it in code nearby the NO_METHOD_TO_FIND_GTFSID_IN_NETEX_STOP_PLACE_ID or don't use the netex file.", OperatorInfo.getFullName()));
+ }
+ return return_value;
+ }
+
+ private String getGtfsEquivalentIdFRFluo() {
+ // Example:
+ String[] base_id;
+ if (parentSiteRef != null) {
+ base_id = parentSiteRef.split(":");
+ if (base_id.length >= 4) {
+ return base_id[3].replace("log", "S");
+ }
+ } else {
+ //if (childSiteRef != null) {
+ // Case when we are on a logical StopPlace or a parentStopPlace
+ base_id = id.split(":");
+ if (base_id.length >= 4) {
+ return base_id[3].replace("log", "S");
+ }
+ //}
+ }
+ System.out.println(String.format("Unexpected format for StopPlace id %s", id));
+ return null;
+ }
+
+ private String getGtfsEquivalentIdFRMobigo() {
+ // Example:
+ String[] base_id;
+ if (parentSiteRef != null) {
+ base_id = parentSiteRef.split(":");
+ if (base_id.length >= 3) {
+ return base_id[2].replace("Navitia_", "");
+ }
+ } else {
+ //if (childSiteRef != null) {
+ // Case when we are on a logical StopPlace or a parentStopPlace
+ base_id = id.split(":");
+ if (base_id.length >= 3) {
+ return base_id[2].replace("Navitia_", "");
+ }
+ //}
+ }
+ System.out.println(String.format("Unexpected format for StopPlace id %s", id));
+ return null;
+ }
+
+ public void setParentSiteRef(String parentSiteRef) {
+ this.parentSiteRef = parentSiteRef;
+ }
+
+ public ArrayList getChildSiteRef() {
+ return childSiteRef;
+ }
+
+ public void addChildSiteRef(String childSiteRef) {
+ this.childSiteRef.add(childSiteRef);
+ }
+
+ public ArrayList getQuayRefs() {
+ return quayRefs;
+ }
+
+ public void setQuayRefs(ArrayList quayRefs) {
+ this.quayRefs = quayRefs;
+ }
+
+ public void addQuayRef(String quayRef) {
+ this.quayRefs.add(quayRef);
+ }
+
+ public String printContent() {
+ return String.format("id: [%s] name: [%s] altNames: %s town: [%s] parentSiteRef: [%s] childSiteRef: [%s] quayRefs: %s", id, name, altNames, town, parentSiteRef, childSiteRef, quayRefs.toString());
+ }
+}
diff --git a/GO_Sync/src/main/java/edu/usf/cutr/go_sync/object/OperatorInfo.java b/GO_Sync/src/main/java/edu/usf/cutr/go_sync/object/OperatorInfo.java
index 52f58797..0df19ef6 100644
--- a/GO_Sync/src/main/java/edu/usf/cutr/go_sync/object/OperatorInfo.java
+++ b/GO_Sync/src/main/java/edu/usf/cutr/go_sync/object/OperatorInfo.java
@@ -18,6 +18,8 @@
import java.util.ArrayList;
import java.util.List;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
/**
*
@@ -26,15 +28,17 @@
public class OperatorInfo {
private static List possibleOperatorName = new ArrayList();
+ private static List possibleOperatorRegexPattern = new ArrayList();
private static String ntdID, fullName, abbreviate, fileDir, aliasName, gtfsFields;
private static int gtfs_id_digit;
- public OperatorInfo(String fName, String abbr, String aName, String id, int digit, String fDir){
+ public OperatorInfo(String fName, String abbr, String aName, String regex, String id, int digit, String fDir){
fullName = fName;
abbreviate = abbr;
aliasName = aName;
+ addRegex(regex);
addName(fullName);
addName(abbreviate);
if(aliasName!=null && !aliasName.equals("")){
@@ -97,6 +101,14 @@ public static void addName(String name){
}
}
+ public static void addRegex(String regex) {
+ // generate possible name for operator fields e.g. HART / Hillsborough Area Regional Transit
+ if (regex != null && !regex.equals("")) {
+ Pattern p = Pattern.compile(regex, Pattern.CASE_INSENSITIVE);
+ possibleOperatorRegexPattern.add(p);
+ }
+ }
+
public static boolean isTheSameOperator(String osmOperator) {
for (int i=0; i wayNdRefs;
+
//TODO change reportCategory to enum
private String status, osmVersion, osmid, reportCategory, reportText, lastEditedOsmUser="", lastEditedOsmDate="";
- public OsmPrimitive(){
+ public OsmPrimitive(String primitiveType){
osmTags = new Hashtable();
+ this.primitiveType = primitiveType;
+ wayNdRefs = new ArrayList<>();
}
public void addTag(String k, String v){
@@ -174,4 +180,22 @@ public void setLastEditedOsmDate(String v){
public String getLastEditedOsmDate(){
return lastEditedOsmDate;
}
+
+ public void setWayNdRefs(ArrayList v) {
+ //System.out.println("setWayNdRefs: size " + v.size());
+ //System.out.println(v.toString());
+ wayNdRefs = v;
+ }
+
+ public ArrayList getWayNdRefs() {
+ return wayNdRefs;
+ }
+
+ public void setPrimitiveType(String primitiveType) {
+ this.primitiveType = primitiveType;
+ }
+
+ public String getPrimitiveType() {
+ return primitiveType;
+ }
}
diff --git a/GO_Sync/src/main/java/edu/usf/cutr/go_sync/object/ProcessingOptions.java b/GO_Sync/src/main/java/edu/usf/cutr/go_sync/object/ProcessingOptions.java
new file mode 100644
index 00000000..904bdaa3
--- /dev/null
+++ b/GO_Sync/src/main/java/edu/usf/cutr/go_sync/object/ProcessingOptions.java
@@ -0,0 +1,38 @@
+/**
+ * Copyright (C) 2023 University of South Florida and individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package edu.usf.cutr.go_sync.object;
+
+public enum ProcessingOptions {
+ // General
+
+ // For Stops
+ SKIP_GTFS_STATIONS,
+
+ // For Routes
+ DONT_REPLACE_EXISING_OSM_ROUTE_COLOR,
+ DONT_ADD_GTFS_ROUTE_TEXT_COLOR_TO_ROUTE,
+ DONT_ADD_GTFS_AGENCY_ID_TO_ROUTE,
+
+ // For Route Members
+ SKIP_NODES_HAVING_ROLE_EMPTY,
+ SKIP_NODES_HAVING_ROLE_STOP_ALL,
+ SKIP_NODES_HAVING_ROLE_STOP_WITHOUT_MATCHING_PLATFORM,
+ CREATE_ROUTE_AS_PTV2,
+ SKIP_NODES_HAVING_ROLE_PLATFORM_NOT_IN_GTFS_TRIP_FROM_OSM_RELATION;
+
+}
diff --git a/GO_Sync/src/main/java/edu/usf/cutr/go_sync/object/ProcessingParams.java b/GO_Sync/src/main/java/edu/usf/cutr/go_sync/object/ProcessingParams.java
new file mode 100644
index 00000000..c41e0e7a
--- /dev/null
+++ b/GO_Sync/src/main/java/edu/usf/cutr/go_sync/object/ProcessingParams.java
@@ -0,0 +1,66 @@
+/**
+ * Copyright (C) 2023 University of South Florida and individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package edu.usf.cutr.go_sync.object;
+
+import java.util.ArrayList;
+
+public class ProcessingParams {
+ ArrayList stopCities;
+ Double stopMinLat, stopMaxLat;
+ Double stopMinLon, stopMaxLon;
+
+ public ArrayList getStopCities() {
+ return stopCities;
+ }
+
+ public void setStopCities(ArrayList stopCities) {
+ this.stopCities = stopCities;
+ }
+
+ public Double getStopMinLat() {
+ return stopMinLat;
+ }
+
+ public void setStopMinLat(String stopMinLat) {
+ this.stopMinLat = Double.valueOf(stopMinLat);
+ }
+
+ public Double getStopMaxLat() {
+ return stopMaxLat;
+ }
+
+ public void setStopMaxLat(String stopMaxLat) {
+ this.stopMaxLat = Double.valueOf(stopMaxLat);
+ }
+
+ public Double getStopMinLon() {
+ return stopMinLon;
+ }
+
+ public void setStopMinLon(String stopMinLon) {
+ this.stopMinLon = Double.valueOf(stopMinLon);
+ }
+
+ public Double getStopMaxLon() {
+ return stopMaxLon;
+ }
+
+ public void setStopMaxLon(String stopMaxLon) {
+ this.stopMaxLon = Double.valueOf(stopMaxLon);
+ }
+}
diff --git a/GO_Sync/src/main/java/edu/usf/cutr/go_sync/object/RelationMember.java b/GO_Sync/src/main/java/edu/usf/cutr/go_sync/object/RelationMember.java
index 60164db9..82b1457d 100644
--- a/GO_Sync/src/main/java/edu/usf/cutr/go_sync/object/RelationMember.java
+++ b/GO_Sync/src/main/java/edu/usf/cutr/go_sync/object/RelationMember.java
@@ -23,10 +23,15 @@
*/
public class RelationMember {
private String ref, type, role, status, gtfsId="";
- public RelationMember(String ref, String type, String role){
+ private String lat, lon;
+ private String refOsmPublicTransportType;
+ public RelationMember(String ref, String type, String role, String lat, String lon, String refOsmPublicTransportType) {
this.ref = ref;
this.type = type;
this.role = role;
+ this.lat = lat;
+ this.lon = lon;
+ this.refOsmPublicTransportType = refOsmPublicTransportType;
}
public RelationMember(RelationMember rm){
@@ -35,6 +40,9 @@ public RelationMember(RelationMember rm){
this.role = rm.getRole();
this.gtfsId = rm.getGtfsId();
this.status = rm.getStatus();
+ this.lat = rm.getLat();
+ this.lon = rm.getLon();
+ this.refOsmPublicTransportType = rm.getRefOsmPublicTransportType();
}
public String getRef(){
@@ -49,6 +57,34 @@ public String getRole(){
return role;
}
+ public String getRoleForFinalOutput() {
+ // Get the role/public_transport_type from the referenced osm object.
+ String cur_role = role;
+ String new_role = role;
+ if (refOsmPublicTransportType == null) {
+ return role;
+ }
+ if (!refOsmPublicTransportType.equals("stop_position") && !refOsmPublicTransportType.equals("platform")) {
+ return role;
+ }
+ if (refOsmPublicTransportType.equals("stop_position")) {
+ new_role = "stop";
+ }
+ if (refOsmPublicTransportType.equals("platform")) {
+ new_role = "platform";
+ }
+ if (role.endsWith("_exit_only")) {
+ return new_role + "_exit_only";
+ } else if (role.endsWith("_entry_only")) {
+ return new_role + "_entry_only";
+ }
+ return role;
+ }
+
+ public void setRole(String role) {
+ this.role = role;
+ }
+
public void setGtfsId(String v){
gtfsId = v;
}
@@ -57,6 +93,14 @@ public String getGtfsId(){
return gtfsId;
}
+ public String getRefOsmPublicTransportType() {
+ return refOsmPublicTransportType;
+ }
+
+ public void setRefOsmPublicTransportType(String refOsmPublicTransportType) {
+ this.refOsmPublicTransportType = refOsmPublicTransportType;
+ }
+
public int compareTo(Object o){
RelationMember rm = (RelationMember) o;
if(this.ref.equals(rm.getRef()) && this.type.equals(rm.getType())){
@@ -79,6 +123,22 @@ public String getStatus(){
return status;
}
+ public String getLat() {
+ return lat;
+ }
+
+ public String getLon() {
+ return lon;
+ }
+
+ public void setLat(String lat) {
+ this.lat = lat;
+ }
+
+ public void setLon(String lon) {
+ this.lon = lon;
+ }
+
@Override
public boolean equals(Object o){
if (o instanceof RelationMember) {
diff --git a/GO_Sync/src/main/java/edu/usf/cutr/go_sync/object/Route.java b/GO_Sync/src/main/java/edu/usf/cutr/go_sync/object/Route.java
index d5260bc4..72c8c46c 100644
--- a/GO_Sync/src/main/java/edu/usf/cutr/go_sync/object/Route.java
+++ b/GO_Sync/src/main/java/edu/usf/cutr/go_sync/object/Route.java
@@ -17,9 +17,10 @@
package edu.usf.cutr.go_sync.object;
-import java.util.HashSet;
+import edu.usf.cutr.go_sync.tag_defs;
import java.util.Hashtable;
import java.util.Iterator;
+import java.util.LinkedHashSet;
/**
*
@@ -28,26 +29,28 @@
public class Route extends OsmPrimitive implements Comparable{
private String routeId, routeRef, operatorName;
- private HashSet osmMembers;
- private final String route_id_key = "gtfs_route_id";
+ private LinkedHashSet osmMembers;
public Route(String rId, String rRef, String op) {
+ super("relation");
osmTags = new Hashtable();
- osmMembers = new HashSet();
+ osmMembers = new LinkedHashSet ();
routeId = rId;
- if(rId!=null) this.osmTags.put(route_id_key, rId);
+ if(rId!=null) this.osmTags.put(tag_defs.OSM_TRIP_ID_KEY, rId);
routeRef = rRef;
operatorName = op;
}
public Route(Route r) {
+ super("relation");
this.osmTags = new Hashtable();
if(r.osmTags!=null) this.osmTags.putAll(r.osmTags);
- this.osmMembers = new HashSet();
+ this.osmMembers = new LinkedHashSet ();
if(r.getOsmMembers()!=null) this.osmMembers.addAll(r.getOsmMembers());
this.routeId = r.getRouteId();
- String ori = (String)r.getTags().get(route_id_key);
- if(ori==null) this.osmTags.put(route_id_key, routeId);
+ if (routeId == null) routeId = "missing";
+ String ori = (String)r.getTags().get(tag_defs.OSM_TRIP_ID_KEY);
+ if(ori==null) this.osmTags.put(tag_defs.OSM_TRIP_ID_KEY, routeId);
this.routeRef = r.getRouteRef();
this.operatorName = r.getOperatorName();
if(r.getOsmId()!=null) this.setOsmId(r.getOsmId());
@@ -63,10 +66,15 @@ public void addOsmMember(RelationMember osmNodeId){
osmMembers.add(osmNodeId);
}
- public void addOsmMembers(HashSet oMembers){
+ public void addOsmMembers(LinkedHashSet oMembers){
osmMembers.addAll(oMembers);
}
+ public void setOsmMembers(LinkedHashSet oMembers){
+ osmMembers.clear();
+ osmMembers = oMembers;
+ }
+
public void removeOsmMember(RelationMember rm){
if(rm!=null){
osmMembers.remove(rm);
@@ -84,7 +92,7 @@ public RelationMember getOsmMember(String ref) {
return null;
}
- public HashSet getOsmMembers(){
+ public LinkedHashSet getOsmMembers(){
return osmMembers;
}
@@ -108,12 +116,22 @@ public boolean compareOperatorName(Route o) {
return false;
}
+ @Override
public int compareTo(Object o){
Route r = (Route) o;
- if(this.compareOperatorName(r) && r.getRouteId().equals(this.getRouteId())) {
+ if (this.getRouteId().equals("missing") || r.getRouteId().equals("missing")) {
+ // Compare osmid
+ if (this.getOsmId().equals(r.getOsmId())) {
+ return 0;
+ }
+ }
+
+ if (!this.getRouteId().equals("missing") && !r.getRouteId().equals("missing")
+ && this.compareOperatorName(r) && r.getRouteId().equals(this.getRouteId())) {
return 0;
}
- return 1;
+
+ return toString().compareTo(r.toString());
}
@Override
@@ -129,11 +147,14 @@ public boolean equals(Object o){
@Override
public int hashCode(){
String id = this.getRouteId();
- return id.hashCode();
+ String osmId = this.getTag("id");
+ return (id + '|' + osmId).hashCode();
}
@Override
public String toString(){
- return this.getRouteId();
+ if (routeId.equals("missing") && !getOsmId().isEmpty())
+ return "missing (" + getOsmId() + ")";
+ return this.getRouteRef() + ": " + this.getRouteId();
}
-}
\ No newline at end of file
+}
diff --git a/GO_Sync/src/main/java/edu/usf/cutr/go_sync/object/RouteVariant.java b/GO_Sync/src/main/java/edu/usf/cutr/go_sync/object/RouteVariant.java
new file mode 100644
index 00000000..d75f75c7
--- /dev/null
+++ b/GO_Sync/src/main/java/edu/usf/cutr/go_sync/object/RouteVariant.java
@@ -0,0 +1,172 @@
+/**
+ * Copyright (C) 2023 University of South Florida and individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package edu.usf.cutr.go_sync.object;
+
+import java.time.Duration;
+import java.time.LocalTime;
+import java.time.format.DateTimeFormatter;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import java.util.Map;
+import java.util.Objects;
+import java.util.TreeMap;
+
+public class RouteVariant {
+
+ String trip_id;
+ String route_id;
+ List same_trip_sequences;
+ TreeMap stops;
+ Route gtfs_route;
+
+ public RouteVariant(String trip_id) {
+ this.trip_id = trip_id;
+ stops = new TreeMap<>();
+ same_trip_sequences = new ArrayList();
+ }
+
+ public String getTrip_id() {
+ return trip_id;
+ }
+
+ public TreeMap getStops() {
+ return stops;
+ }
+
+ public void setStops(TreeMap stops) {
+ this.stops = stops;
+ }
+
+ public void addStop(Integer sequence_id, String stop_id, String name, String arrival_time, String departure_time, String pickup_type, String drop_off_type) {
+ RouteVariantStop rvs = new RouteVariantStop(stop_id, name, arrival_time, departure_time, pickup_type, drop_off_type);
+ stops.put(sequence_id, rvs);
+ }
+
+ public String toText() {
+ String s = "";
+ s += String.format("Trip_id [%s] | route_id [%s] | route_short_name [%s] | route_long_name [%s]\n", trip_id, route_id, getRoute_short_name(), getRoute_long_name());
+ s += String.format(" Same as: %s\n", same_trip_sequences.toString());
+ for (Map.Entry stop : stops.entrySet()) {
+ Integer key = stop.getKey();
+ RouteVariantStop value = stop.getValue();
+ s += String.format(" num: %d, %s, %s, %s\n", key, value.getStop_id(), value.getPickup_type(), value.getDrop_off_type());
+ }
+ return s;
+ }
+
+ public List getSame_trip_sequence() {
+ return same_trip_sequences;
+ }
+
+ public void addSame_trip_sequence(String trip_id) {
+ this.same_trip_sequences.add(trip_id);
+ }
+
+ public String getRoute_id() {
+ return route_id;
+ }
+
+ public void setRoute_id(String route_id) {
+ this.route_id = route_id;
+ }
+
+ public String getRoute_short_name() {
+ return gtfs_route.getRouteRef();
+ }
+
+ public Route getRoute() {
+ return gtfs_route;
+ }
+
+ public void setRoute(Route route) {
+ this.gtfs_route = route;
+ }
+
+ @Override
+ public int hashCode() {
+ int hash = 3;
+ hash = 41 * hash + Objects.hashCode(this.stops);
+ return hash;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (obj == null) {
+ return false;
+ }
+ if (getClass() != obj.getClass()) {
+ return false;
+ }
+ final RouteVariant other = (RouteVariant) obj;
+ return Objects.equals(this.stops, other.stops);
+ }
+
+ public boolean equalsSequenceOf(RouteVariant obj) {
+ final RouteVariant other = (RouteVariant) obj;
+ return Objects.equals(this.stops, other.stops);
+ }
+
+ public String getOsmValue(String key_name) {
+ switch (key_name) {
+ case "ref":
+ return getRoute_short_name();
+ case "name":
+ return String.format("Bus %s: %s => %s",
+ getRoute_short_name(),
+ stops.firstEntry().getValue().getName(),
+ stops.lastEntry().getValue().getName());
+ case "from":
+ return stops.firstEntry().getValue().getName();
+ case "to":
+ return stops.lastEntry().getValue().getName();
+ case "gtfs:route_id":
+ return this.route_id;
+ case "gtfs:trip_id:sample":
+ return this.trip_id;
+ case "gtfs:name":
+ case "gtfs_name":
+ return getRoute_long_name();
+ default:
+ return gtfs_route.getTag(key_name);
+ }
+ }
+
+ public String getRoute_long_name() {
+ return gtfs_route.getTag("gtfs:name");
+ }
+
+ private Duration getDurationAsDuration() {
+ Integer firstStopIndex = Collections.min(stops.keySet());
+ String tripDepartureTime = stops.get(firstStopIndex).getDeparture_time();
+ Integer lastStopIndex = Collections.max(stops.keySet());
+ String tripArrivalTime = stops.get(lastStopIndex).getArrival_time();
+
+ LocalTime tripDepartureTimeLT = LocalTime.parse(tripDepartureTime, DateTimeFormatter.ofPattern("HH:mm:ss"));
+ LocalTime tripArrivalTimeLT = LocalTime.parse(tripArrivalTime, DateTimeFormatter.ofPattern("HH:mm:ss"));
+ return Duration.between(tripDepartureTimeLT, tripArrivalTimeLT);
+ }
+
+ public String getDuration() {
+ Duration d = getDurationAsDuration();
+ return String.format("%02d:%02d", d.toHours(), d.minusHours(d.toHours()).toMinutes());
+ }
+}
diff --git a/GO_Sync/src/main/java/edu/usf/cutr/go_sync/object/RouteVariantStop.java b/GO_Sync/src/main/java/edu/usf/cutr/go_sync/object/RouteVariantStop.java
new file mode 100644
index 00000000..70734eb9
--- /dev/null
+++ b/GO_Sync/src/main/java/edu/usf/cutr/go_sync/object/RouteVariantStop.java
@@ -0,0 +1,94 @@
+/**
+ * Copyright (C) 2023 University of South Florida and individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package edu.usf.cutr.go_sync.object;
+
+import java.util.Objects;
+
+public class RouteVariantStop {
+
+ String stop_id, pickup_type, drop_off_type, name, arrival_time, departure_time;
+
+ public RouteVariantStop(String stop_id, String name, String arrival_time, String departure_time, String pickup_type, String drop_off_type) {
+ this.stop_id = stop_id;
+ this.name = name;
+ this.arrival_time = arrival_time;
+ this.departure_time = departure_time;
+ this.pickup_type = pickup_type;
+ this.drop_off_type = drop_off_type;
+ }
+
+ public String getStop_id() {
+ return stop_id;
+ }
+
+ public String getArrival_time() {
+ return arrival_time;
+ }
+
+ public String getDeparture_time() {
+ return departure_time;
+ }
+
+ public String getPickup_type() {
+ return pickup_type;
+ }
+
+ public String getDrop_off_type() {
+ return drop_off_type;
+ }
+
+ public String toText() {
+ return String.format("stop: [%s], name [%s], pickup_type[%s], drop_off_type[%s]",
+ stop_id, name, pickup_type, drop_off_type);
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (obj == null) {
+ return false;
+ }
+ if (getClass() != obj.getClass()) {
+ return false;
+ }
+ final RouteVariantStop other = (RouteVariantStop) obj;
+ if (!Objects.equals(this.stop_id, other.stop_id)) {
+ return false;
+ }
+ if (!Objects.equals(this.pickup_type, other.pickup_type)) {
+ return false;
+ }
+ return Objects.equals(this.drop_off_type, other.drop_off_type);
+ }
+
+ @Override
+ public int hashCode() {
+ int hash = 3;
+ hash = 61 * hash + Objects.hashCode(this.stop_id);
+ hash = 61 * hash + Objects.hashCode(this.pickup_type);
+ hash = 61 * hash + Objects.hashCode(this.drop_off_type);
+ return hash;
+ }
+
+}
diff --git a/GO_Sync/src/main/java/edu/usf/cutr/go_sync/object/Stop.java b/GO_Sync/src/main/java/edu/usf/cutr/go_sync/object/Stop.java
index 47784f26..5d8b1244 100644
--- a/GO_Sync/src/main/java/edu/usf/cutr/go_sync/object/Stop.java
+++ b/GO_Sync/src/main/java/edu/usf/cutr/go_sync/object/Stop.java
@@ -17,11 +17,15 @@
package edu.usf.cutr.go_sync.object;
+import static edu.usf.cutr.go_sync.gui.MainForm.processingParams;
+import java.util.List;
import java.util.HashSet;
import java.util.Hashtable;
import java.util.Iterator;
import edu.usf.cutr.go_sync.tools.OsmDistance;
import edu.usf.cutr.go_sync.tag_defs;
+import java.util.ArrayList;
+import java.util.Arrays;
/**
*
* @author Khoa Tran
@@ -29,20 +33,40 @@
public class Stop extends OsmPrimitive implements Comparable{
private final double ERROR_TO_ZERO = 0.5;
- private final String GTFS_STOP_ID_KEY = tag_defs.GTFS_STOP_ID_KEY;
- private final String GTFS_OPERATOR_KEY = tag_defs.GTFS_OPERATOR_KEY;
- private final String GTFS_NAME_KEY = tag_defs.GTFS_NAME_KEY;
private String lat, lon;
private HashSet routes;
- public Stop(String stopID, String operatorName, String stopName, String lat, String lon) {
+ private String stopNameWithTown;
+
+ public Stop(String osmPrimitiveType, String stopID, String operatorName, String stopName, String lat, String lon,
+ NetexStopElement netexStopElement) {
+ super(osmPrimitiveType);
osmTags = new Hashtable();
if (operatorName == null || operatorName.equals("")) operatorName="none";
if (stopID == null || stopID.equals("")) stopID="none";
if (stopName == null || stopName.equals("")) stopName="none";
// osmTags.put("highway", "bus_stop");
- osmTags.put(GTFS_STOP_ID_KEY, stopID);
- osmTags.put(GTFS_OPERATOR_KEY, operatorName);
- osmTags.put(GTFS_NAME_KEY, stopName);
+ osmTags.put(tag_defs.OSM_STOP_ID_KEY, stopID);
+ osmTags.put(tag_defs.OSM_NETWORK_KEY, operatorName);
+
+ //System.out.println("Creating stop " + stopID.toString());
+ // Use Quay Name of NetEx instead of GTFS (netexQuayName is null if not created with GTFSReadIn)
+ if (netexStopElement != null) {
+ osmTags.put(tag_defs.OSM_STOP_NAME_KEY, netexStopElement.getLogicalName(processingParams.getStopCities()));
+ stopNameWithTown = netexStopElement.getLogicalNameWithTown(null);
+ // Get alt_names
+ List altNames = netexStopElement.getLogicalAltNames(processingParams.getStopCities());
+ // Add gtfs stop name to alt_name if it is different than the logicalName from Netex
+ if (!stopName.equals(netexStopElement.getLogicalName(processingParams.getStopCities())) && !netexStopElement.getLogicalAltNames(processingParams.getStopCities()).isEmpty()) {
+ if (!altNames.contains(stopName)) {
+ altNames.add(stopName.replace(";", "_"));
+ }
+ }
+ if (!altNames.isEmpty()) {
+ osmTags.put("alt_name", String.join(";", altNames));
+ }
+ } else {
+ osmTags.put(tag_defs.OSM_STOP_NAME_KEY, stopName);
+ }
// osmTags.put("bus", "yes");
// osmTags.put("public_transport", "plaform");
@@ -52,20 +76,24 @@ public Stop(String stopID, String operatorName, String stopName, String lat, Str
// osmTags.put("source", "http://translink.com.au/about-translink/reporting-and-publications/public-transport-performance-data");
// osmTags.put("network", getOperatorName());
-// osmTags.put(GTFS_OPERATOR_KEY, "");
+// osmTags.put(tag_defs.OSM_NETWORK_KEY, "");
this.lat = lat;
this.lon = lon;
routes = new HashSet();
}
public Stop(Stop s) {
+ super(s.primitiveType);
this.osmTags = new Hashtable();
this.osmTags.putAll(s.osmTags);
// this.osmTags.put("highway", "bus_stop");
- this.osmTags.put(GTFS_STOP_ID_KEY, s.getStopID());
- this.osmTags.put(GTFS_OPERATOR_KEY, s.getOperatorName());
- this.osmTags.put(GTFS_NAME_KEY, s.getStopName());
+ this.osmTags.put(tag_defs.OSM_STOP_ID_KEY, s.getStopID());
+ this.osmTags.put(tag_defs.OSM_NETWORK_KEY, s.getOperatorName());
+ this.osmTags.put(tag_defs.OSM_STOP_NAME_KEY, s.getStopName());
+ if (s.getStopAltName() != null) {
+ this.osmTags.put("alt_name", s.getStopAltName());
+ }
// this.osmTags.put("url", "http://translink.com.au/stop/"+s.getStopID());
// if (!s.getStopID().contains("place")) this.osmTags.put("url", "http://translink.com.au/stop/"+s.getStopID());
@@ -75,9 +103,10 @@ public Stop(Stop s) {
// this.osmTags.put("network", s.getOperatorName());
-// this.osmTags.put(GTFS_OPERATOR_KEY, "");
+// this.osmTags.put(tag_defs.OSM_NETWORK_KEY, "");
this.lat = s.lat;
this.lon = s.lon;
+ this.stopNameWithTown = s.stopNameWithTown;
this.setOsmId(s.getOsmId());
this.setOsmVersion(s.getOsmVersion());
this.setReportCategory(s.getReportCategory());
@@ -85,6 +114,7 @@ public Stop(Stop s) {
this.setStatus(s.getStatus());
this.setLastEditedOsmDate(s.getLastEditedOsmDate());
this.setLastEditedOsmUser(s.getLastEditedOsmUser());
+ this.wayNdRefs.addAll(s.wayNdRefs);
routes = new HashSet();
routes.addAll(s.getRoutes());
}
@@ -106,15 +136,34 @@ public void setLon(String v){
}
public String getStopID(){
- return (String)osmTags.get(GTFS_STOP_ID_KEY);
+ return (String)osmTags.get(tag_defs.OSM_STOP_ID_KEY);
}
public String getOperatorName(){
- return (String)osmTags.get(GTFS_OPERATOR_KEY);
+ return (String)osmTags.get(tag_defs.OSM_NETWORK_KEY);
}
public String getStopName(){
- return (String)osmTags.get(GTFS_NAME_KEY);
+ return (String)osmTags.get(tag_defs.OSM_STOP_NAME_KEY);
+ }
+
+ public String getStopNameWithTown(){
+ if (stopNameWithTown != null)
+ return stopNameWithTown;
+ else
+ return getStopName();
+ }
+
+ public String getStopAltName(){
+ return (String)osmTags.get("alt_name");
+ }
+
+ public static List stopAltNamesToList(String alt_names) {
+ if (alt_names == null)
+ return null;
+
+ String[] altNamesArray = alt_names.split(";");
+ return new ArrayList<>(Arrays.asList(altNamesArray));
}
public String getLat(){
@@ -138,17 +187,22 @@ else if ((this.getOperatorName().equals("none")) && (o.getOperatorName().equals(
public int compareTo(Object o){
Stop s = (Stop) o;
- double distance = OsmDistance.distVincenty(this.getLat(), this.getLon(),
- s.getLat(), s.getLon());
if (!(this.getStopID().equals("none")) && !(this.getStopID().equals("missing"))
&& (!(s.getStopID().equals("none"))) && (!(s.getStopID().equals("missing")))
+ && (!(this.getStopID().equals("New"))) && (!(s.getStopID().equals("New")))
&& (!this.getOperatorName().equals("none")) && (!s.getOperatorName().equals("none"))
&& (!this.getOperatorName().equals("missing")) && (!s.getOperatorName().equals("missing"))) {
if ((s.getStopID().equals(this.getStopID())) && (this.compareOperatorName(s))) {
return 0;
}
- }
- else {
+ } else if (this.getStopID().equals("New") || s.getStopID().equals("New")) {
+ if ((s.getStopID().equals(this.getStopID()))) {
+ return 0;
+ }
+ return 1;
+ } else {
+ double distance = OsmDistance.distVincenty(this.getLat(), this.getLon(),
+ s.getLat(), s.getLon());
if (distance < ERROR_TO_ZERO) {
return 0;
}
@@ -196,4 +250,8 @@ public String printOSMStop(){
public String toString(){
return this.getStopID();
}
-}
\ No newline at end of file
+
+ public String getOsmPublicTransportType() {
+ return (String) osmTags.get(tag_defs.OSM_STOP_TYPE_KEY);
+ }
+}
diff --git a/GO_Sync/src/main/java/edu/usf/cutr/go_sync/osm/HttpRequest.java b/GO_Sync/src/main/java/edu/usf/cutr/go_sync/osm/HttpRequest.java
index f78a38cf..25a287c8 100644
--- a/GO_Sync/src/main/java/edu/usf/cutr/go_sync/osm/HttpRequest.java
+++ b/GO_Sync/src/main/java/edu/usf/cutr/go_sync/osm/HttpRequest.java
@@ -22,6 +22,7 @@
import java.util.HashSet;
import java.util.Hashtable;
+import java.util.LinkedHashSet;
import java.util.List;
import javax.xml.parsers.ParserConfigurationException;
import javax.xml.parsers.SAXParserFactory;
@@ -53,7 +54,9 @@
import edu.usf.cutr.go_sync.tools.parser.ChangesetDownloadParser;
import edu.usf.cutr.go_sync.tools.parser.OsmVersionParser;
import edu.usf.cutr.go_sync.tools.parser.RouteParser;
+import edu.usf.cutr.go_sync.tools.parser.NodeWayAttr;
import edu.usf.cutr.go_sync.tag_defs;
+import java.util.Arrays;
/**
*
* @author Khoa Tran
@@ -63,11 +66,11 @@ public class HttpRequest {
private static final String API_VERSION ="0.6";
private static final String OSM_HOST = "https://openstreetmap.org/api/0.6/";
- private ArrayList existingNodes = new ArrayList();
+ private ArrayList existingNodes = new ArrayList();
private ArrayList existingRelations = new ArrayList();
private ArrayList existingBusTags = new ArrayList();
private ArrayList existingRelationTags = new ArrayList();
- private ArrayList> existingRelationMembers = new ArrayList>();
+ private ArrayList> existingRelationMembers = new ArrayList>();
private HashSet revertDelete = new HashSet();
private HashSet revertModify = new HashSet();
@@ -107,7 +110,7 @@ public void checkVersion() throws InterruptedException{
}
}
- public ArrayList getExistingBusStops(String left, String bottom, String right, String top) throws InterruptedException{
+ public ArrayList getExistingBusStops(String left, String bottom, String right, String top) throws InterruptedException{
//http://open.mapquestapi.com/xapi/
//"http://www.informationfreeway.org"
// String urlSuffix = "/api/0.6/node[highway=bus_stop][bbox="+left+","+bottom+","+right+","+top+"]";
@@ -126,6 +129,12 @@ public ArrayList getExistingBusStops(String left, String bottom,
""+
""+
+ "" +
+ ""+
+ ""+
+ ""+
+ " "+
+
"" +
""+
""+
@@ -190,11 +199,27 @@ public ArrayList getExistingBusStopsTags(){
public ArrayList getExistingBusRelations(String left, String bottom, String right, String top) throws InterruptedException{
// String urlSuffix = "/api/0.6/relation[route=bus][bbox="+left+","+bottom+","+right+","+top+"]";
// String[] hosts = {"http://open.mapquestapi.com/xapi","http://www.informationfreeway.org"};
- String urlSuffix = "?relation[route=bus][bbox="+left+","+bottom+","+right+","+top+"]";
- String[] hosts = {"http://www.overpass-api.de/api/xapi_meta","http://overpass.openstreetmap.ru/cgi/xapi_meta"};
+
+ String content = "";
+ content += "";
+ content += "";
+ content += "";
+ content += "";
+ content += "";
+ content += " ";
+ content += "";
+ content += "";
+ content += "";
+ content = content.replace("left", left).replace("right", right).replace("bottom", bottom).replace("north", top);
+ System.out.println(content);
+
+ //String urlSuffix = "?relation[route=bus][bbox="+left+","+bottom+","+right+","+top+"]";
+ //String[] hosts = {"http://www.overpass-api.de/api/xapi_meta","http://overpass.openstreetmap.ru/cgi/xapi_meta"};
+ String[] hosts = {"http://overpass-api.de/api/interpreter", "http://api.openstreetmap.fr/oapi/interpreter", "http://overpass.osm.rambler.ru/cgi/interpreter",};
try {
// get data from server
- String s = sendRequest(hosts, urlSuffix, "GET", "");
+ //String s = sendRequest(hosts, urlSuffix, "GET", "");
+ String s = sendRequest(hosts, "", "POST", content);
InputSource inputSource = new InputSource(new StringReader(s));
// get data from file - need to remove this for REAL APPLICATION
// InputSource inputSource = new InputSource("DataFromServerRELATION.osm");
@@ -225,7 +250,7 @@ public ArrayList getExistingBusRelationTags(){
}
// this method needs to be invoked after getExistingBusRelations
- public ArrayList> getExistingBusRelationMembers(){
+ public ArrayList> getExistingBusRelationMembers(){
System.out.println("tags = "+existingRelationMembers.size());
if (!existingRelationMembers.isEmpty() )
return existingRelationMembers;
@@ -298,10 +323,11 @@ private Stop getNodeByVersion(String osmid, String version, boolean isNew) throw
// InputSource inputSource = new InputSource("DataFromServerRELATION.osm");
BusStopParser par = new BusStopParser();
SAXParserFactory.newInstance().newSAXParser().parse(inputSource, par);
- AttributesImpl attImplNode = par.getOneNode();
+ NodeWayAttr attImplNode = par.getOneNode();
Hashtable tags = par.getTagsOneNode();
- st = new Stop(null,(String)tags.get(tag_defs.GTFS_OPERATOR_KEY),(String)tags.get("name"),
- attImplNode.getValue("lat"),attImplNode.getValue("lon"));
+
+ st = new Stop("node", null,(String)tags.get(tag_defs.OSM_NETWORK_KEY),(String)tags.get("name"),
+ attImplNode.getValue("lat"),attImplNode.getValue("lon"), null);
st.addTags(tags);
if (!isNew) {
st.setOsmId(attImplNode.getValue("id"));
diff --git a/GO_Sync/src/main/java/edu/usf/cutr/go_sync/tag_defs.java b/GO_Sync/src/main/java/edu/usf/cutr/go_sync/tag_defs.java
index a454ecc9..94f607d6 100644
--- a/GO_Sync/src/main/java/edu/usf/cutr/go_sync/tag_defs.java
+++ b/GO_Sync/src/main/java/edu/usf/cutr/go_sync/tag_defs.java
@@ -3,46 +3,86 @@
//
public class tag_defs {
-//https://developers.google.com/transit/gtfs/reference/
-//https://wiki.openstreetmap.org/wiki/Proposed_features/Public_Transport
- public final static String GTFS_STOP_ID_KEY = "gtfs_id";
- public final static String GTFS_OPERATOR_KEY = "network";
- public final static String GTFS_NETWORK_KEY = "agency_name";
- public final static String GTFS_NETWORK_ID_KEY = "agency_id";
- public final static String OSM_NETWORK_KEY = "network";
+ //https://developers.google.com/transit/gtfs/reference/
+ //https://wiki.openstreetmap.org/wiki/Proposed_features/Public_Transport
+ //https://wiki.openstreetmap.org/wiki/GTFS/Mapping_to_OSM_tags
+ //https://wiki.openstreetmap.org/wiki/GTFS
+
+ //https://developers.google.com/transit/gtfs/reference#agencytxt
+ public final static String GTFS_AGENCY_NAME_KEY = "agency_name";
+ public final static String GTFS_AGENCY_ID_KEY = "agency_id";
+ public final static String OSM_NETWORK_KEY = "network";
+
+ //https://developers.google.com/transit/gtfs/reference#stoptxt
+ public final static String GTFS_STOP_ID_KEY = "stop_id";
+ public final static String OSM_STOP_ID_KEY = "gtfs_id"; // Alternatives are: gtfs:stop_id & gtfs:id
+
+ public final static String GTFS_STOP_NAME_KEY = "stop_name";
+ public final static String OSM_STOP_NAME_KEY = "name";
+
+ public final static String GTFS_STOP_DESC_KEY = "stop_desc";
+ public final static String OSM_STOP_DESC_KEY = "description";
+
public final static String GTFS_ZONE_KEY = "zone_id";
public final static String OSM_ZONE_KEY = "transport:zone";
+ public final static String GTFS_STOP_URL_KEY = "stop_url";
+ public final static String OSM_STOP_URL_KEY = "url";
+
+ public final static String GTFS_WHEELCHAIR_KEY = "wheelchair_boarding";
+ public final static String OSM_WHEELCHAIR_KEY = "wheelchair";
+
+ public final static String GTFS_STOP_TYPE_KEY = "location_type";
+ public final static String OSM_STOP_TYPE_KEY = "public_transport";
+
+ public final static String GTFS_PARENT_STATION_KEY = "parent_station";
+ public final static String OSM_PARENT_STATION_KEY = "gtfs_parent_station";
+
+ public final static String GTFS_PLATFORM_CODE_KEY = "platform_code";
+ public final static String OSM_PLATFORM_CODE_KEY = "local_ref";
+
+ // public final static String GTFS_OPERATOR_KEY = "operator";
+
+ //https://developers.google.com/transit/gtfs/reference#routestxt
+ public final static String GTFS_ROUTE_ID_KEY = "route_id";
+ public final static String OSM_ROUTE_ID_KEY = "gtfs:route_id";
+
+ public final static String GTFS_ROUTE_NUM_KEY = "route_short_name";
+ public final static String OSM_ROUTE_NUM_KEY = "ref"; // Alternative is gtfs:name
+
+ public final static String GTFS_ROUTE_NAME_KEY = "route_long_name";
+ public final static String OSM_ROUTE_NAME_KEY = "gtfs:name";
+
+ public final static String GTFS_ROUTE_DESC_NAME_KEY = "route_desc";
+ public final static String OSM_ROUTE_DESC_NAME_KEY = "description";
- // public final static String GTFS_OPERATOR_KEY = "operator"
-//
-//
-// ;
- public final static String GTFS_ROUTE_NUM = "route_short_name";
- public final static String OSM_ROUTE_NUM = "ref";
- public final static String GTFS_ROUTE_NAME = "route_long_name";
- public final static String OSM_ROUTE_NAME = "name";
public final static String GTFS_COLOR_KEY = "route_color";
public final static String GTFS_COLOUR_KEY = "route_colour";
public final static String OSM_COLOUR_KEY = "colour";
- public final static String GTFS_WHEELCHAIR_KEY = "wheelchair_boarding";
- public final static String OSM_WHEELCHAIR_KEY = "wheelchair";
- public final static String GTFS_STOP_TYPE_KEY = "location_type";
- public final static String OSM_STOP_TYPE_KEY = "public_transport";
+ public final static String GTFS_ROUTE_URL_KEY = "route_url";
+ public final static String OSM_ROUTE_URL_KEY = "url";
+
public final static String GTFS_NAME_KEY = "name";
public final static String ROUTE_KEY = "ref";
public final static String OSM_ROUTE_TYPE_KEY = "route";
- public final static String GTFS_STOP_URL_KEY = "stop_url";
- public final static String GTFS_ROUTE_URL_KEY = "route_url";
- public final static String OSM_URL_KEY = "url";
-
//https://developers.google.com/transit/gtfs/reference#tripstxt
- public final static String GTFS_ROUTE_ID_KEY = "route_id";
public final static String GTFS_SERVICE_ID_KEY = "service_id";
+ // No mapping to OSM for GTFS_SERVICE_ID_KEY
+
+ public final static String GTFS_SHAPE_ID_KEY = "shape_id";
+ public final static String OSM_SHAPE_ID_KEY = "gtfs:shape_id";
+
public final static String GTFS_TRIP_ID_KEY = "trip_id";
- public final static String GTFS_TRIPS_STOP_ID_KEY = "stop_id";
+ public final static String OSM_TRIP_ID_KEY = "gtfs:trip_id:sample"; // or gtfs:shape_id if possible
+
+ //https://developers.google.com/transit/gtfs/reference#stop_timestxt
+ public final static String GTFS_SEQUENCE_KEY = "stop_sequence";
+ public final static String GTFS_PICKUP_TYPE_KEY = "pickup_type";
+ public final static String GTFS_DROP_OFF_TYPE_KEY = "drop_off_type";
+ public final static String GTFS_DEPARTURE_TIME_KEY = "departure_time";
+ public final static String GTFS_ARRIVAL_TIME_KEY = "arrival_time";
public enum primative_type {
NODE, RELATION, WAY
diff --git a/GO_Sync/src/main/java/edu/usf/cutr/go_sync/task/CompareData.java b/GO_Sync/src/main/java/edu/usf/cutr/go_sync/task/CompareData.java
index 36701682..ea3986c1 100644
--- a/GO_Sync/src/main/java/edu/usf/cutr/go_sync/task/CompareData.java
+++ b/GO_Sync/src/main/java/edu/usf/cutr/go_sync/task/CompareData.java
@@ -17,18 +17,24 @@
package edu.usf.cutr.go_sync.task;
+import edu.usf.cutr.go_sync.gui.MainForm;
import edu.usf.cutr.go_sync.gui.ReportViewer;
import edu.usf.cutr.go_sync.osm.*;
import edu.usf.cutr.go_sync.io.GTFSReadIn;
import java.awt.Toolkit;
import java.util.ArrayList;
+import java.util.Collections;
+import java.util.EnumSet;
+import java.util.HashMap;
import java.util.HashSet;
import java.util.Hashtable;
import java.util.Iterator;
+import java.util.LinkedHashSet;
import java.util.List;
import java.util.Comparator;
import java.util.SortedSet;
+import java.util.TreeMap;
import java.util.TreeSet;
import java.util.Map;
@@ -37,8 +43,11 @@
import edu.usf.cutr.go_sync.object.OperatorInfo;
import edu.usf.cutr.go_sync.object.OsmPrimitive;
+import edu.usf.cutr.go_sync.object.ProcessingOptions;
import edu.usf.cutr.go_sync.object.RelationMember;
import edu.usf.cutr.go_sync.object.Route;
+import edu.usf.cutr.go_sync.object.RouteVariant;
+import edu.usf.cutr.go_sync.object.RouteVariantStop;
import edu.usf.cutr.go_sync.object.Stop;
import org.xml.sax.helpers.AttributesImpl;
@@ -46,6 +55,8 @@
import edu.usf.cutr.go_sync.tools.OsmDistance;
import edu.usf.cutr.go_sync.tools.OsmFormatter;
import edu.usf.cutr.go_sync.tag_defs;
+import edu.usf.cutr.go_sync.tools.parser.NodeWayAttr;
+import java.io.File;
/**
*
@@ -72,13 +83,13 @@ public class CompareData extends OsmTask{
long tStart = System.currentTimeMillis();
private List GTFSstops = new ArrayList();
private List GTFSstopsIDs = new ArrayList();
- private ArrayList OSMNodes = new ArrayList();
+ private ArrayList OSMNodes = new ArrayList();
// private ArrayList> OSMTags = new ArrayList>();
private ArrayList OSMTags = new ArrayList();
private ArrayList OSMRelations = new ArrayList();
// private ArrayList> OSMRelationTags = new ArrayList>();
private ArrayList OSMRelationTags = new ArrayList();
- private ArrayList> OSMRelationMembers = new ArrayList>();
+ private ArrayList> OSMRelationMembers = new ArrayList>();
// key is gtfs, value is container of potential osm matches, sorted by distance from gtfs stop
private Hashtable> report =
new Hashtable>();
@@ -89,10 +100,21 @@ public class CompareData extends OsmTask{
private Hashtable routes = new Hashtable();
private Hashtable agencyRoutes = new Hashtable();
private Hashtable existingRoutes = new Hashtable();
+ private HashMap