diff options
author | Johannes Hofmann <Johannes.Hofmann@gmx.de> | 2007-08-10 17:56:37 +0200 |
---|---|---|
committer | Johannes Hofmann <Johannes.Hofmann@gmx.de> | 2007-08-10 17:56:37 +0200 |
commit | c712d598ea39dc4f90a733dc06c44617eb30bcbb (patch) | |
tree | 5c1d822deff1877ec78499761d6c19745cc31f81 /src | |
parent | dadd1edab19c6f87c3e8cca7e9fbcce554dd4cb0 (diff) |
implement automatic gipfelweb generation
Diffstat (limited to 'src')
-rw-r--r-- | src/GipfelWidget.cxx | 22 | ||||
-rw-r--r-- | src/gipfel.cxx | 4 |
2 files changed, 16 insertions, 10 deletions
diff --git a/src/GipfelWidget.cxx b/src/GipfelWidget.cxx index 20d4a42..15a3cc6 100644 --- a/src/GipfelWidget.cxx +++ b/src/GipfelWidget.cxx @@ -677,22 +677,28 @@ GipfelWidget::handle(int event) { int GipfelWidget::export_hills(FILE *fp) { Hills *mnts; - Hill *m; - fprintf(fp, "#\n# name\theight\tx\ty\tdistance\n#\n"); + fprintf(fp, "#\n# name\theight\tx\ty\tdistance\tflags\n#\n"); mnts = pan->get_visible_mountains(); for (int i=0; i<mnts->get_num(); i++) { - m = mnts->get(i); + Hill *m = mnts->get(i); + char *flags; + int _x = (int) rint(m->x) + w() / 2; + int _y = (int) rint(m->y) + h() / 2; - if (m->x < 0 || m->x > w() || m->y < 0 || m->y > h()) { + if (_x < 0 || _x > w() || _y < 0 || _y > h()) { continue; } - fprintf(fp, "%s\t%d\t%d\t%d\t%d\n", - m->name, (int) rint(m->height), - (int) rint( m->x), (int) rint(m->y), - (int) rint(pan->get_real_distance(m))); + if (m->flags & Hill::HIDDEN) { + flags = "HIDDEN"; + } else { + flags = ""; + } + fprintf(fp, "%s\t%d\t%d\t%d\t%d\t%s\n", + m->name, (int) rint(m->height), _x, _y, + (int) rint(pan->get_real_distance(m)), flags); } return 0; diff --git a/src/gipfel.cxx b/src/gipfel.cxx index 295adf6..ba757e2 100644 --- a/src/gipfel.cxx +++ b/src/gipfel.cxx @@ -658,9 +658,9 @@ export_hills(const char *export_mode, double visibility) { } else { ImageMetaData md; if (md.load_image(img_file) == 0) { - printf(",,%s,,%f,%f,%d\n", img_file, - md.get_longitude(), + printf(",%s,,%f,%f,%d\n", img_file, md.get_latitude(), + md.get_longitude(), (int) rint(md.get_height())); ret = 0; } |