summaryrefslogtreecommitdiff
path: root/src/GipfelWidget.cxx
diff options
context:
space:
mode:
authorJohannes Hofmann <Johannes.Hofmann@gmx.de>2007-08-11 20:39:29 +0200
committerJohannes Hofmann <Johannes.Hofmann@gmx.de>2007-08-11 20:39:29 +0200
commitd4d4b2fadfd38b260a8d8f68f9c929a6444b221e (patch)
tree00fae9610e53172811373ce87ea8a9839100e6e7 /src/GipfelWidget.cxx
parentbd42e86fd53e7e6c6c5bb837762fbc29676614ca (diff)
change export synapsis
Diffstat (limited to 'src/GipfelWidget.cxx')
-rw-r--r--src/GipfelWidget.cxx25
1 files changed, 22 insertions, 3 deletions
diff --git a/src/GipfelWidget.cxx b/src/GipfelWidget.cxx
index 4ccbfa2..e6bed3a 100644
--- a/src/GipfelWidget.cxx
+++ b/src/GipfelWidget.cxx
@@ -197,7 +197,7 @@ GipfelWidget::load_data(const char *file) {
int
GipfelWidget::load_track(const char *file) {
if (track_points) {
- pan->remove_trackpoints();
+ pan->remove_hills(Hill::TRACK_POINT);
track_points->clobber();
delete track_points;
}
@@ -706,13 +706,26 @@ GipfelWidget::handle(int event) {
}
int
-GipfelWidget::export_hills(FILE *fp) {
- Hills *mnts;
+GipfelWidget::export_hills(const char *file, FILE *fp) {
+ Hills export_hills, *mnts;
if (!have_gipfel_info) {
+ fprintf(stderr, "No gipfel info available for %s.\n", img_file);
return 0;
}
+ if (file) {
+ if (export_hills.load(file) != 0) {
+ return 1;
+ }
+
+ for (int i=0; i<export_hills.get_num(); i++) {
+ export_hills.get(i)->flags |= Hill::EXPORT;
+ }
+
+ pan->add_hills(&export_hills);
+ }
+
fprintf(fp, "#\n# name\theight\tx\ty\tdistance\tflags\n#\n");
mnts = pan->get_visible_mountains();
@@ -722,6 +735,10 @@ GipfelWidget::export_hills(FILE *fp) {
int _x = (int) rint(m->x) + w() / 2;
int _y = (int) rint(m->y) + h() / 2;
+ if (file && !(m->flags & Hill::EXPORT)) {
+ continue;
+ }
+
if (_x < 0 || _x > w() || _y < 0 || _y > h()) {
continue;
}
@@ -736,6 +753,8 @@ GipfelWidget::export_hills(FILE *fp) {
(int) rint(pan->get_real_distance(m)), flags);
}
+ pan->remove_hills(Hill::EXPORT);
+
return 0;
}