summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohannes Hofmann <Johannes.Hofmann@gmx.de>2007-08-11 22:27:55 +0200
committerJohannes Hofmann <Johannes.Hofmann@gmx.de>2007-08-11 22:27:55 +0200
commit50a00beb9598747a3c396088fd4ad311cb6cdf39 (patch)
tree47951a7898b148372e594c684ab6a745e8c944f4
parentbbb6b1845f65fe2d76ac0040e115f66be172961d (diff)
don't export duplicates
-rw-r--r--examples/Makefile24
-rwxr-xr-xexamples/gipfel2html56
-rw-r--r--src/GipfelWidget.cxx2
-rw-r--r--src/gipfel.cxx12
4 files changed, 68 insertions, 26 deletions
diff --git a/examples/Makefile b/examples/Makefile
index 7c26813..a863f23 100644
--- a/examples/Makefile
+++ b/examples/Makefile
@@ -2,21 +2,27 @@ images := $(wildcard *.jpg)
slides := $(addprefix gipfelweb/slides/, $(images))
thumbs := $(addprefix gipfelweb/thumbs/, $(images))
positions := $(addprefix gipfelweb/gipfel/, $(addsuffix .pos, $(basename $(images))))
-dumps := $(addprefix gipfelweb/gipfel/, $(addsuffix .gipf, $(basename $(images))))
+imgpos := $(addprefix gipfelweb/gipfel/, $(addsuffix .imgs, $(basename $(images))))
+hillpos := $(addprefix gipfelweb/gipfel/, $(addsuffix .hills, $(basename $(images))))
html := $(addprefix gipfelweb/, $(addsuffix .html, $(basename $(images))))
+htmlhills := $(addprefix gipfelweb/hills/, $(addsuffix .html, $(basename $(images))))
all:
echo "make gipfelweb - create a HTML based we of gipfel oriented"
echo "images in the current directory."
-gipfelweb: dirs $(slides) $(thumbs) $(dumps) $(html)
+gipfelweb: dirs $(slides) $(thumbs) $(imgpos) $(hillpos) $(html) $(htmlhills)
clean:
+ rm -rf gipfelweb/gipfel
+
+clobber:
rm -rf gipfelweb
dirs:
mkdir -p gipfelweb/slides
mkdir -p gipfelweb/thumbs
+ mkdir -p gipfelweb/hills
mkdir -p gipfelweb/gipfel
gipfelweb/slides/%.jpg: %.jpg
@@ -28,11 +34,17 @@ gipfelweb/thumbs/%.jpg: %.jpg
gipfelweb/gipfel/%.pos: %.jpg
gipfel -p $< > $@
-gipfelweb/gipfel/%.gipf: gipfelweb/slides/%.jpg gipfelweb/gipfel/index.gipfel
- gipfel -v 0.02 -e gipfelweb/gipfel/index.gipfel $< > $@
+gipfelweb/gipfel/%.imgs: gipfelweb/slides/%.jpg gipfelweb/gipfel/index.gipfel
+ gipfel -V 0.05 -e gipfelweb/gipfel/index.gipfel $< > $@
+
+gipfelweb/gipfel/%.hills: gipfelweb/slides/%.jpg
+ gipfel -V 0.05 -E $< > $@
gipfelweb/gipfel/index.gipfel: $(positions)
cat $(positions) > gipfelweb/gipfel/index.gipfel
-gipfelweb/%.html: gipfelweb/slides/%.jpg gipfelweb/gipfel/%.gipf $(thumbs)
- gipfel2html $* > $@
+gipfelweb/%.html: gipfelweb/slides/%.jpg gipfelweb/gipfel/%.imgs $(thumbs)
+ gipfel2html images $* > $@
+
+gipfelweb/hills/%.html: gipfelweb/slides/%.jpg gipfelweb/gipfel/%.hills
+ gipfel2html hills $* > $@
diff --git a/examples/gipfel2html b/examples/gipfel2html
index e8912d9..f66b456 100755
--- a/examples/gipfel2html
+++ b/examples/gipfel2html
@@ -1,8 +1,17 @@
#!/bin/sh
+MODE="$1"
+FILE="$2"
+
+if [ "$MODE" = "images" ]; then
+ DATAFILE="gipfelweb/gipfel/${FILE}.imgs"
+else
+ DATAFILE="gipfelweb/gipfel/${FILE}.hills"
+fi
+
TITLE=""
-if [ -e "$1.title" ]; then
- TITLE=`cat $1.title`
+if [ -e "${FILE}.title" ]; then
+ TITLE=`cat ${FILE}.title`
fi
cat << EOF
@@ -16,18 +25,24 @@ cat << EOF
#gipfel li:hover span {visibility: visible;}
EOF
+IFS=" "
i=0
-grep -v "^#" gipfelweb/gipfel/${1}.gipf | \
+grep -v "^#" ${DATAFILE} | \
while read name height x y dist flags dummy; do
if [ "${flags}" = "HIDDEN" ]; then
continue
fi
- thumb_w=`identify -format %w gipfelweb/thumbs/${name}`
- thumb_h=`identify -format %h gipfelweb/thumbs/${name}`
+ if [ "$MODE" = "images" ]; then
+ thumb_w=`identify -format %w gipfelweb/thumbs/${name}`
+ thumb_h=`identify -format %h gipfelweb/thumbs/${name}`
- echo "#id_${i} {left:$((${x} - 10 / 2))px; top: $((${y} - 6 / 2))px; width: 10px; height: 6px;}"
- echo "#id_${i}:hover {width: ${thumb_w}px; height: ${thumb_h}px; background: url(thumbs/${name});}"
+ echo "#id_${i} {left:$((${x} - 10 / 2))px; top: $((${y} - 6 / 2))px; width: 10px; height: 6px;}"
+ echo "#id_${i}:hover {width: ${thumb_w}px; height: ${thumb_h}px; background: url(thumbs/${name});}"
+ else
+ echo "#id_${i} {left:$((${x} - 4 / 2))px; top: $((${y} - 4 / 2))px; width: 4px; height: 4px;}"
+ echo "#id_${i}:hover {width: 200px; height: 20px;}"
+ fi
i=$((${i} + 1))
done
@@ -54,6 +69,12 @@ EOF
echo "<h3>$TITLE</h3>"
+if [ "$MODE" = "images" ]; then
+ echo "<a href=\"hills/${FILE}.html\">show hill names</a>"
+else
+ echo "<a href=\"../${FILE}.html\">back to gipfelweb</a>"
+fi
+
cat << EOF
<table border="0" cellpadding="0" cellspacing="1" bgcolor="black">
<tr><td>
@@ -62,22 +83,29 @@ cat << EOF
<div id="gipfel">
EOF
-echo "<img src=\"slides/${1}.jpg\"/>"
+if [ "$MODE" = "images" ]; then
+ echo "<img src=\"slides/${FILE}.jpg\"/>"
+else
+ echo "<img src=\"../slides/${FILE}.jpg\"/>"
+fi
i=0
-grep -v "^#" gipfelweb/gipfel/${1}.gipf | \
+grep -v "^#" ${DATAFILE} | \
while read name height x y dist flags dummy; do
if [ "${flags}" = "HIDDEN" ]; then
continue
fi
- THUMB_TITLE="${name%.jpg}"
- if [ -e "${name%.jpg}.title" ]; then
- THUMB_TITLE=`cat ${name%.jpg}.title`
+ if [ "$MODE" = "images" ]; then
+ THUMB_TITLE="${name%.jpg}"
+ if [ -e "${name%.jpg}.title" ]; then
+ THUMB_TITLE=`cat ${name%.jpg}.title`
+ fi
+ echo "<li id=\"id_${i}\"><a href=\"${name%.jpg}.html\"><span>${THUMB_TITLE} (${height}m)</span></a></li>"
+ else
+ echo "<li id=\"id_${i}\"><span>${name} (${height}m)</span></li>"
fi
- echo "<li id=\"id_${i}\"><a href=\"${name%.jpg}.html\"><span>${THUMB_TITLE} (${height}m)</span></a></li>"
-
i=$((${i} + 1))
done
diff --git a/src/GipfelWidget.cxx b/src/GipfelWidget.cxx
index e6bed3a..8590b5c 100644
--- a/src/GipfelWidget.cxx
+++ b/src/GipfelWidget.cxx
@@ -735,7 +735,7 @@ GipfelWidget::export_hills(const char *file, FILE *fp) {
int _x = (int) rint(m->x) + w() / 2;
int _y = (int) rint(m->y) + h() / 2;
- if (file && !(m->flags & Hill::EXPORT)) {
+ if (m->flags & Hill::DUPLICATE || file && !(m->flags & Hill::EXPORT)) {
continue;
}
diff --git a/src/gipfel.cxx b/src/gipfel.cxx
index 50f2404..43f2ed5 100644
--- a/src/gipfel.cxx
+++ b/src/gipfel.cxx
@@ -264,7 +264,7 @@ void usage() {
fprintf(stderr,
"usage: gipfel [-v <viewpoint>] [-d <file>]\n"
" [-s] [-j <file>] [-t <dir] [-w <width>] [-h <height>]\n"
- " [-e <file>] -p]\n"
+ " [-e <file>] [-E] [-p]\n"
" [<image(s)>]\n"
" -v <viewpoint> Set point from which the picture was taken.\n"
" This must be a string that unambiguously \n"
@@ -281,9 +281,8 @@ void usage() {
" -j <file> JPEG output file for Stitch mode.\n"
" -t <dir> Output directory for TIFF images in Stitch mode.\n"
" -p Export position of image to stdout.\n"
- " -e <file> Export positions of hills from <file> on image\n"
- " to stdout. Uses hills from default data file if\n"
- " <file> is omitted.\n"
+ " -e <file> Export positions of hills from <file> on image.\n"
+ " -E Export hills from default data file.\n"
" <image(s)> JPEG file(s) to use.\n");
}
@@ -428,7 +427,7 @@ int main(int argc, char** argv) {
char *export_file = NULL;
err = 0;
- while ((c = getopt(argc, argv, ":?d:v:sw:h:j:t:u:br:4e:V:p")) != EOF) {
+ while ((c = getopt(argc, argv, ":?d:v:sw:h:j:t:u:br:4e:V:pE")) != EOF) {
switch (c) {
case '?':
usage();
@@ -441,6 +440,9 @@ int main(int argc, char** argv) {
export_flag++;
export_file = optarg;
break;
+ case 'E':
+ export_flag++;
+ break;
case 'v':
view_point = optarg;
break;