From cb69ce80f60b07e152ca464c2c08eaeb3b159ec6 Mon Sep 17 00:00:00 2001 From: Johannes Hofmann Date: Wed, 13 Apr 2005 20:24:53 +0000 Subject: add h_d slider add h_d slider --- src/GipfelWidget.H | 4 +++- src/GipfelWidget.cxx | 8 +++++++- src/Panorama.cxx | 14 +++++++++++--- src/gipfel.cxx | 22 ++++++++++++++++++---- 4 files changed, 39 insertions(+), 9 deletions(-) (limited to 'src') diff --git a/src/GipfelWidget.H b/src/GipfelWidget.H index 4d1f0fe..316fbca 100644 --- a/src/GipfelWidget.H +++ b/src/GipfelWidget.H @@ -1,5 +1,5 @@ // -// "$Id: GipfelWidget.H,v 1.4 2005/04/13 21:58:31 hofmann Exp $" +// "$Id: GipfelWidget.H,v 1.5 2005/04/13 22:24:53 hofmann Exp $" // // X11 header file for the Fast Light Tool Kit (FLTK). // @@ -51,6 +51,8 @@ class GipfelWidget : public Fl_Widget { void set_center_angle(double a); void set_scale(double s); + + void set_height_dist_ratio(double r); void draw(); }; diff --git a/src/GipfelWidget.cxx b/src/GipfelWidget.cxx index 03267aa..b586240 100644 --- a/src/GipfelWidget.cxx +++ b/src/GipfelWidget.cxx @@ -1,5 +1,5 @@ // -// "$Id: GipfelWidget.cxx,v 1.4 2005/04/13 21:58:31 hofmann Exp $" +// "$Id: GipfelWidget.cxx,v 1.5 2005/04/13 22:24:53 hofmann Exp $" // // PSEditWidget routines. // @@ -148,6 +148,12 @@ GipfelWidget::set_scale(double s) { redraw(); } +void +GipfelWidget::set_height_dist_ratio(double r) { + pan->set_height_dist_ratio(r); + redraw(); +} + int GipfelWidget::handle(int event) { int mark_x, mark_y; diff --git a/src/Panorama.cxx b/src/Panorama.cxx index 7236d3e..995b5ec 100644 --- a/src/Panorama.cxx +++ b/src/Panorama.cxx @@ -1,5 +1,5 @@ // -// "$Id: Panorama.cxx,v 1.3 2005/04/13 21:58:31 hofmann Exp $" +// "$Id: Panorama.cxx,v 1.4 2005/04/13 22:24:53 hofmann Exp $" // // PSEditWidget routines. // @@ -33,7 +33,7 @@ Panorama::Panorama() { visible_mountains = NULL; m1 = NULL; m2 = NULL; - height_dist_ratio = 0.10; + height_dist_ratio = 0.07; pi = asin(1.0) * 2.0; deg2rad = pi / 180.0; a_center = 0.2*pi; @@ -140,13 +140,21 @@ Panorama::move_mountain(Mountain *m, int x, int y) { void Panorama::set_center_angle(double a) { a_center = a; - fprintf(stderr, "--> %f\n", a); + fprintf(stderr, "--> angle%f\n", a); update_visible_mountains(); } void Panorama::set_scale(double s) { scale = s; + fprintf(stderr, "-->scale %f\n", s); + update_visible_mountains(); +} + +void +Panorama::set_height_dist_ratio(double r) { + height_dist_ratio = r; + fprintf(stderr, "-->ratio %f\n", r); update_visible_mountains(); } diff --git a/src/gipfel.cxx b/src/gipfel.cxx index 3705986..14c618c 100644 --- a/src/gipfel.cxx +++ b/src/gipfel.cxx @@ -1,5 +1,5 @@ // -// "$Id: gipfel.cxx,v 1.5 2005/04/13 21:58:31 hofmann Exp $" +// "$Id: gipfel.cxx,v 1.6 2005/04/13 22:24:53 hofmann Exp $" // // flpsed program. // @@ -66,6 +66,12 @@ void angle_cb(Fl_Slider* o, void*) { } } +void h_d_cb(Fl_Slider* o, void*) { + if (gipf) { + gipf->set_height_dist_ratio((double)(o->value())); + } +} + void about_cb() { fl_message("flpsed -- a pseudo PostScript editor\n" "(c) Johannes Hofmann 2004, 2005\n\n" @@ -141,17 +147,25 @@ int main(int argc, char** argv) { s->box(FL_THIN_DOWN_BOX); s->labelsize(10); s->step(10.0); - s->bounds(0.0, 800.0); + s->bounds(0.0, 2000.0); s->slider(FL_UP_BOX); s->callback((Fl_Callback*)scale_cb); Fl_Slider* a = new Fl_Slider(160, 30, 160, 15, "angle"); a->type(1); a->box(FL_THIN_DOWN_BOX); a->labelsize(10); - a->step(0.01); - a->bounds(-4.0, 4.0); + a->step(0.0001); + a->bounds(-6.4, 6.4); a->slider(FL_UP_BOX); a->callback((Fl_Callback*)angle_cb); + Fl_Slider* r = new Fl_Slider(320, 30, 160, 15, "height-dist"); + r->type(1); + r->box(FL_THIN_DOWN_BOX); + r->labelsize(10); + r->step(-0.005); + r->bounds(0.2, 0.02); + r->slider(FL_UP_BOX); + r->callback((Fl_Callback*)h_d_cb); scroll = new Fl_Scroll(0, 60, win->w(), win->h()-60); -- cgit v1.2.3