summaryrefslogtreecommitdiff
path: root/src/GipfelWidget.cxx
diff options
context:
space:
mode:
authorJohannes Hofmann <Johannes.Hofmann@gmx.de>2007-08-09 19:22:23 +0200
committerJohannes Hofmann <Johannes.Hofmann@gmx.de>2007-08-09 19:22:23 +0200
commite235adf3601bd36605ed3510b55e63d8606cbbe0 (patch)
tree35c62163b2a0c8751d3741586f2c0bd096e94df8 /src/GipfelWidget.cxx
parent22968b805a4b7abbbf24f5e6e6e6ec68eef5d5a0 (diff)
implement export
Diffstat (limited to 'src/GipfelWidget.cxx')
-rw-r--r--src/GipfelWidget.cxx33
1 files changed, 33 insertions, 0 deletions
diff --git a/src/GipfelWidget.cxx b/src/GipfelWidget.cxx
index f9b5d21..b3e9697 100644
--- a/src/GipfelWidget.cxx
+++ b/src/GipfelWidget.cxx
@@ -675,6 +675,39 @@ GipfelWidget::handle(int event) {
}
int
+GipfelWidget::export_hills(const char *file) {
+ FILE *fp;
+ Hills *mnts;
+ Hill *m;
+
+ fp = fopen(file, "wb");
+
+ if (fp == NULL) {
+ perror("fopen");
+ return 1;
+ }
+
+ fprintf(fp, "#\n# name\theight\tx\ty\tdistance\n#\n");
+
+ mnts = pan->get_visible_mountains();
+ for (int i=0; i<mnts->get_num(); i++) {
+ m = mnts->get(i);
+
+ if (m->x < 0 || m->x > w() || m->y < 0 || m->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)));
+ }
+
+ fclose(fp);
+ return 0;
+}
+
+int
GipfelWidget::get_pixel(GipfelWidget::sample_mode_t m,
double a_alph, double a_nick, int *r, int *g, int *b) {
double px, py;