diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/GipfelWidget.H | 4 | ||||
| -rw-r--r-- | src/GipfelWidget.cxx | 12 | ||||
| -rw-r--r-- | src/Panorama.H | 11 | ||||
| -rw-r--r-- | src/Panorama.cxx | 28 | ||||
| -rw-r--r-- | src/gipfel.cxx | 14 | 
5 files changed, 67 insertions, 2 deletions
diff --git a/src/GipfelWidget.H b/src/GipfelWidget.H index 54252b6..c1b2b86 100644 --- a/src/GipfelWidget.H +++ b/src/GipfelWidget.H @@ -96,6 +96,10 @@ class GipfelWidget : public Fl_Widget {    double get_view_long();    double get_view_height(); + +  Projection_t get_projection(); + +  void set_projection(Projection_t p);    int comp_params(); diff --git a/src/GipfelWidget.cxx b/src/GipfelWidget.cxx index 8af751b..318d387 100644 --- a/src/GipfelWidget.cxx +++ b/src/GipfelWidget.cxx @@ -474,6 +474,18 @@ GipfelWidget::set_scale(double s) {    redraw();  } +void +GipfelWidget::set_projection(Projection_t p) { +  pan->set_projection(p); +  set_labels(pan->get_visible_mountains()); +  redraw(); +} + +Projection_t +GipfelWidget::get_projection() { +  return pan->get_projection(); +} +  double  GipfelWidget::get_center_angle() {    return pan->get_center_angle(); diff --git a/src/Panorama.H b/src/Panorama.H index 12e62bf..fe8d41c 100644 --- a/src/Panorama.H +++ b/src/Panorama.H @@ -26,6 +26,12 @@  #include "Projection.H"  #include "ViewParams.H" + +typedef enum { +  PROJECTION_TANGENTIAL = 0, +  PROJECTION_SPHAERIC   = 1 +} Projection_t; +  class Panorama {   private:    double view_phi, view_lam, view_height; @@ -37,6 +43,7 @@ class Panorama {    Hills *visible_mountains;    ViewParams parms;    Projection *proj; +  Projection_t projection_type;    int get_pos(const char *name, double *phi, double *lam, double *height); @@ -124,5 +131,9 @@ class Panorama {    int comp_params(Hill *m1, Hill *m2);    int guess(Hills *p1, Hill *m1); + +  Projection_t get_projection(); + +  void set_projection(Projection_t p);  };  #endif diff --git a/src/Panorama.cxx b/src/Panorama.cxx index 59f70eb..e07d0a8 100644 --- a/src/Panorama.cxx +++ b/src/Panorama.cxx @@ -39,13 +39,12 @@ Panorama::Panorama() {    height_dist_ratio = 0.07;    pi_d = asin(1.0) * 2.0;    deg2rad = pi_d / 180.0; -  view_angle = pi_d / 2.0;    parms.a_center = 0.0;    parms.a_nick = 0.0;    parms.a_tilt = 0.0;    parms.scale = 3500.0;    view_name = NULL; -  proj = new ProjectionSphaeric(); +  set_projection(PROJECTION_TANGENTIAL);  }  Panorama::~Panorama() { @@ -268,6 +267,26 @@ Panorama::set_view_height(double v) {    update_angles();  } +void +Panorama::set_projection(Projection_t p) { +  projection_type = p; +    +  if (proj) { +    delete proj; +  } + +  switch(projection_type) { +    case PROJECTION_TANGENTIAL: +      proj = new ProjectionTangential(); +      view_angle = pi_d / 3.0; +      break; +    case PROJECTION_SPHAERIC: +      proj = new ProjectionSphaeric(); +      view_angle = pi_d / 2.0; +      break; +  } +} +  const char *  Panorama::get_viewpoint() {    return view_name; @@ -313,6 +332,11 @@ Panorama::get_view_height() {    return view_height;  } +Projection_t +Panorama::get_projection() { +  return projection_type; +} +  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 19fcdeb..07087e6 100644 --- a/src/gipfel.cxx +++ b/src/gipfel.cxx @@ -138,6 +138,16 @@ void view_height_cb(Fl_Value_Input* o, void*) {    }  } +void proj_cb(Fl_Value_Input* o, void*d) { +  if (gipf) { +    if(d == NULL) { +      gipf->set_projection(PROJECTION_TANGENTIAL); +    } else { +      gipf->set_projection(PROJECTION_SPHAERIC); +    } +  } +} +  void comp_cb(Fl_Widget *, void *) {    if (gipf) {      gipf->comp_params(); @@ -165,6 +175,10 @@ Fl_Menu_Item menuitems[] = {      { "Load &Track", FL_CTRL + 't', (Fl_Callback *)track_cb, 0 },      { "&Quit", FL_CTRL + 'q', (Fl_Callback *)quit_cb, 0 },    {0}, +  { "&Option",              0, 0, 0, FL_SUBMENU }, +    { "Normal Projection", 0, (Fl_Callback *)proj_cb, (void *)0, FL_MENU_RADIO|FL_MENU_VALUE}, +    { "Panoramic Projection", 0, (Fl_Callback *)proj_cb, (void *)1, FL_MENU_RADIO}, +  {0},    { "&Help", 0, 0, 0, FL_SUBMENU },      { "About",  0, (Fl_Callback *)about_cb },    { 0 },  | 
