summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJohannes Hofmann <Johannes.Hofmann@gmx.de>2007-08-11 13:52:37 +0200
committerJohannes Hofmann <Johannes.Hofmann@gmx.de>2007-08-11 13:52:37 +0200
commit8a8a51d736074cfa9dbd8a7f46842933d558a46f (patch)
tree48f82985c4185010bd1c1d251e939e9eaa710c35 /src
parentc712d598ea39dc4f90a733dc06c44617eb30bcbb (diff)
fill in default values in GipfelWidget instead of ImageMetaData
Diffstat (limited to 'src')
-rw-r--r--src/GipfelWidget.H1
-rw-r--r--src/GipfelWidget.cxx43
-rw-r--r--src/ImageMetaData.H1
-rw-r--r--src/ImageMetaData.cxx12
4 files changed, 43 insertions, 14 deletions
diff --git a/src/GipfelWidget.H b/src/GipfelWidget.H
index 3dc8503..274ce33 100644
--- a/src/GipfelWidget.H
+++ b/src/GipfelWidget.H
@@ -22,6 +22,7 @@ class GipfelWidget : public Fl_Widget {
Fl_Menu_Button *mb;
char *img_file;
double track_width;
+ int have_gipfel_info;
ImageMetaData *md;
int show_hidden;
diff --git a/src/GipfelWidget.cxx b/src/GipfelWidget.cxx
index 15a3cc6..4ccbfa2 100644
--- a/src/GipfelWidget.cxx
+++ b/src/GipfelWidget.cxx
@@ -50,6 +50,7 @@ GipfelWidget::GipfelWidget(int X,int Y,int W, int H): Fl_Widget(X, Y, W, H) {
img_file = NULL;
track_width = 200.0;
show_hidden = 0;
+ have_gipfel_info = 0;
md = new ImageMetaData();
track_points = NULL;
fl_register_images();
@@ -58,6 +59,7 @@ GipfelWidget::GipfelWidget(int X,int Y,int W, int H): Fl_Widget(X, Y, W, H) {
int
GipfelWidget::load_image(char *file) {
Fl_Image *new_img;
+ double direction, nick, tilt, fl;
new_img = new Fl_JPEG_Image(file);
@@ -90,11 +92,40 @@ GipfelWidget::load_image(char *file) {
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((ProjectionLSQ::Projection_t) md->get_projection_type());
- set_focal_length_35mm(md->get_focal_length_35mm());
+
+ have_gipfel_info = 1;
+ direction = md->get_direction();
+ if (isnan(direction)) {
+ set_center_angle(0.0);
+ have_gipfel_info = 0;
+ } else {
+ set_center_angle(direction);
+ }
+
+ nick = md->get_nick();
+ if (isnan(nick)) {
+ set_nick_angle(0.0);
+ have_gipfel_info = 0;
+ } else {
+ set_nick_angle(nick);
+ }
+
+ tilt = md->get_tilt();
+ if (isnan(tilt)) {
+ set_tilt_angle(0.0);
+ have_gipfel_info = 0;
+ } else {
+ set_tilt_angle(tilt);
+ }
+
+ fl = md->get_focal_length_35mm();
+ if (isnan(fl)) {
+ set_focal_length_35mm(35.0);
+ have_gipfel_info = 0;
+ } else {
+ set_focal_length_35mm(fl);
+ }
// try to get distortion parameters in the following ordering:
// 1. gipfel data in JPEG comment
@@ -678,6 +709,10 @@ int
GipfelWidget::export_hills(FILE *fp) {
Hills *mnts;
+ if (!have_gipfel_info) {
+ return 0;
+ }
+
fprintf(fp, "#\n# name\theight\tx\ty\tdistance\tflags\n#\n");
mnts = pan->get_visible_mountains();
diff --git a/src/ImageMetaData.H b/src/ImageMetaData.H
index 90b13c9..a305415 100644
--- a/src/ImageMetaData.H
+++ b/src/ImageMetaData.H
@@ -24,6 +24,7 @@ class ImageMetaData {
double focal_length_35mm;
double scale;
int projection_type;
+ int have_gipfel_info;
int load_image_jpgcom(char *name);
int save_image_jpgcom(char *in_img, char *out_img);
diff --git a/src/ImageMetaData.cxx b/src/ImageMetaData.cxx
index 2693851..0fa95d4 100644
--- a/src/ImageMetaData.cxx
+++ b/src/ImageMetaData.cxx
@@ -51,20 +51,12 @@ ImageMetaData::clear() {
int
ImageMetaData::load_image(char *name) {
- int ret;
-
clear();
- ret = load_image_jpgcom(name);
-
+ load_image_jpgcom(name);
load_image_exif(name); // fill missing values from exif data
- if (isnan(direction)) direction = 0.0;
- if (isnan(nick)) nick = 0.0;
- if (isnan(tilt)) tilt = 0.0;
- if (isnan(focal_length_35mm)) focal_length_35mm = 35.0;
-
- return ret;
+ return 0;
}
int