Compare commits

..

4 Commits

10 changed files with 57 additions and 39 deletions

View File

@ -38,27 +38,27 @@ PROJECT_NAME = Tourplaner
# could be handy for archiving the generated documentation or if some version # could be handy for archiving the generated documentation or if some version
# control system is used. # control system is used.
PROJECT_NUMBER = 0.0.2 PROJECT_NUMBER = 1
# Using the PROJECT_BRIEF tag one can provide an optional one line description # Using the PROJECT_BRIEF tag one can provide an optional one line description
# for a project that appears at the top of each page and should give viewer a # for a project that appears at the top of each page and should give viewer a
# quick idea about the purpose of the project. Keep the description short. # quick idea about the purpose of the project. Keep the description short.
PROJECT_BRIEF = DGTP PROJECT_BRIEF = tpl
# With the PROJECT_LOGO tag one can specify a logo or an icon that is included # With the PROJECT_LOGO tag one can specify a logo or an icon that is included
# in the documentation. The maximum height of the logo should not exceed 55 # in the documentation. The maximum height of the logo should not exceed 55
# pixels and the maximum width should not exceed 200 pixels. Doxygen will copy # pixels and the maximum width should not exceed 200 pixels. Doxygen will copy
# the logo to the output directory. # the logo to the output directory.
PROJECT_LOGO = PROJECT_LOGO = D:/FH_OFFLINE/tourplaner/logo_sm.png
# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) path # The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) path
# into which the generated documentation will be written. If a relative path is # into which the generated documentation will be written. If a relative path is
# entered, it will be relative to the location where doxygen was started. If # entered, it will be relative to the location where doxygen was started. If
# left blank the current directory will be used. # left blank the current directory will be used.
OUTPUT_DIRECTORY = C:\Users\georg\OneDrive\FH\Swe\Tourplaner\doxygendoc OUTPUT_DIRECTORY = D:\FH_OFFLINE\tourplaner\doxygendoc
# If the CREATE_SUBDIRS tag is set to YES then doxygen will create 4096 sub- # If the CREATE_SUBDIRS tag is set to YES then doxygen will create 4096 sub-
# directories (in 2 levels) under the output directory of each output format and # directories (in 2 levels) under the output directory of each output format and
@ -864,7 +864,7 @@ WARN_LOGFILE =
# spaces. See also FILE_PATTERNS and EXTENSION_MAPPING # spaces. See also FILE_PATTERNS and EXTENSION_MAPPING
# Note: If this tag is empty the current directory is searched. # Note: If this tag is empty the current directory is searched.
INPUT = C:\Users\georg\OneDrive\FH\Swe\Tourplaner\src\tourplaner INPUT = D:\FH_OFFLINE\tourplaner\src
# This tag can be used to specify the character encoding of the source files # This tag can be used to specify the character encoding of the source files
# that doxygen parses. Internally doxygen uses the UTF-8 encoding. Doxygen uses # that doxygen parses. Internally doxygen uses the UTF-8 encoding. Doxygen uses
@ -1304,7 +1304,7 @@ HTML_EXTRA_FILES =
# Minimum value: 0, maximum value: 359, default value: 220. # Minimum value: 0, maximum value: 359, default value: 220.
# This tag requires that the tag GENERATE_HTML is set to YES. # This tag requires that the tag GENERATE_HTML is set to YES.
HTML_COLORSTYLE_HUE = 220 HTML_COLORSTYLE_HUE = 359
# The HTML_COLORSTYLE_SAT tag controls the purity (or saturation) of the colors # The HTML_COLORSTYLE_SAT tag controls the purity (or saturation) of the colors
# in the HTML output. For a value of 0 the output will use grayscales only. A # in the HTML output. For a value of 0 the output will use grayscales only. A
@ -1312,7 +1312,7 @@ HTML_COLORSTYLE_HUE = 220
# Minimum value: 0, maximum value: 255, default value: 100. # Minimum value: 0, maximum value: 255, default value: 100.
# This tag requires that the tag GENERATE_HTML is set to YES. # This tag requires that the tag GENERATE_HTML is set to YES.
HTML_COLORSTYLE_SAT = 100 HTML_COLORSTYLE_SAT = 0
# The HTML_COLORSTYLE_GAMMA tag controls the gamma correction applied to the # The HTML_COLORSTYLE_GAMMA tag controls the gamma correction applied to the
# luminance component of the colors in the HTML output. Values below 100 # luminance component of the colors in the HTML output. Values below 100
@ -1323,7 +1323,7 @@ HTML_COLORSTYLE_SAT = 100
# Minimum value: 40, maximum value: 240, default value: 80. # Minimum value: 40, maximum value: 240, default value: 80.
# This tag requires that the tag GENERATE_HTML is set to YES. # This tag requires that the tag GENERATE_HTML is set to YES.
HTML_COLORSTYLE_GAMMA = 80 HTML_COLORSTYLE_GAMMA = 240
# If the HTML_TIMESTAMP tag is set to YES then the footer of each generated HTML # If the HTML_TIMESTAMP tag is set to YES then the footer of each generated HTML
# page will contain the date and time when the page was generated. Setting this # page will contain the date and time when the page was generated. Setting this
@ -1582,7 +1582,7 @@ DISABLE_INDEX = NO
# The default value is: NO. # The default value is: NO.
# This tag requires that the tag GENERATE_HTML is set to YES. # This tag requires that the tag GENERATE_HTML is set to YES.
GENERATE_TREEVIEW = YES GENERATE_TREEVIEW = NO
# The ENUM_VALUES_PER_LINE tag can be used to set the number of enum values that # The ENUM_VALUES_PER_LINE tag can be used to set the number of enum values that
# doxygen will group on one line in the generated HTML documentation. # doxygen will group on one line in the generated HTML documentation.
@ -1790,7 +1790,7 @@ EXTRA_SEARCH_MAPPINGS =
# If the GENERATE_LATEX tag is set to YES, doxygen will generate LaTeX output. # If the GENERATE_LATEX tag is set to YES, doxygen will generate LaTeX output.
# The default value is: YES. # The default value is: YES.
GENERATE_LATEX = YES GENERATE_LATEX = NO
# The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put. If a # The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put. If a
# relative path is entered the value of OUTPUT_DIRECTORY will be put in front of # relative path is entered the value of OUTPUT_DIRECTORY will be put in front of
@ -2050,7 +2050,7 @@ RTF_SOURCE_CODE = NO
# classes and files. # classes and files.
# The default value is: NO. # The default value is: NO.
GENERATE_MAN = YES GENERATE_MAN = NO
# The MAN_OUTPUT tag is used to specify where the man pages will be put. If a # The MAN_OUTPUT tag is used to specify where the man pages will be put. If a
# relative path is entered the value of OUTPUT_DIRECTORY will be put in front of # relative path is entered the value of OUTPUT_DIRECTORY will be put in front of
@ -2128,7 +2128,7 @@ XML_NS_MEMB_FILE_SCOPE = NO
# that can be used to generate PDF. # that can be used to generate PDF.
# The default value is: NO. # The default value is: NO.
GENERATE_DOCBOOK = YES GENERATE_DOCBOOK = NO
# The DOCBOOK_OUTPUT tag is used to specify where the Docbook pages will be put. # The DOCBOOK_OUTPUT tag is used to specify where the Docbook pages will be put.
# If a relative path is entered the value of OUTPUT_DIRECTORY will be put in # If a relative path is entered the value of OUTPUT_DIRECTORY will be put in
@ -2336,7 +2336,7 @@ EXTERNAL_PAGES = YES
# powerful graphs. # powerful graphs.
# The default value is: YES. # The default value is: YES.
CLASS_DIAGRAMS = YES CLASS_DIAGRAMS = NO
# You can include diagrams made with dia in doxygen documentation. Doxygen will # You can include diagrams made with dia in doxygen documentation. Doxygen will
# then run dia to produce the diagram and insert it in the documentation. The # then run dia to produce the diagram and insert it in the documentation. The
@ -2358,7 +2358,7 @@ HIDE_UNDOC_RELATIONS = YES
# set to NO # set to NO
# The default value is: NO. # The default value is: NO.
HAVE_DOT = NO HAVE_DOT = YES
# The DOT_NUM_THREADS specifies the number of dot invocations doxygen is allowed # The DOT_NUM_THREADS specifies the number of dot invocations doxygen is allowed
# to run in parallel. When set to 0 doxygen will base this on the number of # to run in parallel. When set to 0 doxygen will base this on the number of

