mirror of
https://github.com/MistWeatherMedia/WeatherSTAR-3000-Java.git
synced 2026-11-28 22:48:09 -08:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1ecfc3c965 | ||
|
|
7396be94c9 | ||
|
|
e501a99559 | ||
|
|
604fedab47 | ||
|
|
8b50b3b60c | ||
|
|
116a409b6d | ||
|
|
5eb6fade7f |
No files matched your search
@@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
<groupId>WS3000</groupId>
|
<groupId>WS3000</groupId>
|
||||||
<artifactId>weatherstar3000</artifactId>
|
<artifactId>weatherstar3000</artifactId>
|
||||||
<version>1.2.3</version>
|
<version>1.5.0</version>
|
||||||
|
|
||||||
<name>weatherstar3000</name>
|
<name>weatherstar3000</name>
|
||||||
<url>https://github.com/MistWeatherMedia/WeatherSTAR-3000-Java</url>
|
<url>https://github.com/MistWeatherMedia/WeatherSTAR-3000-Java</url>
|
||||||
|
|||||||
Binary file not shown.
|
Before Width: | Height: | Size: 22 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 19 KiB |
@@ -13,6 +13,7 @@ public class DataRunner extends Thread {
|
|||||||
Main.outlook = new Outlook();
|
Main.outlook = new Outlook();
|
||||||
Main.travelForecast = new TravelForecast();
|
Main.travelForecast = new TravelForecast();
|
||||||
Main.bulletin = new Bulletin();
|
Main.bulletin = new Bulletin();
|
||||||
|
Main.tides = new Tides();
|
||||||
|
|
||||||
Main.currentConditions.start();
|
Main.currentConditions.start();
|
||||||
Main.hourlyObservations.start();
|
Main.hourlyObservations.start();
|
||||||
@@ -24,6 +25,7 @@ public class DataRunner extends Thread {
|
|||||||
Main.outlook.start();
|
Main.outlook.start();
|
||||||
Main.travelForecast.start();
|
Main.travelForecast.start();
|
||||||
Main.bulletin.start();
|
Main.bulletin.start();
|
||||||
|
Main.tides.start();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
Main.currentConditions.join();
|
Main.currentConditions.join();
|
||||||
@@ -36,6 +38,7 @@ public class DataRunner extends Thread {
|
|||||||
Main.outlook.join();
|
Main.outlook.join();
|
||||||
Main.travelForecast.join();
|
Main.travelForecast.join();
|
||||||
Main.bulletin.join();
|
Main.bulletin.join();
|
||||||
|
Main.tides.join();
|
||||||
LoadingScreen.dataFinish = true;
|
LoadingScreen.dataFinish = true;
|
||||||
SlidesRunner.collectingData = false;
|
SlidesRunner.collectingData = false;
|
||||||
//ystem.out.println("data finished, destroying thread");
|
//ystem.out.println("data finished, destroying thread");
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ import java.io.File;
|
|||||||
import java.net.URISyntaxException;
|
import java.net.URISyntaxException;
|
||||||
|
|
||||||
public class Main {
|
public class Main {
|
||||||
static String[] slidesList;
|
static String selectedFlavor;
|
||||||
static ArrayList<String> ldlList = new ArrayList<>(Arrays.asList("cityname", "condition", "temperature", "humidity", "pressure", "wind", "visibility", "precip"));
|
static ArrayList<String> ldlList = new ArrayList<>(Arrays.asList("cityname", "condition", "temperature", "humidity", "pressure", "wind", "visibility", "precip"));
|
||||||
static boolean settingsErrorThrown = false;
|
static boolean settingsErrorThrown = false;
|
||||||
static ArrayList<String> settingsErrorReasons = new ArrayList<>();
|
static ArrayList<String> settingsErrorReasons = new ArrayList<>();
|
||||||
@@ -58,6 +58,9 @@ public class Main {
|
|||||||
static Outlook outlook;
|
static Outlook outlook;
|
||||||
static TravelForecast travelForecast;
|
static TravelForecast travelForecast;
|
||||||
static Bulletin bulletin;
|
static Bulletin bulletin;
|
||||||
|
static Tides tides;
|
||||||
|
|
||||||
|
static JFrame settingsWindow;
|
||||||
|
|
||||||
static ArrayList<String> nearNames = new ArrayList<>();
|
static ArrayList<String> nearNames = new ArrayList<>();
|
||||||
static ArrayList<String> nearIcaos = new ArrayList<>();
|
static ArrayList<String> nearIcaos = new ArrayList<>();
|
||||||
@@ -65,271 +68,436 @@ public class Main {
|
|||||||
static ArrayList<String> regConIcaos = new ArrayList<>();
|
static ArrayList<String> regConIcaos = new ArrayList<>();
|
||||||
static ArrayList<String> regForNames = new ArrayList<>();
|
static ArrayList<String> regForNames = new ArrayList<>();
|
||||||
static ArrayList<String> regForIcaos = new ArrayList<>();
|
static ArrayList<String> regForIcaos = new ArrayList<>();
|
||||||
static JFrame settingsWindow;
|
static ArrayList<String> tideIDs = new ArrayList<>();
|
||||||
|
static ArrayList<String> tideNames = new ArrayList<>();
|
||||||
|
|
||||||
static String adCrawl;
|
static String adCrawl;
|
||||||
|
|
||||||
|
static boolean tidesEnabled = false;
|
||||||
|
|
||||||
static String jarFolder = "";
|
static String jarFolder = "";
|
||||||
|
|
||||||
static JTextField mainLocName;
|
static JTextField mainLocName;
|
||||||
|
|
||||||
public static void main(String[] args) throws InterruptedException {
|
public static void main(String[] args) throws InterruptedException {
|
||||||
System.out.println("WeatherSTAR 3000 Simulator Version 1.3.1");
|
/*
|
||||||
|
try {
|
||||||
|
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
|
||||||
|
} catch (UnsupportedLookAndFeelException e) {
|
||||||
|
|
||||||
|
} catch (ClassNotFoundException e) {
|
||||||
|
|
||||||
|
} catch (InstantiationException e) {
|
||||||
|
|
||||||
|
} catch (IllegalAccessException e) {
|
||||||
|
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
//things to add:
|
||||||
|
//airport conditions
|
||||||
|
//air quality
|
||||||
|
//tides
|
||||||
|
System.out.println("WeatherSTAR 3000 Simulator Version 1.5.0");
|
||||||
|
|
||||||
String userDir = System.getProperty("user.dir");
|
String userDir = System.getProperty("user.dir");
|
||||||
if (userDir != null && !userDir.isEmpty()) {
|
if (userDir != null && !userDir.isEmpty()) {
|
||||||
jarFolder = userDir;
|
jarFolder = userDir;
|
||||||
} else {
|
} else {
|
||||||
// Definitive filesystem fallback if the OS environment fails to report
|
|
||||||
jarFolder = new File(".").getAbsolutePath();
|
jarFolder = new File(".").getAbsolutePath();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// read
|
||||||
|
File loadDataFile = new File(jarFolder + File.separator + "loadData.txt");
|
||||||
|
ArrayList<String> loadDataLines = new ArrayList<>();
|
||||||
|
|
||||||
settingsWindow = new JFrame("WeatherSTAR 3000 Settings");
|
settingsWindow = new JFrame("WeatherSTAR 3000 Settings");
|
||||||
settingsWindow.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
settingsWindow.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
||||||
settingsWindow.setSize(540, 350);
|
settingsWindow.setSize(460, 350);
|
||||||
settingsWindow.setLocationRelativeTo(null);
|
settingsWindow.setLocationRelativeTo(null);
|
||||||
settingsWindow.setResizable(false);
|
settingsWindow.setResizable(false);
|
||||||
|
|
||||||
ImageIcon sfIcon = new ImageIcon(Main.class.getResource("/resources/images/icon.png"));
|
ImageIcon sfIcon = new ImageIcon(Main.class.getResource("/resources/images/icon.png"));
|
||||||
settingsWindow.setIconImage(sfIcon.getImage());
|
settingsWindow.setIconImage(sfIcon.getImage());
|
||||||
|
|
||||||
JPanel settingsFrame = new JPanel();
|
JPanel mainPanel = new JPanel(new BorderLayout());
|
||||||
settingsFrame.setPreferredSize(new Dimension(540, 840));
|
|
||||||
settingsFrame.setLayout(new FlowLayout(FlowLayout.LEADING));
|
|
||||||
|
|
||||||
// read
|
JPanel contentPanel = new JPanel();
|
||||||
File loadDataFile = new File(jarFolder + File.separator + "loadData.txt");
|
contentPanel.setLayout(new BoxLayout(contentPanel, BoxLayout.Y_AXIS));
|
||||||
ArrayList<String> loadDataLines = new ArrayList<>();
|
contentPanel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 10));
|
||||||
|
|
||||||
// info
|
JPanel aPanel = new JPanel(new FlowLayout(FlowLayout.LEFT));
|
||||||
settingsFrame.add(new JLabel("***Maximum location name length: 14 characters, 19 for Regional Con***"));// 19
|
aPanel.setBorder(BorderFactory.createTitledBorder("IBM Api Key From api.weather.com"));
|
||||||
// if
|
|
||||||
// regional
|
|
||||||
// conditions
|
|
||||||
|
|
||||||
// api key
|
JTextField apiKeyText = new JTextField(25);
|
||||||
settingsFrame.add(new JLabel("api,weather.com IBM api key"));
|
aPanel.add(apiKeyText);
|
||||||
JTextField apiKeyText = new JTextField(20);
|
|
||||||
settingsFrame.add(apiKeyText);
|
|
||||||
|
|
||||||
// main location
|
aPanel.setMaximumSize(new Dimension(Integer.MAX_VALUE, aPanel.getPreferredSize().height));
|
||||||
settingsFrame.add(new JLabel("Main Location ICAO Code and Name"));
|
|
||||||
JTextField mainLocIcaoCode = new JTextField(4);
|
|
||||||
settingsFrame.add(mainLocIcaoCode);
|
|
||||||
mainLocName = new JTextField(14);
|
|
||||||
settingsFrame.add(mainLocName);
|
|
||||||
|
|
||||||
// spacer
|
contentPanel.add(aPanel);
|
||||||
JPanel firstSpacer = new JPanel();
|
|
||||||
firstSpacer.setPreferredSize(new Dimension(480, 10));
|
|
||||||
settingsFrame.add(firstSpacer);
|
|
||||||
|
|
||||||
// nearby locations
|
JPanel mlPanel = new JPanel(new FlowLayout(FlowLayout.LEFT));
|
||||||
settingsFrame.add(new JLabel("Nearby Location One ICAO Code and Name"));
|
mlPanel.setBorder(BorderFactory.createTitledBorder("Main Location"));
|
||||||
JTextField nearLocOneIcaoCode = new JTextField(4);
|
|
||||||
settingsFrame.add(nearLocOneIcaoCode);
|
|
||||||
JTextField nearLocOneName = new JTextField(14);
|
|
||||||
settingsFrame.add(nearLocOneName);
|
|
||||||
|
|
||||||
settingsFrame.add(new JLabel("Nearby Location Two ICAO Code and Name"));
|
mlPanel.add(new JLabel("ICAO Code"));
|
||||||
JTextField nearLocTwoIcaoCode = new JTextField(4);
|
JTextField mainLocIcaoCode = new JTextField(5);
|
||||||
settingsFrame.add(nearLocTwoIcaoCode);
|
mlPanel.add(mainLocIcaoCode);
|
||||||
JTextField nearLocTwoName = new JTextField(14);
|
mlPanel.add(new JLabel("Location Name"));
|
||||||
settingsFrame.add(nearLocTwoName);
|
mainLocName = new JTextField(15);
|
||||||
|
mlPanel.add(mainLocName);
|
||||||
|
|
||||||
settingsFrame.add(new JLabel("Nearby Location Three ICAO Code and Name"));
|
mlPanel.setMaximumSize(new Dimension(Integer.MAX_VALUE, mlPanel.getPreferredSize().height));
|
||||||
JTextField nearLocThreeIcaoCode = new JTextField(4);
|
|
||||||
settingsFrame.add(nearLocThreeIcaoCode);
|
|
||||||
JTextField nearLocThreeName = new JTextField(14);
|
|
||||||
settingsFrame.add(nearLocThreeName);
|
|
||||||
|
|
||||||
settingsFrame.add(new JLabel("Nearby Location Four ICAO Code and Name"));
|
contentPanel.add(mlPanel);
|
||||||
JTextField nearLocFourIcaoCode = new JTextField(4);
|
|
||||||
settingsFrame.add(nearLocFourIcaoCode);
|
|
||||||
JTextField nearLocFourName = new JTextField(14);
|
|
||||||
settingsFrame.add(nearLocFourName);
|
|
||||||
|
|
||||||
settingsFrame.add(new JLabel("Nearby Location Five ICAO Code and Name"));
|
JPanel nbPanel = new JPanel(new GridLayout(0, 1, 0, 0));
|
||||||
JTextField nearLocFiveIcaoCode = new JTextField(4);
|
nbPanel.setBorder(BorderFactory.createTitledBorder("Nearby Locations"));
|
||||||
settingsFrame.add(nearLocFiveIcaoCode);
|
|
||||||
JTextField nearLocFiveName = new JTextField(14);
|
|
||||||
settingsFrame.add(nearLocFiveName);
|
|
||||||
|
|
||||||
settingsFrame.add(new JLabel("Nearby Location Six ICAO Code and Name"));
|
JPanel nb1Panel = new JPanel(new FlowLayout(FlowLayout.LEFT));
|
||||||
JTextField nearLocSixIcaoCode = new JTextField(4);
|
nb1Panel.add(new JLabel("ICAO Code"));
|
||||||
settingsFrame.add(nearLocSixIcaoCode);
|
JTextField nearLocOneIcaoCode = new JTextField(5);
|
||||||
JTextField nearLocSixName = new JTextField(14);
|
nb1Panel.add(nearLocOneIcaoCode);
|
||||||
settingsFrame.add(nearLocSixName);
|
nb1Panel.add(new JLabel("Location Name"));
|
||||||
|
JTextField nearLocOneName = new JTextField(15);
|
||||||
|
nb1Panel.add(nearLocOneName);
|
||||||
|
|
||||||
settingsFrame.add(new JLabel("Nearby Location Seven ICAO Code and Name"));
|
nbPanel.add(nb1Panel);
|
||||||
JTextField nearLocSevenIcaoCode = new JTextField(4);
|
|
||||||
settingsFrame.add(nearLocSevenIcaoCode);
|
|
||||||
JTextField nearLocSevenName = new JTextField(14);
|
|
||||||
settingsFrame.add(nearLocSevenName);
|
|
||||||
|
|
||||||
// spacer
|
JPanel nb2Panel = new JPanel(new FlowLayout(FlowLayout.LEFT));
|
||||||
JPanel secondSpacer = new JPanel();
|
nb2Panel.add(new JLabel("ICAO Code"));
|
||||||
secondSpacer.setPreferredSize(new Dimension(480, 10));
|
JTextField nearLocTwoIcaoCode = new JTextField(5);
|
||||||
settingsFrame.add(secondSpacer);
|
nb2Panel.add(nearLocTwoIcaoCode);
|
||||||
|
nb2Panel.add(new JLabel("Location Name"));
|
||||||
|
JTextField nearLocTwoName = new JTextField(15);
|
||||||
|
nb2Panel.add(nearLocTwoName);
|
||||||
|
|
||||||
// nearby locations
|
nbPanel.add(nb2Panel);
|
||||||
settingsFrame.add(new JLabel("Regional Conditions One ICAO Code and Name"));
|
|
||||||
JTextField regConOneIcaoCode = new JTextField(4);
|
|
||||||
settingsFrame.add(regConOneIcaoCode);
|
|
||||||
JTextField regConOneName = new JTextField(14);
|
|
||||||
settingsFrame.add(regConOneName);
|
|
||||||
|
|
||||||
settingsFrame.add(new JLabel("Regional Conditions Two ICAO Code and Name"));
|
JPanel nb3Panel = new JPanel(new FlowLayout(FlowLayout.LEFT));
|
||||||
JTextField regConTwoIcaoCode = new JTextField(4);
|
nb3Panel.add(new JLabel("ICAO Code"));
|
||||||
settingsFrame.add(regConTwoIcaoCode);
|
JTextField nearLocThreeIcaoCode = new JTextField(5);
|
||||||
JTextField regConTwoName = new JTextField(14);
|
nb3Panel.add(nearLocThreeIcaoCode);
|
||||||
settingsFrame.add(regConTwoName);
|
nb3Panel.add(new JLabel("Location Name"));
|
||||||
|
JTextField nearLocThreeName = new JTextField(15);
|
||||||
|
nb3Panel.add(nearLocThreeName);
|
||||||
|
|
||||||
settingsFrame.add(new JLabel("Regional Conditions Three ICAO Code and Name"));
|
nbPanel.add(nb3Panel);
|
||||||
JTextField regConThreeIcaoCode = new JTextField(4);
|
|
||||||
settingsFrame.add(regConThreeIcaoCode);
|
|
||||||
JTextField regConThreeName = new JTextField(14);
|
|
||||||
settingsFrame.add(regConThreeName);
|
|
||||||
|
|
||||||
settingsFrame.add(new JLabel("Regional Conditions Four ICAO Code and Name"));
|
JPanel nb4Panel = new JPanel(new FlowLayout(FlowLayout.LEFT));
|
||||||
JTextField regConFourIcaoCode = new JTextField(4);
|
nb4Panel.add(new JLabel("ICAO Code"));
|
||||||
settingsFrame.add(regConFourIcaoCode);
|
JTextField nearLocFourIcaoCode = new JTextField(5);
|
||||||
JTextField regConFourName = new JTextField(14);
|
nb4Panel.add(nearLocFourIcaoCode);
|
||||||
settingsFrame.add(regConFourName);
|
nb4Panel.add(new JLabel("Location Name"));
|
||||||
|
JTextField nearLocFourName = new JTextField(15);
|
||||||
|
nb4Panel.add(nearLocFourName);
|
||||||
|
|
||||||
settingsFrame.add(new JLabel("Regional Conditions Five ICAO Code and Name"));
|
nbPanel.add(nb4Panel);
|
||||||
JTextField regConFiveIcaoCode = new JTextField(4);
|
|
||||||
settingsFrame.add(regConFiveIcaoCode);
|
|
||||||
JTextField regConFiveName = new JTextField(14);
|
|
||||||
settingsFrame.add(regConFiveName);
|
|
||||||
|
|
||||||
settingsFrame.add(new JLabel("Regional Conditions Six ICAO Code and Name"));
|
JPanel nb5Panel = new JPanel(new FlowLayout(FlowLayout.LEFT));
|
||||||
JTextField regConSixIcaoCode = new JTextField(4);
|
nb5Panel.add(new JLabel("ICAO Code"));
|
||||||
settingsFrame.add(regConSixIcaoCode);
|
JTextField nearLocFiveIcaoCode = new JTextField(5);
|
||||||
JTextField regConSixName = new JTextField(14);
|
nb5Panel.add(nearLocFiveIcaoCode);
|
||||||
settingsFrame.add(regConSixName);
|
nb5Panel.add(new JLabel("Location Name"));
|
||||||
|
JTextField nearLocFiveName = new JTextField(15);
|
||||||
|
nb5Panel.add(nearLocFiveName);
|
||||||
|
|
||||||
settingsFrame.add(new JLabel("Regional Conditions Seven ICAO Code and Name"));
|
nbPanel.add(nb5Panel);
|
||||||
JTextField regConSevenIcaoCode = new JTextField(4);
|
|
||||||
settingsFrame.add(regConSevenIcaoCode);
|
|
||||||
JTextField regConSevenName = new JTextField(14);
|
|
||||||
settingsFrame.add(regConSevenName);
|
|
||||||
|
|
||||||
// spacer
|
JPanel nb6Panel = new JPanel(new FlowLayout(FlowLayout.LEFT));
|
||||||
JPanel thirdSpacer = new JPanel();
|
nb6Panel.add(new JLabel("ICAO Code"));
|
||||||
thirdSpacer.setPreferredSize(new Dimension(480, 10));
|
JTextField nearLocSixIcaoCode = new JTextField(5);
|
||||||
settingsFrame.add(thirdSpacer);
|
nb6Panel.add(nearLocSixIcaoCode);
|
||||||
|
nb6Panel.add(new JLabel("Location Name"));
|
||||||
|
JTextField nearLocSixName = new JTextField(15);
|
||||||
|
nb6Panel.add(nearLocSixName);
|
||||||
|
|
||||||
// nearby locations
|
nbPanel.add(nb6Panel);
|
||||||
settingsFrame.add(new JLabel("Regional Forecast One ICAO Code and Name"));
|
|
||||||
JTextField regForOneIcaoCode = new JTextField(4);
|
|
||||||
settingsFrame.add(regForOneIcaoCode);
|
|
||||||
JTextField regForOneName = new JTextField(14);
|
|
||||||
settingsFrame.add(regForOneName);
|
|
||||||
|
|
||||||
settingsFrame.add(new JLabel("Regional Forecast Two ICAO Code and Name"));
|
JPanel nb7Panel = new JPanel(new FlowLayout(FlowLayout.LEFT));
|
||||||
JTextField regForTwoIcaoCode = new JTextField(4);
|
nb7Panel.add(new JLabel("ICAO Code"));
|
||||||
settingsFrame.add(regForTwoIcaoCode);
|
JTextField nearLocSevenIcaoCode = new JTextField(5);
|
||||||
JTextField regForTwoName = new JTextField(14);
|
nb7Panel.add(nearLocSevenIcaoCode);
|
||||||
settingsFrame.add(regForTwoName);
|
nb7Panel.add(new JLabel("Location Name"));
|
||||||
|
JTextField nearLocSevenName = new JTextField(15);
|
||||||
|
nb7Panel.add(nearLocSevenName);
|
||||||
|
|
||||||
settingsFrame.add(new JLabel("Regional Forecast Three ICAO Code and Name"));
|
nbPanel.add(nb7Panel);
|
||||||
JTextField regForThreeIcaoCode = new JTextField(4);
|
|
||||||
settingsFrame.add(regForThreeIcaoCode);
|
|
||||||
JTextField regForThreeName = new JTextField(14);
|
|
||||||
settingsFrame.add(regForThreeName);
|
|
||||||
|
|
||||||
settingsFrame.add(new JLabel("Regional Forecast Four ICAO Code and Name"));
|
nbPanel.setMaximumSize(new Dimension(Integer.MAX_VALUE, nbPanel.getPreferredSize().height));
|
||||||
JTextField regForFourIcaoCode = new JTextField(4);
|
|
||||||
settingsFrame.add(regForFourIcaoCode);
|
|
||||||
JTextField regForFourName = new JTextField(14);
|
|
||||||
settingsFrame.add(regForFourName);
|
|
||||||
|
|
||||||
settingsFrame.add(new JLabel("Regional Forecast Five ICAO Code and Name"));
|
contentPanel.add(nbPanel);
|
||||||
JTextField regForFiveIcaoCode = new JTextField(4);
|
|
||||||
settingsFrame.add(regForFiveIcaoCode);
|
|
||||||
JTextField regForFiveName = new JTextField(14);
|
|
||||||
settingsFrame.add(regForFiveName);
|
|
||||||
|
|
||||||
settingsFrame.add(new JLabel("Regional Forecast Six ICAO Code and Name"));
|
JPanel rcPanel = new JPanel(new GridLayout(0, 1, 0, 0));
|
||||||
JTextField regForSixIcaoCode = new JTextField(4);
|
rcPanel.setBorder(BorderFactory.createTitledBorder("Regional Conditions Locations"));
|
||||||
settingsFrame.add(regForSixIcaoCode);
|
|
||||||
JTextField regForSixName = new JTextField(14);
|
|
||||||
settingsFrame.add(regForSixName);
|
|
||||||
|
|
||||||
settingsFrame.add(new JLabel("Regional Forecast Seven ICAO Code and Name"));
|
JPanel rc1Panel = new JPanel(new FlowLayout(FlowLayout.LEFT));
|
||||||
JTextField regForSevenIcaoCode = new JTextField(4);
|
rc1Panel.add(new JLabel("ICAO Code"));
|
||||||
settingsFrame.add(regForSevenIcaoCode);
|
JTextField regConOneIcaoCode = new JTextField(5);
|
||||||
JTextField regForSevenName = new JTextField(14);
|
rc1Panel.add(regConOneIcaoCode);
|
||||||
settingsFrame.add(regForSevenName);
|
rc1Panel.add(new JLabel("Location Name"));
|
||||||
|
JTextField regConOneName = new JTextField(15);
|
||||||
|
rc1Panel.add(regConOneName);
|
||||||
|
|
||||||
JPanel aSpacer = new JPanel();
|
rcPanel.add(rc1Panel);
|
||||||
aSpacer.setPreferredSize(new Dimension(500, 10));
|
|
||||||
settingsFrame.add(aSpacer);
|
|
||||||
|
|
||||||
settingsFrame.add(new JLabel("Ad crawl message"));
|
JPanel rc2Panel = new JPanel(new FlowLayout(FlowLayout.LEFT));
|
||||||
JTextField adCrawlInput = new JTextField(32);
|
rc2Panel.add(new JLabel("ICAO Code"));
|
||||||
settingsFrame.add(adCrawlInput);
|
JTextField regConTwoIcaoCode = new JTextField(5);
|
||||||
|
rc2Panel.add(regConTwoIcaoCode);
|
||||||
|
rc2Panel.add(new JLabel("Location Name"));
|
||||||
|
JTextField regConTwoName = new JTextField(15);
|
||||||
|
rc2Panel.add(regConTwoName);
|
||||||
|
|
||||||
// spacer
|
rcPanel.add(rc2Panel);
|
||||||
JPanel fourthSpacer = new JPanel();
|
|
||||||
fourthSpacer.setPreferredSize(new Dimension(500, 10));
|
|
||||||
settingsFrame.add(fourthSpacer);
|
|
||||||
|
|
||||||
settingsFrame.add(new JLabel("Width"));
|
JPanel rc3Panel = new JPanel(new FlowLayout(FlowLayout.LEFT));
|
||||||
|
rc3Panel.add(new JLabel("ICAO Code"));
|
||||||
|
JTextField regConThreeIcaoCode = new JTextField(5);
|
||||||
|
rc3Panel.add(regConThreeIcaoCode);
|
||||||
|
rc3Panel.add(new JLabel("Location Name"));
|
||||||
|
JTextField regConThreeName = new JTextField(15);
|
||||||
|
rc3Panel.add(regConThreeName);
|
||||||
|
|
||||||
|
rcPanel.add(rc3Panel);
|
||||||
|
|
||||||
|
JPanel rc4Panel = new JPanel(new FlowLayout(FlowLayout.LEFT));
|
||||||
|
rc4Panel.add(new JLabel("ICAO Code"));
|
||||||
|
JTextField regConFourIcaoCode = new JTextField(5);
|
||||||
|
rc4Panel.add(regConFourIcaoCode);
|
||||||
|
rc4Panel.add(new JLabel("Location Name"));
|
||||||
|
JTextField regConFourName = new JTextField(15);
|
||||||
|
rc4Panel.add(regConFourName);
|
||||||
|
|
||||||
|
rcPanel.add(rc4Panel);
|
||||||
|
|
||||||
|
JPanel rc5Panel = new JPanel(new FlowLayout(FlowLayout.LEFT));
|
||||||
|
rc5Panel.add(new JLabel("ICAO Code"));
|
||||||
|
JTextField regConFiveIcaoCode = new JTextField(5);
|
||||||
|
rc5Panel.add(regConFiveIcaoCode);
|
||||||
|
rc5Panel.add(new JLabel("Location Name"));
|
||||||
|
JTextField regConFiveName = new JTextField(15);
|
||||||
|
rc5Panel.add(regConFiveName);
|
||||||
|
|
||||||
|
rcPanel.add(rc5Panel);
|
||||||
|
|
||||||
|
JPanel rc6Panel = new JPanel(new FlowLayout(FlowLayout.LEFT));
|
||||||
|
rc6Panel.add(new JLabel("ICAO Code"));
|
||||||
|
JTextField regConSixIcaoCode = new JTextField(5);
|
||||||
|
rc6Panel.add(regConSixIcaoCode);
|
||||||
|
rc6Panel.add(new JLabel("Location Name"));
|
||||||
|
JTextField regConSixName = new JTextField(15);
|
||||||
|
rc6Panel.add(regConSixName);
|
||||||
|
|
||||||
|
rcPanel.add(rc6Panel);
|
||||||
|
|
||||||
|
JPanel rc7Panel = new JPanel(new FlowLayout(FlowLayout.LEFT));
|
||||||
|
rc7Panel.add(new JLabel("ICAO Code"));
|
||||||
|
JTextField regConSevenIcaoCode = new JTextField(5);
|
||||||
|
rc7Panel.add(regConSevenIcaoCode);
|
||||||
|
rc7Panel.add(new JLabel("Location Name"));
|
||||||
|
JTextField regConSevenName = new JTextField(15);
|
||||||
|
rc7Panel.add(regConSevenName);
|
||||||
|
|
||||||
|
rcPanel.add(rc7Panel);
|
||||||
|
|
||||||
|
rcPanel.setMaximumSize(new Dimension(Integer.MAX_VALUE, rcPanel.getPreferredSize().height));
|
||||||
|
|
||||||
|
contentPanel.add(rcPanel);
|
||||||
|
|
||||||
|
JPanel rfPanel = new JPanel(new GridLayout(0, 1, 0, 0));
|
||||||
|
rfPanel.setBorder(BorderFactory.createTitledBorder("Regional Forecast Locations"));
|
||||||
|
|
||||||
|
JPanel rf1Panel = new JPanel(new FlowLayout(FlowLayout.LEFT));
|
||||||
|
rf1Panel.add(new JLabel("ICAO Code"));
|
||||||
|
JTextField regForOneIcaoCode = new JTextField(5);
|
||||||
|
rf1Panel.add(regForOneIcaoCode);
|
||||||
|
rf1Panel.add(new JLabel("Location Name"));
|
||||||
|
JTextField regForOneName = new JTextField(15);
|
||||||
|
rf1Panel.add(regForOneName);
|
||||||
|
|
||||||
|
rfPanel.add(rf1Panel);
|
||||||
|
|
||||||
|
JPanel rf2Panel = new JPanel(new FlowLayout(FlowLayout.LEFT));
|
||||||
|
rf2Panel.add(new JLabel("ICAO Code"));
|
||||||
|
JTextField regForTwoIcaoCode = new JTextField(5);
|
||||||
|
rf2Panel.add(regForTwoIcaoCode);
|
||||||
|
rf2Panel.add(new JLabel("Location Name"));
|
||||||
|
JTextField regForTwoName = new JTextField(15);
|
||||||
|
rf2Panel.add(regForTwoName);
|
||||||
|
|
||||||
|
rfPanel.add(rf2Panel);
|
||||||
|
|
||||||
|
JPanel rf3Panel = new JPanel(new FlowLayout(FlowLayout.LEFT));
|
||||||
|
rf3Panel.add(new JLabel("ICAO Code"));
|
||||||
|
JTextField regForThreeIcaoCode = new JTextField(5);
|
||||||
|
rf3Panel.add(regForThreeIcaoCode);
|
||||||
|
rf3Panel.add(new JLabel("Location Name"));
|
||||||
|
JTextField regForThreeName = new JTextField(15);
|
||||||
|
rf3Panel.add(regForThreeName);
|
||||||
|
|
||||||
|
rfPanel.add(rf3Panel);
|
||||||
|
|
||||||
|
JPanel rf4Panel = new JPanel(new FlowLayout(FlowLayout.LEFT));
|
||||||
|
rf4Panel.add(new JLabel("ICAO Code"));
|
||||||
|
JTextField regForFourIcaoCode = new JTextField(5);
|
||||||
|
rf4Panel.add(regForFourIcaoCode);
|
||||||
|
rf4Panel.add(new JLabel("Location Name"));
|
||||||
|
JTextField regForFourName = new JTextField(15);
|
||||||
|
rf4Panel.add(regForFourName);
|
||||||
|
|
||||||
|
rfPanel.add(rf4Panel);
|
||||||
|
|
||||||
|
JPanel rf5Panel = new JPanel(new FlowLayout(FlowLayout.LEFT));
|
||||||
|
rf5Panel.add(new JLabel("ICAO Code"));
|
||||||
|
JTextField regForFiveIcaoCode = new JTextField(5);
|
||||||
|
rf5Panel.add(regForFiveIcaoCode);
|
||||||
|
rf5Panel.add(new JLabel("Location Name"));
|
||||||
|
JTextField regForFiveName = new JTextField(15);
|
||||||
|
rf5Panel.add(regForFiveName);
|
||||||
|
|
||||||
|
rfPanel.add(rf5Panel);
|
||||||
|
|
||||||
|
JPanel rf6Panel = new JPanel(new FlowLayout(FlowLayout.LEFT));
|
||||||
|
rf6Panel.add(new JLabel("ICAO Code"));
|
||||||
|
JTextField regForSixIcaoCode = new JTextField(5);
|
||||||
|
rf6Panel.add(regForSixIcaoCode);
|
||||||
|
rf6Panel.add(new JLabel("Location Name"));
|
||||||
|
JTextField regForSixName = new JTextField(15);
|
||||||
|
rf6Panel.add(regForSixName);
|
||||||
|
|
||||||
|
rfPanel.add(rf6Panel);
|
||||||
|
|
||||||
|
JPanel rf7Panel = new JPanel(new FlowLayout(FlowLayout.LEFT));
|
||||||
|
rf7Panel.add(new JLabel("ICAO Code"));
|
||||||
|
JTextField regForSevenIcaoCode = new JTextField(5);
|
||||||
|
rf7Panel.add(regForSevenIcaoCode);
|
||||||
|
rf7Panel.add(new JLabel("Location Name"));
|
||||||
|
JTextField regForSevenName = new JTextField(15);
|
||||||
|
rf7Panel.add(regForSevenName);
|
||||||
|
|
||||||
|
rfPanel.add(rf7Panel);
|
||||||
|
|
||||||
|
rfPanel.setMaximumSize(new Dimension(Integer.MAX_VALUE, rfPanel.getPreferredSize().height));
|
||||||
|
|
||||||
|
contentPanel.add(rfPanel);
|
||||||
|
|
||||||
|
//tides
|
||||||
|
JPanel tPanel = new JPanel(new GridLayout(0, 1, 0, 0));
|
||||||
|
tPanel.setBorder(BorderFactory.createTitledBorder("Tides Locations"));
|
||||||
|
|
||||||
|
JPanel t1Panel = new JPanel(new FlowLayout(FlowLayout.LEFT));
|
||||||
|
t1Panel.add(new JLabel("Station ID"));
|
||||||
|
JTextField tideOneID = new JTextField(5);
|
||||||
|
t1Panel.add(tideOneID);
|
||||||
|
t1Panel.add(new JLabel("Location Name"));
|
||||||
|
JTextField tideOneName = new JTextField(15);
|
||||||
|
t1Panel.add(tideOneName);
|
||||||
|
|
||||||
|
tPanel.add(t1Panel);
|
||||||
|
|
||||||
|
JPanel t2Panel = new JPanel(new FlowLayout(FlowLayout.LEFT));
|
||||||
|
t2Panel.add(new JLabel("Station ID"));
|
||||||
|
JTextField tideTwoID = new JTextField(5);
|
||||||
|
t2Panel.add(tideTwoID);
|
||||||
|
t2Panel.add(new JLabel("Location Name"));
|
||||||
|
JTextField tideTwoName = new JTextField(15);
|
||||||
|
t2Panel.add(tideTwoName);
|
||||||
|
|
||||||
|
tPanel.add(t2Panel);
|
||||||
|
|
||||||
|
tPanel.setMaximumSize(new Dimension(Integer.MAX_VALUE, tPanel.getPreferredSize().height));
|
||||||
|
|
||||||
|
contentPanel.add(tPanel);
|
||||||
|
|
||||||
|
//ad crawl
|
||||||
|
JPanel cPanel = new JPanel(new FlowLayout(FlowLayout.LEFT));
|
||||||
|
cPanel.setBorder(BorderFactory.createTitledBorder("Ad Crawl"));
|
||||||
|
|
||||||
|
JTextField adCrawlInput = new JTextField(35);
|
||||||
|
cPanel.add(adCrawlInput);
|
||||||
|
|
||||||
|
cPanel.setMaximumSize(new Dimension(Integer.MAX_VALUE, cPanel.getPreferredSize().height));
|
||||||
|
|
||||||
|
contentPanel.add(cPanel);
|
||||||
|
|
||||||
|
JPanel rPanel = new JPanel(new GridLayout(0, 1, 0, 0));
|
||||||
|
rPanel.setBorder(BorderFactory.createTitledBorder("Run Simulation"));
|
||||||
|
|
||||||
|
JPanel r1Panel = new JPanel(new FlowLayout(FlowLayout.LEFT));
|
||||||
|
r1Panel.add(new JLabel("Width"));
|
||||||
JTextField widthField = new JTextField(3);
|
JTextField widthField = new JTextField(3);
|
||||||
settingsFrame.add(widthField);
|
r1Panel.add(widthField);
|
||||||
widthField.setText("720");
|
widthField.setText("720");
|
||||||
settingsFrame.add(new JLabel("Height"));
|
r1Panel.add(new JLabel("Height"));
|
||||||
JTextField heightField = new JTextField(3);
|
JTextField heightField = new JTextField(3);
|
||||||
heightField.setText("480");
|
heightField.setText("480");
|
||||||
settingsFrame.add(heightField);
|
r1Panel.add(heightField);
|
||||||
|
|
||||||
settingsFrame.add(new JLabel("Flavor"));
|
r1Panel.add(new JLabel("Flavor"));
|
||||||
String[] flavorOptions = {"A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q"};
|
String[] flavorOptions = {"A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q"};
|
||||||
JComboBox flavorDropdown = new JComboBox(flavorOptions);
|
JComboBox flavorDropdown = new JComboBox(flavorOptions);
|
||||||
flavorDropdown.setSelectedIndex(0);
|
flavorDropdown.setSelectedIndex(0);
|
||||||
settingsFrame.add(flavorDropdown);
|
r1Panel.add(flavorDropdown);
|
||||||
|
|
||||||
settingsFrame.add(new JLabel("LDL Options"));
|
rPanel.add(r1Panel);
|
||||||
|
|
||||||
|
JPanel r2Panel = new JPanel(new FlowLayout(FlowLayout.LEFT));
|
||||||
|
r2Panel.add(new JLabel("LDL Options"));
|
||||||
String[] ldlOptions = {"Observations", "Ad Crawl", "Both"};
|
String[] ldlOptions = {"Observations", "Ad Crawl", "Both"};
|
||||||
JComboBox ldlDropdown = new JComboBox(ldlOptions);
|
JComboBox ldlDropdown = new JComboBox(ldlOptions);
|
||||||
ldlDropdown.setSelectedIndex(0);
|
ldlDropdown.setSelectedIndex(0);
|
||||||
settingsFrame.add(ldlDropdown);
|
r2Panel.add(ldlDropdown);
|
||||||
|
|
||||||
JPanel fifthSpacer = new JPanel();
|
rPanel.add(r2Panel);
|
||||||
fifthSpacer.setPreferredSize(new Dimension(500, 10));
|
|
||||||
settingsFrame.add(fifthSpacer);
|
JPanel r3Panel = new JPanel(new FlowLayout(FlowLayout.LEFT));
|
||||||
|
JCheckBox tidesCheck = new JCheckBox("Tides");
|
||||||
|
r3Panel.add(tidesCheck);
|
||||||
|
|
||||||
JCheckBox loopCheck = new JCheckBox("Loop");
|
JCheckBox loopCheck = new JCheckBox("Loop");
|
||||||
settingsFrame.add(loopCheck);
|
r3Panel.add(loopCheck);
|
||||||
|
|
||||||
JCheckBox gsCheck = new JCheckBox("Green Screen");
|
JCheckBox gsCheck = new JCheckBox("Green Screen");
|
||||||
settingsFrame.add(gsCheck);
|
r3Panel.add(gsCheck);
|
||||||
|
|
||||||
JCheckBox fsCheck = new JCheckBox("Fullscreen");
|
JCheckBox fsCheck = new JCheckBox("Fullscreen");
|
||||||
settingsFrame.add(fsCheck);
|
r3Panel.add(fsCheck);
|
||||||
|
|
||||||
JPanel sixthSpacer = new JPanel();
|
rPanel.add(r3Panel);
|
||||||
sixthSpacer.setPreferredSize(new Dimension(500, 10));
|
|
||||||
settingsFrame.add(sixthSpacer);
|
|
||||||
|
|
||||||
|
JPanel r4Panel = new JPanel(new FlowLayout(FlowLayout.LEFT));
|
||||||
JButton doneButton = new JButton("Run");
|
JButton doneButton = new JButton("Run");
|
||||||
settingsFrame.add(doneButton);
|
r4Panel.add(doneButton);
|
||||||
|
|
||||||
JButton saveButton = new JButton("Save Config");
|
JButton saveButton = new JButton("Save Config");
|
||||||
settingsFrame.add(saveButton);
|
r4Panel.add(saveButton);
|
||||||
|
|
||||||
JButton loadButton = new JButton("Load Config");
|
JButton loadButton = new JButton("Load Config");
|
||||||
settingsFrame.add(loadButton);
|
r4Panel.add(loadButton);
|
||||||
|
|
||||||
|
r4Panel.setMaximumSize(new Dimension(Integer.MAX_VALUE, rPanel.getPreferredSize().height));
|
||||||
|
|
||||||
|
rPanel.add(r4Panel);
|
||||||
|
|
||||||
|
contentPanel.add(rPanel);
|
||||||
|
|
||||||
|
//final
|
||||||
|
JScrollPane scrollPanel = new JScrollPane(contentPanel);
|
||||||
|
scrollPanel.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
|
||||||
|
scrollPanel.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
|
||||||
|
scrollPanel.getVerticalScrollBar().setUnitIncrement(16);
|
||||||
|
|
||||||
|
mainPanel.add(scrollPanel, BorderLayout.CENTER);
|
||||||
|
|
||||||
|
settingsWindow.setContentPane(mainPanel);
|
||||||
|
|
||||||
try (Scanner myReader = new Scanner(loadDataFile)) {
|
try (Scanner myReader = new Scanner(loadDataFile)) {
|
||||||
while (myReader.hasNextLine()) {
|
while (myReader.hasNextLine()) {
|
||||||
loadDataLines.add(myReader.nextLine());
|
loadDataLines.add(myReader.nextLine());
|
||||||
}
|
}
|
||||||
} catch (FileNotFoundException e) {
|
} catch (FileNotFoundException e) {
|
||||||
JOptionPane.showMessageDialog(settingsFrame, "Unable to read previous data.");
|
JOptionPane.showMessageDialog(mainPanel, "Unable to read previous data.");
|
||||||
}
|
}
|
||||||
|
|
||||||
apiKeyText.setText(loadDataLines.get(0));
|
apiKeyText.setText(loadDataLines.get(0));
|
||||||
mainLocIcaoCode.setText(loadDataLines.get(1));
|
mainLocIcaoCode.setText(loadDataLines.get(1));
|
||||||
mainLocName.setText(loadDataLines.get(2));
|
mainLocName.setText(loadDataLines.get(2));
|
||||||
@@ -375,6 +543,10 @@ public class Main {
|
|||||||
regForSixName.setText(loadDataLines.get(42));
|
regForSixName.setText(loadDataLines.get(42));
|
||||||
regForSevenIcaoCode.setText(loadDataLines.get(43));
|
regForSevenIcaoCode.setText(loadDataLines.get(43));
|
||||||
regForSevenName.setText(loadDataLines.get(44));
|
regForSevenName.setText(loadDataLines.get(44));
|
||||||
|
tideOneID.setText(loadDataLines.get(45));
|
||||||
|
tideOneName.setText(loadDataLines.get(46));
|
||||||
|
tideTwoID.setText(loadDataLines.get(47));
|
||||||
|
tideTwoName.setText(loadDataLines.get(48));
|
||||||
|
|
||||||
saveButton.addActionListener(new ActionListener() {
|
saveButton.addActionListener(new ActionListener() {
|
||||||
@Override
|
@Override
|
||||||
@@ -397,7 +569,7 @@ public class Main {
|
|||||||
+ "\"api_key\": \"" + apiKeyText.getText() + "\","
|
+ "\"api_key\": \"" + apiKeyText.getText() + "\","
|
||||||
+ "\"mainLocation\": {"
|
+ "\"mainLocation\": {"
|
||||||
+ "\"icaoCode\": \"" + mainLocIcaoCode.getText() + "\","
|
+ "\"icaoCode\": \"" + mainLocIcaoCode.getText() + "\","
|
||||||
+ "\"locName\": \"" + mainLocName.getText() + "\","
|
+ "\"locName\": \"" + mainLocName.getText() + "\""
|
||||||
+ "},"
|
+ "},"
|
||||||
+ "\"nearbyLocations\": ["
|
+ "\"nearbyLocations\": ["
|
||||||
+ "{\"icaoCode\": \"" + nearLocOneIcaoCode.getText() + "\", \"locName\": \"" + nearLocOneName.getText() + "\"},"
|
+ "{\"icaoCode\": \"" + nearLocOneIcaoCode.getText() + "\", \"locName\": \"" + nearLocOneName.getText() + "\"},"
|
||||||
@@ -406,7 +578,7 @@ public class Main {
|
|||||||
+ "{\"icaoCode\": \"" + nearLocFourIcaoCode.getText() + "\", \"locName\": \"" + nearLocFourName.getText() + "\"},"
|
+ "{\"icaoCode\": \"" + nearLocFourIcaoCode.getText() + "\", \"locName\": \"" + nearLocFourName.getText() + "\"},"
|
||||||
+ "{\"icaoCode\": \"" + nearLocFiveIcaoCode.getText() + "\", \"locName\": \"" + nearLocFiveName.getText() + "\"},"
|
+ "{\"icaoCode\": \"" + nearLocFiveIcaoCode.getText() + "\", \"locName\": \"" + nearLocFiveName.getText() + "\"},"
|
||||||
+ "{\"icaoCode\": \"" + nearLocSixIcaoCode.getText() + "\", \"locName\": \"" + nearLocSixName.getText() + "\"},"
|
+ "{\"icaoCode\": \"" + nearLocSixIcaoCode.getText() + "\", \"locName\": \"" + nearLocSixName.getText() + "\"},"
|
||||||
+ "{\"icaoCode\": \"" + nearLocSevenIcaoCode.getText() + "\", \"locName\": \"" + nearLocSevenName.getText() + "\"},"
|
+ "{\"icaoCode\": \"" + nearLocSevenIcaoCode.getText() + "\", \"locName\": \"" + nearLocSevenName.getText() + "\"}"
|
||||||
+ "],"
|
+ "],"
|
||||||
+ "\"regionalForecastLocations\": ["
|
+ "\"regionalForecastLocations\": ["
|
||||||
+ "{\"icaoCode\": \"" + regForOneIcaoCode.getText() + "\", \"locName\": \"" + regForOneName.getText() + "\"},"
|
+ "{\"icaoCode\": \"" + regForOneIcaoCode.getText() + "\", \"locName\": \"" + regForOneName.getText() + "\"},"
|
||||||
@@ -415,7 +587,7 @@ public class Main {
|
|||||||
+ "{\"icaoCode\": \"" + regForFourIcaoCode.getText() + "\", \"locName\": \"" + regForFourName.getText() + "\"},"
|
+ "{\"icaoCode\": \"" + regForFourIcaoCode.getText() + "\", \"locName\": \"" + regForFourName.getText() + "\"},"
|
||||||
+ "{\"icaoCode\": \"" + regForFiveIcaoCode.getText() + "\", \"locName\": \"" + regForFiveName.getText() + "\"},"
|
+ "{\"icaoCode\": \"" + regForFiveIcaoCode.getText() + "\", \"locName\": \"" + regForFiveName.getText() + "\"},"
|
||||||
+ "{\"icaoCode\": \"" + regForSixIcaoCode.getText() + "\", \"locName\": \"" + regForSixName.getText() + "\"},"
|
+ "{\"icaoCode\": \"" + regForSixIcaoCode.getText() + "\", \"locName\": \"" + regForSixName.getText() + "\"},"
|
||||||
+ "{\"icaoCode\": \"" + regForSevenIcaoCode.getText() + "\", \"locName\": \"" + regForSevenName.getText() + "\"},"
|
+ "{\"icaoCode\": \"" + regForSevenIcaoCode.getText() + "\", \"locName\": \"" + regForSevenName.getText() + "\"}"
|
||||||
+ "],"
|
+ "],"
|
||||||
+ "\"regionalConditionsLocations\": ["
|
+ "\"regionalConditionsLocations\": ["
|
||||||
+ "{\"icaoCode\": \"" + regConOneIcaoCode.getText() + "\", \"locName\": \"" + regConOneName.getText() + "\"},"
|
+ "{\"icaoCode\": \"" + regConOneIcaoCode.getText() + "\", \"locName\": \"" + regConOneName.getText() + "\"},"
|
||||||
@@ -424,8 +596,12 @@ public class Main {
|
|||||||
+ "{\"icaoCode\": \"" + regConFourIcaoCode.getText() + "\", \"locName\": \"" + regConFourName.getText() + "\"},"
|
+ "{\"icaoCode\": \"" + regConFourIcaoCode.getText() + "\", \"locName\": \"" + regConFourName.getText() + "\"},"
|
||||||
+ "{\"icaoCode\": \"" + regConFiveIcaoCode.getText() + "\", \"locName\": \"" + regConFiveName.getText() + "\"},"
|
+ "{\"icaoCode\": \"" + regConFiveIcaoCode.getText() + "\", \"locName\": \"" + regConFiveName.getText() + "\"},"
|
||||||
+ "{\"icaoCode\": \"" + regConSixIcaoCode.getText() + "\", \"locName\": \"" + regConSixName.getText() + "\"},"
|
+ "{\"icaoCode\": \"" + regConSixIcaoCode.getText() + "\", \"locName\": \"" + regConSixName.getText() + "\"},"
|
||||||
+ "{\"icaoCode\": \"" + regConSevenIcaoCode.getText() + "\", \"locName\": \"" + regConSevenName.getText() + "\"},"
|
+ "{\"icaoCode\": \"" + regConSevenIcaoCode.getText() + "\", \"locName\": \"" + regConSevenName.getText() + "\"}"
|
||||||
+ "],"
|
+ "],"
|
||||||
|
+ "\"tideLocations\": ["
|
||||||
|
+ "{\"id\":\"" + tideOneID.getText() + "\", \"locName\":\"" + tideOneName.getText() + "\"},"
|
||||||
|
+ "{\"id\":\"" + tideTwoID.getText() + "\", \"locName\":\"" + tideTwoName.getText() + "\"}"
|
||||||
|
+ "]"
|
||||||
+ "}}"
|
+ "}}"
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -441,7 +617,7 @@ public class Main {
|
|||||||
JOptionPane.showMessageDialog(null, "Saved to: " + fileToSave.getAbsolutePath());
|
JOptionPane.showMessageDialog(null, "Saved to: " + fileToSave.getAbsolutePath());
|
||||||
} catch (IOException ex) {
|
} catch (IOException ex) {
|
||||||
ex.printStackTrace();
|
ex.printStackTrace();
|
||||||
JOptionPane.showMessageDialog(settingsFrame, "Error saving config file.");
|
JOptionPane.showMessageDialog(mainPanel, "Error saving config file.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -464,7 +640,7 @@ public class Main {
|
|||||||
loadedExtension = "error";
|
loadedExtension = "error";
|
||||||
}
|
}
|
||||||
if (!loadedExtension.equals("application/json")) {
|
if (!loadedExtension.equals("application/json")) {
|
||||||
JOptionPane.showMessageDialog(settingsFrame, "Please choose a json file.");
|
JOptionPane.showMessageDialog(mainPanel, "Please choose a json file.");
|
||||||
} else {
|
} else {
|
||||||
StringBuilder jsonText = new StringBuilder();
|
StringBuilder jsonText = new StringBuilder();
|
||||||
try {
|
try {
|
||||||
@@ -543,34 +719,26 @@ public class Main {
|
|||||||
.getJSONObject(6).getString("locName"));
|
.getJSONObject(6).getString("locName"));
|
||||||
|
|
||||||
// regional forecast
|
// regional forecast
|
||||||
regForOneIcaoCode.setText(settingsObj.getJSONArray("regionalForecastLocations")
|
regForOneIcaoCode.setText(settingsObj.getJSONArray("regionalForecastLocations").getJSONObject(0).getString("icaoCode"));
|
||||||
.getJSONObject(0).getString("icaoCode"));
|
regForOneName.setText(settingsObj.getJSONArray("regionalForecastLocations").getJSONObject(0).getString("locName"));
|
||||||
regForOneName.setText(settingsObj.getJSONArray("regionalForecastLocations").getJSONObject(0)
|
regForTwoIcaoCode.setText(settingsObj.getJSONArray("regionalForecastLocations").getJSONObject(1).getString("icaoCode"));
|
||||||
.getString("locName"));
|
regForTwoName.setText(settingsObj.getJSONArray("regionalForecastLocations").getJSONObject(1).getString("locName"));
|
||||||
regForTwoIcaoCode.setText(settingsObj.getJSONArray("regionalForecastLocations")
|
regForThreeIcaoCode.setText(settingsObj.getJSONArray("regionalForecastLocations").getJSONObject(2).getString("icaoCode"));
|
||||||
.getJSONObject(1).getString("icaoCode"));
|
regForThreeName.setText(settingsObj.getJSONArray("regionalForecastLocations").getJSONObject(2).getString("locName"));
|
||||||
regForTwoName.setText(settingsObj.getJSONArray("regionalForecastLocations").getJSONObject(1)
|
regForFourIcaoCode.setText(settingsObj.getJSONArray("regionalForecastLocations").getJSONObject(3).getString("icaoCode"));
|
||||||
.getString("locName"));
|
regForFourName.setText(settingsObj.getJSONArray("regionalForecastLocations").getJSONObject(3).getString("locName"));
|
||||||
regForThreeIcaoCode.setText(settingsObj.getJSONArray("regionalForecastLocations")
|
regForFiveIcaoCode.setText(settingsObj.getJSONArray("regionalForecastLocations").getJSONObject(4).getString("icaoCode"));
|
||||||
.getJSONObject(2).getString("icaoCode"));
|
regForFiveName.setText(settingsObj.getJSONArray("regionalForecastLocations").getJSONObject(4).getString("locName"));
|
||||||
regForThreeName.setText(settingsObj.getJSONArray("regionalForecastLocations")
|
regForSixIcaoCode.setText(settingsObj.getJSONArray("regionalForecastLocations").getJSONObject(5).getString("icaoCode"));
|
||||||
.getJSONObject(2).getString("locName"));
|
regForSixName.setText(settingsObj.getJSONArray("regionalForecastLocations").getJSONObject(5).getString("locName"));
|
||||||
regForFourIcaoCode.setText(settingsObj.getJSONArray("regionalForecastLocations")
|
regForSevenIcaoCode.setText(settingsObj.getJSONArray("regionalForecastLocations").getJSONObject(6).getString("icaoCode"));
|
||||||
.getJSONObject(3).getString("icaoCode"));
|
regForSevenName.setText(settingsObj.getJSONArray("regionalForecastLocations").getJSONObject(6).getString("locName"));
|
||||||
regForFourName.setText(settingsObj.getJSONArray("regionalForecastLocations")
|
|
||||||
.getJSONObject(3).getString("locName"));
|
// tides
|
||||||
regForFiveIcaoCode.setText(settingsObj.getJSONArray("regionalForecastLocations")
|
tideOneID.setText(settingsObj.getJSONArray("tideLocations").getJSONObject(0).getString("id"));
|
||||||
.getJSONObject(4).getString("icaoCode"));
|
tideOneName.setText(settingsObj.getJSONArray("tideLocations").getJSONObject(0).getString("locName"));
|
||||||
regForFiveName.setText(settingsObj.getJSONArray("regionalForecastLocations")
|
tideTwoID.setText(settingsObj.getJSONArray("tideLocations").getJSONObject(1).getString("id"));
|
||||||
.getJSONObject(4).getString("locName"));
|
tideTwoName.setText(settingsObj.getJSONArray("tideLocations").getJSONObject(1).getString("locName"));
|
||||||
regForSixIcaoCode.setText(settingsObj.getJSONArray("regionalForecastLocations")
|
|
||||||
.getJSONObject(5).getString("icaoCode"));
|
|
||||||
regForSixName.setText(settingsObj.getJSONArray("regionalForecastLocations").getJSONObject(5)
|
|
||||||
.getString("locName"));
|
|
||||||
regForSevenIcaoCode.setText(settingsObj.getJSONArray("regionalForecastLocations")
|
|
||||||
.getJSONObject(6).getString("icaoCode"));
|
|
||||||
regForSevenName.setText(settingsObj.getJSONArray("regionalForecastLocations")
|
|
||||||
.getJSONObject(6).getString("locName"));
|
|
||||||
|
|
||||||
// after all of that, change the base config json that loads on start
|
// after all of that, change the base config json that loads on start
|
||||||
String dataFilePath = jarFolder + File.separator + "loadData.txt";
|
String dataFilePath = jarFolder + File.separator + "loadData.txt";
|
||||||
@@ -596,17 +764,19 @@ public class Main {
|
|||||||
+ regForFourName.getText() + "\n" + regForFiveIcaoCode.getText() + "\n"
|
+ regForFourName.getText() + "\n" + regForFiveIcaoCode.getText() + "\n"
|
||||||
+ regForFiveName.getText() + "\n" + regForSixIcaoCode.getText() + "\n"
|
+ regForFiveName.getText() + "\n" + regForSixIcaoCode.getText() + "\n"
|
||||||
+ regForSixName.getText() + "\n" + regForSevenIcaoCode.getText() + "\n"
|
+ regForSixName.getText() + "\n" + regForSevenIcaoCode.getText() + "\n"
|
||||||
+ regForSevenName.getText() + "\n";
|
+ regForSevenName.getText() + "\n" + tideOneID.getText() + "\n"
|
||||||
|
+ tideOneName.getText() + "\n" + tideTwoID.getText() + "\n"
|
||||||
|
+ tideTwoName.getText() + "\n";
|
||||||
try (BufferedWriter writer = new BufferedWriter(new FileWriter(dataFilePath))) {
|
try (BufferedWriter writer = new BufferedWriter(new FileWriter(dataFilePath))) {
|
||||||
writer.write(content);
|
writer.write(content);
|
||||||
writer.close();
|
writer.close();
|
||||||
} catch (IOException y) {
|
} catch (IOException y) {
|
||||||
y.printStackTrace();
|
y.printStackTrace();
|
||||||
JOptionPane.showMessageDialog(settingsFrame,
|
JOptionPane.showMessageDialog(mainPanel,
|
||||||
"Error saving loaded config data to program. Config will not load on next startup.");
|
"Error saving loaded config data to program. Config will not load on next startup.");
|
||||||
}
|
}
|
||||||
} catch (JSONException ex) {
|
} catch (JSONException ex) {
|
||||||
JOptionPane.showMessageDialog(settingsFrame,
|
JOptionPane.showMessageDialog(mainPanel,
|
||||||
"Unable to read loaded configuration file, please choose a valid file.");
|
"Unable to read loaded configuration file, please choose a valid file.");
|
||||||
} catch (IOException ex) {
|
} catch (IOException ex) {
|
||||||
throw new RuntimeException(ex);
|
throw new RuntimeException(ex);
|
||||||
@@ -624,12 +794,8 @@ public class Main {
|
|||||||
fullscreen = fsCheck.isSelected();
|
fullscreen = fsCheck.isSelected();
|
||||||
key = apiKeyText.getText();
|
key = apiKeyText.getText();
|
||||||
mainIcao = mainLocIcaoCode.getText();
|
mainIcao = mainLocIcaoCode.getText();
|
||||||
/*
|
tidesEnabled = tidesCheck.isSelected();
|
||||||
if (!checkIcaoCode(mainIcao, key).equals("noerror")) {
|
|
||||||
settingsErrorThrown = true;
|
|
||||||
settingsErrorReasons.add("\nMain Location Error: " + checkIcaoCode(mainIcao, key));
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
nearIcaos.add(nearLocOneIcaoCode.getText());
|
nearIcaos.add(nearLocOneIcaoCode.getText());
|
||||||
nearIcaos.add(nearLocTwoIcaoCode.getText());
|
nearIcaos.add(nearLocTwoIcaoCode.getText());
|
||||||
nearIcaos.add(nearLocThreeIcaoCode.getText());
|
nearIcaos.add(nearLocThreeIcaoCode.getText());
|
||||||
@@ -646,15 +812,7 @@ public class Main {
|
|||||||
nearNames.add(nearLocFiveName.getText());
|
nearNames.add(nearLocFiveName.getText());
|
||||||
nearNames.add(nearLocSixName.getText());
|
nearNames.add(nearLocSixName.getText());
|
||||||
nearNames.add(nearLocSevenName.getText());
|
nearNames.add(nearLocSevenName.getText());
|
||||||
/*
|
|
||||||
for (int i = 0; i < nearIcaos.size(); i++) {
|
|
||||||
if (!checkIcaoCode(nearIcaos.get(i), key).equals("noerror")) {
|
|
||||||
settingsErrorThrown = true;
|
|
||||||
settingsErrorReasons
|
|
||||||
.add("\nNear Location " + i + " Error: " + checkIcaoCode(nearIcaos.get(i), key));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
regConIcaos.add(regConOneIcaoCode.getText());
|
regConIcaos.add(regConOneIcaoCode.getText());
|
||||||
regConIcaos.add(regConTwoIcaoCode.getText());
|
regConIcaos.add(regConTwoIcaoCode.getText());
|
||||||
regConIcaos.add(regConThreeIcaoCode.getText());
|
regConIcaos.add(regConThreeIcaoCode.getText());
|
||||||
@@ -670,14 +828,6 @@ public class Main {
|
|||||||
regConNames.add(regConFiveName.getText());
|
regConNames.add(regConFiveName.getText());
|
||||||
regConNames.add(regConSixName.getText());
|
regConNames.add(regConSixName.getText());
|
||||||
regConNames.add(regConSevenName.getText());
|
regConNames.add(regConSevenName.getText());
|
||||||
/*
|
|
||||||
for (int i = 0; i < regConIcaos.size(); i++) {
|
|
||||||
if (!checkIcaoCode(regConIcaos.get(i), key).equals("noerror")) {
|
|
||||||
settingsErrorThrown = true;
|
|
||||||
settingsErrorReasons.add(
|
|
||||||
"\nRegional Conditions Loc " + i + " Error: " + checkIcaoCode(regConIcaos.get(i), key));
|
|
||||||
}
|
|
||||||
}*/
|
|
||||||
|
|
||||||
regForIcaos.add(regForOneIcaoCode.getText());
|
regForIcaos.add(regForOneIcaoCode.getText());
|
||||||
regForIcaos.add(regForTwoIcaoCode.getText());
|
regForIcaos.add(regForTwoIcaoCode.getText());
|
||||||
@@ -695,41 +845,16 @@ public class Main {
|
|||||||
regForNames.add(regForSixName.getText());
|
regForNames.add(regForSixName.getText());
|
||||||
regForNames.add(regForSevenName.getText());
|
regForNames.add(regForSevenName.getText());
|
||||||
|
|
||||||
|
tideIDs.add(tideOneID.getText());
|
||||||
|
tideIDs.add(tideTwoID.getText());
|
||||||
|
|
||||||
|
tideNames.add(tideOneName.getText());
|
||||||
|
tideNames.add(tideTwoName.getText());
|
||||||
|
|
||||||
adCrawl = adCrawlInput.getText();
|
adCrawl = adCrawlInput.getText();
|
||||||
/*
|
|
||||||
for (int i = 0; i < regForIcaos.size(); i++) {
|
|
||||||
if (!checkIcaoCode(regForIcaos.get(i), key).equals("noerror")) {
|
|
||||||
settingsErrorThrown = true;
|
|
||||||
settingsErrorReasons
|
|
||||||
.add("\nRegional Forecast Loc " + i + " Error: " + checkIcaoCode(regForIcaos.get(i), key));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
WindowRunner wr = new WindowRunner();
|
WindowRunner wr = new WindowRunner();
|
||||||
//dr = new DataRunner();
|
|
||||||
/*currentConditions = new CurrentConditions();
|
|
||||||
hourlyObservations = new HourlyObservations();
|
|
||||||
regionalConditions = new RegionalConditions();
|
|
||||||
localForecast = new LocalForecast();
|
|
||||||
almanac = new Almanac();
|
|
||||||
regionalForecast = new RegionalForecast();
|
|
||||||
extendedForecast = new ExtendedForecast();*/
|
|
||||||
|
|
||||||
/*if (settingsErrorThrown) {
|
|
||||||
for (int i = 0; i < settingsErrorReasons.size(); i++) {
|
|
||||||
popupErrors = popupErrors + settingsErrorReasons.get(i);
|
|
||||||
}
|
|
||||||
JOptionPane.showMessageDialog(settingsFrame, "The following errors have occured: " + popupErrors);
|
|
||||||
mainLat = "error";
|
|
||||||
mainLon = "error";
|
|
||||||
|
|
||||||
todayMonth = "error";
|
|
||||||
todayDay = "error";
|
|
||||||
*///} else {
|
|
||||||
// after checking for icao code and key errors, get data
|
|
||||||
|
|
||||||
//}
|
|
||||||
// get cc data
|
|
||||||
String ldltype = (String) ldlDropdown.getSelectedItem();
|
String ldltype = (String) ldlDropdown.getSelectedItem();
|
||||||
switch (ldltype) {
|
switch (ldltype) {
|
||||||
case "Observations":
|
case "Observations":
|
||||||
@@ -746,64 +871,7 @@ public class Main {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
String selectedFlavor = (String) flavorDropdown.getSelectedItem();
|
selectedFlavor = (String) flavorDropdown.getSelectedItem();
|
||||||
switch (selectedFlavor) {
|
|
||||||
case "A":
|
|
||||||
slidesList = Utilities.flavorA;
|
|
||||||
break;
|
|
||||||
case "B":
|
|
||||||
slidesList = Utilities.flavorB;
|
|
||||||
break;
|
|
||||||
case "C":
|
|
||||||
slidesList = Utilities.flavorC;
|
|
||||||
break;
|
|
||||||
case "D":
|
|
||||||
slidesList = Utilities.flavorD;
|
|
||||||
break;
|
|
||||||
case "E":
|
|
||||||
slidesList = Utilities.flavorE;
|
|
||||||
break;
|
|
||||||
case "F":
|
|
||||||
slidesList = Utilities.flavorF;
|
|
||||||
break;
|
|
||||||
case "G":
|
|
||||||
slidesList = Utilities.flavorG;
|
|
||||||
break;
|
|
||||||
case "H":
|
|
||||||
slidesList = Utilities.flavorH;
|
|
||||||
break;
|
|
||||||
case "I":
|
|
||||||
slidesList = Utilities.flavorI;
|
|
||||||
break;
|
|
||||||
case "J":
|
|
||||||
slidesList = Utilities.flavorJ;
|
|
||||||
break;
|
|
||||||
case "K":
|
|
||||||
slidesList = Utilities.flavorK;
|
|
||||||
break;
|
|
||||||
case "L":
|
|
||||||
slidesList = Utilities.flavorL;
|
|
||||||
break;
|
|
||||||
case "M":
|
|
||||||
slidesList = Utilities.flavorM;
|
|
||||||
break;
|
|
||||||
case "N":
|
|
||||||
slidesList = Utilities.flavorN;
|
|
||||||
break;
|
|
||||||
case "O":
|
|
||||||
slidesList = Utilities.flavorO;
|
|
||||||
break;
|
|
||||||
case "P":
|
|
||||||
slidesList = Utilities.flavorP;
|
|
||||||
break;
|
|
||||||
case "Q":
|
|
||||||
slidesList = Utilities.flavorQ;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
System.out.println("Invalid flavor");
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
//slidesList = Utilities.testFlavor;
|
|
||||||
|
|
||||||
simWidth = Integer.parseInt(widthField.getText());
|
simWidth = Integer.parseInt(widthField.getText());
|
||||||
simHeight = Integer.parseInt(heightField.getText());
|
simHeight = Integer.parseInt(heightField.getText());
|
||||||
@@ -815,46 +883,7 @@ public class Main {
|
|||||||
todayMonth = almanac.getMonth(mainIcao, key);
|
todayMonth = almanac.getMonth(mainIcao, key);
|
||||||
todayDay = almanac.getDayDate(mainIcao, key);
|
todayDay = almanac.getDayDate(mainIcao, key);
|
||||||
|
|
||||||
|
|
||||||
/*currentConditions.start();
|
|
||||||
hourlyObservations.start();
|
|
||||||
regionalConditions.start();
|
|
||||||
localForecast.start();
|
|
||||||
almanac.start();
|
|
||||||
regionalForecast.start();
|
|
||||||
extendedForecast.start();
|
|
||||||
|
|
||||||
try {
|
|
||||||
currentConditions.join();
|
|
||||||
hourlyObservations.join();
|
|
||||||
regionalConditions.join();
|
|
||||||
localForecast.join();
|
|
||||||
almanac.join();
|
|
||||||
regionalForecast.join();
|
|
||||||
extendedForecast.join();
|
|
||||||
//wr.join();
|
|
||||||
} catch (InterruptedException e1) {
|
|
||||||
e1.printStackTrace();
|
|
||||||
}*/
|
|
||||||
//dr.run();
|
|
||||||
wr.start();
|
wr.start();
|
||||||
// flavor manager
|
|
||||||
|
|
||||||
|
|
||||||
// after all data, checks, and flavor management
|
|
||||||
/*
|
|
||||||
settingsWindow.setVisible(false);
|
|
||||||
|
|
||||||
//BlueWindow blueWindow = new BlueWindow();
|
|
||||||
//LDLRunner lr = new LDLRunner();
|
|
||||||
//lr.start();
|
|
||||||
//BlueRunner br = new BlueRunner();
|
|
||||||
//br.start();
|
|
||||||
*/
|
|
||||||
|
|
||||||
//settingsWindow.setVisible(false);
|
|
||||||
//Window window = Window.get();
|
|
||||||
//window.runWindow();
|
|
||||||
|
|
||||||
settingsErrorThrown = false;
|
settingsErrorThrown = false;
|
||||||
settingsErrorReasons.clear();
|
settingsErrorReasons.clear();
|
||||||
@@ -862,13 +891,6 @@ public class Main {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
JScrollPane settingsScrollFrame = new JScrollPane(settingsFrame);
|
|
||||||
settingsScrollFrame.getVerticalScrollBar().setUnitIncrement(16);
|
|
||||||
|
|
||||||
settingsScrollFrame.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
|
|
||||||
settingsScrollFrame.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
|
|
||||||
|
|
||||||
settingsWindow.add(settingsScrollFrame);
|
|
||||||
settingsWindow.setVisible(true);
|
settingsWindow.setVisible(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -94,6 +94,10 @@ public class RegionalForecast extends Thread {
|
|||||||
ArrayList<String> regForIcaos = new ArrayList<>();
|
ArrayList<String> regForIcaos = new ArrayList<>();
|
||||||
regForIcaos.addAll(Main.regForIcaos);
|
regForIcaos.addAll(Main.regForIcaos);
|
||||||
String key = Main.key;
|
String key = Main.key;
|
||||||
|
Main.regionalForecast.locName.clear();
|
||||||
|
Main.regionalForecast.condition.clear();
|
||||||
|
Main.regionalForecast.low.clear();
|
||||||
|
Main.regionalForecast.high.clear();
|
||||||
for (int i = 0; i < regForIcaos.size(); i++) {
|
for (int i = 0; i < regForIcaos.size(); i++) {
|
||||||
Main.regionalForecast.locName.add(getLocName(regForNames.get(i)));
|
Main.regionalForecast.locName.add(getLocName(regForNames.get(i)));
|
||||||
Main.regionalForecast.condition.add(getCondition(regForIcaos.get(i), key));
|
Main.regionalForecast.condition.add(getCondition(regForIcaos.get(i), key));
|
||||||
|
|||||||
@@ -94,6 +94,9 @@ public class SlidesRunner extends Scene {
|
|||||||
ArrayList<String> olMainLines = new ArrayList<>();
|
ArrayList<String> olMainLines = new ArrayList<>();
|
||||||
private GameObject[] olPool = new GameObject[288];
|
private GameObject[] olPool = new GameObject[288];
|
||||||
|
|
||||||
|
ArrayList<String> tiMainLines = new ArrayList<>();
|
||||||
|
private GameObject[] tiPool = new GameObject[288];
|
||||||
|
|
||||||
ArrayList<String> travelMainLines = new ArrayList<>();
|
ArrayList<String> travelMainLines = new ArrayList<>();
|
||||||
private GameObject[] tfPool = new GameObject[864];
|
private GameObject[] tfPool = new GameObject[864];
|
||||||
|
|
||||||
@@ -113,9 +116,11 @@ public class SlidesRunner extends Scene {
|
|||||||
private boolean poolsInit = false;
|
private boolean poolsInit = false;
|
||||||
private boolean slideInit = false;
|
private boolean slideInit = false;
|
||||||
|
|
||||||
|
private int tinterval = 0;
|
||||||
|
|
||||||
GameObject tBanner;
|
GameObject tBanner;
|
||||||
TravelForecast tfData;
|
TravelForecast tfData;
|
||||||
int travelOffset = 0;
|
float travelOffset = 0.0f;
|
||||||
boolean travelDataInit = false;
|
boolean travelDataInit = false;
|
||||||
boolean travelForecastActive = false;
|
boolean travelForecastActive = false;
|
||||||
|
|
||||||
@@ -141,7 +146,8 @@ public class SlidesRunner extends Scene {
|
|||||||
|
|
||||||
float slideLength = 600.0f;//length in frames
|
float slideLength = 600.0f;//length in frames
|
||||||
int slideIdx = 0;
|
int slideIdx = 0;
|
||||||
String[] slideLineup;
|
ArrayList<String> slideLineup;
|
||||||
|
ArrayList<Float> slideDurations;
|
||||||
boolean loop;
|
boolean loop;
|
||||||
boolean ending = false;
|
boolean ending = false;
|
||||||
int slideRounds = 0;
|
int slideRounds = 0;
|
||||||
@@ -160,7 +166,23 @@ public class SlidesRunner extends Scene {
|
|||||||
|
|
||||||
crawlingText = Main.adCrawl + " ";
|
crawlingText = Main.adCrawl + " ";
|
||||||
loop = Main.loopSlides;
|
loop = Main.loopSlides;
|
||||||
slideLineup = Main.slidesList;
|
|
||||||
|
try {
|
||||||
|
slideLineup = utl.loadSegments(Main.selectedFlavor);
|
||||||
|
} catch (IOException e) {
|
||||||
|
System.err.println("Exception loading flavor segments");
|
||||||
|
System.exit(100);
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
slideDurations = utl.loadDurations(Main.selectedFlavor);
|
||||||
|
} catch (IOException e) {
|
||||||
|
System.err.println("Exception loading flavor durations");
|
||||||
|
System.exit(101);
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
if (Main.greenScreen) {
|
if (Main.greenScreen) {
|
||||||
backgroundColor = greenScreen;
|
backgroundColor = greenScreen;
|
||||||
}
|
}
|
||||||
@@ -285,18 +307,23 @@ public class SlidesRunner extends Scene {
|
|||||||
olPool[i].addComponent(new SpriteRenderer(new Vector4f(1,1,1,1)));
|
olPool[i].addComponent(new SpriteRenderer(new Vector4f(1,1,1,1)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for (int i = 0; i < tiPool.length; i++) {
|
||||||
|
tiPool[i] = new GameObject("tiPool" + i, new Transform(new Vector2f()), 0);
|
||||||
|
tiPool[i].addComponent(new SpriteRenderer(new Vector4f(1,1,1,1)));
|
||||||
|
}
|
||||||
|
|
||||||
for (int i = 0; i < tfPool.length; i++) {
|
for (int i = 0; i < tfPool.length; i++) {
|
||||||
tfPool[i] = new GameObject("tfPool" + i, new Transform(new Vector2f()), 0);
|
tfPool[i] = new GameObject("tfPool" + i, new Transform(new Vector2f()), 0);
|
||||||
tfPool[i].addComponent(new SpriteRenderer(new Vector4f(1,1,1,1)));
|
tfPool[i].addComponent(new SpriteRenderer(new Vector4f(1,1,1,1)));
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < dtPool.length; i++) {
|
for (int i = 0; i < dtPool.length; i++) {
|
||||||
dtPool[i] = new GameObject("tfPool" + i, new Transform(new Vector2f()), 2);
|
dtPool[i] = new GameObject("dtPool" + i, new Transform(new Vector2f()), 2);
|
||||||
dtPool[i].addComponent(new SpriteRenderer(new Vector4f(1,1,1,1)));
|
dtPool[i].addComponent(new SpriteRenderer(new Vector4f(1,1,1,1)));
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < ctPool.length; i++) {
|
for (int i = 0; i < ctPool.length; i++) {
|
||||||
ctPool[i] = new GameObject("tfPool" + i, new Transform(new Vector2f()), 2);
|
ctPool[i] = new GameObject("ctPool" + i, new Transform(new Vector2f()), 2);
|
||||||
ctPool[i].addComponent(new SpriteRenderer(new Vector4f(1,1,1,1)));
|
ctPool[i].addComponent(new SpriteRenderer(new Vector4f(1,1,1,1)));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -371,7 +398,7 @@ public class SlidesRunner extends Scene {
|
|||||||
round++;
|
round++;
|
||||||
if (round >= slideRounds) {
|
if (round >= slideRounds) {
|
||||||
slideIdx++;
|
slideIdx++;
|
||||||
if (slideIdx >= slideLineup.length) {
|
if (slideIdx >= slideLineup.size()) {
|
||||||
slideIdx = 0;
|
slideIdx = 0;
|
||||||
if (!loop) {
|
if (!loop) {
|
||||||
ending = true;
|
ending = true;
|
||||||
@@ -398,9 +425,18 @@ public class SlidesRunner extends Scene {
|
|||||||
//Main.settingsWindow.setVisible(true);
|
//Main.settingsWindow.setVisible(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
slideLength = slideDurations.get(slideIdx);
|
||||||
slideChooser();
|
slideChooser();
|
||||||
|
|
||||||
if (travelForecastActive) {
|
if (travelForecastActive) {
|
||||||
if (Window.secFrameCount % 2 == 0) travelOffset--;
|
if (Window.secFrameCount % 2 == 0) {
|
||||||
|
travelOffset--;
|
||||||
|
tinterval++;
|
||||||
|
if (tinterval == 3) {
|
||||||
|
travelOffset--;
|
||||||
|
tinterval = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
travelForecast();
|
travelForecast();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -588,7 +624,6 @@ public class SlidesRunner extends Scene {
|
|||||||
}
|
}
|
||||||
public void currentConditions() {
|
public void currentConditions() {
|
||||||
slideRounds = 0;
|
slideRounds = 0;
|
||||||
slideLength = 600.0f;
|
|
||||||
this.addGameObjectToScene(bg);
|
this.addGameObjectToScene(bg);
|
||||||
|
|
||||||
if (!slideInit) {
|
if (!slideInit) {
|
||||||
@@ -639,7 +674,6 @@ public class SlidesRunner extends Scene {
|
|||||||
|
|
||||||
public void hourlyObservations() {
|
public void hourlyObservations() {
|
||||||
slideRounds = 0;
|
slideRounds = 0;
|
||||||
slideLength = 600.0f;
|
|
||||||
this.addGameObjectToScene(bg);
|
this.addGameObjectToScene(bg);
|
||||||
|
|
||||||
if (!slideInit) {
|
if (!slideInit) {
|
||||||
@@ -688,7 +722,6 @@ public class SlidesRunner extends Scene {
|
|||||||
|
|
||||||
public void regionalConditions() {
|
public void regionalConditions() {
|
||||||
slideRounds = 0;
|
slideRounds = 0;
|
||||||
slideLength = 600.0f;
|
|
||||||
this.addGameObjectToScene(bg);
|
this.addGameObjectToScene(bg);
|
||||||
|
|
||||||
if (!slideInit) {
|
if (!slideInit) {
|
||||||
@@ -738,7 +771,6 @@ public class SlidesRunner extends Scene {
|
|||||||
|
|
||||||
public void localForecast() {
|
public void localForecast() {
|
||||||
slideRounds = 3;
|
slideRounds = 3;
|
||||||
slideLength = 600.0f;
|
|
||||||
this.addGameObjectToScene(bg);
|
this.addGameObjectToScene(bg);
|
||||||
|
|
||||||
if (!slideInit) {
|
if (!slideInit) {
|
||||||
@@ -926,7 +958,6 @@ public class SlidesRunner extends Scene {
|
|||||||
|
|
||||||
public void almanac() {
|
public void almanac() {
|
||||||
slideRounds = 0;
|
slideRounds = 0;
|
||||||
slideLength = 600.0f;
|
|
||||||
this.addGameObjectToScene(bg);
|
this.addGameObjectToScene(bg);
|
||||||
|
|
||||||
if (!slideInit) {
|
if (!slideInit) {
|
||||||
@@ -979,7 +1010,6 @@ public class SlidesRunner extends Scene {
|
|||||||
|
|
||||||
public void regionalForecast() {
|
public void regionalForecast() {
|
||||||
slideRounds = 0;
|
slideRounds = 0;
|
||||||
slideLength = 600.0f;
|
|
||||||
this.addGameObjectToScene(bg);
|
this.addGameObjectToScene(bg);
|
||||||
|
|
||||||
if (!slideInit) {
|
if (!slideInit) {
|
||||||
@@ -1029,7 +1059,6 @@ public class SlidesRunner extends Scene {
|
|||||||
|
|
||||||
public void extendedForecast() {
|
public void extendedForecast() {
|
||||||
slideRounds = 0;
|
slideRounds = 0;
|
||||||
slideLength = 600.0f;
|
|
||||||
this.addGameObjectToScene(bg);
|
this.addGameObjectToScene(bg);
|
||||||
|
|
||||||
if (!slideInit) {
|
if (!slideInit) {
|
||||||
@@ -1081,7 +1110,6 @@ public class SlidesRunner extends Scene {
|
|||||||
|
|
||||||
public void outlook() {
|
public void outlook() {
|
||||||
slideRounds = 0;
|
slideRounds = 0;
|
||||||
slideLength = 600.0f;
|
|
||||||
this.addGameObjectToScene(bg);
|
this.addGameObjectToScene(bg);
|
||||||
|
|
||||||
if (!slideInit) {
|
if (!slideInit) {
|
||||||
@@ -1141,10 +1169,81 @@ public class SlidesRunner extends Scene {
|
|||||||
textY += lineHeight;
|
textY += lineHeight;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void tides() {
|
||||||
|
slideRounds = 0;
|
||||||
|
this.addGameObjectToScene(bg);
|
||||||
|
|
||||||
|
if (!slideInit) {
|
||||||
|
Tides tiData = Main.tides;
|
||||||
|
|
||||||
|
tiMainLines.clear();
|
||||||
|
|
||||||
|
tiMainLines.add(" LOCAL TIDE INFORMATION ");
|
||||||
|
tiMainLines.add(utl.ljust(" ", 32, " "));//half space
|
||||||
|
tiMainLines.add(tiData.locName.get(0));
|
||||||
|
tiMainLines.add("HIGHS: " + tiData.highTide.get(0));
|
||||||
|
tiMainLines.add("LOWS: " + tiData.lowTide.get(0));
|
||||||
|
tiMainLines.add(tiData.locName.get(1));
|
||||||
|
tiMainLines.add("HIGHS: " + tiData.highTide.get(1));
|
||||||
|
tiMainLines.add("LOWS: " + tiData.lowTide.get(1));
|
||||||
|
tiMainLines.add(" SUNRISE" + tiData.sunrise + " SET" + tiData.sunset + " ");
|
||||||
|
|
||||||
|
slideInit = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
int textX = 81;
|
||||||
|
int textY = 44;
|
||||||
|
int poolIdx = 0;
|
||||||
|
|
||||||
|
for (int row = 0; row < tiMainLines.size(); row++) {
|
||||||
|
int lineHeight = row == 1 ? 22 : 40;
|
||||||
|
String line = tiMainLines.get(row);
|
||||||
|
for (int i = 0; i < line.length(); i ++) {
|
||||||
|
if (poolIdx >= tiPool.length) break;
|
||||||
|
|
||||||
|
char c = line.charAt(i);
|
||||||
|
|
||||||
|
GameObject go = tiPool[poolIdx++];
|
||||||
|
go.transform.position.set(textX, textY);
|
||||||
|
go.transform.scale.set(18, 32);
|
||||||
|
|
||||||
|
SpriteRenderer sr = go.getComponent(SpriteRenderer.class);
|
||||||
|
sr.setSprite(sprites.getSprite(utl.getMainChar(c)));
|
||||||
|
|
||||||
|
|
||||||
|
this.addGameObjectToScene(go);
|
||||||
|
|
||||||
|
if (i % 2 != 0) textX++;
|
||||||
|
textX += 17;
|
||||||
|
}
|
||||||
|
|
||||||
|
textX = 81;
|
||||||
|
textY += lineHeight;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void airQuality() {
|
||||||
|
slideRounds = 0;
|
||||||
|
this.addGameObjectToScene(bg);
|
||||||
|
|
||||||
|
if (!slideInit) {
|
||||||
|
slideInit = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void airportDelays() {
|
||||||
|
slideRounds = 0;
|
||||||
|
this.addGameObjectToScene(bg);
|
||||||
|
|
||||||
|
if (!slideInit) {
|
||||||
|
slideInit = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void travelForecast() {
|
public void travelForecast() {
|
||||||
slideLength = 3600.0f;
|
|
||||||
travelForecastActive = true;
|
travelForecastActive = true;
|
||||||
this.addGameObjectToScene(travelBg);
|
this.addGameObjectToScene(travelBg);
|
||||||
|
|
||||||
if (!travelDataInit) {
|
if (!travelDataInit) {
|
||||||
tfData = Main.travelForecast;
|
tfData = Main.travelForecast;
|
||||||
@@ -1263,7 +1362,7 @@ public class SlidesRunner extends Scene {
|
|||||||
|
|
||||||
public void slideChooser() {
|
public void slideChooser() {
|
||||||
//draw slide
|
//draw slide
|
||||||
String slide = slideLineup[slideIdx];
|
String slide = slideLineup.get(slideIdx);
|
||||||
//System.out.println(slide);
|
//System.out.println(slide);
|
||||||
switch (slide) {
|
switch (slide) {
|
||||||
case "currentConditions":
|
case "currentConditions":
|
||||||
@@ -1279,7 +1378,11 @@ public class SlidesRunner extends Scene {
|
|||||||
localForecast();
|
localForecast();
|
||||||
break;
|
break;
|
||||||
case "almanac":
|
case "almanac":
|
||||||
almanac();
|
if (Main.tidesEnabled) {
|
||||||
|
tides();
|
||||||
|
} else {
|
||||||
|
almanac();
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case "regionalForecast":
|
case "regionalForecast":
|
||||||
regionalForecast();
|
regionalForecast();
|
||||||
|
|||||||
@@ -0,0 +1,121 @@
|
|||||||
|
package WS3000.weatherstar3000;
|
||||||
|
|
||||||
|
import util.Utilities;
|
||||||
|
|
||||||
|
import org.json.JSONArray;
|
||||||
|
import org.json.JSONObject;
|
||||||
|
|
||||||
|
import java.net.URI;
|
||||||
|
import java.net.http.HttpClient;
|
||||||
|
import java.net.http.HttpRequest;
|
||||||
|
import java.net.http.HttpResponse;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
|
||||||
|
import java.time.LocalDate;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.time.format.DateTimeFormatter;
|
||||||
|
import java.util.Locale;
|
||||||
|
|
||||||
|
public class Tides extends Thread {
|
||||||
|
Utilities utl = new Utilities();
|
||||||
|
ArrayList<String> locName = new ArrayList<>();
|
||||||
|
ArrayList<String> highTide = new ArrayList<>();
|
||||||
|
ArrayList<String> lowTide = new ArrayList<>();
|
||||||
|
String sunrise;
|
||||||
|
String sunset;
|
||||||
|
|
||||||
|
DateTimeFormatter tideDateFormatter = DateTimeFormatter.ofPattern("yyyyMMdd");
|
||||||
|
DateTimeFormatter tideTimeFormatter = DateTimeFormatter.ofPattern("h:mma E", Locale.ENGLISH);
|
||||||
|
|
||||||
|
String getLocName(String displayName) {
|
||||||
|
return utl.cjust(displayName, 32, " ").substring(0, 32);
|
||||||
|
}
|
||||||
|
|
||||||
|
String getTides(String station, String tide) {
|
||||||
|
try {
|
||||||
|
HttpClient Client = HttpClient.newBuilder().build();
|
||||||
|
HttpRequest Request = HttpRequest.newBuilder()
|
||||||
|
.uri(URI.create("https://api.tidesandcurrents.noaa.gov/api/prod/datagetter?begin_date=" + LocalDate.now().format(tideDateFormatter) + "&end_date=" + LocalDate.now().plusDays(1).format(tideDateFormatter) + "&station=" + station + "&product=predictions&datum=MLLW&time_zone=lst_ldt&interval=hilo&units=english&application=DataAPI_Sample&format=json"))
|
||||||
|
.GET()
|
||||||
|
.header("Accept", "application/json")
|
||||||
|
.build();
|
||||||
|
|
||||||
|
try {
|
||||||
|
HttpResponse<String> Response = Client.send(Request, HttpResponse.BodyHandlers.ofString());
|
||||||
|
if (Response.statusCode() != 200) {
|
||||||
|
return " ";
|
||||||
|
}
|
||||||
|
|
||||||
|
String ResponseBody = Response.body();
|
||||||
|
JSONArray predictions = new JSONObject(ResponseBody).getJSONArray("predictions");
|
||||||
|
|
||||||
|
StringBuilder sb = new StringBuilder();
|
||||||
|
int j = 0;
|
||||||
|
|
||||||
|
for (int i = 0; i < predictions.length(); i++) {
|
||||||
|
if (predictions.getJSONObject(i).getString("type").equals(tide)) {
|
||||||
|
sb.append(utl.rjust(LocalDateTime.parse(predictions.getJSONObject(i).getString("t"), DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm")).format(tideTimeFormatter).toUpperCase(Locale.ENGLISH), 11, " "));
|
||||||
|
if (j < 1) sb.append(" ");
|
||||||
|
j++;
|
||||||
|
if (j == 2) break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return sb.toString();
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
return " ";
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
return " ";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
String getSunData(String icaoCode, String key, String type) {
|
||||||
|
HttpClient Client = HttpClient.newBuilder().build();
|
||||||
|
HttpRequest Request = HttpRequest.newBuilder()
|
||||||
|
.uri(URI.create("https://api.weather.com/v3/wx/forecast/daily/7day?icaoCode=" + icaoCode + "&units=e&language=en-US&format=json&apiKey=" + key))
|
||||||
|
.GET()
|
||||||
|
.header("Accept", "application/json")
|
||||||
|
.build();
|
||||||
|
|
||||||
|
try {
|
||||||
|
HttpResponse<String> Response = Client.send(Request, HttpResponse.BodyHandlers.ofString());
|
||||||
|
if (Response.statusCode() != 200) {
|
||||||
|
return " ";
|
||||||
|
}
|
||||||
|
|
||||||
|
String ResponseBody = Response.body();
|
||||||
|
JSONObject JSONResponse = new JSONObject(ResponseBody);
|
||||||
|
String time = JSONResponse.getJSONArray(type).getString(0);
|
||||||
|
|
||||||
|
int hour = Integer.parseInt(time.substring(11, 13));
|
||||||
|
int dispHour = hour > 12 ? hour - 12 : hour;
|
||||||
|
String minutes = time.substring(14, 16);
|
||||||
|
String part = hour < 12 ? "AM" : "PM";
|
||||||
|
|
||||||
|
return utl.rjust(dispHour + ":" + minutes + part, 7, " ");
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
return " ";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void run() {
|
||||||
|
ArrayList<String> tideIDs = new ArrayList<>();
|
||||||
|
tideIDs.addAll(Main.tideIDs);
|
||||||
|
ArrayList<String> tideNames = new ArrayList<>();
|
||||||
|
tideNames.addAll(Main.tideNames);
|
||||||
|
String key = Main.key;
|
||||||
|
Main.tides.highTide.clear();
|
||||||
|
Main.tides.lowTide.clear();
|
||||||
|
for (int i = 0; i < tideIDs.size(); i++) {
|
||||||
|
Main.tides.locName.add(getLocName(Main.tideNames.get(i)));
|
||||||
|
Main.tides.highTide.add(getTides(Main.tideIDs.get(i), "H"));
|
||||||
|
Main.tides.lowTide.add(getTides(Main.tideIDs.get(i), "L"));
|
||||||
|
}
|
||||||
|
Main.tides.sunrise = getSunData(Main.mainIcao, key, "sunriseTimeLocal");
|
||||||
|
Main.tides.sunset = getSunData(Main.mainIcao, key, "sunsetTimeLocal");
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -5,6 +5,7 @@ import java.io.FileReader;
|
|||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.io.InputStreamReader;
|
import java.io.InputStreamReader;
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import org.json.*;
|
import org.json.*;
|
||||||
@@ -13,24 +14,6 @@ import org.joml.Vector4f;
|
|||||||
public class Utilities {
|
public class Utilities {
|
||||||
public static Map<Character, Integer> mainFontMap = new HashMap<>();
|
public static Map<Character, Integer> mainFontMap = new HashMap<>();
|
||||||
public static Map<Character, Integer> smallFontMap = new HashMap<>();
|
public static Map<Character, Integer> smallFontMap = new HashMap<>();
|
||||||
public static String[] testFlavor = {"outlook","travelForecast", "localForecast", "outlook"};
|
|
||||||
public static String[] flavorA = {"currentConditions","localForecast","hourlyObservations"};
|
|
||||||
public static String[] flavorB = {"hourlyObservations", "almanac", "extendedForecast", "regionalConditions"};
|
|
||||||
public static String[] flavorC = {"regionalConditions", "localForecast", "currentConditions"};
|
|
||||||
public static String[] flavorD = {"hourlyObservations", "almanac", "localForecast", "regionalConditions"};
|
|
||||||
public static String[] flavorE = {"localForecast", "extendedForecast","hourlyObservations"};
|
|
||||||
public static String[] flavorF = {"currentConditions", "regionalConditions", "localForecast", "almanac"};
|
|
||||||
public static String[] flavorG = {"localForecast"};
|
|
||||||
public static String[] flavorH = {"localForecast", "regionalforecast", "almanac", "hourlyObservations"};
|
|
||||||
public static String[] flavorI = {"currentConditions", "hourlyObservations", "regionalConditions"};
|
|
||||||
public static String[] flavorJ = {"currentConditions", "hourlyObservations", "regionalConditions", "localForecast", "almanac", "regionalForecast", "travelForecast", "extendedForecast", "outlook"};
|
|
||||||
public static String[] flavorK = {"currentConditions", "almanac", "regionalForecast", "localForecast", "extendedForecast", "hourlyObservations"};
|
|
||||||
public static String[] flavorL = {"currentConditions", "hourlyObservations", "regionalConditions", "regionalForecast", "almanac", "localForecast", "extendedForecast"};
|
|
||||||
public static String[] flavorM = {"currentConditions", "localForecast", "extendedForecast", "travelForecast"};
|
|
||||||
public static String[] flavorN = {"currentConditions", "hourlyObservations", "regionalConditions", "localForecast", "almanac", "regionalForecast", "travelForecast", "extendedForecast", "outlook", "currentConditions", "localForecast", "extendedForecast", "travelForecast"};
|
|
||||||
public static String[] flavorO = {"currentConditions", "hourlyObservations", "regionalConditions", "localForecast", "almanac", "regionalForecast", "travelForecast", "extendedForecast", "outlook", "currentConditions", "hourlyObservations", "regionalConditions", "localForecast", "almanac", "regionalForecast", "travelForecast", "extendedForecast", "outlook"};
|
|
||||||
public static String[] flavorP = {"localForecast", "extendedForecast", "currentConditions"};
|
|
||||||
public static String[] flavorQ = {"currentConditions", "almanac", "localForecast", "regionalConditions"};
|
|
||||||
|
|
||||||
static {
|
static {
|
||||||
mainFontMap.put(' ', 0);
|
mainFontMap.put(' ', 0);
|
||||||
@@ -400,4 +383,34 @@ public class Utilities {
|
|||||||
public void printThirtyTwoLine() {
|
public void printThirtyTwoLine() {
|
||||||
System.out.println("--------------------------------");
|
System.out.println("--------------------------------");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public ArrayList<String> loadSegments(String flavor) throws IOException {
|
||||||
|
String json = readJsonFromResource("/resources/json/SlidesManager.json");
|
||||||
|
JSONObject jsonObject = new JSONObject(json);
|
||||||
|
|
||||||
|
JSONArray fl = jsonObject.getJSONArray(flavor);
|
||||||
|
|
||||||
|
ArrayList<String> segments = new ArrayList<>();
|
||||||
|
|
||||||
|
for (int i = 0; i < fl.length(); i++) {
|
||||||
|
segments.add(fl.getJSONObject(i).getString("segment"));
|
||||||
|
}
|
||||||
|
|
||||||
|
return segments;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ArrayList<Float> loadDurations(String flavor) throws IOException {
|
||||||
|
String json = readJsonFromResource("/resources/json/SlidesManager.json");
|
||||||
|
JSONObject jsonObject = new JSONObject(json);
|
||||||
|
|
||||||
|
JSONArray fl = jsonObject.getJSONArray(flavor);
|
||||||
|
|
||||||
|
ArrayList<Float> segments = new ArrayList<>();
|
||||||
|
|
||||||
|
for (int i = 0; i < fl.length(); i++) {
|
||||||
|
segments.add(fl.getJSONObject(i).getFloat("duration"));
|
||||||
|
}
|
||||||
|
|
||||||
|
return segments;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,129 @@
|
|||||||
|
{
|
||||||
|
"A": [
|
||||||
|
{"segment":"currentConditions", "duration": 600.0},
|
||||||
|
{"segment":"localForecast", "duration": 600.0},
|
||||||
|
{"segment":"hourlyObservations", "duration": 600.0}
|
||||||
|
],
|
||||||
|
"B": [
|
||||||
|
{"segment":"hourlyObservations", "duration": 600.0},
|
||||||
|
{"segment":"almanac", "duration": 600.0},
|
||||||
|
{"segment":"extendedForecast", "duration": 1200.0},
|
||||||
|
{"segment":"regionalConditions", "duration": 600.0}
|
||||||
|
],
|
||||||
|
"C": [
|
||||||
|
{"segment":"regionalConditions", "duration": 600.0},
|
||||||
|
{"segment":"localForecast", "duration": 600.0},
|
||||||
|
{"segment":"regionalForecast", "duration": 600.0}
|
||||||
|
],
|
||||||
|
"D": [
|
||||||
|
{"segment":"hourlyObservations", "duration": 600.0},
|
||||||
|
{"segment":"almanac", "duration": 600.0},
|
||||||
|
{"segment":"localForecast", "duration": 600.0},
|
||||||
|
{"segment":"regionalConditions", "duration": 600.0}
|
||||||
|
],
|
||||||
|
"E": [
|
||||||
|
{"segment":"localForecast", "duration": 600.0},
|
||||||
|
{"segment":"extendedForecast", "duration": 1200.0},
|
||||||
|
{"segment":"hourlyObservations", "duration": 600.0}
|
||||||
|
],
|
||||||
|
"F": [
|
||||||
|
{"segment":"currentConditions", "duration": 600.0},
|
||||||
|
{"segment":"regionalConditions", "duration": 600.0},
|
||||||
|
{"segment":"localForecast", "duration": 600.0},
|
||||||
|
{"segment":"almanac", "duration": 600.0}
|
||||||
|
],
|
||||||
|
"G": [
|
||||||
|
{"segment":"localForecast", "duration": 600.0}
|
||||||
|
],
|
||||||
|
"H": [
|
||||||
|
{"segment":"localForecast", "duration": 600.0},
|
||||||
|
{"segment":"regionalForecast", "duration": 600.0},
|
||||||
|
{"segment":"almanac", "duration": 600.0},
|
||||||
|
{"segment":"regionalConditions", "duration": 600.0}
|
||||||
|
],
|
||||||
|
"I": [
|
||||||
|
{"segment":"currentConditions", "duration": 600.0},
|
||||||
|
{"segment":"hourlyObservations", "duration": 600.0},
|
||||||
|
{"segment":"regionalConditions", "duration": 600.0}
|
||||||
|
],
|
||||||
|
"J": [
|
||||||
|
{"segment":"currentConditions", "duration": 720.0},
|
||||||
|
{"segment":"hourlyObservations", "duration": 720.0},
|
||||||
|
{"segment":"regionalConditions", "duration": 720.0},
|
||||||
|
{"segment":"localForecast", "duration": 720.0},
|
||||||
|
{"segment":"almanac", "duration": 720.0},
|
||||||
|
{"segment":"regionalForecast", "duration": 720.0},
|
||||||
|
{"segment":"travelForecast", "duration": 2880.0},
|
||||||
|
{"segment":"extendedForecast", "duration": 1440.0},
|
||||||
|
{"segment":"outlook", "duration": 720.0}
|
||||||
|
],
|
||||||
|
"K": [
|
||||||
|
{"segment":"currentConditions", "duration": 600.0},
|
||||||
|
{"segment":"almanac", "duration": 600.0},
|
||||||
|
{"segment":"regionalForecast", "duration": 600.0},
|
||||||
|
{"segment":"localForecast", "duration": 600.0},
|
||||||
|
{"segment":"extendedForecast", "duration": 1200.0},
|
||||||
|
{"segment":"hourlyObservations", "duration": 600.0}
|
||||||
|
],
|
||||||
|
"L": [
|
||||||
|
{"segment":"currentConditions", "duration": 720.0},
|
||||||
|
{"segment":"hourlyObservations", "duration": 720.0},
|
||||||
|
{"segment":"regionalConditions", "duration": 720.0},
|
||||||
|
{"segment":"regionalForecast", "duration": 720.0},
|
||||||
|
{"segment":"almanac", "duration": 720.0},
|
||||||
|
{"segment":"localForecast", "duration": 720.0},
|
||||||
|
{"segment":"extendedForecast", "duration": 1440.0}
|
||||||
|
],
|
||||||
|
"M": [
|
||||||
|
{"segment":"currentConditions", "duration": 720.0},
|
||||||
|
{"segment":"localForecast", "duration": 720.0},
|
||||||
|
{"segment":"extendedForecast", "duration": 1440.0},
|
||||||
|
{"segment":"travelForecast", "duration": 2880.0}
|
||||||
|
],
|
||||||
|
"N": [
|
||||||
|
{"segment":"currentConditions", "duration": 720.0},
|
||||||
|
{"segment":"hourlyObservations", "duration": 720.0},
|
||||||
|
{"segment":"regionalConditions", "duration": 720.0},
|
||||||
|
{"segment":"localForecast", "duration": 720.0},
|
||||||
|
{"segment":"almanac", "duration": 720.0},
|
||||||
|
{"segment":"regionalForecast", "duration": 720.0},
|
||||||
|
{"segment":"travelForecast", "duration": 2880.0},
|
||||||
|
{"segment":"extendedForecast", "duration": 1440.0},
|
||||||
|
{"segment":"outlook", "duration": 720.0},
|
||||||
|
{"segment":"currentConditions", "duration": 720.0},
|
||||||
|
{"segment":"localForecast", "duration": 720.0},
|
||||||
|
{"segment":"extendedForecast", "duration": 1440.0},
|
||||||
|
{"segment":"travelForecast", "duration": 2880.0}
|
||||||
|
],
|
||||||
|
"O": [
|
||||||
|
{"segment":"currentConditions", "duration": 720.0},
|
||||||
|
{"segment":"hourlyObservations", "duration": 720.0},
|
||||||
|
{"segment":"regionalConditions", "duration": 720.0},
|
||||||
|
{"segment":"localForecast", "duration": 720.0},
|
||||||
|
{"segment":"almanac", "duration": 720.0},
|
||||||
|
{"segment":"regionalForecast", "duration": 720.0},
|
||||||
|
{"segment":"travelForecast", "duration": 2880.0},
|
||||||
|
{"segment":"extendedForecast", "duration": 1440.0},
|
||||||
|
{"segment":"outlook", "duration": 720.0},
|
||||||
|
{"segment":"currentConditions", "duration": 720.0},
|
||||||
|
{"segment":"hourlyObservations", "duration": 720.0},
|
||||||
|
{"segment":"regionalConditions", "duration": 720.0},
|
||||||
|
{"segment":"localForecast", "duration": 720.0},
|
||||||
|
{"segment":"almanac", "duration": 720.0},
|
||||||
|
{"segment":"regionalForecast", "duration": 720.0},
|
||||||
|
{"segment":"travelForecast", "duration": 2880.0},
|
||||||
|
{"segment":"extendedForecast", "duration": 1440.0},
|
||||||
|
{"segment":"outlook", "duration": 720.0}
|
||||||
|
],
|
||||||
|
"P": [
|
||||||
|
{"segment":"localForecast", "duration": 600.0},
|
||||||
|
{"segment":"extendedForecast", "duration": 1200.0},
|
||||||
|
{"segment":"currentConditions", "duration": 600.0}
|
||||||
|
],
|
||||||
|
"Q": [
|
||||||
|
{"segment":"currentConditions", "duration": 600.0},
|
||||||
|
{"segment":"almanac", "duration": 600.0},
|
||||||
|
{"segment":"localForecast", "duration": 600.0},
|
||||||
|
{"segment":"regionalConditions", "duration": 600.0}
|
||||||
|
]
|
||||||
|
}
|
||||||
Reference in new issue
Block a user