diff options
author | Johannes Hofmann <Johannes.Hofmann@gmx.de> | 2009-03-24 16:30:54 +0100 |
---|---|---|
committer | Johannes Hofmann <Johannes.Hofmann@gmx.de> | 2009-03-24 16:30:54 +0100 |
commit | a7f8f3cee4c36590ff5e7ddc775fc1bfd4d03223 (patch) | |
tree | eee3c38b97c5f34ab0b022e7839d29b6a7c07050 | |
parent | 00e5b9f797c131855f46aff3abdb96b37ec0bf85 (diff) | |
parent | 46a3d8b7197e237c2319021be3ace244233e08a0 (diff) |
merge
-rw-r--r-- | src/GipfelWidget.H | 4 | ||||
-rw-r--r-- | src/GipfelWidget.cxx | 20 |
2 files changed, 24 insertions, 0 deletions
diff --git a/src/GipfelWidget.H b/src/GipfelWidget.H index 777e1d5..f8e242e 100644 --- a/src/GipfelWidget.H +++ b/src/GipfelWidget.H @@ -8,6 +8,7 @@ #define GipfelWidget_H #include <FL/Fl_Group.H> +#include <FL/Fl_Menu_Button.H> #include "Panorama.H" #include "ImageMetaData.H" @@ -18,6 +19,7 @@ class GipfelWidget : public Fl_Group { Hills *track_points; Hills *known_hills; Panorama *pan; + Fl_Menu_Button *mb; char *img_file; double track_width; int have_gipfel_info; @@ -46,6 +48,8 @@ class GipfelWidget : public Fl_Group { static int get_pixel(Fl_Image *img, int x, int y, int *r, int *g, int *b); + static void center_cb(Fl_Widget *o, void *f); + public: typedef enum { NEAREST = 0, diff --git a/src/GipfelWidget.cxx b/src/GipfelWidget.cxx index c851e65..b895ecb 100644 --- a/src/GipfelWidget.cxx +++ b/src/GipfelWidget.cxx @@ -18,6 +18,7 @@ #include <algorithm> #include <FL/Fl.H> +#include <FL/Fl_Menu_Item.H> #include <FL/Fl_Shared_Image.H> #include <FL/Fl_JPEG_Image.H> #include <FL/Fl_Preferences.H> @@ -39,6 +40,7 @@ GipfelWidget::GipfelWidget(int X,int Y,int W, int H): Fl_Group(X, Y, W, H) { pan = new Panorama(); cur_mountain = NULL; focused_mountain = NULL; + mb = NULL; known_hills = new Hills(); img_file = NULL; track_width = 200.0; @@ -74,6 +76,11 @@ GipfelWidget::load_image(char *file) { h(img->h()); w(img->w()); + mb = new Fl_Menu_Button(x(),y(),w()+x(),h()+y(),"&popup"); + mb->type(Fl_Menu_Button::POPUP3); + mb->box(FL_NO_BOX); + mb->add("Center Peak", 0, (Fl_Callback*) center_cb, this); + // try to retrieve gipfel data from JPEG meta data md->load_image(file); set_view_long(md->longitude()); @@ -508,6 +515,19 @@ GipfelWidget::get_focal_length_35mm() { return pan->get_scale() * 35.0 / (double) img->w(); } +void +GipfelWidget::center_cb(Fl_Widget *o, void *f) { + GipfelWidget *g = (GipfelWidget*) f; + + Hill *m = choose_hill(g->pan->get_close_mountains(), "Center Peak"); + if (m) { + g->set_center_angle(m->alph / deg2rad); + + if (!g->known_hills->contains(m)) + g->known_hills->add(m); + } +} + void GipfelWidget::set_height_dist_ratio(double r) { pan->set_height_dist_ratio(r); |