summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJohannes Hofmann <Johannes.Hofmann@gmx.de>2008-07-05 21:33:56 +0200
committerJohannes Hofmann <Johannes.Hofmann@gmx.de>2008-07-05 21:33:56 +0200
commit21fa20047915ac3b75588f762eba92f21c8a32ad (patch)
tree870d1e2d0a445268d4a3e033c4c2aca47cfa1c53 /src
parentf14d7c7bb083ae4f79eba4df066d41359dff7a26 (diff)
cleanup ImageMetaDate interface
Diffstat (limited to 'src')
-rw-r--r--src/GipfelWidget.cxx40
-rw-r--r--src/ImageMetaData.H74
-rw-r--r--src/ImageMetaData.cxx116
-rw-r--r--src/gipfel.cxx6
4 files changed, 118 insertions, 118 deletions
diff --git a/src/GipfelWidget.cxx b/src/GipfelWidget.cxx
index 63e89d2..edd50c5 100644
--- a/src/GipfelWidget.cxx
+++ b/src/GipfelWidget.cxx
@@ -84,13 +84,13 @@ GipfelWidget::load_image(char *file) {
// try to retrieve gipfel data from JPEG meta data
md->load_image(file);
- set_view_long(md->get_longitude());
- set_view_lat(md->get_latitude());
- set_view_height(md->get_height());
- set_projection((ProjectionLSQ::Projection_t) md->get_projection_type());
+ set_view_long(md->longitude());
+ set_view_lat(md->latitude());
+ set_view_height(md->height());
+ set_projection((ProjectionLSQ::Projection_t) md->projection_type());
have_gipfel_info = 1;
- direction = md->get_direction();
+ direction = md->direction();
if (isnan(direction)) {
set_center_angle(0.0);
have_gipfel_info = 0;
@@ -98,7 +98,7 @@ GipfelWidget::load_image(char *file) {
set_center_angle(direction);
}
- nick = md->get_nick();
+ nick = md->nick();
if (isnan(nick)) {
set_nick_angle(0.0);
have_gipfel_info = 0;
@@ -106,7 +106,7 @@ GipfelWidget::load_image(char *file) {
set_nick_angle(nick);
}
- tilt = md->get_tilt();
+ tilt = md->tilt();
if (isnan(tilt)) {
set_tilt_angle(0.0);
have_gipfel_info = 0;
@@ -114,7 +114,7 @@ GipfelWidget::load_image(char *file) {
set_tilt_angle(tilt);
}
- fl = md->get_focal_length_35mm();
+ fl = md->focal_length_35mm();
if (isnan(fl) || fl == 0.0) {
set_focal_length_35mm(35.0);
have_gipfel_info = 0;
@@ -126,7 +126,7 @@ GipfelWidget::load_image(char *file) {
// 1. gipfel data in JPEG comment
// 2. matching distortion profile
// 3. set the to 0.0, 0.0
- md->get_distortion_params(&pan->parms.k0, &pan->parms.k1, &pan->parms.x0);
+ md->distortion_params(&pan->parms.k0, &pan->parms.k1, &pan->parms.x0);
if (isnan(pan->parms.k0)) {
char buf[1024];
if (get_distortion_profile_name(buf, sizeof(buf)) == 0) {
@@ -164,15 +164,15 @@ GipfelWidget::save_image(char *file) {
md = new ImageMetaData();
- md->set_longitude(get_view_long());
- md->set_latitude(get_view_lat());
- md->set_height(get_view_height());
- md->set_direction(get_center_angle());
- md->set_nick(get_nick_angle());
- md->set_tilt(get_tilt_angle());
- md->set_focal_length_35mm(get_focal_length_35mm());
- md->set_projection_type((int) get_projection());
- md->set_distortion_params(pan->parms.k0, pan->parms.k1, pan->parms.x0);
+ md->longitude(get_view_long());
+ md->latitude(get_view_lat());
+ md->height(get_view_height());
+ md->direction(get_center_angle());
+ md->nick(get_nick_angle());
+ md->tilt(get_tilt_angle());
+ md->focal_length_35mm(get_focal_length_35mm());
+ md->projection_type((int) get_projection());
+ md->distortion_params(pan->parms.k0, pan->parms.k1, pan->parms.x0);
ret = md->save_image(img_file, file);
@@ -870,9 +870,9 @@ int
GipfelWidget::get_distortion_profile_name(char *buf, int buflen) {
int n;
- if (md && md->get_manufacturer() && md->get_model()) {
+ if (md && md->manufacturer() && md->model()) {
n = snprintf(buf, buflen, "%s_%s_%.2f_mm",
- md->get_manufacturer(), md->get_model(), md->get_focal_length());
+ md->manufacturer(), md->model(), md->focal_length());
return n > buflen;
} else {
diff --git a/src/ImageMetaData.H b/src/ImageMetaData.H
index b3cc85c..b272123 100644
--- a/src/ImageMetaData.H
+++ b/src/ImageMetaData.H
@@ -9,22 +9,22 @@
class ImageMetaData {
private:
- char *manufacturer;
- char *model;
- double longitude;
- double latitude;
- double height;
- double direction;
- double nick;
- double tilt;
- double k0;
- double k1;
- double x0;
- double focal_length;
- double focal_length_35mm;
- double scale;
- int projection_type;
- int have_gipfel_info;
+ char *_manufacturer;
+ char *_model;
+ double _longitude;
+ double _latitude;
+ double _height;
+ double _direction;
+ double _nick;
+ double _tilt;
+ double _k0;
+ double _k1;
+ double _x0;
+ double _focal_length;
+ 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);
@@ -38,27 +38,27 @@ class ImageMetaData {
int load_image(char *name);
int save_image(char *in_img, char *out_img);
- const char *get_manufacturer() {return manufacturer;};
- const char *get_model() {return model;};
- double get_longitude() {return longitude;};
- double get_latitude() {return latitude;};
- double get_height() {return height;};
- double get_direction() {return direction;};
- double get_nick() {return nick;};
- double get_tilt() {return tilt;};
- double get_focal_length() {return focal_length;};
- double get_focal_length_35mm() {return focal_length_35mm;};
- int get_projection_type() {return projection_type;};
- void get_distortion_params(double *_k0, double *_k1, double *_x0);
+ const char *manufacturer() {return _manufacturer;};
+ const char *model() {return _model;};
+ double longitude() {return _longitude;};
+ double latitude() {return _latitude;};
+ double height() {return _height;};
+ double direction() {return _direction;};
+ double nick() {return _nick;};
+ double tilt() {return _tilt;};
+ double focal_length() {return _focal_length;};
+ double focal_length_35mm() {return _focal_length_35mm;};
+ int projection_type() {return _projection_type;};
+ void distortion_params(double *_k0, double *_k1, double *_x0);
- void set_longitude(double v) {longitude = v;};
- void set_latitude(double v) {latitude = v;};
- void set_height(double v) {height = v;};
- void set_direction(double v) {direction = v;};
- void set_nick(double v) {nick = v;};
- void set_tilt(double v) {tilt = v;};
- void set_focal_length_35mm(double v) {focal_length_35mm = v;};
- void set_projection_type(int v) {projection_type = v;};
- void set_distortion_params(double _k0, double _k1, double _x0);
+ void longitude(double v) {_longitude = v;};
+ void latitude(double v) {_latitude = v;};
+ void height(double v) {_height = v;};
+ void direction(double v) {_direction = v;};
+ void nick(double v) {_nick = v;};
+ void tilt(double v) {_tilt = v;};
+ void focal_length_35mm(double v) {_focal_length_35mm = v;};
+ void projection_type(int v) {_projection_type = v;};
+ void distortion_params(double k0, double k1, double x0);
};
#endif
diff --git a/src/ImageMetaData.cxx b/src/ImageMetaData.cxx
index 04b344e..26f0b37 100644
--- a/src/ImageMetaData.cxx
+++ b/src/ImageMetaData.cxx
@@ -18,35 +18,35 @@
#include "ImageMetaData.H"
ImageMetaData::ImageMetaData() {
- manufacturer = NULL;
- model = NULL;
+ _manufacturer = NULL;
+ _model = NULL;
clear();
}
ImageMetaData::~ImageMetaData() {
- if (manufacturer) free(manufacturer);
- if (model) free(model);
+ if (_manufacturer) free(_manufacturer);
+ if (_model) free(_model);
}
void
ImageMetaData::clear() {
- if (manufacturer) free(manufacturer);
- manufacturer = NULL;
- if (model) free(model);
- model = NULL;
- longitude = NAN;
- latitude = NAN;
- height = NAN;
- direction = NAN;
- nick = NAN;
- tilt = NAN;
- k0 = NAN;
- k1 = NAN;
- x0 = NAN;
- focal_length = NAN;
- focal_length_35mm = NAN;
- scale = NAN;
- projection_type = 0;
+ if (_manufacturer) free(_manufacturer);
+ _manufacturer = NULL;
+ if (_model) free(_model);
+ _model = NULL;
+ _longitude = NAN;
+ _latitude = NAN;
+ _height = NAN;
+ _direction = NAN;
+ _nick = NAN;
+ _tilt = NAN;
+ _k0 = NAN;
+ _k1 = NAN;
+ _x0 = NAN;
+ _focal_length = NAN;
+ _focal_length_35mm = NAN;
+ _scale = NAN;
+ _projection_type = 0;
}
int
@@ -116,25 +116,25 @@ ImageMetaData::load_image_exif(char *name) {
switch(id) {
case EXIF_MANUFACTURER:
- if (!manufacturer) manufacturer = strdup(val);
+ if (!_manufacturer) _manufacturer = strdup(val);
break;
case EXIF_MODEL:
- if (!model) model = strdup(val);
+ if (!_model) _model = strdup(val);
break;
case EXIF_FOCAL_LENGTH:
- if (isnan(focal_length)) focal_length = atof(val);
+ if (isnan(_focal_length)) _focal_length = atof(val);
break;
case EXIF_FOCAL_LENGTH_IN_35MM_FILM:
- if (isnan(focal_length_35mm)) focal_length_35mm = atof(val);
+ if (isnan(_focal_length_35mm)) _focal_length_35mm = atof(val);
break;
case EXIF_GPS_LONGITUDE:
- if (isnan(longitude)) longitude = degminsecstr2double(val);
+ if (isnan(_longitude)) _longitude = degminsecstr2double(val);
break;
case EXIF_GPS_LATIITUDE:
- if (isnan(latitude)) latitude = degminsecstr2double(val);
+ if (isnan(_latitude)) _latitude = degminsecstr2double(val);
break;
case EXIF_GPS_ALTITUDE:
- if (isnan(height)) height = atof(val);
+ if (isnan(_height)) _height = atof(val);
break;
}
}
@@ -159,7 +159,7 @@ ImageMetaData::load_image_jpgcom(char *name) {
pid_t pid;
int status;
char buf[1024];
- double lo, la, he, dir, ni, ti, fr, _k0, _k1, _x0 = 0.0;
+ double lo, la, he, dir, ni, ti, fr, k0, k1, x0 = 0.0;
int pt = 0;
int n, ret = 1;
@@ -172,21 +172,21 @@ ImageMetaData::load_image_jpgcom(char *name) {
if (p) {
while (fgets(buf, sizeof(buf), p) != NULL) {
if ((n = sscanf(buf, GIPFEL_FORMAT_2,
- &lo, &la, &he, &dir, &ni, &ti, &fr, &pt, &_k0, &_k1, &_x0)) >= 8) {
+ &lo, &la, &he, &dir, &ni, &ti, &fr, &pt, &k0, &k1, &x0)) >= 8) {
- longitude = lo;
- latitude = la;
- height = he;
- direction = dir;
- nick = ni;
- tilt = ti;
- focal_length_35mm = fr;
- projection_type = pt;
+ _longitude = lo;
+ _latitude = la;
+ _height = he;
+ _direction = dir;
+ _nick = ni;
+ _tilt = ti;
+ _focal_length_35mm = fr;
+ _projection_type = pt;
if (n >= 10) {
- k0 = _k0;
- k1 = _k1;
- x0 = _x0;
+ _k0 = k0;
+ _k1 = k1;
+ _x0 = x0;
}
ret = 0;
@@ -235,15 +235,15 @@ ImageMetaData::save_image_jpgcom(char *in_img, char *out_img) {
}
snprintf(buf, sizeof(buf), GIPFEL_FORMAT_2,
- longitude,
- latitude,
- height,
- direction,
- nick,
- tilt,
- focal_length_35mm,
- projection_type,
- k0, k1, x0);
+ _longitude,
+ _latitude,
+ _height,
+ _direction,
+ _nick,
+ _tilt,
+ _focal_length_35mm,
+ _projection_type,
+ _k0, _k1, _x0);
// try to save gipfel data in JPEG comment section
args[0] = "wrjpgcom";
@@ -276,15 +276,15 @@ ImageMetaData::save_image_jpgcom(char *in_img, char *out_img) {
}
void
-ImageMetaData::get_distortion_params(double *_k0, double *_k1, double *_x0) {
- *_k0 = k0;
- *_k1 = k1;
- *_x0 = x0;
+ImageMetaData::distortion_params(double *k0, double *k1, double *x0) {
+ *k0 = _k0;
+ *k1 = _k1;
+ *x0 = _x0;
}
void
-ImageMetaData::set_distortion_params(double _k0, double _k1, double _x0) {
- k0 = _k0;
- k1 = _k1;
- x0 = _x0;
+ImageMetaData::distortion_params(double k0, double k1, double x0) {
+ _k0 = k0;
+ _k1 = k1;
+ _x0 = x0;
}
diff --git a/src/gipfel.cxx b/src/gipfel.cxx
index 7331b77..9409673 100644
--- a/src/gipfel.cxx
+++ b/src/gipfel.cxx
@@ -678,9 +678,9 @@ export_position() {
if (md.load_image(img_file) == 0) {
printf(",%s,,%f,%f,%d\n", img_file,
- md.get_latitude(),
- md.get_longitude(),
- (int) rint(md.get_height()));
+ md.latitude(),
+ md.longitude(),
+ (int) rint(md.height()));
return 0;
} else {