diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/GipfelWidget.cxx | 26 | ||||
-rw-r--r-- | src/ImageMetaData.H | 3 | ||||
-rw-r--r-- | src/ImageMetaData.cxx | 11 |
3 files changed, 19 insertions, 21 deletions
diff --git a/src/GipfelWidget.cxx b/src/GipfelWidget.cxx index 2efd231..a1982d5 100644 --- a/src/GipfelWidget.cxx +++ b/src/GipfelWidget.cxx @@ -104,23 +104,17 @@ GipfelWidget::load_image(char *file) { mb->box(FL_NO_BOX); mb->add("Center Peak", 0, (Fl_Callback*) center_cb, this); - // try to retrieve gipfel data from JPEG comment section + // try to retrieve gipfel data from JPEG meta data md = new ImageMetaData(); - ret = md->load_image(file); - if (ret != 1) { - set_view_long(md->get_longitude()); - set_view_lat(md->get_latitude()); - set_view_height(md->get_height()); - set_center_angle(md->get_direction()); - set_nick_angle(md->get_nick()); - set_tilt_angle(md->get_tilt()); - set_projection((Projection::Projection_t) md->get_projection_type()); - if (ret == 2) { // special compatibility return code for old format - set_scale(md->get_focallength_sensor_ratio()); - } else { - set_scale(md->get_focallength_sensor_ratio() * img->w()); - } - } + md->load_image(file, img->w()); + set_view_long(md->get_longitude()); + set_view_lat(md->get_latitude()); + set_view_height(md->get_height()); + set_center_angle(md->get_direction()); + set_nick_angle(md->get_nick()); + set_tilt_angle(md->get_tilt()); + set_projection((Projection::Projection_t) md->get_projection_type()); + set_scale(md->get_focallength_sensor_ratio() * img->w()); delete md; diff --git a/src/ImageMetaData.H b/src/ImageMetaData.H index 442aaef..7116d98 100644 --- a/src/ImageMetaData.H +++ b/src/ImageMetaData.H @@ -29,6 +29,7 @@ class ImageMetaData { double nick; double tilt; double focallength_sensor_ratio; + double scale; int projection_type; int load_image_jpgcom(char *name); @@ -38,7 +39,7 @@ class ImageMetaData { public: ImageMetaData(); - int load_image(char *name); + int load_image(char *name, int img_width); int save_image(char *in_img, char *out_img); double get_longitude(); diff --git a/src/ImageMetaData.cxx b/src/ImageMetaData.cxx index 424a792..d78493d 100644 --- a/src/ImageMetaData.cxx +++ b/src/ImageMetaData.cxx @@ -38,16 +38,19 @@ ImageMetaData::ImageMetaData() { nick = 0.0; tilt = 0.0; focallength_sensor_ratio = 1.0; - projection_type = 1; + scale = NAN; + projection_type = 0; } int -ImageMetaData::load_image(char *name) { +ImageMetaData::load_image(char *name, int img_width) { int ret; ret = load_image_jpgcom(name); - if (ret != 0) { + if (ret == 2) { // old format + focallength_sensor_ratio = scale / (double) img_width; + } else if (ret == 1) { // get reasonable defaults from exif data ret = load_image_exif(name); } @@ -179,7 +182,7 @@ ImageMetaData::load_image_jpgcom(char *name) { direction = dir; nick = ni; tilt = ti; - focallength_sensor_ratio = fr; + scale = fr; projection_type = pt; ret = 2; // special return value for compatibility with |