summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--NEWS15
-rw-r--r--README41
-rw-r--r--configure.ac2
-rw-r--r--gipfel.spec44
-rw-r--r--src/GipfelWidget.H1
-rw-r--r--src/GipfelWidget.cxx22
-rw-r--r--src/ImageMetaData.cxx20
7 files changed, 112 insertions, 33 deletions
diff --git a/NEWS b/NEWS
index c625412..147e3e4 100644
--- a/NEWS
+++ b/NEWS
@@ -1,11 +1,26 @@
gipfel ChangeLog
=================
+gipfel-0.2.9
+* Add rpm spec file.
+* fsync() temporary file before rename().
+
+gipfel-0.2.8
+* Fix issue with image saving on some platforms (reported by David Mitchell).
+* Fix crash in stitching mode.
+* Add a note to the README about generating a data file for the USA from
+ [USGS](http://geonames.usgs.gov/domestic/download_data.htm) data
+ (pointed out by David Mitchell).
+
gipfel-0.2.7
* Import data from http://www.viewfinderpanoramas.org/ with the
kind permission of Jonathan de Ferranti. Thanks a lot!
This brings the number of peaks in the default data file to
more than 21000!
+* Change display style a bit and reduce font size to make room
+ for all the new peaks from the updated data file.
+* Show height and distance of the peak which is currently under
+ the mouse.
gipfel-0.2.6
* Improve image saving. It is now possible to overwrite the current
diff --git a/README b/README
index bb6822e..4669ed9 100644
--- a/README
+++ b/README
@@ -24,11 +24,11 @@ compute the viewing paramteres from the given data points.
Requirements
------------
-* fltk-1.1.x <http://www.fltk.org>
-* libtiff <http://www.remotesensing.org/libtiff/>
-* libjpeg <http://www.ijg.org/>
-* exif utility <http://libexif.sourceforge.net/>
-* GSL - GNU Scientific Library <http://www.gnu.org/software/gsl/>
+* [fltk-1.1.x](http://www.fltk.org)
+* [libtiff](http://www.remotesensing.org/libtiff/)
+* [libjpeg](http://www.ijg.org/)
+* [exif utility](http://libexif.sourceforge.net/)
+* [GSL - GNU Scientific Library](http://www.gnu.org/software/gsl/)
* gipfel works on UNIX-like systems (e.g. Linux, *BSD and probably others)
Installation
@@ -66,8 +66,8 @@ If you have positioned at least two mountains, you can click on
the "comp" button in the control window to compute the
parameters of the picture.
-You may also want to have a look at the screen video at
-<http://www.ecademix.com/JohannesHofmann/gipfel.avi>
+You may also want to have a look at the
+(screen video)[http://www.ecademix.com/JohannesHofmann/gipfel.avi]
for an example session.
Data File
@@ -83,18 +83,25 @@ Each line must contain the following values separated by a comma:
The following line is a valid example:
SMTSBG,Simetsberg,,47.56617,11.25358,1836
-Fortunately, there is a great website <http://www.alpin-koordinaten.de>,
+Fortunately, there is a [great website](http://www.alpin-koordinaten.de),
where you can download a suitable file containg quite a lot of data mostly
concerning the alps:
Click on the "Suchen" button and the click on the diskette symbol below
the first table then select "Fugawi 3 TXT" format and click on "Download".
Obviously you can easily add your own entries to the data file or add them
-to the database at <http://www.alpin-koordinaten.de>.
+to the database at http://www.alpin-koordinaten.de.
-Thanks to the kind permission of the creators of
-<http://www.alpin-koordinaten.de>, the standard gipfel tarball includes
-a default datafile generated by <http://www.alpin-koordinaten.de>.
+Thanks to the kind permission of
+[Jonathan de Ferranti](http://www.viewfinderpanoramas.org/) and the
+creators of http://www.alpin-koordinaten.de, the standard gipfel
+tarball includes a default datafile generated from these two sources.
+
+For the USA, you can download a data file
+from [USGS](http://geonames.usgs.gov/domestic/download_data.htm)
+The file can be transformed for gipfel with
+ awk 'BEGIN {FS="|"; OFS=","};
+ $3 == "Summit" {print "usgs_" $1, $2,"" , $10, $11, $16};'
GPS Tracks
----------
@@ -130,8 +137,8 @@ are displayed in blue.
Refraction
----------
Refraction caused by temperature and density gardients in the atmosphere is
-taken into account according to the approximation described by Tom Chester in:
-<http://tchester.org/sgm/analysis/peaks/refraction_calculation.html>
+taken into account according to the approximation described by
+[Tom Chester](http://tchester.org/sgm/analysis/peaks/refraction_calculation.html).
under the assumption of a temperature change of 6.5°C per 1000m and a
temperature T0 at view point level of 10°C.
@@ -213,10 +220,10 @@ Troubleshooting
Acknowledgements
----------------
-Thanks to the guys from <http://www.alpin-koordinaten.de> for their public
+Thanks to the guys from http://www.alpin-koordinaten.de for their public
GPS database.
-Also have look at their other site <http://www.alpen-panoramen.de>.
-In newer versions I use maxima <http://maxima.sourceforge.net/> for
+Also have look at their other [site](http://www.alpen-panoramen.de).
+In newer versions I use [maxima](http://maxima.sourceforge.net/) for
symbolic computation and code generation.
I also want to thank my brother Martin for his suggestions and the
discussions.
diff --git a/configure.ac b/configure.ac
index cabdf15..b6a391c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2,7 +2,7 @@
# Process this file with autoconf to produce a configure script.
AC_PREREQ(2.59)
-AC_INIT(gipfel, 0.2.7, Johannes.Hofmann@gmx.de)
+AC_INIT(gipfel, 0.2.8, Johannes.Hofmann@gmx.de)
AM_INIT_AUTOMAKE
AC_CONFIG_SRCDIR([src/Panorama.H])
AC_CONFIG_HEADER(config.h)
diff --git a/gipfel.spec b/gipfel.spec
new file mode 100644
index 0000000..2b86897
--- /dev/null
+++ b/gipfel.spec
@@ -0,0 +1,44 @@
+Name: gipfel
+Summary: gipfel - Photogrammetry For Mountain Images
+Version: 0.2.8
+Release: 1
+URL: http://www.ecademix.com/JohannesHofmann/gipfel.html
+BuildRoot: %{_tmppath}/%{name}-%{version}-build
+Source0: %{name}-%{version}.tar.gz
+License: GPL
+Group: Productivity/Scientific/Other
+
+BuildRequires: binutils gcc gcc-c++ libstdc++-devel gsl-devel fltk-devel libjpeg-devel libtiff-devel libpng-devel
+
+%if 0%{?suse_version}
+BuildRequires: xorg-x11-libXext-devel
+%endif
+
+Requires: jpeg exif
+
+%description
+gipfel helps to find the names of mountains or points of interest
+on a picture.
+It uses a database containing names and GPS data. With the given viewpoint
+(the point from which the picture was taken) and two known mountains
+on the picture, gipfel can compute all parameters needed to compute the
+positions of other mountains on the picture.
+gipfel can also be used to play around with the parameters manually.
+%prep
+%setup -q
+%build
+./configure --prefix=%{_prefix} --docdir=%{_defaultdocdir}/%{name} || cat config.log
+make
+%install
+make DESTDIR=$RPM_BUILD_ROOT install-strip
+rm -rf $RPM_BUILD_ROOT/%{_defaultdocdir}/%{name}
+%files
+%defattr(-, root, root)
+%doc NEWS README
+%{_bindir}/%{name}
+%dir %{_datadir}/%{name}
+%{_datadir}/%{name}/gipfel.dat
+
+%changelog
+* Sun Mar 22 2009 Johannes Hofmann <Johannes.Hofmann@gmx.de>
+- initial revision
diff --git a/src/GipfelWidget.H b/src/GipfelWidget.H
index 3158a11..f8e242e 100644
--- a/src/GipfelWidget.H
+++ b/src/GipfelWidget.H
@@ -25,6 +25,7 @@ class GipfelWidget : public Fl_Group {
int have_gipfel_info;
ImageMetaData *md;
int show_hidden;
+ char focused_mountain_label[128];
int handle(int event);
diff --git a/src/GipfelWidget.cxx b/src/GipfelWidget.cxx
index 0f94f9f..b895ecb 100644
--- a/src/GipfelWidget.cxx
+++ b/src/GipfelWidget.cxx
@@ -33,6 +33,7 @@
static double pi_d, deg2rad;
GipfelWidget::GipfelWidget(int X,int Y,int W, int H): Fl_Group(X, Y, W, H) {
+ end();
pi_d = asin(1.0) * 2.0;
deg2rad = pi_d / 180.0;
img = NULL;
@@ -286,19 +287,16 @@ GipfelWidget::draw() {
}
if (focused_mountain) {
- static char buf[128];
m = focused_mountain;
int m_x = w() / 2 + x() + (int) rint(m->x);
int m_y = h() / 2 + y() + (int) rint(m->y);
- snprintf(buf, sizeof(buf), "%s (%dm), distance %.2fkm",
- m->name, (int) m->height, pan->get_real_distance(m) / 1000.0);
-
fl_color(FL_YELLOW);
- fl_rectf(m_x, m_y - height, (int) fl_width(buf) + 2, height + 2);
+ fl_rectf(m_x, m_y - height,
+ (int) fl_width(focused_mountain_label) + 2, height + 2);
fl_color(FL_BLACK);
- fl_draw(buf, m_x, m_y);
+ fl_draw(focused_mountain_label, m_x, m_y);
}
@@ -613,6 +611,10 @@ GipfelWidget::handle(int event) {
cur_mountain = m;
} else if (Fl::event_button() == 2) {
toggle_known_mountain(mark_x, mark_y);
+ if (focused_mountain) {
+ focused_mountain = NULL;
+ redraw();
+ }
}
Fl::focus(this);
@@ -629,7 +631,13 @@ GipfelWidget::handle(int event) {
return 1;
case FL_MOVE:
m = find_mountain(pan->get_visible_mountains(), Fl::event_x()-x(), Fl::event_y()-y());
- if (m && m != focused_mountain) {
+ if (m != focused_mountain && (!m || !known_hills->contains(m))) {
+ if (m)
+ snprintf(focused_mountain_label,
+ sizeof(focused_mountain_label) - 1,
+ "%s (%dm), distance %.2fkm",
+ m->name, (int) m->height, pan->get_real_distance(m) / 1000.0);
+
focused_mountain = m;
redraw();
}
diff --git a/src/ImageMetaData.cxx b/src/ImageMetaData.cxx
index a678360..f22a641 100644
--- a/src/ImageMetaData.cxx
+++ b/src/ImageMetaData.cxx
@@ -93,7 +93,7 @@ degminsecstr2double(char *val) {
int
ImageMetaData::load_image_exif(char *name) {
- char * args[32];
+ const char * args[32];
FILE *p;
pid_t pid;
int status;
@@ -107,7 +107,7 @@ ImageMetaData::load_image_exif(char *name) {
args[3] = name;
args[4] = NULL;
- p = pexecvp(args[0], args, &pid, "r");
+ p = pexecvp(args[0], const_cast<char * const *>(args), &pid, "r");
if (p) {
while (fgets(buf, sizeof(buf), p) != NULL) {
@@ -155,7 +155,7 @@ ImageMetaData::load_image_exif(char *name) {
int
ImageMetaData::load_image_jpgcom(char *name) {
- char * args[32];
+ const char * args[32];
FILE *p;
pid_t pid;
int status;
@@ -168,7 +168,7 @@ ImageMetaData::load_image_jpgcom(char *name) {
args[1] = name;
args[2] = NULL;
- p = pexecvp(args[0], args, &pid, "r");
+ p = pexecvp(args[0], const_cast<char * const *>(args), &pid, "r");
if (p) {
while (fgets(buf, sizeof(buf), p) != NULL) {
@@ -208,15 +208,18 @@ ImageMetaData::load_image_jpgcom(char *name) {
int
ImageMetaData::save_image_jpgcom(char *in_img, char *out_img) {
- char * args[32];
+ const char * args[32];
FILE *p;
pid_t pid;
char buf[1024], tmpname[MAXPATHLEN];
int status, err = 0;
ssize_t n;
int tmp_fd;
+ char *dirbuf;
- snprintf(tmpname, sizeof(tmpname), "%s/.gipfelXXXXXX", dirname(out_img));
+ dirbuf = strdup(out_img);
+ snprintf(tmpname, sizeof(tmpname), "%s/.gipfelXXXXXX", dirname(dirbuf));
+ free(dirbuf);
tmp_fd = mkstemp(tmpname);
if (tmp_fd < 0) {
perror("mkstemp");
@@ -242,7 +245,7 @@ ImageMetaData::save_image_jpgcom(char *in_img, char *out_img) {
args[4] = in_img;
args[5] = NULL;
- p = pexecvp(args[0], args, &pid, "r");
+ p = pexecvp(args[0], const_cast<char * const *>(args), &pid, "r");
if (p) {
while ((n = fread(buf, 1, sizeof(buf), p)) != 0) {
@@ -263,7 +266,8 @@ ImageMetaData::save_image_jpgcom(char *in_img, char *out_img) {
err++;
}
- close(tmp_fd);
+ fsync(tmp_fd); /* make sure data is on disk before replacing orig file */
+ close(tmp_fd);
if (!err) {
if (rename(tmpname, out_img) != 0) {