Compare commits
5 Commits
Author | SHA1 | Date | |
---|---|---|---|
3f60d618ff | |||
39c4244668 | |||
34aa390f2c | |||
0e81b6ca24 | |||
6cd6798609 |
3
.gitignore
vendored
3
.gitignore
vendored
@ -1,4 +1,5 @@
|
|||||||
out/
|
out/
|
||||||
conf.ini
|
conf.ini
|
||||||
log/log4j/log.out/
|
log/
|
||||||
reports/
|
reports/
|
||||||
|
.idea/dataSources*
|
@ -20,3 +20,9 @@ path = ./reports/
|
|||||||
gitrepo = https://git.dergeorg.at/dergeorg/tourplaner
|
gitrepo = https://git.dergeorg.at/dergeorg/tourplaner
|
||||||
doxygendoc = https://git.dergeorg.at/dergeorg/tourplaner
|
doxygendoc = https://git.dergeorg.at/dergeorg/tourplaner
|
||||||
javadoc = https://git.dergeorg.at/dergeorg/tourplaner
|
javadoc = https://git.dergeorg.at/dergeorg/tourplaner
|
||||||
|
|
||||||
|
[map]
|
||||||
|
key =
|
||||||
|
size = 1500,400
|
||||||
|
path = D:\\TourplanerImages\\
|
||||||
|
file_pre = file:///
|
@ -1,171 +0,0 @@
|
|||||||
2021-04-15 00:36:26 ERROR FileNotFoundException:33 - D:\FH_OFFLINE\tourplaner\conf.ini (Das System kann die angegebene Datei nicht finden)
|
|
||||||
2021-04-15 00:36:26 ERROR NullPointerException:33 -
|
|
||||||
2021-04-15 00:37:18 ERROR FileNotFoundException:33 - D:\FH_OFFLINE\tourplaner\conf.ini (Das System kann die angegebene Datei nicht finden)
|
|
||||||
2021-04-15 00:37:18 ERROR NullPointerException:33 -
|
|
||||||
2021-04-15 00:38:24 ERROR PSQLException:33 - Der Verbindungsversuch schlug fehl.
|
|
||||||
2021-04-15 00:38:31 ERROR SQLException:33 - No suitable driver found for jdbc:postgresql://http://postgres.dergeorg.at:5432/tourplaner
|
|
||||||
2021-04-15 00:38:38 INFO PostgresHelper:15 - Tour Table created
|
|
||||||
2021-04-15 00:38:38 ERROR PSQLException:33 - ERROR: relation "tour" already exists
|
|
||||||
2021-04-15 00:38:38 INFO PostgresHelper:15 - Tour Table unique created
|
|
||||||
2021-04-15 00:38:38 ERROR PSQLException:33 - ERROR: relation "tour_tourname_uindex" already exists
|
|
||||||
2021-04-15 00:38:38 INFO PostgresHelper:15 - Tour Table primary created
|
|
||||||
2021-04-15 00:38:38 ERROR PSQLException:33 - ERROR: multiple primary keys for table "tour" are not allowed
|
|
||||||
2021-04-15 00:38:38 INFO PostgresHelper:15 - Log Table created
|
|
||||||
2021-04-15 00:38:38 ERROR PSQLException:33 - ERROR: relation "log" already exists
|
|
||||||
2021-04-15 00:40:43 INFO PostgresHelper:15 - Tour Table created
|
|
||||||
2021-04-15 00:40:43 ERROR PSQLException:33 - ERROR: relation "tour" already exists
|
|
||||||
2021-04-15 00:40:43 INFO PostgresHelper:15 - Tour Table unique created
|
|
||||||
2021-04-15 00:40:43 ERROR PSQLException:33 - ERROR: relation "tour_tourname_uindex" already exists
|
|
||||||
2021-04-15 00:40:43 INFO PostgresHelper:15 - Tour Table primary created
|
|
||||||
2021-04-15 00:40:43 ERROR PSQLException:33 - ERROR: multiple primary keys for table "tour" are not allowed
|
|
||||||
2021-04-15 00:40:43 INFO PostgresHelper:15 - Log Table created
|
|
||||||
2021-04-15 00:40:43 ERROR PSQLException:33 - ERROR: relation "log" already exists
|
|
||||||
2021-04-15 00:44:11 INFO PostgresHelper:15 - Tour Table created
|
|
||||||
2021-04-15 00:44:11 ERROR PSQLException:33 - ERROR: relation "tour" already exists
|
|
||||||
2021-04-15 00:44:11 INFO PostgresHelper:15 - Tour Table unique created
|
|
||||||
2021-04-15 00:44:11 ERROR PSQLException:33 - ERROR: relation "tour_tourname_uindex" already exists
|
|
||||||
2021-04-15 00:44:11 INFO PostgresHelper:15 - Tour Table primary created
|
|
||||||
2021-04-15 00:44:11 ERROR PSQLException:33 - ERROR: multiple primary keys for table "tour" are not allowed
|
|
||||||
2021-04-15 00:44:11 INFO PostgresHelper:15 - Log Table created
|
|
||||||
2021-04-15 00:44:11 ERROR PSQLException:33 - ERROR: relation "log" already exists
|
|
||||||
2021-04-15 16:30:08 INFO PostgresHelper:15 - Tour Table created
|
|
||||||
2021-04-15 16:30:08 ERROR PSQLException:33 - ERROR: relation "tour" already exists
|
|
||||||
2021-04-15 16:30:08 INFO PostgresHelper:15 - Tour Table unique created
|
|
||||||
2021-04-15 16:30:08 ERROR PSQLException:33 - ERROR: relation "tour_tourname_uindex" already exists
|
|
||||||
2021-04-15 16:30:08 INFO PostgresHelper:15 - Tour Table primary created
|
|
||||||
2021-04-15 16:30:08 ERROR PSQLException:33 - ERROR: multiple primary keys for table "tour" are not allowed
|
|
||||||
2021-04-15 16:30:08 INFO PostgresHelper:15 - Log Table created
|
|
||||||
2021-04-15 16:30:08 ERROR PSQLException:33 - ERROR: relation "log" already exists
|
|
||||||
2021-04-15 16:33:57 INFO PostgresHelper:15 - Tour Table created
|
|
||||||
2021-04-15 16:33:57 ERROR PSQLException:33 - ERROR: relation "tour" already exists
|
|
||||||
2021-04-15 16:33:57 INFO PostgresHelper:15 - Tour Table unique created
|
|
||||||
2021-04-15 16:33:57 ERROR PSQLException:33 - ERROR: relation "tour_tourname_uindex" already exists
|
|
||||||
2021-04-15 16:33:57 INFO PostgresHelper:15 - Tour Table primary created
|
|
||||||
2021-04-15 16:33:57 ERROR PSQLException:33 - ERROR: multiple primary keys for table "tour" are not allowed
|
|
||||||
2021-04-15 16:33:57 INFO PostgresHelper:15 - Log Table created
|
|
||||||
2021-04-15 16:33:57 ERROR PSQLException:33 - ERROR: relation "log" already exists
|
|
||||||
2021-04-15 16:38:55 INFO PostgresHelper:15 - Tour Table created
|
|
||||||
2021-04-15 16:38:55 ERROR PSQLException:33 - ERROR: relation "tour" already exists
|
|
||||||
2021-04-15 16:38:55 INFO PostgresHelper:15 - Tour Table unique created
|
|
||||||
2021-04-15 16:38:55 ERROR PSQLException:33 - ERROR: relation "tour_tourname_uindex" already exists
|
|
||||||
2021-04-15 16:38:55 INFO PostgresHelper:15 - Tour Table primary created
|
|
||||||
2021-04-15 16:38:55 ERROR PSQLException:33 - ERROR: multiple primary keys for table "tour" are not allowed
|
|
||||||
2021-04-15 16:38:55 INFO PostgresHelper:15 - Log Table created
|
|
||||||
2021-04-15 16:38:55 ERROR PSQLException:33 - ERROR: relation "log" already exists
|
|
||||||
2021-04-15 16:50:23 INFO PostgresHelper:15 - Tour Table created
|
|
||||||
2021-04-15 16:50:23 ERROR PSQLException:33 - ERROR: relation "tour" already exists
|
|
||||||
2021-04-15 16:50:23 INFO PostgresHelper:15 - Tour Table unique created
|
|
||||||
2021-04-15 16:50:23 ERROR PSQLException:33 - ERROR: relation "tour_tourname_uindex" already exists
|
|
||||||
2021-04-15 16:50:23 INFO PostgresHelper:15 - Tour Table primary created
|
|
||||||
2021-04-15 16:50:23 ERROR PSQLException:33 - ERROR: multiple primary keys for table "tour" are not allowed
|
|
||||||
2021-04-15 16:50:23 INFO PostgresHelper:15 - Log Table created
|
|
||||||
2021-04-15 16:50:23 ERROR PSQLException:33 - ERROR: relation "log" already exists
|
|
||||||
2021-04-15 16:51:01 INFO PostgresHelper:15 - Tour Table created
|
|
||||||
2021-04-15 16:51:01 ERROR PSQLException:33 - ERROR: relation "tour" already exists
|
|
||||||
2021-04-15 16:51:01 INFO PostgresHelper:15 - Tour Table unique created
|
|
||||||
2021-04-15 16:51:01 ERROR PSQLException:33 - ERROR: relation "tour_tourname_uindex" already exists
|
|
||||||
2021-04-15 16:51:01 INFO PostgresHelper:15 - Tour Table primary created
|
|
||||||
2021-04-15 16:51:01 ERROR PSQLException:33 - ERROR: multiple primary keys for table "tour" are not allowed
|
|
||||||
2021-04-15 16:51:01 INFO PostgresHelper:15 - Log Table created
|
|
||||||
2021-04-15 16:51:01 ERROR PSQLException:33 - ERROR: relation "log" already exists
|
|
||||||
2021-04-15 17:08:17 INFO PostgresHelper:15 - Tour Table created
|
|
||||||
2021-04-15 17:08:17 ERROR PSQLException:33 - ERROR: relation "tour" already exists
|
|
||||||
2021-04-15 17:08:17 INFO PostgresHelper:15 - Tour Table unique created
|
|
||||||
2021-04-15 17:08:17 ERROR PSQLException:33 - ERROR: relation "tour_tourname_uindex" already exists
|
|
||||||
2021-04-15 17:08:17 INFO PostgresHelper:15 - Tour Table primary created
|
|
||||||
2021-04-15 17:08:17 ERROR PSQLException:33 - ERROR: multiple primary keys for table "tour" are not allowed
|
|
||||||
2021-04-15 17:08:17 INFO PostgresHelper:15 - Log Table created
|
|
||||||
2021-04-15 17:08:17 ERROR PSQLException:33 - ERROR: relation "log" already exists
|
|
||||||
2021-04-15 17:08:21 ERROR FileNotFoundException:33 - .\reports\Tour 1.pdf (Das System kann den angegebenen Pfad nicht finden)
|
|
||||||
2021-04-15 17:21:48 INFO PostgresHelper:15 - Tour Table created
|
|
||||||
2021-04-15 17:21:48 ERROR PSQLException:33 - ERROR: relation "tour" already exists
|
|
||||||
2021-04-15 17:21:48 INFO PostgresHelper:15 - Tour Table unique created
|
|
||||||
2021-04-15 17:21:48 ERROR PSQLException:33 - ERROR: relation "tour_tourname_uindex" already exists
|
|
||||||
2021-04-15 17:21:48 INFO PostgresHelper:15 - Tour Table primary created
|
|
||||||
2021-04-15 17:21:48 ERROR PSQLException:33 - ERROR: multiple primary keys for table "tour" are not allowed
|
|
||||||
2021-04-15 17:21:48 INFO PostgresHelper:15 - Log Table created
|
|
||||||
2021-04-15 17:21:48 ERROR PSQLException:33 - ERROR: relation "log" already exists
|
|
||||||
2021-04-15 17:21:57 ERROR FileNotFoundException:33 - .\reports\Tour 1.pdf (Der Prozess kann nicht auf die Datei zugreifen, da sie von einem anderen Prozess verwendet wird)
|
|
||||||
2021-04-15 17:31:40 INFO PostgresHelper:15 - Tour Table created
|
|
||||||
2021-04-15 17:31:40 ERROR PSQLException:33 - ERROR: relation "tour" already exists
|
|
||||||
2021-04-15 17:31:40 INFO PostgresHelper:15 - Tour Table unique created
|
|
||||||
2021-04-15 17:31:40 ERROR PSQLException:33 - ERROR: relation "tour_tourname_uindex" already exists
|
|
||||||
2021-04-15 17:31:40 INFO PostgresHelper:15 - Tour Table primary created
|
|
||||||
2021-04-15 17:31:40 ERROR PSQLException:33 - ERROR: multiple primary keys for table "tour" are not allowed
|
|
||||||
2021-04-15 17:31:40 INFO PostgresHelper:15 - Log Table created
|
|
||||||
2021-04-15 17:31:40 ERROR PSQLException:33 - ERROR: relation "log" already exists
|
|
||||||
2021-04-15 17:32:30 INFO PostgresHelper:15 - Tour Table created
|
|
||||||
2021-04-15 17:32:30 ERROR PSQLException:33 - ERROR: relation "tour" already exists
|
|
||||||
2021-04-15 17:32:30 INFO PostgresHelper:15 - Tour Table unique created
|
|
||||||
2021-04-15 17:32:30 ERROR PSQLException:33 - ERROR: relation "tour_tourname_uindex" already exists
|
|
||||||
2021-04-15 17:32:30 INFO PostgresHelper:15 - Tour Table primary created
|
|
||||||
2021-04-15 17:32:30 ERROR PSQLException:33 - ERROR: multiple primary keys for table "tour" are not allowed
|
|
||||||
2021-04-15 17:32:30 INFO PostgresHelper:15 - Log Table created
|
|
||||||
2021-04-15 17:32:30 ERROR PSQLException:33 - ERROR: relation "log" already exists
|
|
||||||
2021-04-15 17:37:57 INFO PostgresHelper:15 - Tour Table created
|
|
||||||
2021-04-15 17:37:57 ERROR PSQLException:33 - ERROR: relation "tour" already exists
|
|
||||||
2021-04-15 17:37:57 INFO PostgresHelper:15 - Tour Table unique created
|
|
||||||
2021-04-15 17:37:58 ERROR PSQLException:33 - ERROR: relation "tour_tourname_uindex" already exists
|
|
||||||
2021-04-15 17:37:58 INFO PostgresHelper:15 - Tour Table primary created
|
|
||||||
2021-04-15 17:37:58 ERROR PSQLException:33 - ERROR: multiple primary keys for table "tour" are not allowed
|
|
||||||
2021-04-15 17:37:58 INFO PostgresHelper:15 - Log Table created
|
|
||||||
2021-04-15 17:37:58 ERROR PSQLException:33 - ERROR: relation "log" already exists
|
|
||||||
2021-04-15 17:38:41 INFO PostgresHelper:15 - Tour Table created
|
|
||||||
2021-04-15 17:38:41 ERROR PSQLException:33 - ERROR: relation "tour" already exists
|
|
||||||
2021-04-15 17:38:41 INFO PostgresHelper:15 - Tour Table unique created
|
|
||||||
2021-04-15 17:38:41 ERROR PSQLException:33 - ERROR: relation "tour_tourname_uindex" already exists
|
|
||||||
2021-04-15 17:38:41 INFO PostgresHelper:15 - Tour Table primary created
|
|
||||||
2021-04-15 17:38:41 ERROR PSQLException:33 - ERROR: multiple primary keys for table "tour" are not allowed
|
|
||||||
2021-04-15 17:38:41 INFO PostgresHelper:15 - Log Table created
|
|
||||||
2021-04-15 17:38:41 ERROR PSQLException:33 - ERROR: relation "log" already exists
|
|
||||||
2021-04-15 17:40:30 INFO PostgresHelper:15 - Tour Table created
|
|
||||||
2021-04-15 17:40:30 ERROR PSQLException:33 - ERROR: relation "tour" already exists
|
|
||||||
2021-04-15 17:40:30 INFO PostgresHelper:15 - Tour Table unique created
|
|
||||||
2021-04-15 17:40:30 ERROR PSQLException:33 - ERROR: relation "tour_tourname_uindex" already exists
|
|
||||||
2021-04-15 17:40:30 INFO PostgresHelper:15 - Tour Table primary created
|
|
||||||
2021-04-15 17:40:30 ERROR PSQLException:33 - ERROR: multiple primary keys for table "tour" are not allowed
|
|
||||||
2021-04-15 17:40:30 INFO PostgresHelper:15 - Log Table created
|
|
||||||
2021-04-15 17:40:30 ERROR PSQLException:33 - ERROR: relation "log" already exists
|
|
||||||
2021-04-15 17:48:48 INFO PostgresHelper:15 - Tour Table created
|
|
||||||
2021-04-15 17:48:48 ERROR PSQLException:33 - ERROR: relation "tour" already exists
|
|
||||||
2021-04-15 17:48:48 INFO PostgresHelper:15 - Tour Table unique created
|
|
||||||
2021-04-15 17:48:48 ERROR PSQLException:33 - ERROR: relation "tour_tourname_uindex" already exists
|
|
||||||
2021-04-15 17:48:48 INFO PostgresHelper:15 - Tour Table primary created
|
|
||||||
2021-04-15 17:48:48 ERROR PSQLException:33 - ERROR: multiple primary keys for table "tour" are not allowed
|
|
||||||
2021-04-15 17:48:48 INFO PostgresHelper:15 - Log Table created
|
|
||||||
2021-04-15 17:48:48 ERROR PSQLException:33 - ERROR: relation "log" already exists
|
|
||||||
2021-04-15 17:49:14 INFO PostgresHelper:15 - Tour Table created
|
|
||||||
2021-04-15 17:49:14 ERROR PSQLException:33 - ERROR: relation "tour" already exists
|
|
||||||
2021-04-15 17:49:14 INFO PostgresHelper:15 - Tour Table unique created
|
|
||||||
2021-04-15 17:49:14 ERROR PSQLException:33 - ERROR: relation "tour_tourname_uindex" already exists
|
|
||||||
2021-04-15 17:49:14 INFO PostgresHelper:15 - Tour Table primary created
|
|
||||||
2021-04-15 17:49:14 ERROR PSQLException:33 - ERROR: multiple primary keys for table "tour" are not allowed
|
|
||||||
2021-04-15 17:49:14 INFO PostgresHelper:15 - Log Table created
|
|
||||||
2021-04-15 17:49:14 ERROR PSQLException:33 - ERROR: relation "log" already exists
|
|
||||||
2021-04-15 18:00:58 INFO PostgresHelper:15 - Tour Table created
|
|
||||||
2021-04-15 18:00:58 ERROR PSQLException:33 - ERROR: relation "tour" already exists
|
|
||||||
2021-04-15 18:00:58 INFO PostgresHelper:15 - Tour Table unique created
|
|
||||||
2021-04-15 18:00:58 ERROR PSQLException:33 - ERROR: relation "tour_tourname_uindex" already exists
|
|
||||||
2021-04-15 18:00:58 INFO PostgresHelper:15 - Tour Table primary created
|
|
||||||
2021-04-15 18:00:59 ERROR PSQLException:33 - ERROR: multiple primary keys for table "tour" are not allowed
|
|
||||||
2021-04-15 18:00:59 INFO PostgresHelper:15 - Log Table created
|
|
||||||
2021-04-15 18:00:59 ERROR PSQLException:33 - ERROR: relation "log" already exists
|
|
||||||
2021-04-15 18:09:56 ERROR FileNotFoundException:33 - .\reports\Tour 1.pdf (Der Prozess kann nicht auf die Datei zugreifen, da sie von einem anderen Prozess verwendet wird)
|
|
||||||
2021-04-15 18:10:01 INFO PostgresHelper:15 - Tour Table created
|
|
||||||
2021-04-15 18:10:01 ERROR PSQLException:33 - ERROR: relation "tour" already exists
|
|
||||||
2021-04-15 18:10:01 INFO PostgresHelper:15 - Tour Table unique created
|
|
||||||
2021-04-15 18:10:01 ERROR PSQLException:33 - ERROR: relation "tour_tourname_uindex" already exists
|
|
||||||
2021-04-15 18:10:01 INFO PostgresHelper:15 - Tour Table primary created
|
|
||||||
2021-04-15 18:10:01 ERROR PSQLException:33 - ERROR: multiple primary keys for table "tour" are not allowed
|
|
||||||
2021-04-15 18:10:01 INFO PostgresHelper:15 - Log Table created
|
|
||||||
2021-04-15 18:10:01 ERROR PSQLException:33 - ERROR: relation "log" already exists
|
|
||||||
2021-04-15 18:10:06 ERROR FileNotFoundException:33 - .\reports\Tour 1.pdf (Der Prozess kann nicht auf die Datei zugreifen, da sie von einem anderen Prozess verwendet wird)
|
|
||||||
2021-04-15 18:12:47 INFO PostgresHelper:15 - Tour Table created
|
|
||||||
2021-04-15 18:12:47 ERROR PSQLException:33 - ERROR: relation "tour" already exists
|
|
||||||
2021-04-15 18:12:47 INFO PostgresHelper:15 - Tour Table unique created
|
|
||||||
2021-04-15 18:12:47 ERROR PSQLException:33 - ERROR: relation "tour_tourname_uindex" already exists
|
|
||||||
2021-04-15 18:12:47 INFO PostgresHelper:15 - Tour Table primary created
|
|
||||||
2021-04-15 18:12:47 ERROR PSQLException:33 - ERROR: multiple primary keys for table "tour" are not allowed
|
|
||||||
2021-04-15 18:12:47 INFO PostgresHelper:15 - Log Table created
|
|
||||||
2021-04-15 18:12:47 ERROR PSQLException:33 - ERROR: relation "log" already exists
|
|
||||||
2021-04-15 18:13:38 ERROR FileNotFoundException:33 - .\reports\Tour 1.pdf (Der Prozess kann nicht auf die Datei zugreifen, da sie von einem anderen Prozess verwendet wird)
|
|
48
src/tourplaner/business/DirectionMap.java
Normal file
48
src/tourplaner/business/DirectionMap.java
Normal file
@ -0,0 +1,48 @@
|
|||||||
|
package tourplaner.business;
|
||||||
|
|
||||||
|
import javax.imageio.ImageIO;
|
||||||
|
import java.awt.*;
|
||||||
|
import java.awt.image.BufferedImage;
|
||||||
|
import java.awt.image.RenderedImage;
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
|
public class DirectionMap {
|
||||||
|
|
||||||
|
private double dauer, strecke;
|
||||||
|
private String start, end, tourname, file;
|
||||||
|
private Image map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Holt die Map als image und alle Daten zur berechneten Route
|
||||||
|
*
|
||||||
|
* @param start Startpunkt
|
||||||
|
* @param ende Endpunkt
|
||||||
|
* @param tourname Name der Aktuellen Tour
|
||||||
|
* @throws IOException Fehler beim Image der Map
|
||||||
|
*/
|
||||||
|
public DirectionMap (String start, String ende, String tourname) throws IOException {
|
||||||
|
this.map = getMap(start, ende);
|
||||||
|
this.start = start;
|
||||||
|
this.end = ende;
|
||||||
|
this.tourname = tourname;
|
||||||
|
this.file = ConfigHelper.getIniString(ConfigHelper.getStandartConfig(), "map", "path") + this.tourname + ".jpg";
|
||||||
|
FileHelper.saveImage(this.map, "jpg", new File(file));
|
||||||
|
FileHelper.openDefault(file);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Downloadet die Map von Mapquest
|
||||||
|
* @param start Startpunkt
|
||||||
|
* @param ende Endpunkt
|
||||||
|
* @return Image von der Map
|
||||||
|
* @throws IOException Fehler beim Get der Map
|
||||||
|
*/
|
||||||
|
private Image getMap(String start, String ende) throws IOException {
|
||||||
|
return HttpHelper.httpGetImage("https://www.mapquestapi.com/staticmap/v5/map?start="+start+"&end="+ende+"&size="+ConfigHelper.getIniString(ConfigHelper.getStandartConfig(), "map", "size")+"&key="+ConfigHelper.getIniString(ConfigHelper.getStandartConfig(), "map", "key"));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
62
src/tourplaner/business/FileHelper.java
Normal file
62
src/tourplaner/business/FileHelper.java
Normal file
@ -0,0 +1,62 @@
|
|||||||
|
package tourplaner.business;
|
||||||
|
|
||||||
|
import javax.imageio.ImageIO;
|
||||||
|
|
||||||
|
import java.awt.*;
|
||||||
|
import java.awt.image.BufferedImage;
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
|
public class FileHelper {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Öffnet ein File mit dem Standart Program
|
||||||
|
* @param f File Path als string
|
||||||
|
*/
|
||||||
|
public static void openDefault(String f){
|
||||||
|
// A reference to a text file
|
||||||
|
File file = new File(f);
|
||||||
|
|
||||||
|
try {
|
||||||
|
Desktop desktop = Desktop.getDesktop();
|
||||||
|
|
||||||
|
// Open a file using the default program for the file type. In the example
|
||||||
|
// we will launch a default registered program to open a text file. For
|
||||||
|
// example on Windows operating system this call might launch a notepad.exe
|
||||||
|
// to open the file.
|
||||||
|
desktop.open(file);
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Speichert ein Image
|
||||||
|
* @param img Das zu speichernde Bild
|
||||||
|
* @param type Dateityp z.b. jpg
|
||||||
|
* @param file Wo die datei zu speichern ist
|
||||||
|
* @throws IOException
|
||||||
|
*/
|
||||||
|
public static void saveImage(Image img, String type, File file) throws IOException {
|
||||||
|
ImageIO.write(ImgHelper.toBufferedImage(img), type, file);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Holt ein image von einem File
|
||||||
|
* @param file File mit dem image
|
||||||
|
* @return Das buffered image
|
||||||
|
* @throws IOException Fehler beim öffnen des bildes
|
||||||
|
*/
|
||||||
|
public static BufferedImage getImage(File file) throws IOException {
|
||||||
|
return ImageIO.read(file);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Löscht ein File
|
||||||
|
* @param file File das zu löschen ist
|
||||||
|
* @return false bei error
|
||||||
|
*/
|
||||||
|
public static boolean delFile(File file){
|
||||||
|
return file.delete();
|
||||||
|
}
|
||||||
|
}
|
23
src/tourplaner/business/HttpHelper.java
Normal file
23
src/tourplaner/business/HttpHelper.java
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
package tourplaner.business;
|
||||||
|
|
||||||
|
import javax.imageio.ImageIO;
|
||||||
|
import java.awt.*;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.net.URL;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Http Hilfsfunktionen
|
||||||
|
*/
|
||||||
|
public class HttpHelper {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Holt ein Image von gegebener URL
|
||||||
|
* @param url Url als Sting
|
||||||
|
* @return Image von der Url
|
||||||
|
* @throws IOException Fehler beim Bild holen
|
||||||
|
*/
|
||||||
|
public static Image httpGetImage(String url) throws IOException {
|
||||||
|
URL urls = new URL(url);
|
||||||
|
return ImageIO.read(urls);
|
||||||
|
}
|
||||||
|
}
|
35
src/tourplaner/business/ImgHelper.java
Normal file
35
src/tourplaner/business/ImgHelper.java
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
package tourplaner.business;
|
||||||
|
|
||||||
|
import java.awt.*;
|
||||||
|
import java.awt.image.BufferedImage;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Image Hilfsfunktionen
|
||||||
|
*/
|
||||||
|
public class ImgHelper {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Converts a given Image into a BufferedImage
|
||||||
|
*
|
||||||
|
* @param img The Image to be converted
|
||||||
|
* @return The converted BufferedImage
|
||||||
|
*/
|
||||||
|
public static BufferedImage toBufferedImage(Image img)
|
||||||
|
{
|
||||||
|
if (img instanceof BufferedImage)
|
||||||
|
{
|
||||||
|
return (BufferedImage) img;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Create a buffered image with transparency
|
||||||
|
BufferedImage bimage = new BufferedImage(img.getWidth(null), img.getHeight(null), BufferedImage.TYPE_INT_ARGB);
|
||||||
|
|
||||||
|
// Draw the image on to the buffered image
|
||||||
|
Graphics2D bGr = bimage.createGraphics();
|
||||||
|
bGr.drawImage(img, 0, 0, null);
|
||||||
|
bGr.dispose();
|
||||||
|
|
||||||
|
// Return the buffered image
|
||||||
|
return bimage;
|
||||||
|
}
|
||||||
|
}
|
@ -33,6 +33,14 @@ public class LogHelper{
|
|||||||
getLog(name).error(msg);
|
getLog(name).error(msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Log info in file und Console
|
||||||
|
* @param e Exception
|
||||||
|
*/
|
||||||
|
public static void error(Exception e){
|
||||||
|
getLog(e.getClass().getName()).error(e.getMessage());
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Log info in file und Console
|
* Log info in file und Console
|
||||||
* @param msg Nachricht in dem Log
|
* @param msg Nachricht in dem Log
|
||||||
|
@ -54,7 +54,7 @@ public class Reporter {
|
|||||||
} catch (DocumentException | FileNotFoundException e) {
|
} catch (DocumentException | FileNotFoundException e) {
|
||||||
LogHelper.error(e.getMessage(), e.getClass().getName());
|
LogHelper.error(e.getMessage(), e.getClass().getName());
|
||||||
}
|
}
|
||||||
openDefault(file);
|
FileHelper.openDefault(file);
|
||||||
}
|
}
|
||||||
|
|
||||||
// iText allows to add metadata to the PDF which can be viewed in your Adobe
|
// iText allows to add metadata to the PDF which can be viewed in your Adobe
|
||||||
@ -216,22 +216,4 @@ public class Reporter {
|
|||||||
paragraph.add(new Paragraph(" "));
|
paragraph.add(new Paragraph(" "));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void openDefault(String f){
|
|
||||||
// A reference to a text file
|
|
||||||
File file = new File(f);
|
|
||||||
|
|
||||||
try {
|
|
||||||
Desktop desktop = Desktop.getDesktop();
|
|
||||||
|
|
||||||
// Open a file using the default program for the file type. In the example
|
|
||||||
// we will launch a default registered program to open a text file. For
|
|
||||||
// example on Windows operating system this call might launch a notepad.exe
|
|
||||||
// to open the file.
|
|
||||||
desktop.open(file);
|
|
||||||
} catch (IOException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -5,6 +5,8 @@ import tourplaner.data.DbConnect;
|
|||||||
import tourplaner.object.Log;
|
import tourplaner.object.Log;
|
||||||
import tourplaner.object.Tour;
|
import tourplaner.object.Tour;
|
||||||
|
|
||||||
|
import java.awt.*;
|
||||||
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
||||||
@ -35,23 +37,38 @@ public class TourPlaner{
|
|||||||
* @param tour Neuer Tourname
|
* @param tour Neuer Tourname
|
||||||
* @return false bei error
|
* @return false bei error
|
||||||
*/
|
*/
|
||||||
public static boolean editTour(String oldname, Tour tour){
|
public static boolean editTour(String oldname, Tour tour) throws IOException {
|
||||||
|
FileHelper.delFile(new File(getImagePath(oldname)));
|
||||||
|
new DirectionMap(tour.getStart(), tour.getZiel(), tour.getName());
|
||||||
return new DbConnect().editTour(oldname, tour);
|
return new DbConnect().editTour(oldname, tour);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean delTour(String tourname){
|
public static boolean delTour(String tourname){
|
||||||
|
FileHelper.delFile(new File(getImagePath(tourname)));
|
||||||
return new DbConnect().delTour(tourname);
|
return new DbConnect().delTour(tourname);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Fügt eine Tour hinzu
|
* Fügt eine Tour hinzu
|
||||||
* @param newTour Neue Tour
|
* @param newTour Neue Tour
|
||||||
* @return false bei error
|
* @return false bei error
|
||||||
*/
|
*/
|
||||||
public static boolean addTour(Tour newTour){
|
public static boolean addTour(Tour newTour) throws IOException {
|
||||||
|
DirectionMap directionMap = new DirectionMap(newTour.getStart(), newTour.getZiel(), newTour.getName());
|
||||||
return new DbConnect().addTour(newTour);
|
return new DbConnect().addTour(newTour);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static Image getImage(String tourname) throws IOException {
|
||||||
|
return FileHelper.getImage(new File(getImagePath(tourname)));
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String getImagePath(String tourname){
|
||||||
|
return ConfigHelper.getIniString(ConfigHelper.getStandartConfig(), "map", "path") + tourname + ".jpg";
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void openImage(String tourname){
|
||||||
|
FileHelper.openDefault(getImagePath(tourname));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public static ArrayList<Log> getLogs(String tourname){
|
public static ArrayList<Log> getLogs(String tourname){
|
||||||
return new DbConnect().getLogs(tourname);
|
return new DbConnect().getLogs(tourname);
|
||||||
|
@ -34,6 +34,7 @@
|
|||||||
|
|
||||||
<?import javafx.geometry.*?>
|
<?import javafx.geometry.*?>
|
||||||
<?import javafx.scene.control.*?>
|
<?import javafx.scene.control.*?>
|
||||||
|
<?import javafx.scene.image.*?>
|
||||||
<?import javafx.scene.layout.*?>
|
<?import javafx.scene.layout.*?>
|
||||||
<?import javafx.scene.paint.*?>
|
<?import javafx.scene.paint.*?>
|
||||||
<?import javafx.scene.text.*?>
|
<?import javafx.scene.text.*?>
|
||||||
@ -112,10 +113,11 @@
|
|||||||
<children>
|
<children>
|
||||||
<TabPane fx:id="viewTabPane" layoutX="1.0" layoutY="69.0" prefWidth="702.0" tabClosingPolicy="UNAVAILABLE" AnchorPane.bottomAnchor="-67.0" AnchorPane.leftAnchor="1.0" AnchorPane.rightAnchor="1.0" AnchorPane.topAnchor="0.0">
|
<TabPane fx:id="viewTabPane" layoutX="1.0" layoutY="69.0" prefWidth="702.0" tabClosingPolicy="UNAVAILABLE" AnchorPane.bottomAnchor="-67.0" AnchorPane.leftAnchor="1.0" AnchorPane.rightAnchor="1.0" AnchorPane.topAnchor="0.0">
|
||||||
<tabs>
|
<tabs>
|
||||||
<Tab fx:id="kartenTab" text="Karte">
|
<Tab fx:id="kartenTab" text="Karte">
|
||||||
<content>
|
<AnchorPane>
|
||||||
<AnchorPane />
|
<ImageView fx:id="mapImageView" pickOnBounds="true" preserveRatio="true" AnchorPane.bottomAnchor="80.0" AnchorPane.leftAnchor="13.0" AnchorPane.rightAnchor="825.0" AnchorPane.topAnchor="0.0" />
|
||||||
</content></Tab>
|
</AnchorPane>
|
||||||
|
</Tab>
|
||||||
<Tab fx:id="beschreibungTab" text="Beschreibung">
|
<Tab fx:id="beschreibungTab" text="Beschreibung">
|
||||||
<content>
|
<content>
|
||||||
<AnchorPane>
|
<AnchorPane>
|
||||||
|
@ -8,6 +8,7 @@ import javafx.scene.control.*;
|
|||||||
import javafx.scene.control.Label;
|
import javafx.scene.control.Label;
|
||||||
import javafx.scene.control.TextField;
|
import javafx.scene.control.TextField;
|
||||||
import javafx.scene.control.cell.PropertyValueFactory;
|
import javafx.scene.control.cell.PropertyValueFactory;
|
||||||
|
import javafx.scene.image.ImageView;
|
||||||
import javafx.scene.input.MouseEvent;
|
import javafx.scene.input.MouseEvent;
|
||||||
import tourplaner.business.ConfigHelper;
|
import tourplaner.business.ConfigHelper;
|
||||||
import tourplaner.business.LogHelper;
|
import tourplaner.business.LogHelper;
|
||||||
@ -37,6 +38,7 @@ public class TourplanerController implements Initializable {
|
|||||||
public TableView<Tour> beschreibungTableView;
|
public TableView<Tour> beschreibungTableView;
|
||||||
public TableColumn<Tour, String> startCol, zielCol, dauerCol, streckeCol, nameCol;
|
public TableColumn<Tour, String> startCol, zielCol, dauerCol, streckeCol, nameCol;
|
||||||
public TextField titleTextView, sucheInput;
|
public TextField titleTextView, sucheInput;
|
||||||
|
public ImageView mapImageView;
|
||||||
//Log -> rechts unten
|
//Log -> rechts unten
|
||||||
public TableView<Log> logTableView;
|
public TableView<Log> logTableView;
|
||||||
public TableColumn<Log, String> logDauerCol, logStreckeCol, logDatumCol, logAvgCol, logHightCol, logPauseCol, logGegangenCol, logBemerkungCol;
|
public TableColumn<Log, String> logDauerCol, logStreckeCol, logDatumCol, logAvgCol, logHightCol, logPauseCol, logGegangenCol, logBemerkungCol;
|
||||||
@ -49,7 +51,11 @@ public class TourplanerController implements Initializable {
|
|||||||
|
|
||||||
@FXML
|
@FXML
|
||||||
private void editTourBtn(){
|
private void editTourBtn(){
|
||||||
this.viewModel.editTour();
|
try {
|
||||||
|
this.viewModel.editTour();
|
||||||
|
} catch (IOException e) {
|
||||||
|
LogHelper.error(e);
|
||||||
|
}
|
||||||
syncTour(this.viewModel.getSelectedTour().getName());
|
syncTour(this.viewModel.getSelectedTour().getName());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -88,6 +94,7 @@ public class TourplanerController implements Initializable {
|
|||||||
private void syncTour(String selectedItem){
|
private void syncTour(String selectedItem){
|
||||||
beschreibungTableView.getItems().removeIf(s -> true); //Leert die Table View komplett
|
beschreibungTableView.getItems().removeIf(s -> true); //Leert die Table View komplett
|
||||||
beschreibungTableView.getItems().add(this.viewModel.getTour(selectedItem));
|
beschreibungTableView.getItems().add(this.viewModel.getTour(selectedItem));
|
||||||
|
mapImageView.setImage(this.viewModel.getImage(selectedItem));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void syncTourNamen(){
|
private void syncTourNamen(){
|
||||||
@ -129,6 +136,7 @@ public class TourplanerController implements Initializable {
|
|||||||
logGegangenCol.setCellValueFactory(new PropertyValueFactory<Log, String>("gegangen"));
|
logGegangenCol.setCellValueFactory(new PropertyValueFactory<Log, String>("gegangen"));
|
||||||
logBemerkungCol.setCellValueFactory(new PropertyValueFactory<Log, String>("bemerkung"));
|
logBemerkungCol.setCellValueFactory(new PropertyValueFactory<Log, String>("bemerkung"));
|
||||||
|
|
||||||
|
mapImageView.setImage(this.viewModel.getImage(this.viewModel.getSelectedTour().getName()));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -147,6 +155,7 @@ public class TourplanerController implements Initializable {
|
|||||||
@FXML
|
@FXML
|
||||||
private void addTour(){
|
private void addTour(){
|
||||||
this.viewModel.addTour();
|
this.viewModel.addTour();
|
||||||
|
this.mapImageView.setImage(this.viewModel.getImage(this.viewModel.getSelectedTour().getName()));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -159,6 +168,7 @@ public class TourplanerController implements Initializable {
|
|||||||
this.titleTextView.setText(ConfigHelper.getLangIniString("keinetourselected"));
|
this.titleTextView.setText(ConfigHelper.getLangIniString("keinetourselected"));
|
||||||
this.viewModel.delTour();
|
this.viewModel.delTour();
|
||||||
logTableView.setPlaceholder(new Label( ConfigHelper.getLangIniString("keinetourselected")));
|
logTableView.setPlaceholder(new Label( ConfigHelper.getLangIniString("keinetourselected")));
|
||||||
|
mapImageView.setImage(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -2,6 +2,7 @@ package tourplaner.viewmodels;
|
|||||||
|
|
||||||
import javafx.collections.FXCollections;
|
import javafx.collections.FXCollections;
|
||||||
import javafx.collections.ObservableList;
|
import javafx.collections.ObservableList;
|
||||||
|
import javafx.scene.image.Image;
|
||||||
import tourplaner.business.TourPlaner;
|
import tourplaner.business.TourPlaner;
|
||||||
import tourplaner.ui.AlertHelper;
|
import tourplaner.ui.AlertHelper;
|
||||||
import tourplaner.business.ConfigHelper;
|
import tourplaner.business.ConfigHelper;
|
||||||
@ -31,11 +32,15 @@ public class ViewModel {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public Image getImage(String tourname){
|
||||||
|
return new Image( ConfigHelper.getIniString(ConfigHelper.getStandartConfig(), "map", "file_pre") + TourPlaner.getImagePath(tourname));
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Bearbeitet eine bereits bestehende Tour
|
* Bearbeitet eine bereits bestehende Tour
|
||||||
* prüft ob eine tour ausgewählt ist
|
* prüft ob eine tour ausgewählt ist
|
||||||
*/
|
*/
|
||||||
public void editTour(){
|
public void editTour() throws IOException {
|
||||||
if (this.selectedTour == null){
|
if (this.selectedTour == null){
|
||||||
AlertHelper.warn(ConfigHelper.getLangIniString("achtung"),
|
AlertHelper.warn(ConfigHelper.getLangIniString("achtung"),
|
||||||
ConfigHelper.getLangIniString("keinetourselected"),
|
ConfigHelper.getLangIniString("keinetourselected"),
|
||||||
@ -155,7 +160,12 @@ public class ViewModel {
|
|||||||
Tour newTour = new Tour(this.neueTourName, "1", "1", 0, this.neueTourStart, this.neueTourZiel);
|
Tour newTour = new Tour(this.neueTourName, "1", "1", 0, this.neueTourStart, this.neueTourZiel);
|
||||||
tourData.add(newTour);
|
tourData.add(newTour);
|
||||||
tourNamen.add(this.neueTourName);
|
tourNamen.add(this.neueTourName);
|
||||||
TourPlaner.addTour(newTour);
|
this.selectedTour = newTour;
|
||||||
|
try {
|
||||||
|
TourPlaner.addTour(newTour);
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
this.neueTourStart = null;
|
this.neueTourStart = null;
|
||||||
this.neueTourZiel = null;
|
this.neueTourZiel = null;
|
||||||
|
Reference in New Issue
Block a user