summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/GipfelWidget.H4
-rw-r--r--src/GipfelWidget.cxx8
-rw-r--r--src/Panorama.H4
-rw-r--r--src/Panorama.cxx19
-rw-r--r--src/gipfel.cxx49
5 files changed, 45 insertions, 39 deletions
diff --git a/src/GipfelWidget.H b/src/GipfelWidget.H
index 329e5f4..3058b68 100644
--- a/src/GipfelWidget.H
+++ b/src/GipfelWidget.H
@@ -1,5 +1,5 @@
//
-// "$Id: GipfelWidget.H,v 1.19 2005/05/10 17:05:32 hofmann Exp $"
+// "$Id: GipfelWidget.H,v 1.20 2005/05/10 17:57:11 hofmann Exp $"
//
// Copyright 2005 by Johannes Hofmann
//
@@ -68,6 +68,8 @@ class GipfelWidget : public Fl_Widget {
double get_tilt_angle();
double get_scale();
+
+ double get_height_dist_ratio();
void set_height_dist_ratio(double r);
diff --git a/src/GipfelWidget.cxx b/src/GipfelWidget.cxx
index 69e3198..527491b 100644
--- a/src/GipfelWidget.cxx
+++ b/src/GipfelWidget.cxx
@@ -1,5 +1,5 @@
//
-// "$Id: GipfelWidget.cxx,v 1.27 2005/05/10 17:05:32 hofmann Exp $"
+// "$Id: GipfelWidget.cxx,v 1.28 2005/05/10 17:57:11 hofmann Exp $"
//
// GipfelWidget routines.
//
@@ -299,6 +299,11 @@ GipfelWidget::get_scale() {
return pan->get_scale();
}
+double
+GipfelWidget::get_height_dist_ratio() {
+ return pan->get_height_dist_ratio();
+}
+
void
GipfelWidget::set_height_dist_ratio(double r) {
pan->set_height_dist_ratio(r);
@@ -349,7 +354,6 @@ GipfelWidget::handle(int event) {
mark_x = Fl::event_x()-x();
mark_y = Fl::event_y()-y();
- fprintf(stderr, "x %d, y %d\n", mark_x, mark_y);
set_cur_mountain(mark_x, mark_y);
Fl::focus(this);
diff --git a/src/Panorama.H b/src/Panorama.H
index 5ee1698..66a9a3f 100644
--- a/src/Panorama.H
+++ b/src/Panorama.H
@@ -1,5 +1,5 @@
//
-// "$Id: Panorama.H,v 1.17 2005/05/10 17:05:32 hofmann Exp $"
+// "$Id: Panorama.H,v 1.18 2005/05/10 17:57:11 hofmann Exp $"
//
// Copyright 2005 by Johannes Hofmann
//
@@ -93,6 +93,8 @@ class Panorama {
double get_scale();
+ double get_height_dist_ratio();
+
int comp_params(Hill *m1, Hill *m2);
int guess(Hills *p1, Hill *m1);
diff --git a/src/Panorama.cxx b/src/Panorama.cxx
index a9ab97b..f100a95 100644
--- a/src/Panorama.cxx
+++ b/src/Panorama.cxx
@@ -1,5 +1,5 @@
//
-// "$Id: Panorama.cxx,v 1.38 2005/05/10 17:16:54 hofmann Exp $"
+// "$Id: Panorama.cxx,v 1.39 2005/05/10 17:57:11 hofmann Exp $"
//
// Panorama routines.
//
@@ -59,7 +59,7 @@ Panorama::Panorama() {
a_center = 0.0;
a_nick = 0.0;
a_tilt = 0.0;
- scale = 500.0;
+ scale = 3500.0;
}
Panorama::~Panorama() {
@@ -178,8 +178,6 @@ Panorama::guess(Hills *p, Hill *m1) {
a_nick_best = a_nick;
a_tilt_best = a_tilt;
scale_best = scale;
-
- fprintf(stderr, "best %f\n", best);
}
}
}
@@ -190,7 +188,6 @@ Panorama::guess(Hills *p, Hill *m1) {
a_tilt = a_tilt_best;
scale = scale_best;
fprintf(stderr, "best %f\n", best);
- fprintf(stderr, "center = %f, scale = %f, nick=%f\n", a_center /deg2rad, scale, a_nick/deg2rad);
} else {
fprintf(stderr, "No solution found.\n");
}
@@ -354,6 +351,11 @@ Panorama::get_scale() {
return scale;
}
+double
+Panorama::get_height_dist_ratio() {
+ return height_dist_ratio;
+}
+
int
Panorama::get_pos(const char *name, double *phi, double *lam, double *height) {
int i;
@@ -539,10 +541,6 @@ Panorama::nick(double dist, double height) {
-//
-//
-//
-
static int
get_matrix(double m[],
double tan_nick_view, double tan_dir_view, double n_scale,
@@ -593,9 +591,6 @@ static int opt_step(double *tan_nick_view,
f_x0[2] = d_m1_m2_2 - (pow((- (((*tan_dir_view - tan_dir_m1) * *n_scale) / (tan_dir_m1 * *tan_dir_view + 1.0)) + (((*tan_dir_view - tan_dir_m2) * *n_scale) / (tan_dir_m2 * *tan_dir_view + 1))), 2.0) + pow((- (((*tan_nick_view - tan_nick_m1) * *n_scale) / (tan_nick_m1 * *tan_nick_view + 1)) + ((*tan_nick_view - tan_nick_m2) * *n_scale) / (tan_nick_m2 * *tan_nick_view + 1)), 2.0));
- // fprintf(stderr, "f_x0[0] %f, f_x0[1] %f, f_x0[2] %f\n",
- // f_x0[0], f_x0[1], f_x0[2]);
-
x0[0] = *tan_nick_view;
x0[1] = *tan_dir_view;
x0[2] = *n_scale;
diff --git a/src/gipfel.cxx b/src/gipfel.cxx
index e78d5ff..8c05d07 100644
--- a/src/gipfel.cxx
+++ b/src/gipfel.cxx
@@ -1,5 +1,5 @@
//
-// "$Id: gipfel.cxx,v 1.22 2005/05/10 17:05:32 hofmann Exp $"
+// "$Id: gipfel.cxx,v 1.23 2005/05/10 17:57:11 hofmann Exp $"
//
// gipfel program.
//
@@ -32,6 +32,8 @@
#include <errno.h>
#include <signal.h>
+#include "../config.h"
+
#include <FL/Fl.H>
#include <FL/Fl_Window.H>
#include <FL/Fl_Scroll.H>
@@ -49,7 +51,15 @@ char *img_file;
char *data_file;
GipfelWidget *gipf = NULL;
Fl_Dial *s_center = NULL;
-Fl_Slider *s_nick = NULL, *s_scale = NULL, *s_tilt = NULL;
+Fl_Slider *s_nick = NULL, *s_scale = NULL, *s_tilt = NULL, *s_height_dist;
+
+void set_valuators() {
+ s_center->value(gipf->get_center_angle());
+ s_nick->value(gipf->get_nick_angle());
+ s_scale->value(gipf->get_scale());
+ s_tilt->value(gipf->get_tilt_angle());
+ s_height_dist->value(gipf->get_height_dist_ratio());
+}
void quit_cb() {
exit(0);
@@ -95,27 +105,21 @@ void h_d_cb(Fl_Slider* o, void*) {
void comp_cb(Fl_Widget *, void *) {
if (gipf) {
gipf->comp_params();
- fprintf(stderr, " == cent %f\n", gipf->get_center_angle());
- s_center->value(gipf->get_center_angle());
- s_nick->value(gipf->get_nick_angle());
- s_scale->value(gipf->get_scale());
- s_tilt->value(gipf->get_tilt_angle());
+ set_valuators();
}
}
void guess_cb(Fl_Widget *, void *) {
if (gipf) {
gipf->guess();
- s_center->value(gipf->get_center_angle());
- s_nick->value(gipf->get_nick_angle());
- s_scale->value(gipf->get_scale());
- s_tilt->value(gipf->get_tilt_angle());
+ set_valuators();
}
}
void about_cb() {
fl_message("gipfel -- and you know what you see.\n"
- "(c) Johannes Hofmann 2005\n");
+ "Version %s\n\n"
+ "(c) Johannes Hofmann 2005\n", VERSION);
}
@@ -131,11 +135,11 @@ Fl_Menu_Item menuitems[] = {
void usage() {
fprintf(stderr,
- "usage: gipfel -v <viewpoint> [-d <datafile>] <image>\n"
+ "usage: gipfel -v <viewpoint> -d <datafile> <image>\n"
" -v <viewpoint> Set point from which the picture was taken.\n"
" This must be a string that unambiguously \n"
" matches the name of an entry in the data file.\n"
- " -d <datafile> Use <datafile> instead of default file.\n"
+ " -d <datafile> Use <datafile> for GPS data.\n"
" <image> JPEG file to use.\n");
}
@@ -190,7 +194,7 @@ create_control_window() {
s_tilt->callback((Fl_Callback*)tilt_cb);
s_tilt->align(FL_ALIGN_TOP);
- Fl_Slider* s_height_dist = new Fl_Slider(235, 150, 160, 15, "Visibility");
+ s_height_dist = new Fl_Slider(235, 150, 160, 15, "Visibility");
s_height_dist->type(1);
s_height_dist->box(FL_THIN_DOWN_BOX);
s_height_dist->labelsize(10);
@@ -237,10 +241,6 @@ int main(int argc, char** argv) {
}
}
- if (err) {
- usage();
- exit(1);
- }
my_argc = argc - optind;
my_argv = argv + optind;
@@ -249,6 +249,12 @@ int main(int argc, char** argv) {
img_file = my_argv[0];
}
+ if (data_file == NULL || view_point == NULL || img_file == NULL || err) {
+ usage();
+ exit(1);
+ }
+
+
control_win = create_control_window();
view_win = new Fl_Window(700, 500);
@@ -263,10 +269,7 @@ int main(int argc, char** argv) {
}
scroll->end();
- s_center->value(gipf->get_center_angle());
- s_nick->value(gipf->get_nick_angle());
- s_scale->value(gipf->get_scale());
- s_tilt->value(gipf->get_tilt_angle());
+ set_valuators();
view_win->resizable(scroll);