summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJohannes Hofmann <johannes.hofmann@gmx.de>2005-05-20 11:34:39 +0000
committerJohannes Hofmann <johannes.hofmann@gmx.de>2005-05-20 11:34:39 +0000
commitf680b80a513c991f9afdb6c96566cfbb22a7f208 (patch)
treee466d7f7b8f06872dec5ef420c577b5b75d2d65b /src
parentb957c92f76e834f7727c2bcf259566cbd78b8002 (diff)
add viewpoint name to control window
add viewpoint name to control window
Diffstat (limited to 'src')
-rw-r--r--src/GipfelWidget.H20
-rw-r--r--src/GipfelWidget.cxx43
-rw-r--r--src/Panorama.H17
-rw-r--r--src/Panorama.cxx48
-rw-r--r--src/gipfel.cxx73
5 files changed, 183 insertions, 18 deletions
diff --git a/src/GipfelWidget.H b/src/GipfelWidget.H
index 3058b68..a0459a6 100644
--- a/src/GipfelWidget.H
+++ b/src/GipfelWidget.H
@@ -1,5 +1,5 @@
//
-// "$Id: GipfelWidget.H,v 1.20 2005/05/10 17:57:11 hofmann Exp $"
+// "$Id: GipfelWidget.H,v 1.21 2005/05/20 13:34:39 hofmann Exp $"
//
// Copyright 2005 by Johannes Hofmann
//
@@ -61,6 +61,16 @@ class GipfelWidget : public Fl_Widget {
void set_scale(double s);
+ void set_height_dist_ratio(double r);
+
+ void set_view_lat(double v);
+
+ void set_view_long(double v);
+
+ void set_view_height(double v);
+
+ const char * get_viewpoint();
+
double get_center_angle();
double get_nick_angle();
@@ -70,8 +80,12 @@ class GipfelWidget : public Fl_Widget {
double get_scale();
double get_height_dist_ratio();
-
- void set_height_dist_ratio(double r);
+
+ double get_view_lat();
+
+ double get_view_long();
+
+ double get_view_height();
int comp_params();
diff --git a/src/GipfelWidget.cxx b/src/GipfelWidget.cxx
index c291685..85669b1 100644
--- a/src/GipfelWidget.cxx
+++ b/src/GipfelWidget.cxx
@@ -1,5 +1,5 @@
//
-// "$Id: GipfelWidget.cxx,v 1.31 2005/05/17 09:20:38 hofmann Exp $"
+// "$Id: GipfelWidget.cxx,v 1.32 2005/05/20 13:34:39 hofmann Exp $"
//
// GipfelWidget routines.
//
@@ -317,6 +317,26 @@ GipfelWidget::get_height_dist_ratio() {
return pan->get_height_dist_ratio();
}
+const char *
+GipfelWidget::get_viewpoint() {
+ return pan->get_viewpoint();
+}
+
+double
+GipfelWidget::get_view_lat() {
+ return pan->get_view_lat();
+}
+
+double
+GipfelWidget::get_view_long() {
+ return pan->get_view_long();
+}
+
+double
+GipfelWidget::get_view_height() {
+ return pan->get_view_height();
+}
+
void
GipfelWidget::set_height_dist_ratio(double r) {
pan->set_height_dist_ratio(r);
@@ -324,6 +344,27 @@ GipfelWidget::set_height_dist_ratio(double r) {
redraw();
}
+void
+GipfelWidget::set_view_lat(double v) {
+ pan->set_view_lat(v);
+ set_labels(pan->get_visible_mountains());
+ redraw();
+}
+
+void
+GipfelWidget::set_view_long(double v) {
+ pan->set_view_long(v);
+ set_labels(pan->get_visible_mountains());
+ redraw();
+}
+
+void
+GipfelWidget::set_view_height(double v) {
+ pan->set_view_height(v);
+ set_labels(pan->get_visible_mountains());
+ redraw();
+}
+
int
GipfelWidget::comp_params() {
if (m1 == NULL || m2 == NULL) {
diff --git a/src/Panorama.H b/src/Panorama.H
index 66a9a3f..15e51cb 100644
--- a/src/Panorama.H
+++ b/src/Panorama.H
@@ -1,5 +1,5 @@
//
-// "$Id: Panorama.H,v 1.18 2005/05/10 17:57:11 hofmann Exp $"
+// "$Id: Panorama.H,v 1.19 2005/05/20 13:34:39 hofmann Exp $"
//
// Copyright 2005 by Johannes Hofmann
//
@@ -27,6 +27,7 @@
class Panorama {
private:
double view_phi, view_lam, view_height;
+ char *view_name;
double height_dist_ratio;
Hills *mountains;
Hills *visible_mountains;
@@ -85,6 +86,14 @@ class Panorama {
void set_scale(double s);
+ void set_view_lat(double v);
+
+ void set_view_long(double v);
+
+ void set_view_height(double v);
+
+ const char * get_viewpoint();
+
double get_center_angle();
double get_nick_angle();
@@ -94,6 +103,12 @@ class Panorama {
double get_scale();
double get_height_dist_ratio();
+
+ double get_view_lat();
+
+ double get_view_long();
+
+ double get_view_height();
int comp_params(Hill *m1, Hill *m2);
diff --git a/src/Panorama.cxx b/src/Panorama.cxx
index 7321c3a..7e1ccff 100644
--- a/src/Panorama.cxx
+++ b/src/Panorama.cxx
@@ -1,5 +1,5 @@
//
-// "$Id: Panorama.cxx,v 1.42 2005/05/10 18:45:29 hofmann Exp $"
+// "$Id: Panorama.cxx,v 1.43 2005/05/20 13:34:39 hofmann Exp $"
//
// Panorama routines.
//
@@ -60,6 +60,7 @@ Panorama::Panorama() {
a_nick = 0.0;
a_tilt = 0.0;
scale = 3500.0;
+ view_name = NULL;
}
Panorama::~Panorama() {
@@ -91,6 +92,13 @@ Panorama::set_viewpoint(const char *name) {
return 1;
}
+ if (view_name) {
+ free(view_name);
+ view_name = NULL;
+ }
+
+ view_name = strdup(name);
+
update_angles();
return 0;
@@ -330,6 +338,29 @@ Panorama::set_height_dist_ratio(double r) {
update_visible_mountains();
}
+void
+Panorama::set_view_lat(double v) {
+ view_lam = v * deg2rad;
+ update_angles();
+}
+
+void
+Panorama::set_view_long(double v) {
+ view_phi = v * deg2rad;
+ update_angles();
+}
+
+void
+Panorama::set_view_height(double v) {
+ view_height = v;
+ update_angles();
+}
+
+const char *
+Panorama::get_viewpoint() {
+ return view_name;
+}
+
double
Panorama::get_center_angle() {
return a_center / deg2rad;
@@ -355,6 +386,21 @@ Panorama::get_height_dist_ratio() {
return height_dist_ratio;
}
+double
+Panorama::get_view_lat() {
+ return view_lam / deg2rad;
+}
+
+double
+Panorama::get_view_long() {
+ return view_phi / deg2rad;
+}
+
+double
+Panorama::get_view_height() {
+ return view_height;
+}
+
int
Panorama::get_pos(const char *name, double *phi, double *lam, double *height) {
int i;
diff --git a/src/gipfel.cxx b/src/gipfel.cxx
index db1e863..e21f5f0 100644
--- a/src/gipfel.cxx
+++ b/src/gipfel.cxx
@@ -1,5 +1,5 @@
//
-// "$Id: gipfel.cxx,v 1.25 2005/05/18 11:34:30 hofmann Exp $"
+// "$Id: gipfel.cxx,v 1.26 2005/05/20 13:34:39 hofmann Exp $"
//
// gipfel program.
//
@@ -44,6 +44,7 @@
#include <FL/Fl_Menu_Item.H>
#include <FL/Fl_Valuator.H>
#include <FL/Fl_Value_Slider.H>
+#include <FL/Fl_Value_Input.H>
#include "Fl_Value_Dial.H"
#include "GipfelWidget.H"
@@ -53,13 +54,19 @@ char *data_file;
GipfelWidget *gipf = NULL;
Fl_Dial *s_center = NULL;
Fl_Slider *s_nick = NULL, *s_scale = NULL, *s_tilt = NULL, *s_height_dist;
+Fl_Value_Input *i_view_lat, *i_view_long, *i_view_height;
+Fl_Box *b_viewpoint;
-void set_valuators() {
+void set_values() {
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());
+ i_view_lat->value(gipf->get_view_lat());
+ i_view_long->value(gipf->get_view_long());
+ i_view_height->value(gipf->get_view_height());
+ b_viewpoint->label(gipf->get_viewpoint());
}
void quit_cb() {
@@ -75,45 +82,63 @@ void open_cb() {
void scale_cb(Fl_Slider* o, void*) {
if (gipf) {
- gipf->set_scale((double)(o->value()));
+ gipf->set_scale(o->value());
}
}
void angle_cb(Fl_Slider* o, void*) {
if (gipf) {
- gipf->set_center_angle((double)(o->value()));
+ gipf->set_center_angle(o->value());
}
}
void nick_cb(Fl_Slider* o, void*) {
if (gipf) {
- gipf->set_nick_angle((double)(o->value()));
+ gipf->set_nick_angle(o->value());
}
}
void tilt_cb(Fl_Slider* o, void*) {
if (gipf) {
- gipf->set_tilt_angle((double)(o->value()));
+ gipf->set_tilt_angle(o->value());
}
}
void h_d_cb(Fl_Slider* o, void*) {
if (gipf) {
- gipf->set_height_dist_ratio((double)(o->value()));
+ gipf->set_height_dist_ratio(o->value());
+ }
+}
+
+void view_lat_cb(Fl_Value_Input* o, void*) {
+ if (gipf) {
+ gipf->set_view_lat(o->value());
+ }
+}
+
+void view_long_cb(Fl_Value_Input* o, void*) {
+ if (gipf) {
+ gipf->set_view_long(o->value());
+ }
+}
+
+void view_height_cb(Fl_Value_Input* o, void*) {
+ if (gipf) {
+ gipf->set_view_height(o->value());
}
}
void comp_cb(Fl_Widget *, void *) {
if (gipf) {
gipf->comp_params();
- set_valuators();
+ set_values();
}
}
void guess_cb(Fl_Widget *, void *) {
if (gipf) {
gipf->guess();
- set_valuators();
+ set_values();
}
}
@@ -147,7 +172,7 @@ void usage() {
Fl_Window *
create_control_window() {
Fl_Menu_Bar *m;
- Fl_Window *win = new Fl_Window(400,250);
+ Fl_Window *win = new Fl_Window(400,350);
m = new Fl_Menu_Bar(0, 0, 400, 30);
m->menu(menuitems);
@@ -199,12 +224,36 @@ create_control_window() {
s_height_dist->type(1);
s_height_dist->box(FL_THIN_DOWN_BOX);
s_height_dist->labelsize(10);
- s_height_dist->step(-0.002);
+ s_height_dist->step(-0.001);
s_height_dist->bounds(0.2, 0.01);
s_height_dist->slider(FL_UP_BOX);
s_height_dist->callback((Fl_Callback*)h_d_cb);
s_height_dist->align(FL_ALIGN_TOP);
+ // Viewpoint Stuff
+
+ b_viewpoint = new Fl_Box(FL_DOWN_BOX, 30, 255, 300, 80, "");
+ b_viewpoint->align(FL_ALIGN_TOP);
+
+ i_view_lat = new Fl_Value_Input(40, 270, 100, 20, "Latitude");
+ i_view_lat->labelsize(10);
+ i_view_lat->align(FL_ALIGN_TOP);
+ i_view_lat->when(FL_WHEN_ENTER_KEY);
+ i_view_lat->callback((Fl_Callback*)view_lat_cb);
+
+ i_view_long = new Fl_Value_Input(200, 270, 100, 20, "Longitude");
+ i_view_long->labelsize(10);
+ i_view_long->align(FL_ALIGN_TOP);
+ i_view_long->when(FL_WHEN_ENTER_KEY);
+ i_view_long->callback((Fl_Callback*)view_long_cb);
+
+ i_view_height = new Fl_Value_Input(40, 310, 80, 20, "Height");
+ i_view_height->labelsize(10);
+ i_view_height->align(FL_ALIGN_TOP);
+ i_view_height->when(FL_WHEN_ENTER_KEY);
+ i_view_height->callback((Fl_Callback*)view_height_cb);
+
+ // Buttons
Fl_Button *b = new Fl_Button(240, 180, 50, 15, "comp");
b->color(FL_RED);
b->callback(comp_cb);
@@ -270,7 +319,7 @@ int main(int argc, char** argv) {
}
scroll->end();
- set_valuators();
+ set_values();
view_win->resizable(scroll);