View File

@ -1,8 +1,16 @@
# Tourplaner # Tourplaner
* JavaDoc: https://dergeorg.at/javadoc
* DoxygenDoc: https://dergeorg.at/doxygendoc/html
# Config # Config
* DB informationen müssen in das config.ini.sample unter [db] eingetragen werden * DB informationen müssen in das config.ini.sample unter ```[db]``` eingetragen werden
* Datei muss in config.ini umbenannt werden * Datei muss in config.ini umbenannt werden
* [langde] beinhaltet alle Deutschen Texte der Gui * ```langde.ini``` beinhaltet alle Deutschen Texte der Gui
* [start] beinhaltet den Title und infos die beim start verabeitet werden * ```langen.ini``` beinhaltet alle Englischen Texte der Gui
* [hilfe] beinhaltet die Links zu den Hilfeseiten * Bei ```[map] -> key``` muss ein API Key zu Mapquest eingegeben werden
* Bei ```[report] -> path``` kann der Path eingestellt werden, wo die Reports gespeichert werden
* Bei ```[map] -> path``` kann der Path eingestellt werden, wo die Maps gespeichert werden
# UML
```[UML.svg]``` (https://git.dergeorg.at/dergeorg/tourplaner/src/branch/master/uml.svg)
![UML.svg](uml.svg)

View File

@ -9,6 +9,7 @@ import java.io.IOException;
*/ */
public class DirectionMap { public class DirectionMap {
private double dauer, strecke; private double dauer, strecke;
private String sessionId;
/** /**
* Holt die Map als image und alle Daten zur berechneten Route * Holt die Map als image und alle Daten zur berechneten Route
@ -19,13 +20,13 @@ public class DirectionMap {
* @throws IOException Fehler beim Image der Map * @throws IOException Fehler beim Image der Map
*/ */
public DirectionMap (String start, String ende, String tourname) throws IOException { public DirectionMap (String start, String ende, String tourname) throws IOException {
Image map = getMap(start, ende, ConfigHelper.getIniString(ConfigHelper.getStandartConfig(), "map", "size")); getDirections(start, ende);
Image mappdf = getMap(start, ende, ConfigHelper.getIniString(ConfigHelper.getStandartConfig(), "map", "sizePdf")); Image map = getMap(ConfigHelper.getIniString(ConfigHelper.getStandartConfig(), "map", "size"));
Image mappdf = getMap(ConfigHelper.getIniString(ConfigHelper.getStandartConfig(), "map", "sizePdf"));
String file = ConfigHelper.getIniString(ConfigHelper.getStandartConfig(), "map", "path") + tourname + ".jpg"; String file = ConfigHelper.getIniString(ConfigHelper.getStandartConfig(), "map", "path") + tourname + ".jpg";
String filepdf = ConfigHelper.getIniString(ConfigHelper.getStandartConfig(), "map", "path") + tourname + "_pdf.jpg"; String filepdf = ConfigHelper.getIniString(ConfigHelper.getStandartConfig(), "map", "path") + tourname + "_pdf.jpg";
FileHelper.saveImage(map, "jpg", new File(file)); FileHelper.saveImage(map, "jpg", new File(file));
FileHelper.saveImage(mappdf, "jpg", new File(filepdf)); FileHelper.saveImage(mappdf, "jpg", new File(filepdf));
getDirections(start, ende);
if(ConfigHelper.getIniInt(ConfigHelper.getStandartConfig(), "settings", "openmap") == 1) { if(ConfigHelper.getIniInt(ConfigHelper.getStandartConfig(), "settings", "openmap") == 1) {
FileHelper.openDefault(file); FileHelper.openDefault(file);
} }
@ -54,8 +55,9 @@ public class DirectionMap {
* @return Image von der Map * @return Image von der Map
* @throws IOException Fehler beim Get der Map * @throws IOException Fehler beim Get der Map
*/ */
private Image getMap(String start, String ende, String size) throws IOException { private Image getMap(String size) throws IOException {
return HttpHelper.httpGetImage("https://www.mapquestapi.com/staticmap/v5/map?start="+start+"&end="+ende+"&size="+size+"&key="+ConfigHelper.getIniString(ConfigHelper.getStandartConfig(), "map", "key")); System.out.println("URL: " + "https://www.mapquestapi.com/staticmap/v5/map?session="+this.sessionId+"&size="+size+"&key="+ConfigHelper.getIniString(ConfigHelper.getStandartConfig(), "map", "key"));
return HttpHelper.httpGetImage("https://www.mapquestapi.com/staticmap/v5/map?session="+this.sessionId+"&size="+size+"&key="+ConfigHelper.getIniString(ConfigHelper.getStandartConfig(), "map", "key"));
} }
/** /**
@ -65,12 +67,10 @@ public class DirectionMap {
* @throws IOException Fehler beim besorgen der infos über die Tour * @throws IOException Fehler beim besorgen der infos über die Tour
*/ */
private void getDirections(String start, String ende) throws IOException { private void getDirections(String start, String ende) throws IOException {
System.out.println("LOCS: " + start + ende);
String json = HttpHelper.httpGetJsonString("https://www.mapquestapi.com/directions/v2/route?key="+ ConfigHelper.getIniString(ConfigHelper.getStandartConfig(), "map", "key")+"&from="+start+"&to="+ende+"&outFormat=json&ambiguities=ignore&routeType=fastest&doReverseGeocode=false&enhancedNarrative=false&avoidTimedConditions=false"); String json = HttpHelper.httpGetJsonString("https://www.mapquestapi.com/directions/v2/route?key="+ ConfigHelper.getIniString(ConfigHelper.getStandartConfig(), "map", "key")+"&from="+start+"&to="+ende+"&outFormat=json&ambiguities=ignore&routeType=fastest&doReverseGeocode=false&enhancedNarrative=false&avoidTimedConditions=false");
System.out.println("JSON: " + json);
System.out.println("URL https://www.mapquestapi.com/directions/v2/route?key="+ ConfigHelper.getIniString(ConfigHelper.getStandartConfig(), "map", "key")+"&from="+start+"&to="+ende+"&outFormat=json&ambiguities=ignore&routeType=fastest&doReverseGeocode=false&enhancedNarrative=false&avoidTimedConditions=false");
this.strecke = JsonHelper.getDoubleFromJson(json, "distance"); this.strecke = JsonHelper.getDoubleFromJson(json, "distance");
this.dauer = formatetTimeToMinutes(JsonHelper.getStingFromJson(json, "formattedTime")); this.dauer = formatetTimeToMinutes(JsonHelper.getStingFromJson(json, "formattedTime"));
this.sessionId = JsonHelper.getStingFromJson(json, "sessionId");
} }
/** /**

View File

@ -50,19 +50,25 @@ public class Exporter {
try { try {
ArrayList<Tour> touren = JsonHelper.getTourenFromJson(new FileReader(EinheitenAdder.addJson(this.path))); ArrayList<Tour> touren = JsonHelper.getTourenFromJson(new FileReader(EinheitenAdder.addJson(this.path)));
DbConnect dbConnect = new DbConnect(); DbConnect dbConnect = new DbConnect();
dbConnect.delAllData(); ArrayList<Tour> allTours = dbConnect.getAllTouren();
progressBar.addProgress(5); progressBar.addProgress(2);
int size = progressBar.getProgressSize(touren.size() * 3, 100); int size = progressBar.getProgressSize(allTours.size(), 25);
allTours.forEach(t -> {
TourPlaner.delTour(t.getName());
progressBar.addProgress(size);
});
int finalSize = progressBar.getProgressSize(touren.size() * 3, 100);
for (Tour tour: touren) { for (Tour tour: touren) {
new DirectionMap(tour.getStart(), tour.getZiel(), tour.getName()); new DirectionMap(tour.getStart(), tour.getZiel(), tour.getName());
progressBar.addProgress(size); progressBar.addProgress(finalSize);
dbConnect.addTour(tour); dbConnect.addTour(tour);
progressBar.addProgress(size); progressBar.addProgress(finalSize);
ArrayList<Log> logs = tour.getLogs(); ArrayList<Log> logs = tour.getLogs();
for (Log log:logs) { for (Log log:logs) {
dbConnect.addLog(tour.getName(), log); dbConnect.addLog(tour.getName(), log);
} }
progressBar.addProgress(size); progressBar.addProgress(finalSize);
} }
} catch (IOException e) { } catch (IOException e) {
LogHelper.error(e); LogHelper.error(e);

View File

@ -40,6 +40,7 @@ public class Reporter {
Document document = new Document(); Document document = new Document();
PdfWriter.getInstance(document, new FileOutputStream(file)); PdfWriter.getInstance(document, new FileOutputStream(file));
document.open(); document.open();
addMetaData(document, new Tour("Summary", "String dauer", "String mapJson", 1, "String start", "String ziel"));
addSumRepo(document, tours); addSumRepo(document, tours);
document.close(); document.close();
@ -173,6 +174,7 @@ public class Reporter {
subCatPart.add(new Paragraph(EinheitenAdder.addKm(ConfigHelper.getLangIniString("logstrecke") + " " + log.getStrecke()))); subCatPart.add(new Paragraph(EinheitenAdder.addKm(ConfigHelper.getLangIniString("logstrecke") + " " + log.getStrecke())));
subCatPart.add(new Paragraph(EinheitenAdder.addMeter(ConfigHelper.getLangIniString("loghight") + " " + log.getHightmeter()))); subCatPart.add(new Paragraph(EinheitenAdder.addMeter(ConfigHelper.getLangIniString("loghight") + " " + log.getHightmeter())));
subCatPart.add(new Paragraph(ConfigHelper.getLangIniString("logbemerkung") + " " + log.getBemerkung())); subCatPart.add(new Paragraph(ConfigHelper.getLangIniString("logbemerkung") + " " + log.getBemerkung()));
subCatPart.add(new Paragraph( "Rating " + log.getRating()));
} }
// now add all this to the document // now add all this to the document
document.add(catPart); document.add(catPart);

View File

@ -10,6 +10,7 @@ import java.awt.*;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Locale;
/** /**
* Haupt Logik des Tourplaners * Haupt Logik des Tourplaners
@ -59,14 +60,9 @@ public class TourPlaner{
* @return false bei error * @return false bei error
*/ */
public static boolean delTour(String tourname){ public static boolean delTour(String tourname){
ProgressBar progressBar = new ProgressBar("Del...");
int step = progressBar.getProgressSize(3, 100);
FileHelper.delFile(new File(getImagePath(tourname))); FileHelper.delFile(new File(getImagePath(tourname)));
progressBar.addProgress(step);
FileHelper.delFile(new File(getImagePdfPath(tourname))); FileHelper.delFile(new File(getImagePdfPath(tourname)));
progressBar.addProgress(step);
boolean ret = new DbConnect().delTour(tourname); boolean ret = new DbConnect().delTour(tourname);
progressBar.setProgress(100);
return ret; return ret;
} }
/** /**
@ -172,7 +168,7 @@ public class TourPlaner{
public static ArrayList<Tour> sucheTour(String tourname){ public static ArrayList<Tour> sucheTour(String tourname){
ArrayList<Tour> touren = new ArrayList<>(); ArrayList<Tour> touren = new ArrayList<>();
getAllTours().forEach(t ->{ getAllTours().forEach(t ->{
if(t.getName().contains(tourname)){ if(t.getName().toLowerCase(Locale.ROOT).contains(tourname.toLowerCase())){
touren.add(t); touren.add(t);
} }
}); });

View File

@ -147,7 +147,7 @@ public class DbConnect {
public boolean editLog(String tourname, Log log){ public boolean editLog(String tourname, Log log){
return PostgresHelper.executeUpdate("UPDATE public.log SET bemerkung = '"+log.getBemerkung()+"', datum = '"+log.getDatum()+"', strecke = "+log.getStrecke()+", avg = "+log.getAvgspeed()+", hightmeter = "+ return PostgresHelper.executeUpdate("UPDATE public.log SET bemerkung = '"+log.getBemerkung()+"', datum = '"+log.getDatum()+"', strecke = "+log.getStrecke()+", avg = "+log.getAvgspeed()+", hightmeter = "+
log.getHightmeter()+", pause = "+log.getPause()+", gegangen = "+log.getGegangen()+", dauer = "+log.getDauer()+" WHERE tourname = '"+tourname+"' and id = '"+log.getId()+"', rating = '"+log.getRating()+"'"); log.getHightmeter()+", pause = "+log.getPause()+", gegangen = "+log.getGegangen()+", dauer = "+log.getDauer()+", rating = '"+log.getRating()+"' WHERE tourname = '"+tourname+"' and id = '"+log.getId()+"'");
} }
public boolean delLog(String tourname, String id){ public boolean delLog(String tourname, String id){

View File

@ -28,6 +28,7 @@ public class ProgressBar {
Container content = this.frame.getContentPane(); Container content = this.frame.getContentPane();
this.progressBar = new JProgressBar(); this.progressBar = new JProgressBar();
this.progressBar.setValue(0); this.progressBar.setValue(0);
this.progressBar.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
this.progressBar.setStringPainted(true); this.progressBar.setStringPainted(true);
TitledBorder border = BorderFactory.createTitledBorder("Laden...."); TitledBorder border = BorderFactory.createTitledBorder("Laden....");
this.progressBar.setBorder(border); this.progressBar.setBorder(border);

View File

@ -506,8 +506,10 @@ public class ViewModel {
tourData.removeIf(s -> s.getName().equals(tourname)); tourData.removeIf(s -> s.getName().equals(tourname));
tourNamen.removeIf(s -> s.equals(tourname)); tourNamen.removeIf(s -> s.equals(tourname));
logData.removeIf(s -> true); logData.removeIf(s -> true);
ProgressBar progressBar = new ProgressBar("");
TourPlaner.delTour(tourname); TourPlaner.delTour(tourname);
setSelectedTour(null); setSelectedTour(null);
progressBar.setProgress(100);
} catch (NullPointerException e) { } catch (NullPointerException e) {
LogHelper.error(e); LogHelper.error(e);
} }

3
uml.svg Normal file

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 451 KiB