[GRASS-SVN] r44654 - in
grass/branches/releasebranch_6_4/imagery/i.ortho.photo: .
i.photo.2image i.photo.2target i.photo.camera i.photo.elev
i.photo.init i.photo.rectify i.photo.target menu
svn_grass at osgeo.org
svn_grass at osgeo.org
Wed Dec 22 05:05:10 EST 2010
Author: mmetz
Date: 2010-12-22 02:05:10 -0800 (Wed, 22 Dec 2010)
New Revision: 44654
Added:
grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2image/
grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2image/Makefile
grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2image/analyze.c
grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2image/ask.c
grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2image/ask_mag.c
grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2image/call.c
grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2image/camera_ref.h
grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2image/cell.c
grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2image/cellhd.c
grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2image/colors.c
grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2image/conv.c
grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2image/curses.c
grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2image/defs.h
grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2image/description.html
grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2image/dot.c
grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2image/drawcam.c
grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2image/drawcell.c
grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2image/driver.c
grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2image/equ.c
grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2image/find.c
grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2image/globals.h
grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2image/graphics.c
grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2image/group.c
grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2image/input.c
grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2image/local_proto.h
grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2image/main.c
grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2image/mark.c
grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2image/mouse.c
grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2image/points.c
grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2image/target.c
grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2image/title.c
grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2image/use_camera.c
grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2image/view.c
grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2image/where.c
grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2image/zoom.c
grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2image/zoom_box.c
grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2image/zoom_pnt.c
grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2target/
grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2target/Makefile
grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2target/analyze.c
grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2target/ask.c
grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2target/ask_mag.c
grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2target/call.c
grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2target/cell.c
grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2target/cellhd.c
grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2target/colors.c
grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2target/conv.c
grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2target/curses.c
grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2target/defs.h
grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2target/description.html
grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2target/digit.c
grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2target/dot.c
grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2target/drawcell.c
grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2target/driver.c
grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2target/equ.c
grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2target/find.c
grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2target/globals.h
grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2target/graphics.c
grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2target/group.c
grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2target/input.c
grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2target/local_proto.h
grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2target/main.c
grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2target/mark.c
grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2target/mouse.c
grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2target/points.c
grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2target/target.c
grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2target/title.c
grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2target/view.c
grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2target/where.c
grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2target/zoom.c
grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2target/zoom_box.c
grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2target/zoom_pnt.c
grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.camera/
grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.camera/Makefile
grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.camera/camera.h
grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.camera/description.html
grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.camera/globals.h
grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.camera/main.c
grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.camera/mod_cam_info.c
grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.camera/photo.camera.png
grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.elev/
grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.elev/Makefile
grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.elev/ask_elev.c
grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.elev/elev.h
grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.elev/local_proto.h
grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.elev/main.c
grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.elev/mod_elev.c
grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.init/
grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.init/Makefile
grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.init/description.html
grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.init/globals.h
grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.init/main.c
grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.init/mod_info.c
grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.rectify/
grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.rectify/Makefile
grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.rectify/README
grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.rectify/ask_files.c
grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.rectify/ask_method.c
grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.rectify/aver_z.c
grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.rectify/bilinear.c
grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.rectify/bilinear_f.c
grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.rectify/compress.c
grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.rectify/cp.c
grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.rectify/cubic.c
grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.rectify/cubic_f.c
grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.rectify/defs.h
grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.rectify/description.html
grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.rectify/env.c
grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.rectify/equ.c
grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.rectify/exec.c
grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.rectify/get_wind.c
grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.rectify/global.h
grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.rectify/local_proto.h
grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.rectify/main.c
grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.rectify/nearest.c
grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.rectify/readcell.c
grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.rectify/rectify.c
grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.rectify/report.c
grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.rectify/target.c
grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.target/
grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.target/Makefile
grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.target/ask_target.c
grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.target/local_proto.h
grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.target/main.c
Removed:
grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2image/Makefile
grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2image/analyze.c
grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2image/ask.c
grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2image/ask_mag.c
grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2image/call.c
grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2image/camera_ref.h
grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2image/cell.c
grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2image/cellhd.c
grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2image/colors.c
grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2image/conv.c
grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2image/curses.c
grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2image/defs.h
grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2image/description.html
grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2image/dot.c
grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2image/drawcam.c
grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2image/drawcell.c
grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2image/driver.c
grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2image/equ.c
grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2image/find.c
grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2image/globals.h
grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2image/graphics.c
grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2image/group.c
grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2image/input.c
grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2image/local_proto.h
grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2image/main.c
grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2image/mark.c
grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2image/mouse.c
grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2image/points.c
grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2image/target.c
grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2image/title.c
grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2image/use_camera.c
grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2image/view.c
grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2image/where.c
grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2image/zoom.c
grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2image/zoom_box.c
grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2image/zoom_pnt.c
grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2target/Makefile
grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2target/analyze.c
grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2target/ask.c
grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2target/ask_mag.c
grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2target/call.c
grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2target/cell.c
grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2target/cellhd.c
grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2target/colors.c
grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2target/conv.c
grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2target/curses.c
grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2target/defs.h
grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2target/description.html
grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2target/digit.c
grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2target/dot.c
grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2target/drawcell.c
grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2target/driver.c
grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2target/equ.c
grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2target/find.c
grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2target/globals.h
grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2target/graphics.c
grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2target/group.c
grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2target/input.c
grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2target/local_proto.h
grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2target/main.c
grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2target/mark.c
grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2target/mouse.c
grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2target/points.c
grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2target/target.c
grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2target/title.c
grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2target/view.c
grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2target/where.c
grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2target/zoom.c
grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2target/zoom_box.c
grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2target/zoom_pnt.c
grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.camera/Makefile
grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.camera/camera.h
grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.camera/description.html
grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.camera/globals.h
grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.camera/main.c
grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.camera/mod_cam_info.c
grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.camera/photo.camera.png
grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.elev/Makefile
grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.elev/ask_elev.c
grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.elev/elev.h
grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.elev/local_proto.h
grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.elev/main.c
grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.elev/mod_elev.c
grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.init/Makefile
grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.init/description.html
grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.init/globals.h
grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.init/main.c
grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.init/mod_info.c
grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.rectify/Makefile
grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.rectify/README
grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.rectify/ask_files.c
grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.rectify/ask_method.c
grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.rectify/aver_z.c
grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.rectify/bilinear.c
grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.rectify/bilinear_f.c
grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.rectify/compress.c
grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.rectify/cp.c
grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.rectify/cubic.c
grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.rectify/cubic_f.c
grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.rectify/defs.h
grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.rectify/description.html
grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.rectify/env.c
grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.rectify/equ.c
grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.rectify/exec.c
grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.rectify/get_wind.c
grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.rectify/global.h
grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.rectify/local_proto.h
grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.rectify/main.c
grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.rectify/nearest.c
grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.rectify/readcell.c
grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.rectify/rectify.c
grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.rectify/report.c
grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.rectify/target.c
grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.target/Makefile
grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.target/ask_target.c
grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.target/local_proto.h
grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.target/main.c
grass/branches/releasebranch_6_4/imagery/i.ortho.photo/photo.2image/
grass/branches/releasebranch_6_4/imagery/i.ortho.photo/photo.2target/
grass/branches/releasebranch_6_4/imagery/i.ortho.photo/photo.camera/
grass/branches/releasebranch_6_4/imagery/i.ortho.photo/photo.elev/
grass/branches/releasebranch_6_4/imagery/i.ortho.photo/photo.init/
grass/branches/releasebranch_6_4/imagery/i.ortho.photo/photo.rectify/
grass/branches/releasebranch_6_4/imagery/i.ortho.photo/photo.target/
Modified:
grass/branches/releasebranch_6_4/imagery/i.ortho.photo/
grass/branches/releasebranch_6_4/imagery/i.ortho.photo/Makefile
grass/branches/releasebranch_6_4/imagery/i.ortho.photo/README
grass/branches/releasebranch_6_4/imagery/i.ortho.photo/menu/description.html
grass/branches/releasebranch_6_4/imagery/i.ortho.photo/menu/menu.c
Log:
merge r44501,44502 from devbr6
Property changes on: grass/branches/releasebranch_6_4/imagery/i.ortho.photo
___________________________________________________________________
Modified: svn:mergeinfo
- /grass/branches/develbranch_6/imagery/i.ortho.photo:44349-44350,44472-44477,44500
+ /grass/branches/develbranch_6/imagery/i.ortho.photo:44349-44350,44472-44477,44500-44502
Modified: grass/branches/releasebranch_6_4/imagery/i.ortho.photo/Makefile
===================================================================
--- grass/branches/releasebranch_6_4/imagery/i.ortho.photo/Makefile 2010-12-22 09:44:29 UTC (rev 44653)
+++ grass/branches/releasebranch_6_4/imagery/i.ortho.photo/Makefile 2010-12-22 10:05:10 UTC (rev 44654)
@@ -3,13 +3,13 @@
SUBDIRS1 = \
menu \
- photo.2image \
- photo.2target \
- photo.camera \
- photo.elev \
- photo.init \
- photo.rectify \
- photo.target
+ i.photo.2image \
+ i.photo.2target \
+ i.photo.camera \
+ i.photo.elev \
+ i.photo.init \
+ i.photo.rectify \
+ i.photo.target
SUBDIRS = libes $(SUBDIRS1)
Modified: grass/branches/releasebranch_6_4/imagery/i.ortho.photo/README
===================================================================
--- grass/branches/releasebranch_6_4/imagery/i.ortho.photo/README 2010-12-22 09:44:29 UTC (rev 44653)
+++ grass/branches/releasebranch_6_4/imagery/i.ortho.photo/README 2010-12-22 10:05:10 UTC (rev 44654)
@@ -25,13 +25,13 @@
following programs:
1 i.group
-2 photo.target
-3 photo.init
-4 photo.camera
-5 photo.elev
-6 photo.2image
-7 photo.2target
-8 photo.rectify
+2 i.photo.target
+3 i.photo.init
+4 i.photo.camera
+5 i.photo.elev
+6 i.photo.2image
+7 i.photo.2target
+8 i.photo.rectify
@@ -39,21 +39,21 @@
./menu: main menu code (-> menu/menu.c)
- ./photo.target: select target location and mapset
+ ./i.photo.target: select target location and mapset
- ./photo.elev: select elevation model
+ ./i.photo.elev: select elevation model
- ./photo.camera: select a camera to use for parameters
+ ./i.photo.camera: select a camera to use for parameters
- ./photo.2image: code for image to photo coordinate
+ ./i.photo.2image: code for image to photo coordinate
transformation
- ./photo.init: choose initial camera exposure station
+ ./i.photo.init: choose initial camera exposure station
parameters
- ./photo.2target: computes photo to target location
+ ./i.photo.2target: computes photo to target location
transformation paramters
- ./photo.rectify: does the actual image rectification
+ ./i.photo.rectify: does the actual image rectification
./libes: libraries for ortho programs
Property changes on: grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2image
___________________________________________________________________
Added: svn:ignore
+ *.tmp.html
*OBJ*
Deleted: grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2image/Makefile
===================================================================
--- grass/branches/develbranch_6/imagery/i.ortho.photo/i.photo.2image/Makefile 2010-12-01 09:34:37 UTC (rev 44501)
+++ grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2image/Makefile 2010-12-22 10:05:10 UTC (rev 44654)
@@ -1,16 +0,0 @@
-MODULE_TOPDIR = ../../..
-
-PGM = i.photo.2image
-
-EXTRA_CFLAGS = -I../libes
-
-LIBES = $(IMAGERYLIB) $(DISPLAYLIB) $(RASTERLIB) $(GISLIB) $(IORTHOLIB) $(VASKLIB) $(CURSES) $(GMATHLIB)
-DEPENDENCIES= $(IMAGERYDEP) $(DISPLAYDEP) $(RASTERDEP) $(IORTHODEP) $(GISDEP) $(VASKDEP) $(GMATHDEP)
-
-include $(MODULE_TOPDIR)/include/Make/Module.make
-
-default: etc
-
-$(PGM).tmp.html: description.html
- $(INSTALL_DATA) $< $@
-
Copied: grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2image/Makefile (from rev 44501, grass/branches/develbranch_6/imagery/i.ortho.photo/i.photo.2image/Makefile)
===================================================================
--- grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2image/Makefile (rev 0)
+++ grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2image/Makefile 2010-12-22 10:05:10 UTC (rev 44654)
@@ -0,0 +1,16 @@
+MODULE_TOPDIR = ../../..
+
+PGM = i.photo.2image
+
+EXTRA_CFLAGS = -I../libes
+
+LIBES = $(IMAGERYLIB) $(DISPLAYLIB) $(RASTERLIB) $(GISLIB) $(IORTHOLIB) $(VASKLIB) $(CURSES) $(GMATHLIB)
+DEPENDENCIES= $(IMAGERYDEP) $(DISPLAYDEP) $(RASTERDEP) $(IORTHODEP) $(GISDEP) $(VASKDEP) $(GMATHDEP)
+
+include $(MODULE_TOPDIR)/include/Make/Module.make
+
+default: etc
+
+$(PGM).tmp.html: description.html
+ $(INSTALL_DATA) $< $@
+
Deleted: grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2image/analyze.c
===================================================================
--- grass/branches/develbranch_6/imagery/i.ortho.photo/i.photo.2image/analyze.c 2010-12-01 09:34:37 UTC (rev 44501)
+++ grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2image/analyze.c 2010-12-22 10:05:10 UTC (rev 44654)
@@ -1,591 +0,0 @@
-#include <string.h>
-#include <math.h>
-#include <unistd.h>
-#include <grass/gis.h>
-#include <grass/imagery.h>
-#include <grass/raster.h>
-#include "globals.h"
-
-
-/* debug */
-#undef DEBUG
-
-#define NLINES 18
-struct box
-{
- int top, bottom, left, right;
-};
-
-
-static int which;
-static struct box more, less, report;
-static int height, size, edge, nlines;
-static int curp, first_point;
-static double rms;
-static double *xres, *yres, *gnd;
-static int pager;
-static int xmax, ymax, gmax;
-static char buf[300];
-static int uparrow(struct box *, int);
-static int downarrow(struct box *, int);
-static int pick(int, int);
-static int done(void);
-static int cancel_which(void);
-static int inbox(struct box *, int, int);
-static int dotext(char *, int, int, int, int, int, int);
-static int compute_transformation(void);
-
-#ifdef DEBUG
-static int debug(char *);
-#endif
-static int to_file(void);
-static int askfile(void);
-static int to_printer(void);
-static int do_report(FILE *);
-static int printcentered(FILE *, char *, int);
-static int show_point(int, int);
-
-#define FMT0(buf,n) \
- sprintf (buf, "%3d ", n)
-#define FMT1(buf,xres,yres,gnd) \
- sprintf (buf, "%5.1f %5.1f %6.1f ", xres,yres,gnd)
-#define LHEAD1 " error "
-#define LHEAD2 " # col row target "
-
-#define FMT2(buf,e1,n1,e2,n2) \
- sprintf (buf, "%9.1f %9.1f %9.1f %9.1f ", e1,n1,e2,n2)
-#define RHEAD1 " image photo "
-#define RHEAD2 " east north X Y "
-
-#define BACKGROUND GREY
-
-int analyze(void)
-{
- static int use = 1;
- static Objects objects[] = {
- MENU("DONE", done, &use),
- MENU("PRINT", to_printer, &use),
- MENU("FILE", to_file, &use),
- INFO(" Double click on point to be included/excluded ", &use),
- OTHER(pick, &use),
- {0}
- };
-
- int color;
- int tsize;
- int cury;
- int len;
- int line;
- int top, bottom, left, right, width, middle, nums;
-
- /* to give user a response of some sort */
- Menu_msg("Preparing analysis ...");
-
- /*
- * build a popup window at center of the screen.
- * 35% the height and wide enough to hold the report
- *
- */
-
- /* height of 1 line, based on NLINES taking up 35% vertical space */
- height = (.35 * (SCREEN_BOTTOM - SCREEN_TOP)) / NLINES + 1;
-
- /* size of text, 80% of line height */
- tsize = .8 * height;
- size = tsize - 2; /* fudge for computing pixels width of text */
-
- /* indent for the text */
- edge = .1 * height + 1;
-
- /* determine the length, in chars, of printed line */
- FMT0(buf, 0);
- nums = strlen(buf) * size;
- FMT1(buf, 0.0, 0.0, 0.0);
- len = strlen(buf);
- middle = len * size;
- FMT2(buf, 0.0, 0.0, 0.0, 0.0);
- len += strlen(buf);
-
- /* width is for max chars plus sidecar for more/less */
- width = len * size + nums + 2 * height;
- if ((SCREEN_RIGHT - SCREEN_LEFT) < width)
- width = SCREEN_RIGHT - SCREEN_LEFT;
-
-
- /* define the window */
- bottom = VIEW_MENU->top - 1;
- top = bottom - height * NLINES;
-
-
- left = SCREEN_LEFT;
- right = left + width;
- middle += left + nums;
- nums += left;
-
- /* save what is under this area, so it can be restored */
- R_panel_save(tempfile1, top, bottom+1, left, right+1);
-
-
- /* fill it with white */
- R_standard_color(BACKGROUND);
- R_box_abs(left, top, right, bottom);
-
- right -= 2 * height; /* reduce it to exclude sidecar */
-
- /* print messages in message area */
- R_text_size(tsize, tsize);
-
-
- /* setup the more/less boxes in the sidecar */
- R_standard_color(BLACK);
- less.top = top;
- less.bottom = top + 2 * height;
- less.left = right;
- less.right = right + 2 * height;
- Outline_box(less.top, less.bottom, less.left, less.right);
-
- more.top = bottom - 2 * height;
- more.bottom = bottom;
- more.left = right;
- more.right = right + 2 * height;
- Outline_box(more.top, more.bottom, more.left, more.right);
-
- /*
- * top two lines are for column labels
- * last two line is for overall rms error.
- */
- nlines = NLINES - 3;
- first_point = 0;
-
- /* allocate predicted values */
- xres = (double *)G_calloc(group.photo_points.count, sizeof(double));
- yres = (double *)G_calloc(group.photo_points.count, sizeof(double));
- gnd = (double *)G_calloc(group.photo_points.count, sizeof(double));
-
- /* compute transformation for the first time */
- compute_transformation();
-
-
- /* put head on the report */
- cury = top;
- dotext(LHEAD1, cury, cury + height, left, middle, 0, BLACK);
- dotext(RHEAD1, cury, cury + height, middle, right - 1, 0, BLACK);
- cury += height;
- dotext(LHEAD2, cury, cury + height, left, middle, 0, BLACK);
- dotext(RHEAD2, cury, cury + height, middle, right - 1, 0, BLACK);
- cury += height;
- R_move_abs(left, cury - 1);
- R_cont_abs(right, cury - 1);
-
- /* isolate the sidecar */
- R_move_abs(right, top);
- R_cont_abs(right, bottom);
-
- /* define report box */
- report.top = cury;
- report.left = left;
- report.right = right;
-
- /* lets do it */
- pager = 1;
- while (1) {
- R_text_size(tsize, tsize);
- line = 0;
- curp = first_point;
- cury = top + 2 * height;
- while (1) {
- if (line >= nlines || curp >= group.photo_points.count)
- break;
- line++;
- if (group.ref_equation_stat > 0 &&
- group.photo_points.status[curp] > 0) {
- color = BLACK;
- FMT1(buf, xres[curp], yres[curp], gnd[curp]);
- if (curp == xmax || curp == ymax || curp == gmax)
- color = RED;
- dotext(buf, cury, cury + height, nums, middle, 0, color);
- }
- else if (group.photo_points.status[curp] > 0)
- dotext("?", cury, cury + height, nums, middle, 1, BLACK);
- else
- dotext("not used", cury, cury + height, nums, middle, 1,
- BLACK);
- if (pager) {
- FMT0(buf, curp + 1);
- dotext(buf, cury, cury + height, left, nums, 0, BLACK);
- FMT2(buf,
- group.photo_points.e1[curp],
- group.photo_points.n1[curp],
- group.photo_points.e2[curp],
- group.photo_points.n2[curp]);
- dotext(buf, cury, cury + height, middle, right - 1, 0, BLACK);
- }
- cury += height;
- curp++;
- }
- report.bottom = cury;
- downarrow(&more,
- curp < group.photo_points.count ? BLACK : BACKGROUND);
- uparrow(&less, first_point > 0 ? BLACK : BACKGROUND);
- R_standard_color(BACKGROUND);
- R_box_abs(left, cury, right - 1, bottom);
- if (group.ref_equation_stat < 0) {
- color = RED;
- strcpy(buf, "Poorly placed reference points");
- }
- else if (group.ref_equation_stat == 0) {
- color = RED;
- strcpy(buf, "No active reference points");
- }
- else {
- color = BLACK;
- sprintf(buf, "Overall rms error: %.2f", rms);
- }
- dotext(buf, bottom - height, bottom, left, right - 1, 0, color);
- R_standard_color(BLACK);
- R_move_abs(left, bottom - height);
- R_cont_abs(right - 1, bottom - height);
-
- pager = 0;
- which = -1;
- if (Input_pointer(objects) < 0)
- break;
- }
-
- /* all done. restore what was under the window */
- right += 2 * height; /* move it back over the sidecar */
- R_standard_color(BACKGROUND);
- R_box_abs(left, top, right, bottom);
- R_panel_restore(tempfile1);
- R_panel_delete(tempfile1);
- R_flush();
-
- G_free(xres);
- G_free(yres);
- G_free(gnd);
- I_put_ref_points(group.name, &group.photo_points);
- display_ref_points(1);
- return 0; /* return but don't QUIT */
-}
-
-
-static int uparrow(struct box *box, int color)
-{
- R_standard_color(color);
- Uparrow(box->top + edge, box->bottom - edge, box->left + edge,
- box->right - edge);
-
- return 0;
-}
-
-static int downarrow(struct box *box, int color)
-{
- R_standard_color(color);
- Downarrow(box->top + edge, box->bottom - edge, box->left + edge,
- box->right - edge);
-
- return 0;
-}
-
-static int pick(int x, int y)
-{
- int n;
- int cur;
-
- cur = which;
- cancel_which();
- if (inbox(&more, x, y)) {
- if (curp >= group.photo_points.count)
- return 0;
- first_point = curp;
- pager = 1;
- return 1;
- }
- if (inbox(&less, x, y)) {
- if (first_point == 0)
- return 0;
- first_point -= nlines;
- if (first_point < 0)
- first_point = 0;
- pager = 1;
- return 1;
- }
- if (!inbox(&report, x, y)) {
- return 0;
- }
-
- n = (y - report.top) / height;
- if (n == cur) { /* second click! */
-#ifdef DEBUG
- debug("have second click n = %d", n);
-#endif
- group.photo_points.status[first_point + n] =
- !group.photo_points.status[first_point + n];
- compute_transformation();
- show_point(first_point + n, 1);
- return 1;
- }
-
- /* first click */
- which = n;
- show_point(first_point + n, 0);
- R_standard_color(RED);
- Outline_box((report.top + n * height)+1, report.top + (n + 1) * height,
- report.left, report.right - 1);
- R_flush();
- return 0; /* ignore first click */
-
-}
-
-static int done(void)
-{
- cancel_which();
- return -1;
-}
-
-static int cancel_which(void)
-{
- if (which >= 0) {
- R_standard_color(BACKGROUND);
- Outline_box((report.top + which * height)+1,
- report.top + (which + 1) * height, report.left,
- report.right - 1);
- show_point(first_point + which, 1);
- }
- which = -1;
-
- return 0;
-}
-
-static int inbox(struct box *box, int x, int y)
-{
- return (x > box->left && x < box->right && y > box->top &&
- y < box->bottom);
-}
-
-static int dotext(char *text, int top, int bottom, int left, int right,
- int centered, int color)
-{
- R_standard_color(BACKGROUND);
- R_box_abs(left, top, right, bottom);
- R_standard_color(color);
- R_move_abs(left + 1 + edge, bottom - 1 - edge);
- if (centered)
- R_move_rel((right - left - strlen(text) * size) / 2, 0);
- R_set_window(top, bottom, left, right); /* for text clipping */
- R_text(text);
- R_set_window(SCREEN_TOP, SCREEN_BOTTOM, SCREEN_LEFT, SCREEN_RIGHT);
-
- return 0;
-}
-
-static int compute_transformation(void)
-{
- int n, count;
- double d, d1, d2, sum;
- double e1, e2, n1, n2;
- double xval, yval, gval;
-
- xmax = ymax = gmax = 0;
- xval = yval = gval = 0.0;
-
- Compute_equation();
- if (group.ref_equation_stat <= 0)
- return 1;
-
- /* compute the row,col error plus ground error
- * keep track of largest and second largest error
- */
- sum = 0.0;
- rms = 0.0;
- count = 0;
- for (n = 0; n < group.photo_points.count; n++) {
- if (group.photo_points.status[n] <= 0)
- continue;
- count++;
- I_georef(group.photo_points.e2[n], group.photo_points.n2[n], &e1, &n1,
- group.E21, group.N21);
- I_georef(group.photo_points.e1[n], group.photo_points.n1[n], &e2, &n2,
- group.E12, group.N12);
-
- if ((d = xres[n] = e1 - group.photo_points.e1[n]) < 0)
- d = -d;
- if (d > xval) {
- xmax = n;
- xval = d;
- }
-
- if ((d = yres[n] = n1 - group.photo_points.n1[n]) < 0)
- d = -d;
- if (d > yval) {
- ymax = n;
- yval = d;
- }
-
- /* compute ground error (ie along diagonal) */
- d1 = e2 - group.photo_points.e2[n];
- d2 = n2 - group.photo_points.n2[n];
- d = d1 * d1 + d2 * d2;
- sum += d; /* add it to rms sum, before taking sqrt */
- d = sqrt(d);
- gnd[n] = d;
- if (d > gval) { /* is this one the max? */
- gmax = n;
- gval = d;
- }
- }
-
- /* compute overall rms error */
- if (count)
- rms = sqrt(sum / count);
-
- return 0;
-}
-
-#ifdef DEBUG
-static int debug(char *msg)
-{
- R_stabilize();
- Curses_write_window(PROMPT_WINDOW, 1, 1, msg);
- Curses_getch(0);
-
- return 0;
-}
-#endif
-
-static int to_file(void)
-{
- FILE *fd;
- char msg[1024];
-
- cancel_which();
- if (Input_other(askfile, "Keyboard") < 0) {
- return 0;
- }
-
- fd = fopen(buf, "w");
- if (fd == NULL) {
- sprintf(msg, "** Unable to create file %s\n", buf);
- Beep();
- Curses_write_window(PROMPT_WINDOW, 2, 1, msg);
- }
- else {
- do_report(fd);
- fclose(fd);
- sprintf(msg, "Report saved in file %s\n", buf);
- Curses_write_window(PROMPT_WINDOW, 2, 1, msg);
- }
- return 0;
-}
-
-static int askfile(void)
-{
- char file[100];
-
- while (1) {
- Curses_prompt_gets("Enter file to hold report: ", file);
- G_strip(file);
- if (*file == 0)
- return -1;
- if (G_index(file, '/'))
- strcpy(buf, file);
- else
- sprintf(buf, "%s/%s", G_home(), file);
- if (access(buf, 0) != 0)
- return 1;
- sprintf(buf, "** %s already exists. choose another file", file);
- Beep();
- Curses_write_window(PROMPT_WINDOW, 2, 1, buf);
- }
-
- return 0;
-}
-
-static int to_printer(void)
-{
- FILE *fd;
-
- cancel_which();
- Menu_msg("sending report to printer ...");
-
- fd = popen("lpr", "w");
- do_report(fd);
- pclose(fd);
- return 0;
-}
-
-static int do_report(FILE * fd)
-{
- char buf[100];
- int n;
- int width;
-
- fprintf(fd, "LOCATION: %-20s GROUP: %-20s MAPSET: %s\n\n",
- G_location(), group.name, G_mapset());
- fprintf(fd, "%15sAnalysis of control point registration\n\n", "");
- fprintf(fd, "%s %s\n", LHEAD1, RHEAD1);
- fprintf(fd, "%s %s\n", LHEAD2, RHEAD2);
-
- FMT1(buf, 0.0, 0.0, 0.0);
- width = strlen(buf);
-
- for (n = 0; n < group.photo_points.count; n++) {
- FMT0(buf, n + 1);
- fprintf(fd, "%s", buf);
- if (group.ref_equation_stat > 0 && group.photo_points.status[n] > 0) {
- FMT1(buf, xres[n], yres[n], gnd[n]);
- fprintf(fd, "%s", buf);
- }
- else if (group.photo_points.status[n] > 0)
- printcentered(fd, "?", width);
- else
- printcentered(fd, "not used", width);
- FMT2(buf,
- group.photo_points.e1[n],
- group.photo_points.n1[n],
- group.photo_points.e2[n], group.photo_points.n2[n]);
- fprintf(fd, " %s\n", buf);
- }
- fprintf(fd, "\n");
- if (group.ref_equation_stat < 0)
- fprintf(fd, "Poorly place control points\n");
- else if (group.ref_equation_stat == 0)
- fprintf(fd, "No active control points\n");
- else
- fprintf(fd, "Overall rms error: %.2f\n", rms);
-
- return 0;
-}
-
-static int printcentered(FILE * fd, char *buf, int width)
-{
- int len;
- int n;
- int i;
-
- len = strlen(buf);
- n = (width - len) / 2;
-
- for (i = 0; i < n; i++)
- fprintf(fd, " ");
- fprintf(fd, "%s", buf);
- i += len;
- while (i++ < width)
- fprintf(fd, " ");
-
- return 0;
-}
-
-static int show_point(int n, int true_color)
-{
- if (!true_color)
- R_standard_color(ORANGE);
- else if (group.photo_points.status[n])
- R_standard_color(GREEN);
- else
- R_standard_color(RED);
- display_one_point(VIEW_MAP1, group.photo_points.e1[n],
- group.photo_points.n1[n]);
-
- return 0;
-}
Copied: grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2image/analyze.c (from rev 44501, grass/branches/develbranch_6/imagery/i.ortho.photo/i.photo.2image/analyze.c)
===================================================================
--- grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2image/analyze.c (rev 0)
+++ grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2image/analyze.c 2010-12-22 10:05:10 UTC (rev 44654)
@@ -0,0 +1,591 @@
+#include <string.h>
+#include <math.h>
+#include <unistd.h>
+#include <grass/gis.h>
+#include <grass/imagery.h>
+#include <grass/raster.h>
+#include "globals.h"
+
+
+/* debug */
+#undef DEBUG
+
+#define NLINES 18
+struct box
+{
+ int top, bottom, left, right;
+};
+
+
+static int which;
+static struct box more, less, report;
+static int height, size, edge, nlines;
+static int curp, first_point;
+static double rms;
+static double *xres, *yres, *gnd;
+static int pager;
+static int xmax, ymax, gmax;
+static char buf[300];
+static int uparrow(struct box *, int);
+static int downarrow(struct box *, int);
+static int pick(int, int);
+static int done(void);
+static int cancel_which(void);
+static int inbox(struct box *, int, int);
+static int dotext(char *, int, int, int, int, int, int);
+static int compute_transformation(void);
+
+#ifdef DEBUG
+static int debug(char *);
+#endif
+static int to_file(void);
+static int askfile(void);
+static int to_printer(void);
+static int do_report(FILE *);
+static int printcentered(FILE *, char *, int);
+static int show_point(int, int);
+
+#define FMT0(buf,n) \
+ sprintf (buf, "%3d ", n)
+#define FMT1(buf,xres,yres,gnd) \
+ sprintf (buf, "%5.1f %5.1f %6.1f ", xres,yres,gnd)
+#define LHEAD1 " error "
+#define LHEAD2 " # col row target "
+
+#define FMT2(buf,e1,n1,e2,n2) \
+ sprintf (buf, "%9.1f %9.1f %9.1f %9.1f ", e1,n1,e2,n2)
+#define RHEAD1 " image photo "
+#define RHEAD2 " east north X Y "
+
+#define BACKGROUND GREY
+
+int analyze(void)
+{
+ static int use = 1;
+ static Objects objects[] = {
+ MENU("DONE", done, &use),
+ MENU("PRINT", to_printer, &use),
+ MENU("FILE", to_file, &use),
+ INFO(" Double click on point to be included/excluded ", &use),
+ OTHER(pick, &use),
+ {0}
+ };
+
+ int color;
+ int tsize;
+ int cury;
+ int len;
+ int line;
+ int top, bottom, left, right, width, middle, nums;
+
+ /* to give user a response of some sort */
+ Menu_msg("Preparing analysis ...");
+
+ /*
+ * build a popup window at center of the screen.
+ * 35% the height and wide enough to hold the report
+ *
+ */
+
+ /* height of 1 line, based on NLINES taking up 35% vertical space */
+ height = (.35 * (SCREEN_BOTTOM - SCREEN_TOP)) / NLINES + 1;
+
+ /* size of text, 80% of line height */
+ tsize = .8 * height;
+ size = tsize - 2; /* fudge for computing pixels width of text */
+
+ /* indent for the text */
+ edge = .1 * height + 1;
+
+ /* determine the length, in chars, of printed line */
+ FMT0(buf, 0);
+ nums = strlen(buf) * size;
+ FMT1(buf, 0.0, 0.0, 0.0);
+ len = strlen(buf);
+ middle = len * size;
+ FMT2(buf, 0.0, 0.0, 0.0, 0.0);
+ len += strlen(buf);
+
+ /* width is for max chars plus sidecar for more/less */
+ width = len * size + nums + 2 * height;
+ if ((SCREEN_RIGHT - SCREEN_LEFT) < width)
+ width = SCREEN_RIGHT - SCREEN_LEFT;
+
+
+ /* define the window */
+ bottom = VIEW_MENU->top - 1;
+ top = bottom - height * NLINES;
+
+
+ left = SCREEN_LEFT;
+ right = left + width;
+ middle += left + nums;
+ nums += left;
+
+ /* save what is under this area, so it can be restored */
+ R_panel_save(tempfile1, top, bottom+1, left, right+1);
+
+
+ /* fill it with white */
+ R_standard_color(BACKGROUND);
+ R_box_abs(left, top, right, bottom);
+
+ right -= 2 * height; /* reduce it to exclude sidecar */
+
+ /* print messages in message area */
+ R_text_size(tsize, tsize);
+
+
+ /* setup the more/less boxes in the sidecar */
+ R_standard_color(BLACK);
+ less.top = top;
+ less.bottom = top + 2 * height;
+ less.left = right;
+ less.right = right + 2 * height;
+ Outline_box(less.top, less.bottom, less.left, less.right);
+
+ more.top = bottom - 2 * height;
+ more.bottom = bottom;
+ more.left = right;
+ more.right = right + 2 * height;
+ Outline_box(more.top, more.bottom, more.left, more.right);
+
+ /*
+ * top two lines are for column labels
+ * last two line is for overall rms error.
+ */
+ nlines = NLINES - 3;
+ first_point = 0;
+
+ /* allocate predicted values */
+ xres = (double *)G_calloc(group.photo_points.count, sizeof(double));
+ yres = (double *)G_calloc(group.photo_points.count, sizeof(double));
+ gnd = (double *)G_calloc(group.photo_points.count, sizeof(double));
+
+ /* compute transformation for the first time */
+ compute_transformation();
+
+
+ /* put head on the report */
+ cury = top;
+ dotext(LHEAD1, cury, cury + height, left, middle, 0, BLACK);
+ dotext(RHEAD1, cury, cury + height, middle, right - 1, 0, BLACK);
+ cury += height;
+ dotext(LHEAD2, cury, cury + height, left, middle, 0, BLACK);
+ dotext(RHEAD2, cury, cury + height, middle, right - 1, 0, BLACK);
+ cury += height;
+ R_move_abs(left, cury - 1);
+ R_cont_abs(right, cury - 1);
+
+ /* isolate the sidecar */
+ R_move_abs(right, top);
+ R_cont_abs(right, bottom);
+
+ /* define report box */
+ report.top = cury;
+ report.left = left;
+ report.right = right;
+
+ /* lets do it */
+ pager = 1;
+ while (1) {
+ R_text_size(tsize, tsize);
+ line = 0;
+ curp = first_point;
+ cury = top + 2 * height;
+ while (1) {
+ if (line >= nlines || curp >= group.photo_points.count)
+ break;
+ line++;
+ if (group.ref_equation_stat > 0 &&
+ group.photo_points.status[curp] > 0) {
+ color = BLACK;
+ FMT1(buf, xres[curp], yres[curp], gnd[curp]);
+ if (curp == xmax || curp == ymax || curp == gmax)
+ color = RED;
+ dotext(buf, cury, cury + height, nums, middle, 0, color);
+ }
+ else if (group.photo_points.status[curp] > 0)
+ dotext("?", cury, cury + height, nums, middle, 1, BLACK);
+ else
+ dotext("not used", cury, cury + height, nums, middle, 1,
+ BLACK);
+ if (pager) {
+ FMT0(buf, curp + 1);
+ dotext(buf, cury, cury + height, left, nums, 0, BLACK);
+ FMT2(buf,
+ group.photo_points.e1[curp],
+ group.photo_points.n1[curp],
+ group.photo_points.e2[curp],
+ group.photo_points.n2[curp]);
+ dotext(buf, cury, cury + height, middle, right - 1, 0, BLACK);
+ }
+ cury += height;
+ curp++;
+ }
+ report.bottom = cury;
+ downarrow(&more,
+ curp < group.photo_points.count ? BLACK : BACKGROUND);
+ uparrow(&less, first_point > 0 ? BLACK : BACKGROUND);
+ R_standard_color(BACKGROUND);
+ R_box_abs(left, cury, right - 1, bottom);
+ if (group.ref_equation_stat < 0) {
+ color = RED;
+ strcpy(buf, "Poorly placed reference points");
+ }
+ else if (group.ref_equation_stat == 0) {
+ color = RED;
+ strcpy(buf, "No active reference points");
+ }
+ else {
+ color = BLACK;
+ sprintf(buf, "Overall rms error: %.2f", rms);
+ }
+ dotext(buf, bottom - height, bottom, left, right - 1, 0, color);
+ R_standard_color(BLACK);
+ R_move_abs(left, bottom - height);
+ R_cont_abs(right - 1, bottom - height);
+
+ pager = 0;
+ which = -1;
+ if (Input_pointer(objects) < 0)
+ break;
+ }
+
+ /* all done. restore what was under the window */
+ right += 2 * height; /* move it back over the sidecar */
+ R_standard_color(BACKGROUND);
+ R_box_abs(left, top, right, bottom);
+ R_panel_restore(tempfile1);
+ R_panel_delete(tempfile1);
+ R_flush();
+
+ G_free(xres);
+ G_free(yres);
+ G_free(gnd);
+ I_put_ref_points(group.name, &group.photo_points);
+ display_ref_points(1);
+ return 0; /* return but don't QUIT */
+}
+
+
+static int uparrow(struct box *box, int color)
+{
+ R_standard_color(color);
+ Uparrow(box->top + edge, box->bottom - edge, box->left + edge,
+ box->right - edge);
+
+ return 0;
+}
+
+static int downarrow(struct box *box, int color)
+{
+ R_standard_color(color);
+ Downarrow(box->top + edge, box->bottom - edge, box->left + edge,
+ box->right - edge);
+
+ return 0;
+}
+
+static int pick(int x, int y)
+{
+ int n;
+ int cur;
+
+ cur = which;
+ cancel_which();
+ if (inbox(&more, x, y)) {
+ if (curp >= group.photo_points.count)
+ return 0;
+ first_point = curp;
+ pager = 1;
+ return 1;
+ }
+ if (inbox(&less, x, y)) {
+ if (first_point == 0)
+ return 0;
+ first_point -= nlines;
+ if (first_point < 0)
+ first_point = 0;
+ pager = 1;
+ return 1;
+ }
+ if (!inbox(&report, x, y)) {
+ return 0;
+ }
+
+ n = (y - report.top) / height;
+ if (n == cur) { /* second click! */
+#ifdef DEBUG
+ debug("have second click n = %d", n);
+#endif
+ group.photo_points.status[first_point + n] =
+ !group.photo_points.status[first_point + n];
+ compute_transformation();
+ show_point(first_point + n, 1);
+ return 1;
+ }
+
+ /* first click */
+ which = n;
+ show_point(first_point + n, 0);
+ R_standard_color(RED);
+ Outline_box((report.top + n * height)+1, report.top + (n + 1) * height,
+ report.left, report.right - 1);
+ R_flush();
+ return 0; /* ignore first click */
+
+}
+
+static int done(void)
+{
+ cancel_which();
+ return -1;
+}
+
+static int cancel_which(void)
+{
+ if (which >= 0) {
+ R_standard_color(BACKGROUND);
+ Outline_box((report.top + which * height)+1,
+ report.top + (which + 1) * height, report.left,
+ report.right - 1);
+ show_point(first_point + which, 1);
+ }
+ which = -1;
+
+ return 0;
+}
+
+static int inbox(struct box *box, int x, int y)
+{
+ return (x > box->left && x < box->right && y > box->top &&
+ y < box->bottom);
+}
+
+static int dotext(char *text, int top, int bottom, int left, int right,
+ int centered, int color)
+{
+ R_standard_color(BACKGROUND);
+ R_box_abs(left, top, right, bottom);
+ R_standard_color(color);
+ R_move_abs(left + 1 + edge, bottom - 1 - edge);
+ if (centered)
+ R_move_rel((right - left - strlen(text) * size) / 2, 0);
+ R_set_window(top, bottom, left, right); /* for text clipping */
+ R_text(text);
+ R_set_window(SCREEN_TOP, SCREEN_BOTTOM, SCREEN_LEFT, SCREEN_RIGHT);
+
+ return 0;
+}
+
+static int compute_transformation(void)
+{
+ int n, count;
+ double d, d1, d2, sum;
+ double e1, e2, n1, n2;
+ double xval, yval, gval;
+
+ xmax = ymax = gmax = 0;
+ xval = yval = gval = 0.0;
+
+ Compute_equation();
+ if (group.ref_equation_stat <= 0)
+ return 1;
+
+ /* compute the row,col error plus ground error
+ * keep track of largest and second largest error
+ */
+ sum = 0.0;
+ rms = 0.0;
+ count = 0;
+ for (n = 0; n < group.photo_points.count; n++) {
+ if (group.photo_points.status[n] <= 0)
+ continue;
+ count++;
+ I_georef(group.photo_points.e2[n], group.photo_points.n2[n], &e1, &n1,
+ group.E21, group.N21);
+ I_georef(group.photo_points.e1[n], group.photo_points.n1[n], &e2, &n2,
+ group.E12, group.N12);
+
+ if ((d = xres[n] = e1 - group.photo_points.e1[n]) < 0)
+ d = -d;
+ if (d > xval) {
+ xmax = n;
+ xval = d;
+ }
+
+ if ((d = yres[n] = n1 - group.photo_points.n1[n]) < 0)
+ d = -d;
+ if (d > yval) {
+ ymax = n;
+ yval = d;
+ }
+
+ /* compute ground error (ie along diagonal) */
+ d1 = e2 - group.photo_points.e2[n];
+ d2 = n2 - group.photo_points.n2[n];
+ d = d1 * d1 + d2 * d2;
+ sum += d; /* add it to rms sum, before taking sqrt */
+ d = sqrt(d);
+ gnd[n] = d;
+ if (d > gval) { /* is this one the max? */
+ gmax = n;
+ gval = d;
+ }
+ }
+
+ /* compute overall rms error */
+ if (count)
+ rms = sqrt(sum / count);
+
+ return 0;
+}
+
+#ifdef DEBUG
+static int debug(char *msg)
+{
+ R_stabilize();
+ Curses_write_window(PROMPT_WINDOW, 1, 1, msg);
+ Curses_getch(0);
+
+ return 0;
+}
+#endif
+
+static int to_file(void)
+{
+ FILE *fd;
+ char msg[1024];
+
+ cancel_which();
+ if (Input_other(askfile, "Keyboard") < 0) {
+ return 0;
+ }
+
+ fd = fopen(buf, "w");
+ if (fd == NULL) {
+ sprintf(msg, "** Unable to create file %s\n", buf);
+ Beep();
+ Curses_write_window(PROMPT_WINDOW, 2, 1, msg);
+ }
+ else {
+ do_report(fd);
+ fclose(fd);
+ sprintf(msg, "Report saved in file %s\n", buf);
+ Curses_write_window(PROMPT_WINDOW, 2, 1, msg);
+ }
+ return 0;
+}
+
+static int askfile(void)
+{
+ char file[100];
+
+ while (1) {
+ Curses_prompt_gets("Enter file to hold report: ", file);
+ G_strip(file);
+ if (*file == 0)
+ return -1;
+ if (G_index(file, '/'))
+ strcpy(buf, file);
+ else
+ sprintf(buf, "%s/%s", G_home(), file);
+ if (access(buf, 0) != 0)
+ return 1;
+ sprintf(buf, "** %s already exists. choose another file", file);
+ Beep();
+ Curses_write_window(PROMPT_WINDOW, 2, 1, buf);
+ }
+
+ return 0;
+}
+
+static int to_printer(void)
+{
+ FILE *fd;
+
+ cancel_which();
+ Menu_msg("sending report to printer ...");
+
+ fd = popen("lpr", "w");
+ do_report(fd);
+ pclose(fd);
+ return 0;
+}
+
+static int do_report(FILE * fd)
+{
+ char buf[100];
+ int n;
+ int width;
+
+ fprintf(fd, "LOCATION: %-20s GROUP: %-20s MAPSET: %s\n\n",
+ G_location(), group.name, G_mapset());
+ fprintf(fd, "%15sAnalysis of control point registration\n\n", "");
+ fprintf(fd, "%s %s\n", LHEAD1, RHEAD1);
+ fprintf(fd, "%s %s\n", LHEAD2, RHEAD2);
+
+ FMT1(buf, 0.0, 0.0, 0.0);
+ width = strlen(buf);
+
+ for (n = 0; n < group.photo_points.count; n++) {
+ FMT0(buf, n + 1);
+ fprintf(fd, "%s", buf);
+ if (group.ref_equation_stat > 0 && group.photo_points.status[n] > 0) {
+ FMT1(buf, xres[n], yres[n], gnd[n]);
+ fprintf(fd, "%s", buf);
+ }
+ else if (group.photo_points.status[n] > 0)
+ printcentered(fd, "?", width);
+ else
+ printcentered(fd, "not used", width);
+ FMT2(buf,
+ group.photo_points.e1[n],
+ group.photo_points.n1[n],
+ group.photo_points.e2[n], group.photo_points.n2[n]);
+ fprintf(fd, " %s\n", buf);
+ }
+ fprintf(fd, "\n");
+ if (group.ref_equation_stat < 0)
+ fprintf(fd, "Poorly place control points\n");
+ else if (group.ref_equation_stat == 0)
+ fprintf(fd, "No active control points\n");
+ else
+ fprintf(fd, "Overall rms error: %.2f\n", rms);
+
+ return 0;
+}
+
+static int printcentered(FILE * fd, char *buf, int width)
+{
+ int len;
+ int n;
+ int i;
+
+ len = strlen(buf);
+ n = (width - len) / 2;
+
+ for (i = 0; i < n; i++)
+ fprintf(fd, " ");
+ fprintf(fd, "%s", buf);
+ i += len;
+ while (i++ < width)
+ fprintf(fd, " ");
+
+ return 0;
+}
+
+static int show_point(int n, int true_color)
+{
+ if (!true_color)
+ R_standard_color(ORANGE);
+ else if (group.photo_points.status[n])
+ R_standard_color(GREEN);
+ else
+ R_standard_color(RED);
+ display_one_point(VIEW_MAP1, group.photo_points.e1[n],
+ group.photo_points.n1[n]);
+
+ return 0;
+}
Deleted: grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2image/ask.c
===================================================================
--- grass/branches/develbranch_6/imagery/i.ortho.photo/i.photo.2image/ask.c 2010-12-01 09:34:37 UTC (rev 44501)
+++ grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2image/ask.c 2010-12-22 10:05:10 UTC (rev 44654)
@@ -1,389 +0,0 @@
-#include <string.h>
-#include <stdlib.h>
-#include <grass/gis.h>
-#include <grass/raster.h>
-#include "globals.h"
-
-
-#define NLINES 18
-struct box
-{
- int top, bottom, left, right;
-};
-
-
-static int text_size;
-static int which;
-static struct box cancel, more, less;
-static int height, size, edge, count;
-static int page, npages;
-static struct
-{
- char name[30], mapset[30];
- struct box box;
-} list[NLINES * 2];
-
-static int dobox(struct box *, char *, int, int, int, int, int);
-static int dotext(char *, int, int, int, int, int);
-static int inbox(struct box *, int, int);
-static int cancel_which(void);
-static int pick(int, int);
-static int downarrow(struct box *, int);
-static int uparrow(struct box *, int);
-static int dobox(struct box *, char *, int, int, int, int, int);
-
-int ask_gis_files(char *type, char *file, char *xname,
- char *xmapset, int position)
-{
- static int use = 1;
- static Objects objects[] = {
- OTHER(pick, &use),
- {0}
- };
-
- char msg[100];
- FILE *fd;
- int width;
- int len1, len2, len;
- long offset;
- long *page_offset;
- int col, nlist;
- int line;
- int stat;
- char buf[100];
- int top, bottom, left, right, center;
- int topx, bottomx, leftx, rightx, widthx;
- char name[30], mapset[30], cur_mapset[30];
- int new_mapset;
-
- Menu_msg("");
- fd = fopen(file, "r");
- if (fd == NULL)
- G_fatal_error("ask_gis_files: can't read tempfile");
- if (fread(&len1, sizeof(len1), 1, fd) != 1
- || fread(&len2, sizeof(len2), 1, fd) != 1 || len1 <= 0 || len2 <= 0) {
- fclose(fd);
- return 0;
- }
-
- sprintf(msg, "Double click on %s file to be plotted", type);
-
- /*
- * build a popup window at center of the screen.
- * 35% the height and wide enough to hold 2 columms of file names
- *
- * the window is for choosing file names and will be laid out in 2 columns
- *
- * ------------------------------------------
- * | CANCEL | (MORE) | (LESS) |
- * ------------------------------------------
- * | mapset |
- * ------------------------------------------
- * | name1 | name2 |
- * ------------------------------------------
- * | name3 | name4 |
- * ------------------------------------------
- * | name5 | name6 |
- * | . |
- * | . |
- * | . |
- * ------------------------------------------
- */
-
- /* height of 1 line, based on NLINES taking up 35% vertical space */
- height = (.35 * (SCREEN_BOTTOM - SCREEN_TOP)) / NLINES + 1;
-
- /* size of text, 80% of line height */
- text_size = .8 * height;
- size = text_size - 1; /* fudge for computing pixels width of text */
-
- /* indent for the text */
- edge = .1 * height + 1;
-
- /* this is a fudge to determine the length of the largest text */
- len1 = 2 * len1; /* name in 2 columns */
- len2 += strlen("mapset ");
- len = (len1 > len2 ? len1 : len2);
-
- /* width is for max chars plus sidecar for more/less */
- width = len * size + height;
- widthx = strlen(msg) * size;
- if (widthx < width)
- widthx = width;
-
- /* define the window */
- top = (SCREEN_TOP + SCREEN_BOTTOM - height * NLINES) / 2;
- bottom = top + height * NLINES;
-
- center = (SCREEN_LEFT + SCREEN_RIGHT) / 2;
- if (position > 0) {
- right = (center + SCREEN_RIGHT + width) / 2;
- if (right >= SCREEN_RIGHT)
- right = SCREEN_RIGHT - 1;
- left = right - width;
- }
- else if (position < 0) {
- left = (center + SCREEN_LEFT - width) / 2;
- if (left <= SCREEN_LEFT)
- left = SCREEN_LEFT + 1;
- right = left + width;
- }
- else {
- left = center + width / 2;
- right = left + width;
- }
-
- topx = top - 3 * height;
- bottomx = topx + 2 * height;
- leftx = (left + right - widthx) / 2;
- if (leftx < SCREEN_LEFT)
- leftx = SCREEN_LEFT;
- rightx = leftx + widthx;
-
- /* save what is under these areas, so they can be restored */
- R_panel_save(tempfile1, top, bottom+1, left, right+1);
- R_panel_save(tempfile2, topx, bottomx+1, leftx, rightx+1);
-
- /* fill it top with GREY, pick area with white */
- R_standard_color(WHITE);
- R_box_abs(left, top, right, bottom);
- R_standard_color(GREY);
- R_box_abs(leftx, topx, rightx, bottomx);
-
- R_standard_color(BLACK);
- Outline_box(top, bottom, left, right);
- right -= height; /* reduce it to exclude sidecar */
- Outline_box(top, bottom, left, right);
-
- /* print messages above the files */
- dotext(msg, topx, topx + height, leftx, rightx, 1);
- dotext("Double click here to cancel", topx + height, bottomx, leftx,
- rightx, 1);
- cancel.top = topx;
- cancel.bottom = bottomx;
- cancel.left = leftx;
- cancel.right = rightx;
-
- /* start the mouse in the cancel box */
- Set_mouse_xy((leftx + rightx) / 2, (topx + bottomx) / 2);
-
- dobox(&less, "", WHITE, top, right, right + height, 0);
- dobox(&more, "", WHITE, bottom - height, right, right + height, 0);
-
- /* as we read the file of names, keep track of pages so we can
- * page backward
- */
- page = 0;
- page_offset = (long *)G_calloc(npages = 1, sizeof(long));
- *page_offset = ftell(fd);
-
- nlist = sizeof(list) / sizeof(list[0]);
- for (stat = -1; stat < 0;) {
- line = 0;
- count = 0;
- *cur_mapset = 0;
- col = 0;
- while (1) {
- offset = ftell(fd);
- if (fgets(buf, sizeof buf, fd) == NULL
- || sscanf(buf, "%s %s", name, mapset) != 2)
- break;
-
- if ((new_mapset = (strcmp(cur_mapset, mapset) != 0))) {
- if (line)
- line++;
- if (col)
- line++;
- col = 0;
- }
- if (count >= nlist || line + new_mapset >= NLINES) {
- if (page + 1 == npages) {
- npages++;
- page_offset =
- (long *)G_realloc(page_offset, npages * sizeof(long));
- page_offset[npages - 1] = offset;
- }
- break;
- }
- if (new_mapset) {
- struct box dummy;
- char label[100];
-
- strcpy(cur_mapset, mapset);
- sprintf(label, "Mapset %s", mapset);
- dobox(&dummy, label, WHITE, top + line * height, left, right,
- 0);
- line++;
- }
- if (col) {
- dobox(&list[count].box, name, GREY, top + line * height,
- left + width / 2, right, 0);
- line++;
- col = 0;
- }
- else {
- dobox(&list[count].box, name, GREY, top + line * height, left,
- left + width / 2, 0);
- col = 1;
- }
- strcpy(list[count].name, name);
- strcpy(list[count].mapset, mapset);
- count++;
- }
- downarrow(&more, page + 1 < npages ? BLACK : WHITE);
- uparrow(&less, page > 0 ? BLACK : WHITE);
- which = -1;
- switch (Input_pointer(objects)) {
- case -1: /* more or less */
- break;
- case -2: /* cancel */
- stat = 0;
- continue;
- default: /* file picked */
- strcpy(xname, list[which].name);
- strcpy(xmapset, list[which].mapset);
- stat = 1;
- continue;
- }
- fseek(fd, page_offset[page], 0);
- R_standard_color(WHITE);
- R_box_abs(left + 1, top + 1, right - 1, bottom - 1);
- }
-
- /* all done. restore what was under the window */
- right += height; /* move it back over the sidecar */
- R_standard_color(WHITE);
- R_box_abs(left, top, right, bottom);
- R_panel_restore(tempfile1);
- R_panel_restore(tempfile2);
- R_panel_delete(tempfile1);
- R_panel_delete(tempfile2);
- R_flush();
-
- G_free(page_offset);
- return stat;
-}
-
-static int dobox(struct box *box, char *text,
- int color, int top, int left, int right, int centered)
-{
- int bottom;
-
- bottom = top + height;
- /* fill inside of box with color */
- R_standard_color(color);
- R_box_abs(left + 1, top + 1, right - 1, bottom - 1);
-
- /* draw box outline and text in black */
- R_standard_color(BLACK);
- Outline_box(top, bottom, left, right);
- dotext(text, top, bottom, left, right, centered);
- R_flush();
-
- box->top = top;
- box->bottom = bottom;
- box->left = left;
- box->right = right;
-
- return 0;
-}
-
-static int uparrow(struct box *box, int color)
-{
- R_standard_color(color);
- Uparrow(box->top + edge, box->bottom - edge, box->left + edge,
- box->right - edge);
-
- return 0;
-}
-
-static int downarrow(struct box *box, int color)
-{
- R_standard_color(color);
- Downarrow(box->top + edge, box->bottom - edge, box->left + edge,
- box->right - edge);
-
- return 0;
-}
-
-static int pick(int x, int y)
-{
- int n;
-
- if (inbox(&more, x, y)) {
- cancel_which();
- if (page + 1 >= npages)
- return 0;
- page++;
- return -1;
- }
- if (inbox(&less, x, y)) {
- cancel_which();
- if (page == 0)
- return 0;
- page--;
- return -1;
- }
- if (inbox(&cancel, x, y)) {
- if (which == -2)
- return -2;
- cancel_which();
- which = -2;
- R_standard_color(RED);
- Outline_box(cancel.top, cancel.bottom, cancel.left, cancel.right);
- R_flush();
- return 0;
- }
- /* search name list. handle double click */
- for (n = 0; n < count; n++)
- if (inbox(&list[n].box, x, y)) {
- if (n == which) /* second click! */
- return 1;
- cancel_which();
- which = n;
- R_standard_color(RED);
- Outline_box(list[n].box.top, list[n].box.bottom,
- list[n].box.left, list[n].box.right);
- R_flush();
- return 0; /* ignore first click */
- }
-
- cancel_which();
- return 0;
-}
-
-static int cancel_which(void)
-{
- if (which == -2) {
- R_standard_color(BLACK);
- Outline_box(cancel.top, cancel.bottom, cancel.left, cancel.right);
- }
- else if (which >= 0) {
- R_standard_color(BLACK);
- Outline_box(list[which].box.top, list[which].box.bottom,
- list[which].box.left, list[which].box.right);
- }
- which = -1;
-
- return 0;
-}
-
-static int inbox(struct box *box, int x, int y)
-{
- return (x > box->left && x < box->right && y > box->top &&
- y < box->bottom);
-}
-
-static int dotext(char *text,
- int top, int bottom, int left, int right, int centered)
-{
- R_text_size(text_size, text_size);
- R_move_abs(left + 1 + edge, bottom - 1 - edge);
- if (centered)
- R_move_rel((right - left - strlen(text) * size) / 2, 0);
- R_set_window(top, bottom, left, right); /* for text clipping */
- R_text(text);
- R_set_window(SCREEN_TOP, SCREEN_BOTTOM, SCREEN_LEFT, SCREEN_RIGHT);
-
- return 0;
-}
Copied: grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2image/ask.c (from rev 44501, grass/branches/develbranch_6/imagery/i.ortho.photo/i.photo.2image/ask.c)
===================================================================
--- grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2image/ask.c (rev 0)
+++ grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2image/ask.c 2010-12-22 10:05:10 UTC (rev 44654)
@@ -0,0 +1,389 @@
+#include <string.h>
+#include <stdlib.h>
+#include <grass/gis.h>
+#include <grass/raster.h>
+#include "globals.h"
+
+
+#define NLINES 18
+struct box
+{
+ int top, bottom, left, right;
+};
+
+
+static int text_size;
+static int which;
+static struct box cancel, more, less;
+static int height, size, edge, count;
+static int page, npages;
+static struct
+{
+ char name[30], mapset[30];
+ struct box box;
+} list[NLINES * 2];
+
+static int dobox(struct box *, char *, int, int, int, int, int);
+static int dotext(char *, int, int, int, int, int);
+static int inbox(struct box *, int, int);
+static int cancel_which(void);
+static int pick(int, int);
+static int downarrow(struct box *, int);
+static int uparrow(struct box *, int);
+static int dobox(struct box *, char *, int, int, int, int, int);
+
+int ask_gis_files(char *type, char *file, char *xname,
+ char *xmapset, int position)
+{
+ static int use = 1;
+ static Objects objects[] = {
+ OTHER(pick, &use),
+ {0}
+ };
+
+ char msg[100];
+ FILE *fd;
+ int width;
+ int len1, len2, len;
+ long offset;
+ long *page_offset;
+ int col, nlist;
+ int line;
+ int stat;
+ char buf[100];
+ int top, bottom, left, right, center;
+ int topx, bottomx, leftx, rightx, widthx;
+ char name[30], mapset[30], cur_mapset[30];
+ int new_mapset;
+
+ Menu_msg("");
+ fd = fopen(file, "r");
+ if (fd == NULL)
+ G_fatal_error("ask_gis_files: can't read tempfile");
+ if (fread(&len1, sizeof(len1), 1, fd) != 1
+ || fread(&len2, sizeof(len2), 1, fd) != 1 || len1 <= 0 || len2 <= 0) {
+ fclose(fd);
+ return 0;
+ }
+
+ sprintf(msg, "Double click on %s file to be plotted", type);
+
+ /*
+ * build a popup window at center of the screen.
+ * 35% the height and wide enough to hold 2 columms of file names
+ *
+ * the window is for choosing file names and will be laid out in 2 columns
+ *
+ * ------------------------------------------
+ * | CANCEL | (MORE) | (LESS) |
+ * ------------------------------------------
+ * | mapset |
+ * ------------------------------------------
+ * | name1 | name2 |
+ * ------------------------------------------
+ * | name3 | name4 |
+ * ------------------------------------------
+ * | name5 | name6 |
+ * | . |
+ * | . |
+ * | . |
+ * ------------------------------------------
+ */
+
+ /* height of 1 line, based on NLINES taking up 35% vertical space */
+ height = (.35 * (SCREEN_BOTTOM - SCREEN_TOP)) / NLINES + 1;
+
+ /* size of text, 80% of line height */
+ text_size = .8 * height;
+ size = text_size - 1; /* fudge for computing pixels width of text */
+
+ /* indent for the text */
+ edge = .1 * height + 1;
+
+ /* this is a fudge to determine the length of the largest text */
+ len1 = 2 * len1; /* name in 2 columns */
+ len2 += strlen("mapset ");
+ len = (len1 > len2 ? len1 : len2);
+
+ /* width is for max chars plus sidecar for more/less */
+ width = len * size + height;
+ widthx = strlen(msg) * size;
+ if (widthx < width)
+ widthx = width;
+
+ /* define the window */
+ top = (SCREEN_TOP + SCREEN_BOTTOM - height * NLINES) / 2;
+ bottom = top + height * NLINES;
+
+ center = (SCREEN_LEFT + SCREEN_RIGHT) / 2;
+ if (position > 0) {
+ right = (center + SCREEN_RIGHT + width) / 2;
+ if (right >= SCREEN_RIGHT)
+ right = SCREEN_RIGHT - 1;
+ left = right - width;
+ }
+ else if (position < 0) {
+ left = (center + SCREEN_LEFT - width) / 2;
+ if (left <= SCREEN_LEFT)
+ left = SCREEN_LEFT + 1;
+ right = left + width;
+ }
+ else {
+ left = center + width / 2;
+ right = left + width;
+ }
+
+ topx = top - 3 * height;
+ bottomx = topx + 2 * height;
+ leftx = (left + right - widthx) / 2;
+ if (leftx < SCREEN_LEFT)
+ leftx = SCREEN_LEFT;
+ rightx = leftx + widthx;
+
+ /* save what is under these areas, so they can be restored */
+ R_panel_save(tempfile1, top, bottom+1, left, right+1);
+ R_panel_save(tempfile2, topx, bottomx+1, leftx, rightx+1);
+
+ /* fill it top with GREY, pick area with white */
+ R_standard_color(WHITE);
+ R_box_abs(left, top, right, bottom);
+ R_standard_color(GREY);
+ R_box_abs(leftx, topx, rightx, bottomx);
+
+ R_standard_color(BLACK);
+ Outline_box(top, bottom, left, right);
+ right -= height; /* reduce it to exclude sidecar */
+ Outline_box(top, bottom, left, right);
+
+ /* print messages above the files */
+ dotext(msg, topx, topx + height, leftx, rightx, 1);
+ dotext("Double click here to cancel", topx + height, bottomx, leftx,
+ rightx, 1);
+ cancel.top = topx;
+ cancel.bottom = bottomx;
+ cancel.left = leftx;
+ cancel.right = rightx;
+
+ /* start the mouse in the cancel box */
+ Set_mouse_xy((leftx + rightx) / 2, (topx + bottomx) / 2);
+
+ dobox(&less, "", WHITE, top, right, right + height, 0);
+ dobox(&more, "", WHITE, bottom - height, right, right + height, 0);
+
+ /* as we read the file of names, keep track of pages so we can
+ * page backward
+ */
+ page = 0;
+ page_offset = (long *)G_calloc(npages = 1, sizeof(long));
+ *page_offset = ftell(fd);
+
+ nlist = sizeof(list) / sizeof(list[0]);
+ for (stat = -1; stat < 0;) {
+ line = 0;
+ count = 0;
+ *cur_mapset = 0;
+ col = 0;
+ while (1) {
+ offset = ftell(fd);
+ if (fgets(buf, sizeof buf, fd) == NULL
+ || sscanf(buf, "%s %s", name, mapset) != 2)
+ break;
+
+ if ((new_mapset = (strcmp(cur_mapset, mapset) != 0))) {
+ if (line)
+ line++;
+ if (col)
+ line++;
+ col = 0;
+ }
+ if (count >= nlist || line + new_mapset >= NLINES) {
+ if (page + 1 == npages) {
+ npages++;
+ page_offset =
+ (long *)G_realloc(page_offset, npages * sizeof(long));
+ page_offset[npages - 1] = offset;
+ }
+ break;
+ }
+ if (new_mapset) {
+ struct box dummy;
+ char label[100];
+
+ strcpy(cur_mapset, mapset);
+ sprintf(label, "Mapset %s", mapset);
+ dobox(&dummy, label, WHITE, top + line * height, left, right,
+ 0);
+ line++;
+ }
+ if (col) {
+ dobox(&list[count].box, name, GREY, top + line * height,
+ left + width / 2, right, 0);
+ line++;
+ col = 0;
+ }
+ else {
+ dobox(&list[count].box, name, GREY, top + line * height, left,
+ left + width / 2, 0);
+ col = 1;
+ }
+ strcpy(list[count].name, name);
+ strcpy(list[count].mapset, mapset);
+ count++;
+ }
+ downarrow(&more, page + 1 < npages ? BLACK : WHITE);
+ uparrow(&less, page > 0 ? BLACK : WHITE);
+ which = -1;
+ switch (Input_pointer(objects)) {
+ case -1: /* more or less */
+ break;
+ case -2: /* cancel */
+ stat = 0;
+ continue;
+ default: /* file picked */
+ strcpy(xname, list[which].name);
+ strcpy(xmapset, list[which].mapset);
+ stat = 1;
+ continue;
+ }
+ fseek(fd, page_offset[page], 0);
+ R_standard_color(WHITE);
+ R_box_abs(left + 1, top + 1, right - 1, bottom - 1);
+ }
+
+ /* all done. restore what was under the window */
+ right += height; /* move it back over the sidecar */
+ R_standard_color(WHITE);
+ R_box_abs(left, top, right, bottom);
+ R_panel_restore(tempfile1);
+ R_panel_restore(tempfile2);
+ R_panel_delete(tempfile1);
+ R_panel_delete(tempfile2);
+ R_flush();
+
+ G_free(page_offset);
+ return stat;
+}
+
+static int dobox(struct box *box, char *text,
+ int color, int top, int left, int right, int centered)
+{
+ int bottom;
+
+ bottom = top + height;
+ /* fill inside of box with color */
+ R_standard_color(color);
+ R_box_abs(left + 1, top + 1, right - 1, bottom - 1);
+
+ /* draw box outline and text in black */
+ R_standard_color(BLACK);
+ Outline_box(top, bottom, left, right);
+ dotext(text, top, bottom, left, right, centered);
+ R_flush();
+
+ box->top = top;
+ box->bottom = bottom;
+ box->left = left;
+ box->right = right;
+
+ return 0;
+}
+
+static int uparrow(struct box *box, int color)
+{
+ R_standard_color(color);
+ Uparrow(box->top + edge, box->bottom - edge, box->left + edge,
+ box->right - edge);
+
+ return 0;
+}
+
+static int downarrow(struct box *box, int color)
+{
+ R_standard_color(color);
+ Downarrow(box->top + edge, box->bottom - edge, box->left + edge,
+ box->right - edge);
+
+ return 0;
+}
+
+static int pick(int x, int y)
+{
+ int n;
+
+ if (inbox(&more, x, y)) {
+ cancel_which();
+ if (page + 1 >= npages)
+ return 0;
+ page++;
+ return -1;
+ }
+ if (inbox(&less, x, y)) {
+ cancel_which();
+ if (page == 0)
+ return 0;
+ page--;
+ return -1;
+ }
+ if (inbox(&cancel, x, y)) {
+ if (which == -2)
+ return -2;
+ cancel_which();
+ which = -2;
+ R_standard_color(RED);
+ Outline_box(cancel.top, cancel.bottom, cancel.left, cancel.right);
+ R_flush();
+ return 0;
+ }
+ /* search name list. handle double click */
+ for (n = 0; n < count; n++)
+ if (inbox(&list[n].box, x, y)) {
+ if (n == which) /* second click! */
+ return 1;
+ cancel_which();
+ which = n;
+ R_standard_color(RED);
+ Outline_box(list[n].box.top, list[n].box.bottom,
+ list[n].box.left, list[n].box.right);
+ R_flush();
+ return 0; /* ignore first click */
+ }
+
+ cancel_which();
+ return 0;
+}
+
+static int cancel_which(void)
+{
+ if (which == -2) {
+ R_standard_color(BLACK);
+ Outline_box(cancel.top, cancel.bottom, cancel.left, cancel.right);
+ }
+ else if (which >= 0) {
+ R_standard_color(BLACK);
+ Outline_box(list[which].box.top, list[which].box.bottom,
+ list[which].box.left, list[which].box.right);
+ }
+ which = -1;
+
+ return 0;
+}
+
+static int inbox(struct box *box, int x, int y)
+{
+ return (x > box->left && x < box->right && y > box->top &&
+ y < box->bottom);
+}
+
+static int dotext(char *text,
+ int top, int bottom, int left, int right, int centered)
+{
+ R_text_size(text_size, text_size);
+ R_move_abs(left + 1 + edge, bottom - 1 - edge);
+ if (centered)
+ R_move_rel((right - left - strlen(text) * size) / 2, 0);
+ R_set_window(top, bottom, left, right); /* for text clipping */
+ R_text(text);
+ R_set_window(SCREEN_TOP, SCREEN_BOTTOM, SCREEN_LEFT, SCREEN_RIGHT);
+
+ return 0;
+}
Deleted: grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2image/ask_mag.c
===================================================================
--- grass/branches/develbranch_6/imagery/i.ortho.photo/i.photo.2image/ask_mag.c 2010-12-01 09:34:37 UTC (rev 44501)
+++ grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2image/ask_mag.c 2010-12-22 10:05:10 UTC (rev 44654)
@@ -1,162 +0,0 @@
-#include <grass/raster.h>
-#include "globals.h"
-
-struct box
-{
- int top, bottom, left, right;
-};
-
-static struct box plus, minus, value;
-static struct box cancel, accept;
-static int mag;
-static int incr(int, int);
-static int dotext(char *, int, int, int, int, int);
-static int inbox(struct box *, int, int);
-
-int ask_magnification(int *magnification)
-{
- static int use = 1;
- int x, y;
- int height;
- int stat;
- int width;
- int top, bottom, left, right;
-
- static Objects objects[] = {
- OTHER(incr, &use),
- {0}
- };
-
- Menu_msg("");
-
- mag = *magnification;
- if (mag < 1)
- mag = 1;
-
- height = VIEW_MENU->nrows;
- R_text_size(height - 4, height - 4);
-
-
- Get_mouse_xy(&x, &y);
- top = y - height / 2;
- if (top < SCREEN_TOP)
- top = SCREEN_TOP;
- bottom = top + 4 * height;
- if (bottom >= VIEW_MENU->top) {
- top -= bottom - (VIEW_MENU->top - 1);
- bottom = VIEW_MENU->top - 1;
- }
- width = Text_width("MAGNIFICATION") + 4;
- left = x - width / 2;
- if (left < SCREEN_LEFT)
- left = SCREEN_LEFT;
- right = left + width;
- if (right > SCREEN_RIGHT) {
- left -= right - SCREEN_RIGHT;
- right = SCREEN_RIGHT;
- }
-
- R_panel_save(tempfile1, top, bottom, left, right);
- R_standard_color(WHITE);
- R_box_abs(left, top, right, bottom);
- R_standard_color(BLACK);
- Outline_box(top, bottom, left, right);
-
- plus.top = top + height;
- plus.bottom = plus.top + height;
- plus.left = left;
- plus.right = plus.left + Text_width("++") + 4;
- Outline_box(plus.top, plus.bottom, plus.left, plus.right);
-
- minus.top = top + height;
- minus.bottom = minus.top + height;
- minus.right = right;
- minus.left = minus.right - Text_width("--") - 4;
- Outline_box(minus.top, minus.bottom, minus.left, minus.right);
-
- value.top = top + height;
- value.bottom = value.top + height;
- value.left = plus.right;
- value.right = minus.left;
- Outline_box(value.top, value.bottom, value.left, value.right);
-
- accept.top = value.bottom;
- accept.bottom = accept.top + height;
- accept.left = left;
- accept.right = right;
- Outline_box(accept.top, accept.bottom, accept.left, accept.right);
-
- cancel.top = accept.bottom;
- cancel.bottom = cancel.top + height;
- cancel.left = left;
- cancel.right = right;
- Outline_box(cancel.top, cancel.bottom, cancel.left, cancel.right);
-
- dotext("MAGNIFICATION", top, top + height, left, right, WHITE);
- dotext("+", plus.top, plus.bottom, plus.left, plus.right, GREY);
- dotext("-", minus.top, minus.bottom, minus.left, minus.right, GREY);
- dotext("ACCEPT", accept.top, accept.bottom, accept.left, accept.right,
- GREY);
- dotext("CANCEL", cancel.top, cancel.bottom, cancel.left, cancel.right,
- GREY);
- draw_mag();
-
- stat = Input_pointer(objects);
-
- /* to respond to user */
- R_standard_color(WHITE);
- R_box_abs(left, top, right, bottom);
- R_flush();
-
- R_panel_restore(tempfile1);
- R_panel_delete(tempfile1);
-
- *magnification = mag;
- return stat > 0;
-}
-
-int draw_mag(void)
-{
- char buf[10];
-
- sprintf(buf, "%d", mag);
- dotext(buf, value.top, value.bottom, value.left, value.right, WHITE);
-
- return 0;
-}
-
-static int incr(int x, int y)
-{
- if (inbox(&accept, x, y))
- return 1;
- if (inbox(&cancel, x, y))
- return -1;
- if (inbox(&plus, x, y)) {
- mag++;
- draw_mag();
- }
- else if (inbox(&minus, x, y) && mag > 1) {
- mag--;
- draw_mag();
- }
- return 0;
-}
-
-static int dotext(char *text, int top, int bottom, int left, int right,
- int background)
-{
- R_standard_color(background);
- R_box_abs(left + 1, top + 1, right - 1, bottom - 1);
- R_standard_color(BLACK);
- /* center the text */
- left = (left + right - Text_width(text)) / 2;
- Text(text, top, bottom, left, right, 2);
-
- return 0;
-}
-
-static int inbox(struct box *box, int x, int y)
-{
- return (x > box->left && x < box->right && y > box->top &&
- y < box->bottom);
-}
Copied: grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2image/ask_mag.c (from rev 44501, grass/branches/develbranch_6/imagery/i.ortho.photo/i.photo.2image/ask_mag.c)
===================================================================
--- grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2image/ask_mag.c (rev 0)
+++ grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2image/ask_mag.c 2010-12-22 10:05:10 UTC (rev 44654)
@@ -0,0 +1,162 @@
+#include <grass/raster.h>
+#include "globals.h"
+
+struct box
+{
+ int top, bottom, left, right;
+};
+
+static struct box plus, minus, value;
+static struct box cancel, accept;
+static int mag;
+static int incr(int, int);
+static int dotext(char *, int, int, int, int, int);
+static int inbox(struct box *, int, int);
+
+int ask_magnification(int *magnification)
+{
+ static int use = 1;
+ int x, y;
+ int height;
+ int stat;
+ int width;
+ int top, bottom, left, right;
+
+ static Objects objects[] = {
+ OTHER(incr, &use),
+ {0}
+ };
+
+ Menu_msg("");
+
+ mag = *magnification;
+ if (mag < 1)
+ mag = 1;
+
+ height = VIEW_MENU->nrows;
+ R_text_size(height - 4, height - 4);
+
+
+ Get_mouse_xy(&x, &y);
+ top = y - height / 2;
+ if (top < SCREEN_TOP)
+ top = SCREEN_TOP;
+ bottom = top + 4 * height;
+ if (bottom >= VIEW_MENU->top) {
+ top -= bottom - (VIEW_MENU->top - 1);
+ bottom = VIEW_MENU->top - 1;
+ }
+ width = Text_width("MAGNIFICATION") + 4;
+ left = x - width / 2;
+ if (left < SCREEN_LEFT)
+ left = SCREEN_LEFT;
+ right = left + width;
+ if (right > SCREEN_RIGHT) {
+ left -= right - SCREEN_RIGHT;
+ right = SCREEN_RIGHT;
+ }
+
+ R_panel_save(tempfile1, top, bottom, left, right);
+ R_standard_color(WHITE);
+ R_box_abs(left, top, right, bottom);
+ R_standard_color(BLACK);
+ Outline_box(top, bottom, left, right);
+
+ plus.top = top + height;
+ plus.bottom = plus.top + height;
+ plus.left = left;
+ plus.right = plus.left + Text_width("++") + 4;
+ Outline_box(plus.top, plus.bottom, plus.left, plus.right);
+
+ minus.top = top + height;
+ minus.bottom = minus.top + height;
+ minus.right = right;
+ minus.left = minus.right - Text_width("--") - 4;
+ Outline_box(minus.top, minus.bottom, minus.left, minus.right);
+
+ value.top = top + height;
+ value.bottom = value.top + height;
+ value.left = plus.right;
+ value.right = minus.left;
+ Outline_box(value.top, value.bottom, value.left, value.right);
+
+ accept.top = value.bottom;
+ accept.bottom = accept.top + height;
+ accept.left = left;
+ accept.right = right;
+ Outline_box(accept.top, accept.bottom, accept.left, accept.right);
+
+ cancel.top = accept.bottom;
+ cancel.bottom = cancel.top + height;
+ cancel.left = left;
+ cancel.right = right;
+ Outline_box(cancel.top, cancel.bottom, cancel.left, cancel.right);
+
+ dotext("MAGNIFICATION", top, top + height, left, right, WHITE);
+ dotext("+", plus.top, plus.bottom, plus.left, plus.right, GREY);
+ dotext("-", minus.top, minus.bottom, minus.left, minus.right, GREY);
+ dotext("ACCEPT", accept.top, accept.bottom, accept.left, accept.right,
+ GREY);
+ dotext("CANCEL", cancel.top, cancel.bottom, cancel.left, cancel.right,
+ GREY);
+ draw_mag();
+
+ stat = Input_pointer(objects);
+
+ /* to respond to user */
+ R_standard_color(WHITE);
+ R_box_abs(left, top, right, bottom);
+ R_flush();
+
+ R_panel_restore(tempfile1);
+ R_panel_delete(tempfile1);
+
+ *magnification = mag;
+ return stat > 0;
+}
+
+int draw_mag(void)
+{
+ char buf[10];
+
+ sprintf(buf, "%d", mag);
+ dotext(buf, value.top, value.bottom, value.left, value.right, WHITE);
+
+ return 0;
+}
+
+static int incr(int x, int y)
+{
+ if (inbox(&accept, x, y))
+ return 1;
+ if (inbox(&cancel, x, y))
+ return -1;
+ if (inbox(&plus, x, y)) {
+ mag++;
+ draw_mag();
+ }
+ else if (inbox(&minus, x, y) && mag > 1) {
+ mag--;
+ draw_mag();
+ }
+ return 0;
+}
+
+static int dotext(char *text, int top, int bottom, int left, int right,
+ int background)
+{
+ R_standard_color(background);
+ R_box_abs(left + 1, top + 1, right - 1, bottom - 1);
+ R_standard_color(BLACK);
+ /* center the text */
+ left = (left + right - Text_width(text)) / 2;
+ Text(text, top, bottom, left, right, 2);
+
+ return 0;
+}
+
+static int inbox(struct box *box, int x, int y)
+{
+ return (x > box->left && x < box->right && y > box->top &&
+ y < box->bottom);
+}
Deleted: grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2image/call.c
===================================================================
--- grass/branches/develbranch_6/imagery/i.ortho.photo/i.photo.2image/call.c 2010-12-01 09:34:37 UTC (rev 44501)
+++ grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2image/call.c 2010-12-22 10:05:10 UTC (rev 44654)
@@ -1,57 +0,0 @@
-#include <stdlib.h>
-#include <unistd.h>
-#include <signal.h>
-#include <sys/types.h>
-#ifdef __MINGW32__
-#include <process.h>
-#else
-#include <sys/wait.h>
-#endif
-#include <grass/gis.h>
-#include <grass/raster.h>
-#include "globals.h"
-/*
- * call a subroutine, but as a child process
- * allowing interrupts for the child
- */
-
-int call(int (*function) (), char *msg)
-{
- int pid;
- int w, status;
- char i_msg[80];
-
- /*
- * build interrupt msg
- */
- sprintf(i_msg, "Hit %s %s\n", G_unctrl(interrupt_char), msg);
- /*
- * make sure all graphics have gotten to the monitor
- */
- R_stabilize();
-
- /* fork to create child */
- pid = fork();
- if (pid < 0) {
- End_curses();
- perror("Can't fork");
- exit(1);
- }
-
- /* parent just waits for child */
- Curses_allow_interrupts(1);
- if (pid) {
- Curses_write_window(PROMPT_WINDOW, 1, 1, i_msg);
- while ((w = wait(&status)) != pid && w != -1) ;
- Curses_allow_interrupts(0);
- Curses_write_window(PROMPT_WINDOW, 1, 1, "\n");
- }
-
- /* child turns on interrupts and calls the function */
- else {
- signal(SIGINT, SIG_DFL);
- (*function) ();
- exit(0);
- }
- return 0;
-}
Copied: grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2image/call.c (from rev 44501, grass/branches/develbranch_6/imagery/i.ortho.photo/i.photo.2image/call.c)
===================================================================
--- grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2image/call.c (rev 0)
+++ grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2image/call.c 2010-12-22 10:05:10 UTC (rev 44654)
@@ -0,0 +1,57 @@
+#include <stdlib.h>
+#include <unistd.h>
+#include <signal.h>
+#include <sys/types.h>
+#ifdef __MINGW32__
+#include <process.h>
+#else
+#include <sys/wait.h>
+#endif
+#include <grass/gis.h>
+#include <grass/raster.h>
+#include "globals.h"
+/*
+ * call a subroutine, but as a child process
+ * allowing interrupts for the child
+ */
+
+int call(int (*function) (), char *msg)
+{
+ int pid;
+ int w, status;
+ char i_msg[80];
+
+ /*
+ * build interrupt msg
+ */
+ sprintf(i_msg, "Hit %s %s\n", G_unctrl(interrupt_char), msg);
+ /*
+ * make sure all graphics have gotten to the monitor
+ */
+ R_stabilize();
+
+ /* fork to create child */
+ pid = fork();
+ if (pid < 0) {
+ End_curses();
+ perror("Can't fork");
+ exit(1);
+ }
+
+ /* parent just waits for child */
+ Curses_allow_interrupts(1);
+ if (pid) {
+ Curses_write_window(PROMPT_WINDOW, 1, 1, i_msg);
+ while ((w = wait(&status)) != pid && w != -1) ;
+ Curses_allow_interrupts(0);
+ Curses_write_window(PROMPT_WINDOW, 1, 1, "\n");
+ }
+
+ /* child turns on interrupts and calls the function */
+ else {
+ signal(SIGINT, SIG_DFL);
+ (*function) ();
+ exit(0);
+ }
+ return 0;
+}
Deleted: grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2image/camera_ref.h
===================================================================
--- grass/branches/develbranch_6/imagery/i.ortho.photo/i.photo.2image/camera_ref.h 2010-12-01 09:34:37 UTC (rev 44501)
+++ grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2image/camera_ref.h 2010-12-22 10:05:10 UTC (rev 44654)
@@ -1,57 +0,0 @@
-/* camera_ref.h */
-
-#define BACKGROUND GREY
-#define NLINES 20
-
-static int ok;
-
-struct box
-{
- int top, bottom, left, right;
-};
-
-#ifndef GLOBALCAM
-# define GLOBALCAM extern
-#endif
-
-GLOBALCAM int which;
-GLOBALCAM struct box more, less, report;
-GLOBALCAM int height, size, edge, nlines;
-GLOBALCAM int curp, cury, first_point;
-GLOBALCAM double rms;
-GLOBALCAM char cam_name[30], cam_id[30];
-GLOBALCAM double Xp, Yp, cfl;
-GLOBALCAM int num_fid;
-GLOBALCAM char fid_id[5];
-GLOBALCAM double *Xf, *Yf;
-GLOBALCAM int pager;
-GLOBALCAM int xmax, ymax, gmax;
-GLOBALCAM int color;
-GLOBALCAM int tsize;
-GLOBALCAM int cury;
-GLOBALCAM int len;
-GLOBALCAM int line;
-GLOBALCAM int top, bottom, left, right, width, middle, nums;
-
-#define FMT0(buf,n) \
- sprintf (buf, "%3d ", n)
-#define FMT0f(buf,n) \
- sprintf (buf, "%3f ", n)
-#define FMT1(buf,fid_id,Xf,Yf) \
- sprintf (buf, " %10s %10.4f %10.4f ", fid_id,Xf,Yf)
-#define FMT2(buf,cam_name) \
- sprintf (buf, "CAMERA NAME %10s", cam_name)
-#define FMT3(buf,cam_id) \
- sprintf (buf, "CAMERA ID %10s", cam_id)
-#define FMT4(buf,cfl) \
- sprintf (buf, "CAMERA CFL %10.4f", cfl)
-#define FMT5(buf, Xp) \
- sprintf (buf, "CAMERA XP %10.4f", Xp)
-#define FMT6(buf, Yp) \
- sprintf (buf, "CAMERA YP %10.4f", Yp)
-#define FMT7(buf, num_fid) \
- sprintf (buf, "number of fid. %5d", num_fid)
-#define LHEAD1 " CAMERA REFERENCE FILE "
-#define LHEAD3 " "
-#define LHEAD4 " ID Photo X Photo Y "
-#define LHEAD2 "----------------------------------------------"
Copied: grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2image/camera_ref.h (from rev 44501, grass/branches/develbranch_6/imagery/i.ortho.photo/i.photo.2image/camera_ref.h)
===================================================================
--- grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2image/camera_ref.h (rev 0)
+++ grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2image/camera_ref.h 2010-12-22 10:05:10 UTC (rev 44654)
@@ -0,0 +1,57 @@
+/* camera_ref.h */
+
+#define BACKGROUND GREY
+#define NLINES 20
+
+static int ok;
+
+struct box
+{
+ int top, bottom, left, right;
+};
+
+#ifndef GLOBALCAM
+# define GLOBALCAM extern
+#endif
+
+GLOBALCAM int which;
+GLOBALCAM struct box more, less, report;
+GLOBALCAM int height, size, edge, nlines;
+GLOBALCAM int curp, cury, first_point;
+GLOBALCAM double rms;
+GLOBALCAM char cam_name[30], cam_id[30];
+GLOBALCAM double Xp, Yp, cfl;
+GLOBALCAM int num_fid;
+GLOBALCAM char fid_id[5];
+GLOBALCAM double *Xf, *Yf;
+GLOBALCAM int pager;
+GLOBALCAM int xmax, ymax, gmax;
+GLOBALCAM int color;
+GLOBALCAM int tsize;
+GLOBALCAM int cury;
+GLOBALCAM int len;
+GLOBALCAM int line;
+GLOBALCAM int top, bottom, left, right, width, middle, nums;
+
+#define FMT0(buf,n) \
+ sprintf (buf, "%3d ", n)
+#define FMT0f(buf,n) \
+ sprintf (buf, "%3f ", n)
+#define FMT1(buf,fid_id,Xf,Yf) \
+ sprintf (buf, " %10s %10.4f %10.4f ", fid_id,Xf,Yf)
+#define FMT2(buf,cam_name) \
+ sprintf (buf, "CAMERA NAME %10s", cam_name)
+#define FMT3(buf,cam_id) \
+ sprintf (buf, "CAMERA ID %10s", cam_id)
+#define FMT4(buf,cfl) \
+ sprintf (buf, "CAMERA CFL %10.4f", cfl)
+#define FMT5(buf, Xp) \
+ sprintf (buf, "CAMERA XP %10.4f", Xp)
+#define FMT6(buf, Yp) \
+ sprintf (buf, "CAMERA YP %10.4f", Yp)
+#define FMT7(buf, num_fid) \
+ sprintf (buf, "number of fid. %5d", num_fid)
+#define LHEAD1 " CAMERA REFERENCE FILE "
+#define LHEAD3 " "
+#define LHEAD4 " ID Photo X Photo Y "
+#define LHEAD2 "----------------------------------------------"
Deleted: grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2image/cell.c
===================================================================
--- grass/branches/develbranch_6/imagery/i.ortho.photo/i.photo.2image/cell.c 2010-12-01 09:34:37 UTC (rev 44501)
+++ grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2image/cell.c 2010-12-22 10:05:10 UTC (rev 44654)
@@ -1,64 +0,0 @@
-#include <unistd.h>
-#include <grass/gis.h>
-#include "globals.h"
-
-static int use = 1;
-static int cancel(void);
-static int plot(int, int);
-static int choose_cellfile(char *, char *);
-
-int plotcell(int x, int y)
-{
- static Objects objects[] = {
- MENU("CANCEL", cancel, &use),
- INFO("Indicate which side should be plotted", &use),
- OTHER(plot, &use),
- {0}
- };
- /*
- * if the target raster map list is ready, ask the user which side
- * should be plotted, otherwise can only plot group files
- */
- if (access(cell_list, 0) == 0)
- Input_pointer(objects);
- else
- plot(VIEW_MAP1->left + 1, 0);
- return 0;
-}
-
-static int cancel(void)
-{
- return 1;
-}
-
-
-static int plot(int x, int y)
-{
- char name[40], mapset[40];
- struct Cell_head cellhd;
-
- if (x > VIEW_MAP1->left && x < VIEW_MAP1->right) {
- if (!choose_groupfile(name, mapset))
- return 1;
- if (G_get_cellhd(name, mapset, &cellhd) < 0)
- return 1;
-
- Erase_view(VIEW_MAP1_ZOOM);
- VIEW_MAP1_ZOOM->cell.configured = 0;
-
- G_adjust_window_to_box(&cellhd, &VIEW_MAP1->cell.head,
- VIEW_MAP1->nrows, VIEW_MAP1->ncols);
- Configure_view(VIEW_MAP1, name, mapset, cellhd.ns_res, cellhd.ew_res);
- drawcell(VIEW_MAP1);
- }
- else
- return 0; /* ignore mouse click */
-
- display_ref_points(1);
- return 1;
-}
-
-static int choose_cellfile(char *name, char *mapset)
-{
- return ask_gis_files("cell", cell_list, name, mapset, 1);
-}
Copied: grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2image/cell.c (from rev 44501, grass/branches/develbranch_6/imagery/i.ortho.photo/i.photo.2image/cell.c)
===================================================================
--- grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2image/cell.c (rev 0)
+++ grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2image/cell.c 2010-12-22 10:05:10 UTC (rev 44654)
@@ -0,0 +1,64 @@
+#include <unistd.h>
+#include <grass/gis.h>
+#include "globals.h"
+
+static int use = 1;
+static int cancel(void);
+static int plot(int, int);
+static int choose_cellfile(char *, char *);
+
+int plotcell(int x, int y)
+{
+ static Objects objects[] = {
+ MENU("CANCEL", cancel, &use),
+ INFO("Indicate which side should be plotted", &use),
+ OTHER(plot, &use),
+ {0}
+ };
+ /*
+ * if the target raster map list is ready, ask the user which side
+ * should be plotted, otherwise can only plot group files
+ */
+ if (access(cell_list, 0) == 0)
+ Input_pointer(objects);
+ else
+ plot(VIEW_MAP1->left + 1, 0);
+ return 0;
+}
+
+static int cancel(void)
+{
+ return 1;
+}
+
+
+static int plot(int x, int y)
+{
+ char name[40], mapset[40];
+ struct Cell_head cellhd;
+
+ if (x > VIEW_MAP1->left && x < VIEW_MAP1->right) {
+ if (!choose_groupfile(name, mapset))
+ return 1;
+ if (G_get_cellhd(name, mapset, &cellhd) < 0)
+ return 1;
+
+ Erase_view(VIEW_MAP1_ZOOM);
+ VIEW_MAP1_ZOOM->cell.configured = 0;
+
+ G_adjust_window_to_box(&cellhd, &VIEW_MAP1->cell.head,
+ VIEW_MAP1->nrows, VIEW_MAP1->ncols);
+ Configure_view(VIEW_MAP1, name, mapset, cellhd.ns_res, cellhd.ew_res);
+ drawcell(VIEW_MAP1);
+ }
+ else
+ return 0; /* ignore mouse click */
+
+ display_ref_points(1);
+ return 1;
+}
+
+static int choose_cellfile(char *name, char *mapset)
+{
+ return ask_gis_files("cell", cell_list, name, mapset, 1);
+}
Deleted: grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2image/cellhd.c
===================================================================
--- grass/branches/develbranch_6/imagery/i.ortho.photo/i.photo.2image/cellhd.c 2010-12-01 09:34:37 UTC (rev 44501)
+++ grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2image/cellhd.c 2010-12-22 10:05:10 UTC (rev 44654)
@@ -1,23 +0,0 @@
-#include "globals.h"
-
-int Outline_cellhd(View * view, struct Cell_head *cellhd)
-{
- int row, col;
- int top, bottom, left, right;
-
- row = northing_to_row(&view->cell.head, cellhd->north) + .5;
- top = row_to_view(view, row);
-
- col = easting_to_col(&view->cell.head, cellhd->west) + .5;
- left = col_to_view(view, col);
-
- row = northing_to_row(&view->cell.head, cellhd->south) + .5;
- bottom = row_to_view(view, row);
-
- col = easting_to_col(&view->cell.head, cellhd->east) + .5;
- right = col_to_view(view, col);
-
- Outline_box(top, bottom, left, right);
-
- return 0;
-}
Copied: grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2image/cellhd.c (from rev 44501, grass/branches/develbranch_6/imagery/i.ortho.photo/i.photo.2image/cellhd.c)
===================================================================
--- grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2image/cellhd.c (rev 0)
+++ grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2image/cellhd.c 2010-12-22 10:05:10 UTC (rev 44654)
@@ -0,0 +1,23 @@
+#include "globals.h"
+
+int Outline_cellhd(View * view, struct Cell_head *cellhd)
+{
+ int row, col;
+ int top, bottom, left, right;
+
+ row = northing_to_row(&view->cell.head, cellhd->north) + .5;
+ top = row_to_view(view, row);
+
+ col = easting_to_col(&view->cell.head, cellhd->west) + .5;
+ left = col_to_view(view, col);
+
+ row = northing_to_row(&view->cell.head, cellhd->south) + .5;
+ bottom = row_to_view(view, row);
+
+ col = easting_to_col(&view->cell.head, cellhd->east) + .5;
+ right = col_to_view(view, col);
+
+ Outline_box(top, bottom, left, right);
+
+ return 0;
+}
Deleted: grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2image/colors.c
===================================================================
--- grass/branches/develbranch_6/imagery/i.ortho.photo/i.photo.2image/colors.c 2010-12-01 09:34:37 UTC (rev 44501)
+++ grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2image/colors.c 2010-12-22 10:05:10 UTC (rev 44654)
@@ -1,7 +0,0 @@
-#include <grass/gis.h>
-#include <grass/display.h>
-
-int set_colors(struct Colors *colors)
-{
- return 0;
-}
Copied: grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2image/colors.c (from rev 44501, grass/branches/develbranch_6/imagery/i.ortho.photo/i.photo.2image/colors.c)
===================================================================
--- grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2image/colors.c (rev 0)
+++ grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2image/colors.c 2010-12-22 10:05:10 UTC (rev 44654)
@@ -0,0 +1,7 @@
+#include <grass/gis.h>
+#include <grass/display.h>
+
+int set_colors(struct Colors *colors)
+{
+ return 0;
+}
Deleted: grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2image/conv.c
===================================================================
--- grass/branches/develbranch_6/imagery/i.ortho.photo/i.photo.2image/conv.c 2010-12-01 09:34:37 UTC (rev 44501)
+++ grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2image/conv.c 2010-12-22 10:05:10 UTC (rev 44654)
@@ -1,49 +0,0 @@
-#include "globals.h"
-/* conversion routines to convert from view x,y to cell col,row
- * as well as cell col,row to cell east,north
- */
-int view_to_col(View * view, int x)
-{
- return x - view->cell.left;
-}
-
-int view_to_row(View * view, int y)
-{
- return y - view->cell.top;
-}
-
-int col_to_view(View * view, int col)
-{
- return view->cell.left + col;
-}
-
-int row_to_view(View * view, int row)
-{
- return view->cell.top + row;
-}
-
-/* in these next 2 routines, location determines if we are
- * converting from center of the cell (location == .5)
- * top or left edge (location == 0.0)
- * bottom or right edge (location == 1.0)
- */
-
-double row_to_northing(struct Cell_head *cellhd, int row, double location)
-{
- return cellhd->north - (row + location) * cellhd->ns_res;
-}
-
-double col_to_easting(struct Cell_head *cellhd, int col, double location)
-{
- return cellhd->west + (col + location) * cellhd->ew_res;
-}
-
-double northing_to_row(struct Cell_head *cellhd, double north)
-{
- return (cellhd->north - north) / cellhd->ns_res;
-}
-
-double easting_to_col(struct Cell_head *cellhd, double east)
-{
- return (east - cellhd->west) / cellhd->ew_res;
-}
Copied: grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2image/conv.c (from rev 44501, grass/branches/develbranch_6/imagery/i.ortho.photo/i.photo.2image/conv.c)
===================================================================
--- grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2image/conv.c (rev 0)
+++ grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2image/conv.c 2010-12-22 10:05:10 UTC (rev 44654)
@@ -0,0 +1,49 @@
+#include "globals.h"
+/* conversion routines to convert from view x,y to cell col,row
+ * as well as cell col,row to cell east,north
+ */
+int view_to_col(View * view, int x)
+{
+ return x - view->cell.left;
+}
+
+int view_to_row(View * view, int y)
+{
+ return y - view->cell.top;
+}
+
+int col_to_view(View * view, int col)
+{
+ return view->cell.left + col;
+}
+
+int row_to_view(View * view, int row)
+{
+ return view->cell.top + row;
+}
+
+/* in these next 2 routines, location determines if we are
+ * converting from center of the cell (location == .5)
+ * top or left edge (location == 0.0)
+ * bottom or right edge (location == 1.0)
+ */
+
+double row_to_northing(struct Cell_head *cellhd, int row, double location)
+{
+ return cellhd->north - (row + location) * cellhd->ns_res;
+}
+
+double col_to_easting(struct Cell_head *cellhd, int col, double location)
+{
+ return cellhd->west + (col + location) * cellhd->ew_res;
+}
+
+double northing_to_row(struct Cell_head *cellhd, double north)
+{
+ return (cellhd->north - north) / cellhd->ns_res;
+}
+
+double easting_to_col(struct Cell_head *cellhd, double east)
+{
+ return (east - cellhd->west) / cellhd->ew_res;
+}
Deleted: grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2image/curses.c
===================================================================
--- grass/branches/develbranch_6/imagery/i.ortho.photo/i.photo.2image/curses.c 2010-12-01 09:34:37 UTC (rev 44501)
+++ grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2image/curses.c 2010-12-22 10:05:10 UTC (rev 44654)
@@ -1,265 +0,0 @@
-#include <stdlib.h>
-#include <unistd.h>
-#include <grass/gis.h>
-#include "globals.h"
-
-static int inited = 0;
-
-static WINDOW *save;
-WINDOW *newwin();
-
-static Window *make_window(int top, int bottom, int left, int right)
-{
- Window *window;
-
- if (top < 0 || bottom >= LINES || left < 0 || right >= COLS
- || bottom - top <= 1 || right - left <= 1) {
- End_curses();
- G_warning("make_window(%d,%d,%d,%d): illegal screen values.",
- top, bottom, left, right);
- G_sleep(3);
- exit(1);
- }
- window = (Window *) G_malloc(sizeof(Window));
- window->top = top;
- window->bottom = bottom;
- window->left = left;
- window->right = right;
- Curses_clear_window(window);
- return window;
-}
-
-int Begin_curses(void)
-{
- /* should only be called once at program outset */
-
- initscr(); /* initialize curses standard screens */
- raw(); /* set tty modes via curses calls */
- noecho();
- nonl();
-
- inited = 1;
-
- /* make a window to save stdscr */
- save = newwin(LINES, COLS, 0, 0);
-
- /* make_window (nrows, ncols, start_row, start_col) */
- INFO_WINDOW = make_window(0, LINES - 4, COLS / 2, COLS - 1);
- MENU_WINDOW = make_window(0, LINES - 4, 0, COLS / 2);
- PROMPT_WINDOW = make_window(LINES - 4, LINES - 1, 0, COLS - 1);
- refresh();
-
- return 0;
-}
-
-int End_curses(void)
-{
- /* should only be called upon program exit */
-
- clear(); /* clear the screen */
- refresh();
- endwin(); /* let curses reset the tty now */
-
- return 0;
-}
-
-int Suspend_curses(void)
-{
- overwrite(stdscr, save);
- clear();
- refresh();
- endwin();
-
- return 0;
-}
-
-int Resume_curses(void)
-{
- clear();
- refresh();
- overwrite(save, stdscr);
- refresh();
-
- return 0;
-}
-
-int Curses_allow_interrupts(int ok)
-{
- refresh();
- if (ok)
- noraw();
- else
- raw();
-
- return 0;
-}
-
-int Curses_clear_window(Window * window)
-{
- int y, x;
-
- if (!inited)
- return 1;
- for (y = window->top + 1; y < window->bottom; y++) {
- move(y, x = window->left + 1);
- while (x++ < window->right)
- addch(' ');
- }
- Curses_outline_window(window);
- refresh();
-
- return 0;
-}
-
-int Curses_outline_window(Window * window)
-{
- int x, y;
-
- move(window->top, x = window->left + 1);
- while (x++ < window->right)
- addch('-');
- move(window->bottom, x = window->left + 1);
- while (x++ < window->right)
- addch('-');
- for (y = window->top + 1; y < window->bottom; y++) {
- move(y, window->left);
- addch('|');
- move(y, window->right);
- addch('|');
- }
- move(window->top, window->left);
- addch('+');
- move(window->top, window->right);
- addch('+');
- move(window->bottom, window->left);
- addch('+');
- if (window->bottom < LINES - 1 || window->right < COLS - 1) {
- move(window->bottom, window->right);
- addch('+');
- }
-
- return 0;
-}
-
-int Curses_write_window(Window * window, int line, int col, char *message)
-{
- int y, x, i;
-
- if (!inited) {
- fprintf(stderr, "%s\n", message);
- return 1;
- }
- if (line <= 0 || line >= window->bottom - window->top)
- return 1;
- if (col <= 0 || col >= window->right - window->left)
- return 1;
- move(y = window->top + line, x = window->left + col);
- while (*message != 0 && *message != '\n' && x < window->right) {
- addch(*message);
- message++;
- x++;
- }
- if (*message == '\n')
- for (i = x; i < window->right; i++)
- addch(' ');
- move(y, x);
- refresh();
-
- return 0;
-}
-
-int Curses_replot_screen(void)
-{
- int x, y;
-
- getyx(stdscr, y, x);
- wrefresh(curscr);
- move(y, x);
- refresh();
-
- return 0;
-}
-
-int Curses_prompt_gets(char *prompt, char *answer)
-{
- char c;
- int n;
- int y, x;
-
- *answer = 0;
- n = 0;
-
- Curses_write_window(PROMPT_WINDOW, 1, 1, "\n");
- Curses_write_window(PROMPT_WINDOW, 1, 1, prompt);
-
- for (;;) {
- refresh();
- c = Curses_getch(0);
- if (c == '\n' || c == '\r')
- break;
-
- getyx(stdscr, y, x);
- if (c > '\037' && c < '\177') { /* octal codes: accept space to '~' */
- if (x < PROMPT_WINDOW->right) {
- *answer++ = c;
- *answer = 0;
- addch(c);
- n++;
- }
- continue;
- }
- if (c == '\b' || c == '\177') { /* backspace or DEL (decimal 8,127) */
- if (n > 0) {
- answer--;
- *answer = 0;
- move(y, x - 1);
- addch(' ');
- move(y, x - 1);
- n--;
- }
- continue;
- }
- Beep();
- }
-
- return 0;
-}
-
-int Beep(void)
-{
- putchar('\7');
- fflush(stdout);
-
- return 0;
-}
-
-int Curses_getch(int with_echo)
-{
- char achar;
- int c;
- int kill;
-
- if (!inited)
- return 0;
- kill = 0;
- while (1) {
- c = getch() & 0177;
- if (c == interrupt_char) {
- if (kill++ >= 3) {
- End_curses();
- exit(0);
- }
- continue;
- }
- kill = 0;
- if (c != 18)
- break;
- Curses_replot_screen();
- }
- if (with_echo) {
- achar = c;
- addch(achar);
- refresh();
- }
- return c;
-}
Copied: grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2image/curses.c (from rev 44501, grass/branches/develbranch_6/imagery/i.ortho.photo/i.photo.2image/curses.c)
===================================================================
--- grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2image/curses.c (rev 0)
+++ grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2image/curses.c 2010-12-22 10:05:10 UTC (rev 44654)
@@ -0,0 +1,265 @@
+#include <stdlib.h>
+#include <unistd.h>
+#include <grass/gis.h>
+#include "globals.h"
+
+static int inited = 0;
+
+static WINDOW *save;
+WINDOW *newwin();
+
+static Window *make_window(int top, int bottom, int left, int right)
+{
+ Window *window;
+
+ if (top < 0 || bottom >= LINES || left < 0 || right >= COLS
+ || bottom - top <= 1 || right - left <= 1) {
+ End_curses();
+ G_warning("make_window(%d,%d,%d,%d): illegal screen values.",
+ top, bottom, left, right);
+ G_sleep(3);
+ exit(1);
+ }
+ window = (Window *) G_malloc(sizeof(Window));
+ window->top = top;
+ window->bottom = bottom;
+ window->left = left;
+ window->right = right;
+ Curses_clear_window(window);
+ return window;
+}
+
+int Begin_curses(void)
+{
+ /* should only be called once at program outset */
+
+ initscr(); /* initialize curses standard screens */
+ raw(); /* set tty modes via curses calls */
+ noecho();
+ nonl();
+
+ inited = 1;
+
+ /* make a window to save stdscr */
+ save = newwin(LINES, COLS, 0, 0);
+
+ /* make_window (nrows, ncols, start_row, start_col) */
+ INFO_WINDOW = make_window(0, LINES - 4, COLS / 2, COLS - 1);
+ MENU_WINDOW = make_window(0, LINES - 4, 0, COLS / 2);
+ PROMPT_WINDOW = make_window(LINES - 4, LINES - 1, 0, COLS - 1);
+ refresh();
+
+ return 0;
+}
+
+int End_curses(void)
+{
+ /* should only be called upon program exit */
+
+ clear(); /* clear the screen */
+ refresh();
+ endwin(); /* let curses reset the tty now */
+
+ return 0;
+}
+
+int Suspend_curses(void)
+{
+ overwrite(stdscr, save);
+ clear();
+ refresh();
+ endwin();
+
+ return 0;
+}
+
+int Resume_curses(void)
+{
+ clear();
+ refresh();
+ overwrite(save, stdscr);
+ refresh();
+
+ return 0;
+}
+
+int Curses_allow_interrupts(int ok)
+{
+ refresh();
+ if (ok)
+ noraw();
+ else
+ raw();
+
+ return 0;
+}
+
+int Curses_clear_window(Window * window)
+{
+ int y, x;
+
+ if (!inited)
+ return 1;
+ for (y = window->top + 1; y < window->bottom; y++) {
+ move(y, x = window->left + 1);
+ while (x++ < window->right)
+ addch(' ');
+ }
+ Curses_outline_window(window);
+ refresh();
+
+ return 0;
+}
+
+int Curses_outline_window(Window * window)
+{
+ int x, y;
+
+ move(window->top, x = window->left + 1);
+ while (x++ < window->right)
+ addch('-');
+ move(window->bottom, x = window->left + 1);
+ while (x++ < window->right)
+ addch('-');
+ for (y = window->top + 1; y < window->bottom; y++) {
+ move(y, window->left);
+ addch('|');
+ move(y, window->right);
+ addch('|');
+ }
+ move(window->top, window->left);
+ addch('+');
+ move(window->top, window->right);
+ addch('+');
+ move(window->bottom, window->left);
+ addch('+');
+ if (window->bottom < LINES - 1 || window->right < COLS - 1) {
+ move(window->bottom, window->right);
+ addch('+');
+ }
+
+ return 0;
+}
+
+int Curses_write_window(Window * window, int line, int col, char *message)
+{
+ int y, x, i;
+
+ if (!inited) {
+ fprintf(stderr, "%s\n", message);
+ return 1;
+ }
+ if (line <= 0 || line >= window->bottom - window->top)
+ return 1;
+ if (col <= 0 || col >= window->right - window->left)
+ return 1;
+ move(y = window->top + line, x = window->left + col);
+ while (*message != 0 && *message != '\n' && x < window->right) {
+ addch(*message);
+ message++;
+ x++;
+ }
+ if (*message == '\n')
+ for (i = x; i < window->right; i++)
+ addch(' ');
+ move(y, x);
+ refresh();
+
+ return 0;
+}
+
+int Curses_replot_screen(void)
+{
+ int x, y;
+
+ getyx(stdscr, y, x);
+ wrefresh(curscr);
+ move(y, x);
+ refresh();
+
+ return 0;
+}
+
+int Curses_prompt_gets(char *prompt, char *answer)
+{
+ char c;
+ int n;
+ int y, x;
+
+ *answer = 0;
+ n = 0;
+
+ Curses_write_window(PROMPT_WINDOW, 1, 1, "\n");
+ Curses_write_window(PROMPT_WINDOW, 1, 1, prompt);
+
+ for (;;) {
+ refresh();
+ c = Curses_getch(0);
+ if (c == '\n' || c == '\r')
+ break;
+
+ getyx(stdscr, y, x);
+ if (c > '\037' && c < '\177') { /* octal codes: accept space to '~' */
+ if (x < PROMPT_WINDOW->right) {
+ *answer++ = c;
+ *answer = 0;
+ addch(c);
+ n++;
+ }
+ continue;
+ }
+ if (c == '\b' || c == '\177') { /* backspace or DEL (decimal 8,127) */
+ if (n > 0) {
+ answer--;
+ *answer = 0;
+ move(y, x - 1);
+ addch(' ');
+ move(y, x - 1);
+ n--;
+ }
+ continue;
+ }
+ Beep();
+ }
+
+ return 0;
+}
+
+int Beep(void)
+{
+ putchar('\7');
+ fflush(stdout);
+
+ return 0;
+}
+
+int Curses_getch(int with_echo)
+{
+ char achar;
+ int c;
+ int kill;
+
+ if (!inited)
+ return 0;
+ kill = 0;
+ while (1) {
+ c = getch() & 0177;
+ if (c == interrupt_char) {
+ if (kill++ >= 3) {
+ End_curses();
+ exit(0);
+ }
+ continue;
+ }
+ kill = 0;
+ if (c != 18)
+ break;
+ Curses_replot_screen();
+ }
+ if (with_echo) {
+ achar = c;
+ addch(achar);
+ refresh();
+ }
+ return c;
+}
Deleted: grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2image/defs.h
===================================================================
--- grass/branches/develbranch_6/imagery/i.ortho.photo/i.photo.2image/defs.h 2010-12-01 09:34:37 UTC (rev 44501)
+++ grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2image/defs.h 2010-12-22 10:05:10 UTC (rev 44654)
@@ -1,66 +0,0 @@
-#include "orthophoto.h"
-#include <stdio.h>
-#include <curses.h>
-
-/* this is a curses structure */
-typedef struct
-{
- int top, left, bottom, right;
-} Window;
-
-/* this is a graphics structure */
-typedef struct
-{
- int top, bottom, left, right;
- int nrows, ncols;
- struct
- {
- int configured;
- struct Cell_head head;
- struct Colors colors;
- char name[30];
- char mapset[30];
- int top, bottom, left, right;
- double ew_res, ns_res; /* original map resolution */
- } cell;
-} View;
-
-
-/* this is a group structure */
-/* not used -- see orthophoto.h
- typedef struct
- {
- char name[50];
- struct Block_Image_Group_Ref ref;
- struct Ref_Points ref_points;
- struct Con_Points con_points;
- int ref_equation_stat;
- int con_equation_stat;
- double E12[3], N12[3], E21[3], N21[3], Z12[3], Z21[3];
- } Group;
- ******************************************************** */
-
-typedef struct
-{
- int type; /* object type */
- int (*handler) (); /* routine to handle the event */
- char *label; /* label to display if MENU or OPTION */
- int binding; /* OPTION bindings */
- int *status; /* MENU,OPTION status */
- int top, bottom, left, right;
-} Objects;
-
-#define MENU_OBJECT 1
-#define OPTION_OBJECT 2
-#define INFO_OBJECT 3
-#define OTHER_OBJECT 4
-
-
-#define MENU(label,handler,status) \
- {MENU_OBJECT,handler,label,0,status,0,0,0,0}
-#define OPTION(label,binding,status) \
- {OPTION_OBJECT,NULL,label,binding,status,0,0,0,0}
-#define INFO(label,status) \
- {INFO_OBJECT,NULL,label,0,status,0,0,0,0}
-#define OTHER(handler,status) \
- {OTHER_OBJECT,handler,NULL,0,status,0,0,0,0}
Copied: grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2image/defs.h (from rev 44501, grass/branches/develbranch_6/imagery/i.ortho.photo/i.photo.2image/defs.h)
===================================================================
--- grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2image/defs.h (rev 0)
+++ grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2image/defs.h 2010-12-22 10:05:10 UTC (rev 44654)
@@ -0,0 +1,66 @@
+#include "orthophoto.h"
+#include <stdio.h>
+#include <curses.h>
+
+/* this is a curses structure */
+typedef struct
+{
+ int top, left, bottom, right;
+} Window;
+
+/* this is a graphics structure */
+typedef struct
+{
+ int top, bottom, left, right;
+ int nrows, ncols;
+ struct
+ {
+ int configured;
+ struct Cell_head head;
+ struct Colors colors;
+ char name[30];
+ char mapset[30];
+ int top, bottom, left, right;
+ double ew_res, ns_res; /* original map resolution */
+ } cell;
+} View;
+
+
+/* this is a group structure */
+/* not used -- see orthophoto.h
+ typedef struct
+ {
+ char name[50];
+ struct Block_Image_Group_Ref ref;
+ struct Ref_Points ref_points;
+ struct Con_Points con_points;
+ int ref_equation_stat;
+ int con_equation_stat;
+ double E12[3], N12[3], E21[3], N21[3], Z12[3], Z21[3];
+ } Group;
+ ******************************************************** */
+
+typedef struct
+{
+ int type; /* object type */
+ int (*handler) (); /* routine to handle the event */
+ char *label; /* label to display if MENU or OPTION */
+ int binding; /* OPTION bindings */
+ int *status; /* MENU,OPTION status */
+ int top, bottom, left, right;
+} Objects;
+
+#define MENU_OBJECT 1
+#define OPTION_OBJECT 2
+#define INFO_OBJECT 3
+#define OTHER_OBJECT 4
+
+
+#define MENU(label,handler,status) \
+ {MENU_OBJECT,handler,label,0,status,0,0,0,0}
+#define OPTION(label,binding,status) \
+ {OPTION_OBJECT,NULL,label,binding,status,0,0,0,0}
+#define INFO(label,status) \
+ {INFO_OBJECT,NULL,label,0,status,0,0,0,0}
+#define OTHER(handler,status) \
+ {OTHER_OBJECT,handler,NULL,0,status,0,0,0,0}
Deleted: grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2image/description.html
===================================================================
--- grass/branches/develbranch_6/imagery/i.ortho.photo/i.photo.2image/description.html 2010-12-01 09:34:37 UTC (rev 44501)
+++ grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2image/description.html 2010-12-22 10:05:10 UTC (rev 44654)
@@ -1,345 +0,0 @@
-<H2>DESCRIPTION</H2>
-
-<EM>i.photo.2image</EM> is an imagery function that enables
-you to mark fiducial or reseau points on an image to be
-ortho-rectified and then computes the image-to-photo
-coordinate transformation parameters. The coordinates of
-the fiducials or reseau marks can be choosen for a camera
-reference file.
-<P>
-
-During the process of marking reference points with known
-photo coordinates, you may compute the RMS (root mean
-square) error for each reference point entered.
-<EM>i.photo.2image</EM> does this by calculating the
-transformation equation (the same one that is calculated by
-<EM><A HREF="i.points.html">i.points</A> </EM>),
-and then plugging these results into an equation for RMS
-error.
-<P>
-
-<EM>i.photo.2image</EM> offers a zoom option to locate
-precisely the fiducial or reseau point to be marked on an
-image.
-<P>
-
-To run <EM>i.photo.2image</EM>, a graphics monitor is
-required.
-<P>
-
-The procedure for marking fiducial or reseau points,
-entering known photo-coordinates, and analyzing the RMS
-error is described below.
-<P>
-
-The terminal screen displays this message:
-<P>
-
-<B>use mouse now...</B>
-<P>
-
-The graphics monitor displays the following screen:
-
-<PRE>
- +---------------------------+---------------------------------+
- |imagery | |
- +---------------------------+---------------------------------+
- | | |
- | | |
- | | |
- | | |
- | | |
- | | |
- | | |
- +---------------------------+---------------------------------+
- | | |
- | | |
- | | |
- | | |
- | | |
- | | |
- | | |
- +---------------------------+---------------------------------+
- | | |
- +---------------------------+---------------------------------+
-</PRE>
-
-<P>
-
-A pop-down menu like that shown below will be superimposed on the
-left half of the screen:
-
-<P>
-<PRE>
- +------------------------------------------+
- | Double click on raster map to be plotted |
- | Double click here to cancel |
- +------------------------------------------+
- +----------------+
- |Mapset imagery |
- +-------+--------+
- |gs13.1 | gs21.1 |
- +-------+--------+
- |gs14.1 | gs22.2 |
- +-------+--------+
-</PRE>
-
-Any single file in the imagery group may be used on which to mark
-points, and you may mark points on more than one file
-in the imagery group to accumulate the suggested minimum number of
-4-8 fiducial or ressue points.
-The imagery file selected is displayed in the upper
-left quadrant of the screen.
-<P>
-
-<H2>CAMERA FILE</H2>
-
-The camera reference file may be viewed by placing the mouse
-cross hairs on the words CAMERA. The camera reference file
-will be displayed in the lower left quadrant of the display:
-
-
-<P>
-<PRE>
-
-|---------------------------------------------------------------|
-|Camera Reference File |
-|---------------------------------------------------------------|
-| CAMERA NAME : camera name |
-| CAMERA ID : L1234 |
-| CAMERA CFL : 153.021 mm. |
-| CAMERA XP : 0.050 mm. |
-| CAMERA XP : 0.056 mm. |
-| number of fid. 4 |
-|---------------------------------------------------------------|
-| |
-|ID (X PHOTO) mm. (Y PHOTO) mm. |
-|_______________________________________________________________|
-|1 -105.023 110.123 |
-|2 107.987 109.834 |
-|3 110.965 -104.329 |
-|4 -103.932 -110.352 |
-|_______________________________________________________________|
-</PRE>
-<P>
-The following menu is displayed at the bottom
-of the graphics display:
-<P>
-
-<PRE>
-+-----+------+-----------+--------+---------+-------------------+-------------+
-|Quit | Zoom | Plot Cell | Camera | Analyze | Input->KEYBOARD | CAMERA FILE |
-+-----+------+-----------+--------+---------+-------------------+-------------+
-</PRE>
-
-<P>
-<H2>ZOOM</H2>
-
-To magnify the displayed file, you must
-place the mouse cross hairs on the word ZOOM. The following menu
-will then be displayed at the bottom of the screen:
-<P>
-
-<PRE>
-+-------+-----+-------++--------------------+
-|Cancel | Box | Point ||Select type of ZOOM |
-+-------+-----+-------++--------------------+
-</PRE>
-
-<P>
-You have the option of identifying the zoom window either by using
-the mouse to make a box, or by using the mouse to mark the center
-of the desired window, and adjusting the magnification factor.
-The terminal screen will display a mouse button menu to guide you in
-identifying the window. The section of the image within the zoom window
-will be displayed in the upper right hand quadrant.
-<P>
-
-
-<H2>MARKING REFERENCE POINTS</H2>
-
-To mark the known reference points (fiducial marks, reseau marks, etc.)
-on the image, you must place the mouse cross hairs
-on the corresponding location on the image to be marked and press
-the left hand button on the mouse. A diamond shaped symbol will be marked
-on the image.
-<P>
-If you wish to use the camera reference file only as a
-comparative reference, then the keyboard can be chosen as
-the means to input photo coordinates corresponding to the marked
-reference points on the image. This is done by placing the mouse
-cross hairs on the word KEYBOARD and pressing the left
-button on the mouse.
-<P>
-The following menu is displayed on the graphics terminal:
-<P>
-<PRE>
-+------------------------------------+--------------------------+
-|Point 1 marked at IMAGE COORDINATES | |
-|east: 1023.77 | |
-|north: 506.56 | |
-| | |
-| | |
-| | |
-| | |
-| | |
-+------------------------------------+--------------------------+
-|Enter PHOTO COORDINATES as x and y: |
-+---------------------------------------------------------------+
-</PRE>
-<P>
-You then enter the known (x,y) photo coordinates, relative
-to the perspective center, for the reference
-point marked on the image. If you
-do not wish to enter a coordinate, simply hit RETURN to continue;
-the marked reference point will disappear.
-<P>
-If you select the CAMERA FILE option, then reference points
-marked on the image will be associated with selected photo
-coordinates from the displayed camera reference file. In this option,
-when you mark a point on the image, the following menu is
-displayed on the graphics terminal:
-<P>
-<PRE>
--------------------------------------------------------------
-CANCEL Double click on the fiducial mark to be referenced
--------------------------------------------------------------
-</PRE>
-<P>
-
-If you would like to select the photo coordinates of a displayed
-reference mark, this can be accomplished by placing the mouse
-cross hairs on the reference point to be selected and pressing
-the left button on the mouse twice. After a reference point is selected
-from the display, you are prompted with "Look ok? (Y/N)".
-If you respond with no, the reference point is ignored.
-If you respond with yes, the following is displayed on the terminal:
-<P>
-<P>
-<PRE>
-+----------------------------------------+--------------------------+
-|Point 1 marked at IMAGE COORDINATES | |
-|east: 1023.77 | |
-|north: 1065.41 | |
-| | |
-| | |
-|Point 1 referenced at PHOTO COORDINATES | |
-|X: -105.023 | |
-|Y: 110.122 | |
-| | |
-| | |
-| | |
-| | |
-| | |
-+----------------------------------------+--------------------------+
-| use mouse now... |
-+----------------------------------------+--------------------------+
-</PRE>
-<P>
-The photo coordinates and the corresponding image coordinates are
-automatically saved in the photo_points file associated with the imagery
-group.
-<P>
-<P>
-<H2>ANALYZE</H2>
-
-After a number of points have been marked (4 to 8), you can
-check the RMS error of the points marked on the image. This is done
-by placing the mouse cross hairs on the word ANALYZE at the bottom
-of the monitor. An error report resembling the one shown below
-is superimposed on the monitor:
-<P>
-<PRE>
-+--------------------------------------------------------------------+
-| error image photo |
-| |
-|# row col photo east north x y |
-|1 0.0 -0.9 1.0 1048.5 -144.8 -105.023 110.122 |
-|2 0.4 1.0 1.3 2153.1 -567.2 107.987 109.834 |
-|3 -1.2 -0.5 0.6 1452.8 -476.5 110.965 -104.329 |
-|4 1.1 0.5 1.3 1034.0 -109.2 -103.932 -110.352 |
-| |
-+--------------------------------------------------------------------+
-| overall rms error: 4.46 |
-+--------------------------------------------------------------------+
-</PRE>
-<P>
- The following menu then appears at the bottom of the monitor:
-<P>
-<PRE>
-+-----+-------+------+-----------------------------------------------+
-|DONE | PRINT | FILE | Double click on point to be included/excluded |
-+-----+-------+------+-----------------------------------------------+
-</PRE>
-<P>
-
-The RMS error for the image is given under the column
-TITLEd "error" and subTITLEd "row" and "col". In the above
-report, point number 1 is 0.0 rows and -0.9 columns from
-the predicted location calculated from the transformation
-equation. The RMS error for the photo coordinates is
-listed under the heading "photo". This is the RMS error
-for the x and y coordinates of the photo coordinates but it
-is presented in the table using one general value. The
-overall RMS error is displayed at the bottom of the screen
-in milimeters. Points that create high RMS error are
-displayed in red on the monitor (represented here in
-italics).
-<P>
-
-The location of the point marked on the imagery group file
-is given under the heading "image" and the subheadings
-"east" and "north". The location of the point in the photo
-coordinates is given under the heading "photo" and the
-subheadings "x" and "y". If you would like to exclude or
-include a point, this can be accomplished by placing the
-mouse cross hairs on the point number to be included (if
-the point is absent) or excluded (if the point is
-displayed) and pressing the left button on the mouse
-twice. When a point is excluded, it is not afterwards
-included in the calculation of the RMS error, or included
-in the final transformation matrix. However, it can be
-retrieved within <EM>i.photo.2image</EM> at any time by
-double clicking with the mouse as described above.
-<P>
-
-
-<H2>QUIT</H2>
-
-To end the <EM>i.photo.2image</EM> program place the mouse cross hairs
-on the word QUIT; the marked reference points (including coordinates)
-will be saved.
-<P>
-
-
-<H2>NOTES</H2>
-
-A good rule of thumb is to mark at least 4 to 8 points which are
-evenly distributed over the perimeter of the imagery
-group file in order to obtain
-an accurate transformation equation for the rectification process.
-The RMS error may increase with more points added, but the
-transformation equation will be more accurate.
-<P>
-
-An RMS error of less than or equal to approximately one resolution
-unit (pixel) for the image being rectified is generally considered
-acceptable.
-
-<H2>SEE ALSO</H2>
-
-<EM>
-<A HREF="i.ortho.photo.html">i.ortho.photo</A>,
-<A HREF="i.photo.camera.html">i.photo.camera</A>,
-<A HREF="i.photo.2target.html">i.photo.2target</A>,
-<A HREF="i.photo.init.html">i.photo.init</A>,
-<A HREF="i.photo.rectify.html">i.photo.rectify</A>
-</EM>
-
-<H2>AUTHOR</H2>
-
-Mike Baba, DBA Systems, Inc.
-
-<p>
-<i>Last changed: $Date$</i>
-
Copied: grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2image/description.html (from rev 44501, grass/branches/develbranch_6/imagery/i.ortho.photo/i.photo.2image/description.html)
===================================================================
--- grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2image/description.html (rev 0)
+++ grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2image/description.html 2010-12-22 10:05:10 UTC (rev 44654)
@@ -0,0 +1,345 @@
+<H2>DESCRIPTION</H2>
+
+<EM>i.photo.2image</EM> is an imagery function that enables
+you to mark fiducial or reseau points on an image to be
+ortho-rectified and then computes the image-to-photo
+coordinate transformation parameters. The coordinates of
+the fiducials or reseau marks can be choosen for a camera
+reference file.
+<P>
+
+During the process of marking reference points with known
+photo coordinates, you may compute the RMS (root mean
+square) error for each reference point entered.
+<EM>i.photo.2image</EM> does this by calculating the
+transformation equation (the same one that is calculated by
+<EM><A HREF="i.points.html">i.points</A> </EM>),
+and then plugging these results into an equation for RMS
+error.
+<P>
+
+<EM>i.photo.2image</EM> offers a zoom option to locate
+precisely the fiducial or reseau point to be marked on an
+image.
+<P>
+
+To run <EM>i.photo.2image</EM>, a graphics monitor is
+required.
+<P>
+
+The procedure for marking fiducial or reseau points,
+entering known photo-coordinates, and analyzing the RMS
+error is described below.
+<P>
+
+The terminal screen displays this message:
+<P>
+
+<B>use mouse now...</B>
+<P>
+
+The graphics monitor displays the following screen:
+
+<PRE>
+ +---------------------------+---------------------------------+
+ |imagery | |
+ +---------------------------+---------------------------------+
+ | | |
+ | | |
+ | | |
+ | | |
+ | | |
+ | | |
+ | | |
+ +---------------------------+---------------------------------+
+ | | |
+ | | |
+ | | |
+ | | |
+ | | |
+ | | |
+ | | |
+ +---------------------------+---------------------------------+
+ | | |
+ +---------------------------+---------------------------------+
+</PRE>
+
+<P>
+
+A pop-down menu like that shown below will be superimposed on the
+left half of the screen:
+
+<P>
+<PRE>
+ +------------------------------------------+
+ | Double click on raster map to be plotted |
+ | Double click here to cancel |
+ +------------------------------------------+
+ +----------------+
+ |Mapset imagery |
+ +-------+--------+
+ |gs13.1 | gs21.1 |
+ +-------+--------+
+ |gs14.1 | gs22.2 |
+ +-------+--------+
+</PRE>
+
+Any single file in the imagery group may be used on which to mark
+points, and you may mark points on more than one file
+in the imagery group to accumulate the suggested minimum number of
+4-8 fiducial or ressue points.
+The imagery file selected is displayed in the upper
+left quadrant of the screen.
+<P>
+
+<H2>CAMERA FILE</H2>
+
+The camera reference file may be viewed by placing the mouse
+cross hairs on the words CAMERA. The camera reference file
+will be displayed in the lower left quadrant of the display:
+
+
+<P>
+<PRE>
+
+|---------------------------------------------------------------|
+|Camera Reference File |
+|---------------------------------------------------------------|
+| CAMERA NAME : camera name |
+| CAMERA ID : L1234 |
+| CAMERA CFL : 153.021 mm. |
+| CAMERA XP : 0.050 mm. |
+| CAMERA XP : 0.056 mm. |
+| number of fid. 4 |
+|---------------------------------------------------------------|
+| |
+|ID (X PHOTO) mm. (Y PHOTO) mm. |
+|_______________________________________________________________|
+|1 -105.023 110.123 |
+|2 107.987 109.834 |
+|3 110.965 -104.329 |
+|4 -103.932 -110.352 |
+|_______________________________________________________________|
+</PRE>
+<P>
+The following menu is displayed at the bottom
+of the graphics display:
+<P>
+
+<PRE>
++-----+------+-----------+--------+---------+-------------------+-------------+
+|Quit | Zoom | Plot Cell | Camera | Analyze | Input->KEYBOARD | CAMERA FILE |
++-----+------+-----------+--------+---------+-------------------+-------------+
+</PRE>
+
+<P>
+<H2>ZOOM</H2>
+
+To magnify the displayed file, you must
+place the mouse cross hairs on the word ZOOM. The following menu
+will then be displayed at the bottom of the screen:
+<P>
+
+<PRE>
++-------+-----+-------++--------------------+
+|Cancel | Box | Point ||Select type of ZOOM |
++-------+-----+-------++--------------------+
+</PRE>
+
+<P>
+You have the option of identifying the zoom window either by using
+the mouse to make a box, or by using the mouse to mark the center
+of the desired window, and adjusting the magnification factor.
+The terminal screen will display a mouse button menu to guide you in
+identifying the window. The section of the image within the zoom window
+will be displayed in the upper right hand quadrant.
+<P>
+
+
+<H2>MARKING REFERENCE POINTS</H2>
+
+To mark the known reference points (fiducial marks, reseau marks, etc.)
+on the image, you must place the mouse cross hairs
+on the corresponding location on the image to be marked and press
+the left hand button on the mouse. A diamond shaped symbol will be marked
+on the image.
+<P>
+If you wish to use the camera reference file only as a
+comparative reference, then the keyboard can be chosen as
+the means to input photo coordinates corresponding to the marked
+reference points on the image. This is done by placing the mouse
+cross hairs on the word KEYBOARD and pressing the left
+button on the mouse.
+<P>
+The following menu is displayed on the graphics terminal:
+<P>
+<PRE>
++------------------------------------+--------------------------+
+|Point 1 marked at IMAGE COORDINATES | |
+|east: 1023.77 | |
+|north: 506.56 | |
+| | |
+| | |
+| | |
+| | |
+| | |
++------------------------------------+--------------------------+
+|Enter PHOTO COORDINATES as x and y: |
++---------------------------------------------------------------+
+</PRE>
+<P>
+You then enter the known (x,y) photo coordinates, relative
+to the perspective center, for the reference
+point marked on the image. If you
+do not wish to enter a coordinate, simply hit RETURN to continue;
+the marked reference point will disappear.
+<P>
+If you select the CAMERA FILE option, then reference points
+marked on the image will be associated with selected photo
+coordinates from the displayed camera reference file. In this option,
+when you mark a point on the image, the following menu is
+displayed on the graphics terminal:
+<P>
+<PRE>
+-------------------------------------------------------------
+CANCEL Double click on the fiducial mark to be referenced
+-------------------------------------------------------------
+</PRE>
+<P>
+
+If you would like to select the photo coordinates of a displayed
+reference mark, this can be accomplished by placing the mouse
+cross hairs on the reference point to be selected and pressing
+the left button on the mouse twice. After a reference point is selected
+from the display, you are prompted with "Look ok? (Y/N)".
+If you respond with no, the reference point is ignored.
+If you respond with yes, the following is displayed on the terminal:
+<P>
+<P>
+<PRE>
++----------------------------------------+--------------------------+
+|Point 1 marked at IMAGE COORDINATES | |
+|east: 1023.77 | |
+|north: 1065.41 | |
+| | |
+| | |
+|Point 1 referenced at PHOTO COORDINATES | |
+|X: -105.023 | |
+|Y: 110.122 | |
+| | |
+| | |
+| | |
+| | |
+| | |
++----------------------------------------+--------------------------+
+| use mouse now... |
++----------------------------------------+--------------------------+
+</PRE>
+<P>
+The photo coordinates and the corresponding image coordinates are
+automatically saved in the photo_points file associated with the imagery
+group.
+<P>
+<P>
+<H2>ANALYZE</H2>
+
+After a number of points have been marked (4 to 8), you can
+check the RMS error of the points marked on the image. This is done
+by placing the mouse cross hairs on the word ANALYZE at the bottom
+of the monitor. An error report resembling the one shown below
+is superimposed on the monitor:
+<P>
+<PRE>
++--------------------------------------------------------------------+
+| error image photo |
+| |
+|# row col photo east north x y |
+|1 0.0 -0.9 1.0 1048.5 -144.8 -105.023 110.122 |
+|2 0.4 1.0 1.3 2153.1 -567.2 107.987 109.834 |
+|3 -1.2 -0.5 0.6 1452.8 -476.5 110.965 -104.329 |
+|4 1.1 0.5 1.3 1034.0 -109.2 -103.932 -110.352 |
+| |
++--------------------------------------------------------------------+
+| overall rms error: 4.46 |
++--------------------------------------------------------------------+
+</PRE>
+<P>
+ The following menu then appears at the bottom of the monitor:
+<P>
+<PRE>
++-----+-------+------+-----------------------------------------------+
+|DONE | PRINT | FILE | Double click on point to be included/excluded |
++-----+-------+------+-----------------------------------------------+
+</PRE>
+<P>
+
+The RMS error for the image is given under the column
+TITLEd "error" and subTITLEd "row" and "col". In the above
+report, point number 1 is 0.0 rows and -0.9 columns from
+the predicted location calculated from the transformation
+equation. The RMS error for the photo coordinates is
+listed under the heading "photo". This is the RMS error
+for the x and y coordinates of the photo coordinates but it
+is presented in the table using one general value. The
+overall RMS error is displayed at the bottom of the screen
+in milimeters. Points that create high RMS error are
+displayed in red on the monitor (represented here in
+italics).
+<P>
+
+The location of the point marked on the imagery group file
+is given under the heading "image" and the subheadings
+"east" and "north". The location of the point in the photo
+coordinates is given under the heading "photo" and the
+subheadings "x" and "y". If you would like to exclude or
+include a point, this can be accomplished by placing the
+mouse cross hairs on the point number to be included (if
+the point is absent) or excluded (if the point is
+displayed) and pressing the left button on the mouse
+twice. When a point is excluded, it is not afterwards
+included in the calculation of the RMS error, or included
+in the final transformation matrix. However, it can be
+retrieved within <EM>i.photo.2image</EM> at any time by
+double clicking with the mouse as described above.
+<P>
+
+
+<H2>QUIT</H2>
+
+To end the <EM>i.photo.2image</EM> program place the mouse cross hairs
+on the word QUIT; the marked reference points (including coordinates)
+will be saved.
+<P>
+
+
+<H2>NOTES</H2>
+
+A good rule of thumb is to mark at least 4 to 8 points which are
+evenly distributed over the perimeter of the imagery
+group file in order to obtain
+an accurate transformation equation for the rectification process.
+The RMS error may increase with more points added, but the
+transformation equation will be more accurate.
+<P>
+
+An RMS error of less than or equal to approximately one resolution
+unit (pixel) for the image being rectified is generally considered
+acceptable.
+
+<H2>SEE ALSO</H2>
+
+<EM>
+<A HREF="i.ortho.photo.html">i.ortho.photo</A>,
+<A HREF="i.photo.camera.html">i.photo.camera</A>,
+<A HREF="i.photo.2target.html">i.photo.2target</A>,
+<A HREF="i.photo.init.html">i.photo.init</A>,
+<A HREF="i.photo.rectify.html">i.photo.rectify</A>
+</EM>
+
+<H2>AUTHOR</H2>
+
+Mike Baba, DBA Systems, Inc.
+
+<p>
+<i>Last changed: $Date$</i>
+
Deleted: grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2image/dot.c
===================================================================
--- grass/branches/develbranch_6/imagery/i.ortho.photo/i.photo.2image/dot.c 2010-12-01 09:34:37 UTC (rev 44501)
+++ grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2image/dot.c 2010-12-22 10:05:10 UTC (rev 44654)
@@ -1,57 +0,0 @@
-#include <grass/raster.h>
-#include "globals.h"
-
-int dot(int x, int y)
-{
- int vx[5], vy[5];
-
- vx[0] = x;
- vy[0] = y - dotsize;
- vx[1] = x - dotsize;
- vy[1] = y;
- vx[2] = x;
- vy[2] = y + dotsize;
- vx[3] = x + dotsize;
- vy[3] = y;
- vx[4] = x;
- vy[4] = y - dotsize;
-
- R_polygon_abs(vx, vy, 5);
- /*
- int i;
-
- for (i = 0; i < dotsize; i++)
- {
- R_move_abs (x-i, y+i-dotsize);
- R_cont_rel (i+i,0);
- R_move_abs (x-i, y+dotsize-i);
- R_cont_rel (i+i,0);
- }
- R_move_abs (x-dotsize, y);
- R_cont_rel (dotsize+dotsize, 0);
- */
-
- return 0;
-}
-
-int save_under_dot(int x, int y)
-{
- R_panel_save(tempfile3, y - dotsize, y + dotsize, x - dotsize,
- x + dotsize);
-
- return 0;
-}
-
-int restore_under_dot(void)
-{
- R_panel_restore(tempfile3);
-
- return 0;
-}
-
-int release_under_dot(void)
-{
- R_panel_delete(tempfile3);
-
- return 0;
-}
Copied: grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2image/dot.c (from rev 44501, grass/branches/develbranch_6/imagery/i.ortho.photo/i.photo.2image/dot.c)
===================================================================
--- grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2image/dot.c (rev 0)
+++ grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2image/dot.c 2010-12-22 10:05:10 UTC (rev 44654)
@@ -0,0 +1,57 @@
+#include <grass/raster.h>
+#include "globals.h"
+
+int dot(int x, int y)
+{
+ int vx[5], vy[5];
+
+ vx[0] = x;
+ vy[0] = y - dotsize;
+ vx[1] = x - dotsize;
+ vy[1] = y;
+ vx[2] = x;
+ vy[2] = y + dotsize;
+ vx[3] = x + dotsize;
+ vy[3] = y;
+ vx[4] = x;
+ vy[4] = y - dotsize;
+
+ R_polygon_abs(vx, vy, 5);
+ /*
+ int i;
+
+ for (i = 0; i < dotsize; i++)
+ {
+ R_move_abs (x-i, y+i-dotsize);
+ R_cont_rel (i+i,0);
+ R_move_abs (x-i, y+dotsize-i);
+ R_cont_rel (i+i,0);
+ }
+ R_move_abs (x-dotsize, y);
+ R_cont_rel (dotsize+dotsize, 0);
+ */
+
+ return 0;
+}
+
+int save_under_dot(int x, int y)
+{
+ R_panel_save(tempfile3, y - dotsize, y + dotsize, x - dotsize,
+ x + dotsize);
+
+ return 0;
+}
+
+int restore_under_dot(void)
+{
+ R_panel_restore(tempfile3);
+
+ return 0;
+}
+
+int release_under_dot(void)
+{
+ R_panel_delete(tempfile3);
+
+ return 0;
+}
Deleted: grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2image/drawcam.c
===================================================================
--- grass/branches/develbranch_6/imagery/i.ortho.photo/i.photo.2image/drawcam.c 2010-12-01 09:34:37 UTC (rev 44501)
+++ grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2image/drawcam.c 2010-12-22 10:05:10 UTC (rev 44654)
@@ -1,154 +0,0 @@
-#include <unistd.h>
-#include <string.h>
-#include <grass/gis.h>
-#include <grass/raster.h>
-#include "globals.h"
-
-static char buf[300];
-static int done(void);
-static int debug(char *);
-static int to_file(void);
-static int askfile(void);
-static int to_printer(void);
-static int do_report(FILE *);
-
-#define FMT0(buf,n) \
- sprintf (buf, " %3d ", n)
-#define FMT1(buf,fid_id,Xf,Yf) \
- sprintf (buf, " %10s %10.4f %10.4f ", fid_id,Xf,Yf)
-#define FMT2(buf,cam_name) \
- sprintf (buf, "CAMERA NAME %30s", cam_name)
-#define FMT3(buf,cam_id) \
- sprintf (buf, "CAMERA ID %30s", cam_id)
-#define FMT4(buf,cfl) \
- sprintf (buf, "CAMERA CFL %10.4f", cfl)
-#define FMT5(buf, Xp) \
- sprintf (buf, "CAMERA XP %10.4f", Xp)
-#define FMT6(buf, Yp) \
- sprintf (buf, "CAMERA YP %10.4f", Yp)
-#define FMT7(buf, num_fid) \
- sprintf (buf, "number of fid. %5d", num_fid)
-#define LHEAD1 " CAMERA REFERENCE FILE "
-#define LHEAD3 " "
-#define LHEAD4 " ID Photo X Photo Y "
-#define LHEAD2 "----------------------------------------------"
-
-
-int drawcam(void)
-{
- static int use = 1;
- static Objects objects[] = {
- MENU("CANCEL", done, &use),
- MENU("PRINT", to_printer, &use),
- MENU("FILE", to_file, &use),
- /*INFO("do something", &use), */
- /*OTHER(pick,&use), */
- {0}
- };
-
- while (1) {
- if (Input_pointer(objects) < 0)
- break;
- }
- return 0; /* return but don't QUIT */
-}
-
-static int done(void)
-{
- return -1;
-}
-
-static int debug(char *msg)
-{
- R_stabilize();
- Curses_write_window(PROMPT_WINDOW, 1, 1, msg);
- /* Curses_getch(0); */
-
- return 0;
-}
-
-static int to_file(void)
-{
- FILE *fd;
- char msg[1024];
-
- if (Input_other(askfile, "Keyboard") < 0) {
- return 0;
- }
-
- fd = fopen(buf, "w");
- if (fd == NULL) {
- sprintf(msg, "** Unable to create file %s\n", buf);
- Beep();
- Curses_write_window(PROMPT_WINDOW, 2, 1, msg);
- }
- else {
- do_report(fd);
- fclose(fd);
- sprintf(msg, "Report saved in file %s\n", buf);
- Curses_write_window(PROMPT_WINDOW, 2, 1, msg);
- }
- return -1;
-}
-
-static int askfile(void)
-{
- char file[100];
-
- while (1) {
- Curses_prompt_gets("Enter file to hold report: ", file);
- G_strip(file);
- if (*file == 0)
- return -1;
- if (G_index(file, '/'))
- strcpy(buf, file);
- else
- sprintf(buf, "%s/%s", G_home(), file);
- if (access(buf, 0) != 0)
- return 1;
- sprintf(buf, "** %s already exists. choose another file", file);
- Beep();
- Curses_write_window(PROMPT_WINDOW, 2, 1, buf);
- }
-}
-
-static int to_printer(void)
-{
- FILE *fd;
-
- Menu_msg("sending camera file to printer ...");
-
- fd = popen("lpr", "w");
- do_report(fd);
- pclose(fd);
- return 0;
-}
-
-static int do_report(FILE * fd)
-{
- char buf[100];
- int n;
- int width;
-
- fprintf(fd, "LOCATION: %-20s GROUP: %-20s MAPSET: %s\n\n",
- G_location(), group.name, G_mapset());
- fprintf(fd, "CAMERA REFERENCE FILE\n\n");
- fprintf(fd, "%s\n", LHEAD1);
- fprintf(fd, "%s\n", LHEAD2);
-
- FMT1(buf, " ", 0.0, 0.0);
- width = strlen(buf);
-
- for (n = 0; n < group.camera_ref.num_fid; n++) {
- FMT0(buf, n + 1);
- fprintf(fd, "%s", buf);
- FMT1(buf, group.camera_ref.fiducials[n].fid_id,
- group.camera_ref.fiducials[n].Xf,
- group.camera_ref.fiducials[n].Yf);
- fprintf(fd, "%s", buf);
- fprintf(fd, " %s\n", buf);
- }
- fprintf(fd, "\n");
-
- return 0;
-}
Copied: grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2image/drawcam.c (from rev 44501, grass/branches/develbranch_6/imagery/i.ortho.photo/i.photo.2image/drawcam.c)
===================================================================
--- grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2image/drawcam.c (rev 0)
+++ grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2image/drawcam.c 2010-12-22 10:05:10 UTC (rev 44654)
@@ -0,0 +1,154 @@
+#include <unistd.h>
+#include <string.h>
+#include <grass/gis.h>
+#include <grass/raster.h>
+#include "globals.h"
+
+static char buf[300];
+static int done(void);
+static int debug(char *);
+static int to_file(void);
+static int askfile(void);
+static int to_printer(void);
+static int do_report(FILE *);
+
+#define FMT0(buf,n) \
+ sprintf (buf, " %3d ", n)
+#define FMT1(buf,fid_id,Xf,Yf) \
+ sprintf (buf, " %10s %10.4f %10.4f ", fid_id,Xf,Yf)
+#define FMT2(buf,cam_name) \
+ sprintf (buf, "CAMERA NAME %30s", cam_name)
+#define FMT3(buf,cam_id) \
+ sprintf (buf, "CAMERA ID %30s", cam_id)
+#define FMT4(buf,cfl) \
+ sprintf (buf, "CAMERA CFL %10.4f", cfl)
+#define FMT5(buf, Xp) \
+ sprintf (buf, "CAMERA XP %10.4f", Xp)
+#define FMT6(buf, Yp) \
+ sprintf (buf, "CAMERA YP %10.4f", Yp)
+#define FMT7(buf, num_fid) \
+ sprintf (buf, "number of fid. %5d", num_fid)
+#define LHEAD1 " CAMERA REFERENCE FILE "
+#define LHEAD3 " "
+#define LHEAD4 " ID Photo X Photo Y "
+#define LHEAD2 "----------------------------------------------"
+
+
+int drawcam(void)
+{
+ static int use = 1;
+ static Objects objects[] = {
+ MENU("CANCEL", done, &use),
+ MENU("PRINT", to_printer, &use),
+ MENU("FILE", to_file, &use),
+ /*INFO("do something", &use), */
+ /*OTHER(pick,&use), */
+ {0}
+ };
+
+ while (1) {
+ if (Input_pointer(objects) < 0)
+ break;
+ }
+ return 0; /* return but don't QUIT */
+}
+
+static int done(void)
+{
+ return -1;
+}
+
+static int debug(char *msg)
+{
+ R_stabilize();
+ Curses_write_window(PROMPT_WINDOW, 1, 1, msg);
+ /* Curses_getch(0); */
+
+ return 0;
+}
+
+static int to_file(void)
+{
+ FILE *fd;
+ char msg[1024];
+
+ if (Input_other(askfile, "Keyboard") < 0) {
+ return 0;
+ }
+
+ fd = fopen(buf, "w");
+ if (fd == NULL) {
+ sprintf(msg, "** Unable to create file %s\n", buf);
+ Beep();
+ Curses_write_window(PROMPT_WINDOW, 2, 1, msg);
+ }
+ else {
+ do_report(fd);
+ fclose(fd);
+ sprintf(msg, "Report saved in file %s\n", buf);
+ Curses_write_window(PROMPT_WINDOW, 2, 1, msg);
+ }
+ return -1;
+}
+
+static int askfile(void)
+{
+ char file[100];
+
+ while (1) {
+ Curses_prompt_gets("Enter file to hold report: ", file);
+ G_strip(file);
+ if (*file == 0)
+ return -1;
+ if (G_index(file, '/'))
+ strcpy(buf, file);
+ else
+ sprintf(buf, "%s/%s", G_home(), file);
+ if (access(buf, 0) != 0)
+ return 1;
+ sprintf(buf, "** %s already exists. choose another file", file);
+ Beep();
+ Curses_write_window(PROMPT_WINDOW, 2, 1, buf);
+ }
+}
+
+static int to_printer(void)
+{
+ FILE *fd;
+
+ Menu_msg("sending camera file to printer ...");
+
+ fd = popen("lpr", "w");
+ do_report(fd);
+ pclose(fd);
+ return 0;
+}
+
+static int do_report(FILE * fd)
+{
+ char buf[100];
+ int n;
+ int width;
+
+ fprintf(fd, "LOCATION: %-20s GROUP: %-20s MAPSET: %s\n\n",
+ G_location(), group.name, G_mapset());
+ fprintf(fd, "CAMERA REFERENCE FILE\n\n");
+ fprintf(fd, "%s\n", LHEAD1);
+ fprintf(fd, "%s\n", LHEAD2);
+
+ FMT1(buf, " ", 0.0, 0.0);
+ width = strlen(buf);
+
+ for (n = 0; n < group.camera_ref.num_fid; n++) {
+ FMT0(buf, n + 1);
+ fprintf(fd, "%s", buf);
+ FMT1(buf, group.camera_ref.fiducials[n].fid_id,
+ group.camera_ref.fiducials[n].Xf,
+ group.camera_ref.fiducials[n].Yf);
+ fprintf(fd, "%s", buf);
+ fprintf(fd, " %s\n", buf);
+ }
+ fprintf(fd, "\n");
+
+ return 0;
+}
Deleted: grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2image/drawcell.c
===================================================================
--- grass/branches/develbranch_6/imagery/i.ortho.photo/i.photo.2image/drawcell.c 2010-12-01 09:34:37 UTC (rev 44501)
+++ grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2image/drawcell.c 2010-12-22 10:05:10 UTC (rev 44654)
@@ -1,72 +0,0 @@
-#include <stdlib.h>
-#include <grass/gis.h>
-#include <grass/display.h>
-#include <grass/raster.h>
-#include "globals.h"
-
-int drawcell(View * view)
-{
- int fd;
- int left, top;
- int ncols, nrows;
- int row;
- CELL *cell;
- struct Colors *colors = NULL;
- int read_colors = 0;
- char msg[100];
-
-
- if (!view->cell.configured)
- return 0;
- if (view == VIEW_MAP1 || view == VIEW_MAP1_ZOOM) {
- colors = &VIEW_MAP1->cell.colors;
- read_colors = view == VIEW_MAP1;
- }
- if (read_colors) {
- G_free_colors(colors);
- if (G_read_colors(view->cell.name, view->cell.mapset, colors) < 0)
- return 0;
- }
-
-
- display_title(view);
-
- set_colors(colors);
-
- G_set_window(&view->cell.head);
- nrows = G_window_rows();
- ncols = G_window_cols();
-
- left = view->cell.left;
- top = view->cell.top;
-
- R_standard_color(BLUE);
- Outline_box(top, top + nrows - 1, left, left + ncols - 1);
-
- if (getenv("NO_DRAW"))
- return 1;
-
- fd = G_open_cell_old(view->cell.name, view->cell.mapset);
- if (fd < 0)
- return 0;
- cell = G_allocate_cell_buf();
-
-
- sprintf(msg, "Plotting %s ...", view->cell.name);
- Menu_msg(msg);
-
- D_cell_draw_setup(top, top + nrows, left, left + ncols);
- for (row = 0; row < nrows; row++) {
- if (G_get_map_row_nomask(fd, cell, row) < 0)
- break;
- D_draw_c_raster(row, cell, colors);
- }
- D_cell_draw_end();
- G_close_cell(fd);
- G_free(cell);
-
- if (colors != &VIEW_MAP1->cell.colors)
- set_colors(&VIEW_MAP1->cell.colors);
-
- return row == nrows;
-}
Copied: grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2image/drawcell.c (from rev 44501, grass/branches/develbranch_6/imagery/i.ortho.photo/i.photo.2image/drawcell.c)
===================================================================
--- grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2image/drawcell.c (rev 0)
+++ grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2image/drawcell.c 2010-12-22 10:05:10 UTC (rev 44654)
@@ -0,0 +1,72 @@
+#include <stdlib.h>
+#include <grass/gis.h>
+#include <grass/display.h>
+#include <grass/raster.h>
+#include "globals.h"
+
+int drawcell(View * view)
+{
+ int fd;
+ int left, top;
+ int ncols, nrows;
+ int row;
+ CELL *cell;
+ struct Colors *colors = NULL;
+ int read_colors = 0;
+ char msg[100];
+
+
+ if (!view->cell.configured)
+ return 0;
+ if (view == VIEW_MAP1 || view == VIEW_MAP1_ZOOM) {
+ colors = &VIEW_MAP1->cell.colors;
+ read_colors = view == VIEW_MAP1;
+ }
+ if (read_colors) {
+ G_free_colors(colors);
+ if (G_read_colors(view->cell.name, view->cell.mapset, colors) < 0)
+ return 0;
+ }
+
+
+ display_title(view);
+
+ set_colors(colors);
+
+ G_set_window(&view->cell.head);
+ nrows = G_window_rows();
+ ncols = G_window_cols();
+
+ left = view->cell.left;
+ top = view->cell.top;
+
+ R_standard_color(BLUE);
+ Outline_box(top, top + nrows - 1, left, left + ncols - 1);
+
+ if (getenv("NO_DRAW"))
+ return 1;
+
+ fd = G_open_cell_old(view->cell.name, view->cell.mapset);
+ if (fd < 0)
+ return 0;
+ cell = G_allocate_cell_buf();
+
+
+ sprintf(msg, "Plotting %s ...", view->cell.name);
+ Menu_msg(msg);
+
+ D_cell_draw_setup(top, top + nrows, left, left + ncols);
+ for (row = 0; row < nrows; row++) {
+ if (G_get_map_row_nomask(fd, cell, row) < 0)
+ break;
+ D_draw_c_raster(row, cell, colors);
+ }
+ D_cell_draw_end();
+ G_close_cell(fd);
+ G_free(cell);
+
+ if (colors != &VIEW_MAP1->cell.colors)
+ set_colors(&VIEW_MAP1->cell.colors);
+
+ return row == nrows;
+}
Deleted: grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2image/driver.c
===================================================================
--- grass/branches/develbranch_6/imagery/i.ortho.photo/i.photo.2image/driver.c 2010-12-01 09:34:37 UTC (rev 44501)
+++ grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2image/driver.c 2010-12-22 10:05:10 UTC (rev 44654)
@@ -1,50 +0,0 @@
-#include "globals.h"
-
-static int use = 1;
-static int really_quit(void);
-static int dont_stop(void);
-static int stop(void);
-
-int driver(void)
-{
- static Objects objects[] = {
- MENU("QUIT", really_quit, &use),
- MENU("ZOOM", zoom, &use),
- MENU("PLOT CELL", plotcell, &use),
- MENU("CAMERA", drawcam, &use),
- MENU("ANALYZE", analyze, &use),
- INFO(" Input method -> ", &use),
- OPTION("KEYBOARD", 2, &from_keyboard),
- OPTION("CAMERA FILE", 2, &from_screen),
- OTHER(mark, &use),
- {0}
- };
-
- Input_pointer(objects);
- Menu_msg("");
-
- return 0;
-}
-
-static int really_quit(void)
-{
- static Objects objects[] = {
- INFO("really quit? ", &use),
- MENU("NO", dont_stop, &use),
- MENU("YES", stop, &use),
- {0}
- };
- if (Input_pointer(objects) < 0)
- return -1;
- return 0; /* don't quit */
-}
-
-static int dont_stop(void)
-{
- return 1;
-}
-
-static int stop(void)
-{
- return -1;
-}
Copied: grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2image/driver.c (from rev 44501, grass/branches/develbranch_6/imagery/i.ortho.photo/i.photo.2image/driver.c)
===================================================================
--- grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2image/driver.c (rev 0)
+++ grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2image/driver.c 2010-12-22 10:05:10 UTC (rev 44654)
@@ -0,0 +1,50 @@
+#include "globals.h"
+
+static int use = 1;
+static int really_quit(void);
+static int dont_stop(void);
+static int stop(void);
+
+int driver(void)
+{
+ static Objects objects[] = {
+ MENU("QUIT", really_quit, &use),
+ MENU("ZOOM", zoom, &use),
+ MENU("PLOT CELL", plotcell, &use),
+ MENU("CAMERA", drawcam, &use),
+ MENU("ANALYZE", analyze, &use),
+ INFO(" Input method -> ", &use),
+ OPTION("KEYBOARD", 2, &from_keyboard),
+ OPTION("CAMERA FILE", 2, &from_screen),
+ OTHER(mark, &use),
+ {0}
+ };
+
+ Input_pointer(objects);
+ Menu_msg("");
+
+ return 0;
+}
+
+static int really_quit(void)
+{
+ static Objects objects[] = {
+ INFO("really quit? ", &use),
+ MENU("NO", dont_stop, &use),
+ MENU("YES", stop, &use),
+ {0}
+ };
+ if (Input_pointer(objects) < 0)
+ return -1;
+ return 0; /* don't quit */
+}
+
+static int dont_stop(void)
+{
+ return 1;
+}
+
+static int stop(void)
+{
+ return -1;
+}
Deleted: grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2image/equ.c
===================================================================
--- grass/branches/develbranch_6/imagery/i.ortho.photo/i.photo.2image/equ.c 2010-12-01 09:34:37 UTC (rev 44501)
+++ grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2image/equ.c 2010-12-22 10:05:10 UTC (rev 44654)
@@ -1,12 +0,0 @@
-#include <grass/imagery.h>
-#include "globals.h"
-
-
-int Compute_equation(void)
-{
- group.ref_equation_stat = I_compute_ref_equations(&group.photo_points,
- group.E12, group.N12,
- group.E21, group.N21);
-
- return 0;
-}
Copied: grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2image/equ.c (from rev 44501, grass/branches/develbranch_6/imagery/i.ortho.photo/i.photo.2image/equ.c)
===================================================================
--- grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2image/equ.c (rev 0)
+++ grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2image/equ.c 2010-12-22 10:05:10 UTC (rev 44654)
@@ -0,0 +1,12 @@
+#include <grass/imagery.h>
+#include "globals.h"
+
+
+int Compute_equation(void)
+{
+ group.ref_equation_stat = I_compute_ref_equations(&group.photo_points,
+ group.E12, group.N12,
+ group.E21, group.N21);
+
+ return 0;
+}
Deleted: grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2image/find.c
===================================================================
--- grass/branches/develbranch_6/imagery/i.ortho.photo/i.photo.2image/find.c 2010-12-01 09:34:37 UTC (rev 44501)
+++ grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2image/find.c 2010-12-22 10:05:10 UTC (rev 44654)
@@ -1,49 +0,0 @@
-#include <stdlib.h>
-#include <unistd.h>
-#include <sys/types.h>
-#ifdef __MINGW32__
-#include <process.h>
-#else
-#include <sys/wait.h>
-#endif
-#include <grass/gis.h>
-#include "globals.h"
-
-
-/*
- * run etc/i.find command in background to find all cell, vect files
- * in the target location.
- */
-int find_target_files(void)
-{
- int pid, w, status;
-
- select_target_env();
- pid = G_fork(); /* use G_fork() to inhibit signals */
- if (pid < 0) {
- perror("fork");
- exit(1);
- }
-
- /*
- * parent waits for child. this wait will be short since child
- * simply forks and exits. The grandchild runs in background
- * and grandma continues
- */
- if (pid) {
- while ((w = wait(&status)) != pid && w != -1) ;
- }
- else {
- char command[1024];
-
- sprintf(command, "%s/etc/i.find", G_gisbase());
- if (fork())
- exit(0); /* go into background */
- execl(command, "i.find",
- G_location(), G_mapset(),
- "cell", cell_list, "dig", vect_list, (char *)0);
- }
- select_current_env();
-
- return 0;
-}
Copied: grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2image/find.c (from rev 44501, grass/branches/develbranch_6/imagery/i.ortho.photo/i.photo.2image/find.c)
===================================================================
--- grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2image/find.c (rev 0)
+++ grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2image/find.c 2010-12-22 10:05:10 UTC (rev 44654)
@@ -0,0 +1,49 @@
+#include <stdlib.h>
+#include <unistd.h>
+#include <sys/types.h>
+#ifdef __MINGW32__
+#include <process.h>
+#else
+#include <sys/wait.h>
+#endif
+#include <grass/gis.h>
+#include "globals.h"
+
+
+/*
+ * run etc/i.find command in background to find all cell, vect files
+ * in the target location.
+ */
+int find_target_files(void)
+{
+ int pid, w, status;
+
+ select_target_env();
+ pid = G_fork(); /* use G_fork() to inhibit signals */
+ if (pid < 0) {
+ perror("fork");
+ exit(1);
+ }
+
+ /*
+ * parent waits for child. this wait will be short since child
+ * simply forks and exits. The grandchild runs in background
+ * and grandma continues
+ */
+ if (pid) {
+ while ((w = wait(&status)) != pid && w != -1) ;
+ }
+ else {
+ char command[1024];
+
+ sprintf(command, "%s/etc/i.find", G_gisbase());
+ if (fork())
+ exit(0); /* go into background */
+ execl(command, "i.find",
+ G_location(), G_mapset(),
+ "cell", cell_list, "dig", vect_list, (char *)0);
+ }
+ select_current_env();
+
+ return 0;
+}
Deleted: grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2image/globals.h
===================================================================
--- grass/branches/develbranch_6/imagery/i.ortho.photo/i.photo.2image/globals.h 2010-12-01 09:34:37 UTC (rev 44501)
+++ grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2image/globals.h 2010-12-22 10:05:10 UTC (rev 44654)
@@ -1,218 +0,0 @@
-#include "defs.h"
-
-#ifndef GLOBAL
-# define GLOBAL extern
-# define INIT(x)
-#else
-# define INIT(x) = x
-#endif
-
-GLOBAL int SCREEN_TOP;
-GLOBAL int SCREEN_BOTTOM;
-GLOBAL int SCREEN_LEFT;
-GLOBAL int SCREEN_RIGHT;
-
-GLOBAL Window *INFO_WINDOW;
-GLOBAL Window *MENU_WINDOW;
-GLOBAL Window *PROMPT_WINDOW;
-
-GLOBAL View *VIEW_MAP1;
-GLOBAL View *VIEW_TITLE1;
-GLOBAL View *VIEW_MAP1_ZOOM;
-GLOBAL View *VIEW_TITLE1_ZOOM;
-
-GLOBAL View *VIEW_CAM_REF;
-GLOBAL View *VIEW_CAM_TITLE;
-
-GLOBAL View *VIEW_MENU;
-
-/* GLOBAL Block block; */
-GLOBAL struct Ortho_Image_Group group;
-
-GLOBAL char interrupt_char;
-GLOBAL char *tempfile1;
-GLOBAL char *tempfile2;
-GLOBAL char *tempfile3;
-
-GLOBAL char *digit_points; /* digitizer control points */
-GLOBAL int use_camera_file INIT(0); /* is there a digitizer out there? */
-
-/* group file list, target cell,vector files */
-GLOBAL char *group_list INIT(NULL);
-GLOBAL char *cell_list INIT(NULL);
-GLOBAL char *vect_list INIT(NULL);
-
-GLOBAL int from_keyboard INIT(-1); /* input method */
-GLOBAL int from_file INIT(-1);
-GLOBAL int from_screen INIT(-1);
-GLOBAL int from_flag INIT(0);
-
-GLOBAL int dotsize INIT(4);
-
-GLOBAL int COLOR[10];
-
-#define BLACK COLOR[0]
-#define BLUE COLOR[1]
-#define BROWN COLOR[2]
-#define GREEN COLOR[3]
-#define GREY COLOR[4]
-#define ORANGE COLOR[5]
-#define PURPLE COLOR[6]
-#define RED COLOR[7]
-#define WHITE COLOR[8]
-#define YELLOW COLOR[9]
-
-double row_to_northing();
-double col_to_easting();
-double northing_to_row();
-double easting_to_col();
-
-#undef INIT
-/* analyze.c */
-int analyze(void);
-
-/* ask.c */
-int ask_gis_files(char *, char *, char *, char *, int);
-
-/* ask_mag.c */
-int ask_magnification(int *);
-int draw_mag(void);
-
-/* assign.c */
-/* call.c */
-int call(int (*)(), char *);
-
-/* cam_ref.c */
-int get_cam_ref(void);
-
-/* cell.c */
-int plotcell(int, int);
-
-/* cellhd.c */
-int Outline_cellhd(View *, struct Cell_head *);
-
-/* colors.c */
-int set_colors(struct Colors *);
-
-/* conv.c */
-int view_to_col(View *, int);
-int view_to_row(View *, int);
-int col_to_view(View *, int);
-int row_to_view(View *, int);
-double row_to_northing(struct Cell_head *, int, double);
-double col_to_easting(struct Cell_head *, int, double);
-double northing_to_row(struct Cell_head *, double);
-double easting_to_col(struct Cell_head *, double);
-
-/* curses.c */
-int Begin_curses(void);
-int End_curses(void);
-int Suspend_curses(void);
-int Resume_curses(void);
-int Curses_allow_interrupts(int);
-int Curses_clear_window(Window *);
-int Curses_outline_window(Window *);
-int Curses_write_window(Window *, int, int, char *);
-int Curses_replot_screen(void);
-int Curses_prompt_gets(char *, char *);
-int Beep(void);
-int Curses_getch(int);
-
-/* digit.c */
-int setup_digitizer(void);
-int digitizer_point(double *, double *);
-
-/* dot.c */
-int dot(int, int);
-int save_under_dot(int, int);
-int restore_under_dot(void);
-int release_under_dot(void);
-
-/* drawcam.c */
-int drawcam(void);
-
-/* drawcam2.c */
-int drawcam(void);
-
-/* drawcell.c */
-int drawcell(View *);
-
-/* driver.c */
-int driver(void);
-
-/* equ.c */
-int Compute_equation(void);
-
-/* find.c */
-int find_target_files(void);
-
-/* graphics.c */
-int Init_graphics(void);
-int Outline_box(int, int, int, int);
-int Text_width(char *);
-int Text(char *, int, int, int, int, int);
-int Uparrow(int, int, int, int);
-int Downarrow(int, int, int, int);
-
-/* group.c */
-int prepare_group_list(void);
-int choose_groupfile(char *, char *);
-
-/* input.c */
-int Input_pointer(Objects *);
-int Input_box(Objects *, int, int);
-int Input_other(int (*)(), char *);
-int Menu_msg(char *);
-int Start_mouse_in_menu(void);
-
-/* main.c */
-#ifdef __GNUC_MINOR__
-int quit(int) __attribute__ ((__noreturn__));
-#else
-int quit(int);
-#endif
-int error(const char *, int);
-
-/* mark.c */
-int mark(int, int, int);
-int mark_point(View *, int, int);
-
-/* mouse.c */
-int Mouse_pointer(int *, int *, int *);
-int Mouse_box_anchored(int, int, int *, int *, int *);
-int Get_mouse_xy(int *, int *);
-int Set_mouse_xy(int, int);
-
-/* points.c */
-int display_ref_points(int);
-int display_ref_points_in_view(View *, int, double *, double *, int *, int);
-int display_one_point(View *, double, double);
-
-/* target.c */
-int get_target(void);
-int select_current_env(void);
-int select_target_env(void);
-
-/* title.c */
-int display_title(View *);
-
-/* use_camera.c */
-int setup_camera_file(void);
-
-/* view.c */
-int Configure_view(View *, char *, char *, double, double);
-int In_view(View *, int, int);
-int Erase_view(View *);
-double magnification(View *);
-
-/* where.c */
-int where(int, int);
-
-/* zoom.c */
-int zoom(void);
-
-/* zoom_box.c */
-int zoom_box(void);
-
-/* zoom_pnt.c */
-int zoom_point(void);
Copied: grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2image/globals.h (from rev 44501, grass/branches/develbranch_6/imagery/i.ortho.photo/i.photo.2image/globals.h)
===================================================================
--- grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2image/globals.h (rev 0)
+++ grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2image/globals.h 2010-12-22 10:05:10 UTC (rev 44654)
@@ -0,0 +1,218 @@
+#include "defs.h"
+
+#ifndef GLOBAL
+# define GLOBAL extern
+# define INIT(x)
+#else
+# define INIT(x) = x
+#endif
+
+GLOBAL int SCREEN_TOP;
+GLOBAL int SCREEN_BOTTOM;
+GLOBAL int SCREEN_LEFT;
+GLOBAL int SCREEN_RIGHT;
+
+GLOBAL Window *INFO_WINDOW;
+GLOBAL Window *MENU_WINDOW;
+GLOBAL Window *PROMPT_WINDOW;
+
+GLOBAL View *VIEW_MAP1;
+GLOBAL View *VIEW_TITLE1;
+GLOBAL View *VIEW_MAP1_ZOOM;
+GLOBAL View *VIEW_TITLE1_ZOOM;
+
+GLOBAL View *VIEW_CAM_REF;
+GLOBAL View *VIEW_CAM_TITLE;
+
+GLOBAL View *VIEW_MENU;
+
+/* GLOBAL Block block; */
+GLOBAL struct Ortho_Image_Group group;
+
+GLOBAL char interrupt_char;
+GLOBAL char *tempfile1;
+GLOBAL char *tempfile2;
+GLOBAL char *tempfile3;
+
+GLOBAL char *digit_points; /* digitizer control points */
+GLOBAL int use_camera_file INIT(0); /* is there a digitizer out there? */
+
+/* group file list, target cell,vector files */
+GLOBAL char *group_list INIT(NULL);
+GLOBAL char *cell_list INIT(NULL);
+GLOBAL char *vect_list INIT(NULL);
+
+GLOBAL int from_keyboard INIT(-1); /* input method */
+GLOBAL int from_file INIT(-1);
+GLOBAL int from_screen INIT(-1);
+GLOBAL int from_flag INIT(0);
+
+GLOBAL int dotsize INIT(4);
+
+GLOBAL int COLOR[10];
+
+#define BLACK COLOR[0]
+#define BLUE COLOR[1]
+#define BROWN COLOR[2]
+#define GREEN COLOR[3]
+#define GREY COLOR[4]
+#define ORANGE COLOR[5]
+#define PURPLE COLOR[6]
+#define RED COLOR[7]
+#define WHITE COLOR[8]
+#define YELLOW COLOR[9]
+
+double row_to_northing();
+double col_to_easting();
+double northing_to_row();
+double easting_to_col();
+
+#undef INIT
+/* analyze.c */
+int analyze(void);
+
+/* ask.c */
+int ask_gis_files(char *, char *, char *, char *, int);
+
+/* ask_mag.c */
+int ask_magnification(int *);
+int draw_mag(void);
+
+/* assign.c */
+/* call.c */
+int call(int (*)(), char *);
+
+/* cam_ref.c */
+int get_cam_ref(void);
+
+/* cell.c */
+int plotcell(int, int);
+
+/* cellhd.c */
+int Outline_cellhd(View *, struct Cell_head *);
+
+/* colors.c */
+int set_colors(struct Colors *);
+
+/* conv.c */
+int view_to_col(View *, int);
+int view_to_row(View *, int);
+int col_to_view(View *, int);
+int row_to_view(View *, int);
+double row_to_northing(struct Cell_head *, int, double);
+double col_to_easting(struct Cell_head *, int, double);
+double northing_to_row(struct Cell_head *, double);
+double easting_to_col(struct Cell_head *, double);
+
+/* curses.c */
+int Begin_curses(void);
+int End_curses(void);
+int Suspend_curses(void);
+int Resume_curses(void);
+int Curses_allow_interrupts(int);
+int Curses_clear_window(Window *);
+int Curses_outline_window(Window *);
+int Curses_write_window(Window *, int, int, char *);
+int Curses_replot_screen(void);
+int Curses_prompt_gets(char *, char *);
+int Beep(void);
+int Curses_getch(int);
+
+/* digit.c */
+int setup_digitizer(void);
+int digitizer_point(double *, double *);
+
+/* dot.c */
+int dot(int, int);
+int save_under_dot(int, int);
+int restore_under_dot(void);
+int release_under_dot(void);
+
+/* drawcam.c */
+int drawcam(void);
+
+/* drawcam2.c */
+int drawcam(void);
+
+/* drawcell.c */
+int drawcell(View *);
+
+/* driver.c */
+int driver(void);
+
+/* equ.c */
+int Compute_equation(void);
+
+/* find.c */
+int find_target_files(void);
+
+/* graphics.c */
+int Init_graphics(void);
+int Outline_box(int, int, int, int);
+int Text_width(char *);
+int Text(char *, int, int, int, int, int);
+int Uparrow(int, int, int, int);
+int Downarrow(int, int, int, int);
+
+/* group.c */
+int prepare_group_list(void);
+int choose_groupfile(char *, char *);
+
+/* input.c */
+int Input_pointer(Objects *);
+int Input_box(Objects *, int, int);
+int Input_other(int (*)(), char *);
+int Menu_msg(char *);
+int Start_mouse_in_menu(void);
+
+/* main.c */
+#ifdef __GNUC_MINOR__
+int quit(int) __attribute__ ((__noreturn__));
+#else
+int quit(int);
+#endif
+int error(const char *, int);
+
+/* mark.c */
+int mark(int, int, int);
+int mark_point(View *, int, int);
+
+/* mouse.c */
+int Mouse_pointer(int *, int *, int *);
+int Mouse_box_anchored(int, int, int *, int *, int *);
+int Get_mouse_xy(int *, int *);
+int Set_mouse_xy(int, int);
+
+/* points.c */
+int display_ref_points(int);
+int display_ref_points_in_view(View *, int, double *, double *, int *, int);
+int display_one_point(View *, double, double);
+
+/* target.c */
+int get_target(void);
+int select_current_env(void);
+int select_target_env(void);
+
+/* title.c */
+int display_title(View *);
+
+/* use_camera.c */
+int setup_camera_file(void);
+
+/* view.c */
+int Configure_view(View *, char *, char *, double, double);
+int In_view(View *, int, int);
+int Erase_view(View *);
+double magnification(View *);
+
+/* where.c */
+int where(int, int);
+
+/* zoom.c */
+int zoom(void);
+
+/* zoom_box.c */
+int zoom_box(void);
+
+/* zoom_pnt.c */
+int zoom_point(void);
Deleted: grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2image/graphics.c
===================================================================
--- grass/branches/develbranch_6/imagery/i.ortho.photo/i.photo.2image/graphics.c 2010-12-01 09:34:37 UTC (rev 44501)
+++ grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2image/graphics.c 2010-12-22 10:05:10 UTC (rev 44654)
@@ -1,132 +0,0 @@
-#include <grass/gis.h>
-#include <grass/display.h>
-#include <grass/raster.h>
-#include "globals.h"
-
-static View *makeview(double bottom, double top, double left, double right)
-{
- View *view;
-
- view = (View *) G_malloc(sizeof(View));
-
- top = 100 - top;
- bottom = 100 - bottom;
-
- view->top = SCREEN_TOP + (SCREEN_BOTTOM - SCREEN_TOP) * top / 100.0;
- view->bottom = SCREEN_TOP + (SCREEN_BOTTOM - SCREEN_TOP) * bottom / 100.0;
- view->left = SCREEN_LEFT + (SCREEN_RIGHT - SCREEN_LEFT) * left / 100.0;
- view->right = SCREEN_LEFT + (SCREEN_RIGHT - SCREEN_LEFT) * right / 100.0;
-
- if (view->top < SCREEN_TOP)
- view->top = SCREEN_TOP;
- if (view->bottom > SCREEN_BOTTOM)
- view->bottom = SCREEN_BOTTOM;
- if (view->left < SCREEN_LEFT)
- view->left = SCREEN_LEFT;
- if (view->right > SCREEN_RIGHT)
- view->right = SCREEN_RIGHT;
-
- Outline_box(view->top, view->bottom, view->left, view->right);
-
- view->top++;
- view->bottom--;
- view->left++;
- view->right--;
-
- view->nrows = view->bottom - view->top + 1;
- view->ncols = view->right - view->left + 1;
- view->cell.configured = 0;
-
- return view;
-}
-
-int Init_graphics(void)
-{
- /* Dclearscreen(); */
- D_full_screen();
-
- SCREEN_TOP = R_screen_top();
- SCREEN_BOTTOM = R_screen_bot();
- SCREEN_LEFT = R_screen_left();
- SCREEN_RIGHT = R_screen_rite();
-
-
- BLACK = D_translate_color("black");
- BLUE = D_translate_color("blue");
- BROWN = D_translate_color("brown");
- GREEN = D_translate_color("green");
- GREY = D_translate_color("grey");
- ORANGE = D_translate_color("orange");
- PURPLE = D_translate_color("purple");
- RED = D_translate_color("red");
- WHITE = D_translate_color("white");
- YELLOW = D_translate_color("yellow");
-
- R_standard_color(WHITE);
-
- VIEW_TITLE1 = makeview(97.5, 100.0, 0.0, 50.0);
- VIEW_MAP1 = makeview(51.0, 97.5, 0.0, 50.0);
- VIEW_TITLE1_ZOOM = makeview(97.5, 100.0, 50.0, 100.0);
- VIEW_MAP1_ZOOM = makeview(51.0, 97.5, 50.0, 100.0);
- VIEW_MENU = makeview(0.0, 2.5, 0.0, 100.0);
-
- G_init_colors(&VIEW_MAP1->cell.colors);
-
- return 0;
-}
-
-int Outline_box(int top, int bottom, int left, int right)
-{
- R_move_abs(left, top);
- R_cont_abs(left, bottom);
- R_cont_abs(right, bottom);
- R_cont_abs(right, top);
- R_cont_abs(left, top);
-
- return 0;
-}
-
-
-int Text_width(char *text)
-{
- int top, bottom, left, right;
-
- R_get_text_box(text, &top, &bottom, &left, &right);
-
- if (right > left)
- return right - left + 1;
- else
- return left - right + 1;
-}
-
-int Text(char *text, int top, int bottom, int left, int right, int the_border)
-{
- R_set_window(top, bottom, left, right);
- R_move_abs(left + the_border, bottom - the_border);
- R_text(text);
- R_set_window(SCREEN_TOP, SCREEN_BOTTOM, SCREEN_LEFT, SCREEN_RIGHT);
-
- return 0;
-}
-
-int Uparrow(int top, int bottom, int left, int right)
-{
- R_move_abs((left + right) / 2, bottom);
- R_cont_abs((left + right) / 2, top);
- R_cont_rel((left - right) / 2, (bottom - top) / 2);
- R_move_abs((left + right) / 2, top);
- R_cont_rel((right - left) / 2, (bottom - top) / 2);
-
- return 0;
-}
-
-int Downarrow(int top, int bottom, int left, int right)
-{
- R_move_abs((left + right) / 2, top);
- R_cont_abs((left + right) / 2, bottom);
- R_cont_rel((left - right) / 2, (top - bottom) / 2);
- R_move_abs((left + right) / 2, bottom);
- R_cont_rel((right - left) / 2, (top - bottom) / 2);
-
- return 0;
-}
Copied: grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2image/graphics.c (from rev 44501, grass/branches/develbranch_6/imagery/i.ortho.photo/i.photo.2image/graphics.c)
===================================================================
--- grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2image/graphics.c (rev 0)
+++ grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2image/graphics.c 2010-12-22 10:05:10 UTC (rev 44654)
@@ -0,0 +1,132 @@
+#include <grass/gis.h>
+#include <grass/display.h>
+#include <grass/raster.h>
+#include "globals.h"
+
+static View *makeview(double bottom, double top, double left, double right)
+{
+ View *view;
+
+ view = (View *) G_malloc(sizeof(View));
+
+ top = 100 - top;
+ bottom = 100 - bottom;
+
+ view->top = SCREEN_TOP + (SCREEN_BOTTOM - SCREEN_TOP) * top / 100.0;
+ view->bottom = SCREEN_TOP + (SCREEN_BOTTOM - SCREEN_TOP) * bottom / 100.0;
+ view->left = SCREEN_LEFT + (SCREEN_RIGHT - SCREEN_LEFT) * left / 100.0;
+ view->right = SCREEN_LEFT + (SCREEN_RIGHT - SCREEN_LEFT) * right / 100.0;
+
+ if (view->top < SCREEN_TOP)
+ view->top = SCREEN_TOP;
+ if (view->bottom > SCREEN_BOTTOM)
+ view->bottom = SCREEN_BOTTOM;
+ if (view->left < SCREEN_LEFT)
+ view->left = SCREEN_LEFT;
+ if (view->right > SCREEN_RIGHT)
+ view->right = SCREEN_RIGHT;
+
+ Outline_box(view->top, view->bottom, view->left, view->right);
+
+ view->top++;
+ view->bottom--;
+ view->left++;
+ view->right--;
+
+ view->nrows = view->bottom - view->top + 1;
+ view->ncols = view->right - view->left + 1;
+ view->cell.configured = 0;
+
+ return view;
+}
+
+int Init_graphics(void)
+{
+ /* Dclearscreen(); */
+ D_full_screen();
+
+ SCREEN_TOP = R_screen_top();
+ SCREEN_BOTTOM = R_screen_bot();
+ SCREEN_LEFT = R_screen_left();
+ SCREEN_RIGHT = R_screen_rite();
+
+
+ BLACK = D_translate_color("black");
+ BLUE = D_translate_color("blue");
+ BROWN = D_translate_color("brown");
+ GREEN = D_translate_color("green");
+ GREY = D_translate_color("grey");
+ ORANGE = D_translate_color("orange");
+ PURPLE = D_translate_color("purple");
+ RED = D_translate_color("red");
+ WHITE = D_translate_color("white");
+ YELLOW = D_translate_color("yellow");
+
+ R_standard_color(WHITE);
+
+ VIEW_TITLE1 = makeview(97.5, 100.0, 0.0, 50.0);
+ VIEW_MAP1 = makeview(51.0, 97.5, 0.0, 50.0);
+ VIEW_TITLE1_ZOOM = makeview(97.5, 100.0, 50.0, 100.0);
+ VIEW_MAP1_ZOOM = makeview(51.0, 97.5, 50.0, 100.0);
+ VIEW_MENU = makeview(0.0, 2.5, 0.0, 100.0);
+
+ G_init_colors(&VIEW_MAP1->cell.colors);
+
+ return 0;
+}
+
+int Outline_box(int top, int bottom, int left, int right)
+{
+ R_move_abs(left, top);
+ R_cont_abs(left, bottom);
+ R_cont_abs(right, bottom);
+ R_cont_abs(right, top);
+ R_cont_abs(left, top);
+
+ return 0;
+}
+
+
+int Text_width(char *text)
+{
+ int top, bottom, left, right;
+
+ R_get_text_box(text, &top, &bottom, &left, &right);
+
+ if (right > left)
+ return right - left + 1;
+ else
+ return left - right + 1;
+}
+
+int Text(char *text, int top, int bottom, int left, int right, int the_border)
+{
+ R_set_window(top, bottom, left, right);
+ R_move_abs(left + the_border, bottom - the_border);
+ R_text(text);
+ R_set_window(SCREEN_TOP, SCREEN_BOTTOM, SCREEN_LEFT, SCREEN_RIGHT);
+
+ return 0;
+}
+
+int Uparrow(int top, int bottom, int left, int right)
+{
+ R_move_abs((left + right) / 2, bottom);
+ R_cont_abs((left + right) / 2, top);
+ R_cont_rel((left - right) / 2, (bottom - top) / 2);
+ R_move_abs((left + right) / 2, top);
+ R_cont_rel((right - left) / 2, (bottom - top) / 2);
+
+ return 0;
+}
+
+int Downarrow(int top, int bottom, int left, int right)
+{
+ R_move_abs((left + right) / 2, top);
+ R_cont_abs((left + right) / 2, bottom);
+ R_cont_rel((left - right) / 2, (top - bottom) / 2);
+ R_move_abs((left + right) / 2, bottom);
+ R_cont_rel((right - left) / 2, (top - bottom) / 2);
+
+ return 0;
+}
Deleted: grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2image/group.c
===================================================================
--- grass/branches/develbranch_6/imagery/i.ortho.photo/i.photo.2image/group.c 2010-12-01 09:34:37 UTC (rev 44501)
+++ grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2image/group.c 2010-12-22 10:05:10 UTC (rev 44654)
@@ -1,72 +0,0 @@
-#include <string.h>
-#include <stdlib.h>
-#include <grass/gis.h>
-#include "globals.h"
-
-
-static int cmp(const void *, const void *);
-
-
-int prepare_group_list(void)
-{
- FILE *fd;
- int *idx;
- int n;
- int len, len1, len2;
-
- /* open file to store group file names */
- fd = fopen(group_list, "w");
- if (fd == NULL)
- G_fatal_error("Can't open any tempfiles");
-
- /*
- * build sorted index into group files
- * so that all raster maps for a mapset to appear together
- */
- idx = (int *)G_calloc(group.group_ref.nfiles, sizeof(int));
- for (n = 0; n < group.group_ref.nfiles; n++)
- idx[n] = n;
- qsort(idx, group.group_ref.nfiles, sizeof(int), cmp);
-
- /* determine length of longest mapset name, and longest raster map name */
- len1 = len2 = 0;
- for (n = 0; n < group.group_ref.nfiles; n++) {
- len = strlen(group.group_ref.file[n].name);
- if (len > len1)
- len1 = len;
- len = strlen(group.group_ref.file[n].mapset);
- if (len > len2)
- len2 = len;
- }
-
- /* write lengths, names to file */
- fwrite(&len1, sizeof(len1), 1, fd);
- fwrite(&len2, sizeof(len2), 1, fd);
- for (n = 0; n < group.group_ref.nfiles; n++)
- fprintf(fd, "%s %s\n", group.group_ref.file[idx[n]].name,
- group.group_ref.file[idx[n]].mapset);
- fclose(fd);
-
- G_free(idx);
-
- return 0;
-}
-
-static int cmp(const void *aa, const void *bb)
-{
- const int *a = aa, *b = bb;
- int n;
-
- if ((n =
- strcmp(group.group_ref.file[*a].mapset,
- group.group_ref.file[*b].mapset)) != 0)
- return n;
- return strcmp(group.group_ref.file[*a].name,
- group.group_ref.file[*b].name);
-}
-
-/* ask the user to pick a file */
-int choose_groupfile(char *name, char *mapset)
-{
- return ask_gis_files("cell", group_list, name, mapset, -1);
-}
Copied: grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2image/group.c (from rev 44501, grass/branches/develbranch_6/imagery/i.ortho.photo/i.photo.2image/group.c)
===================================================================
--- grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2image/group.c (rev 0)
+++ grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2image/group.c 2010-12-22 10:05:10 UTC (rev 44654)
@@ -0,0 +1,72 @@
+#include <string.h>
+#include <stdlib.h>
+#include <grass/gis.h>
+#include "globals.h"
+
+
+static int cmp(const void *, const void *);
+
+
+int prepare_group_list(void)
+{
+ FILE *fd;
+ int *idx;
+ int n;
+ int len, len1, len2;
+
+ /* open file to store group file names */
+ fd = fopen(group_list, "w");
+ if (fd == NULL)
+ G_fatal_error("Can't open any tempfiles");
+
+ /*
+ * build sorted index into group files
+ * so that all raster maps for a mapset to appear together
+ */
+ idx = (int *)G_calloc(group.group_ref.nfiles, sizeof(int));
+ for (n = 0; n < group.group_ref.nfiles; n++)
+ idx[n] = n;
+ qsort(idx, group.group_ref.nfiles, sizeof(int), cmp);
+
+ /* determine length of longest mapset name, and longest raster map name */
+ len1 = len2 = 0;
+ for (n = 0; n < group.group_ref.nfiles; n++) {
+ len = strlen(group.group_ref.file[n].name);
+ if (len > len1)
+ len1 = len;
+ len = strlen(group.group_ref.file[n].mapset);
+ if (len > len2)
+ len2 = len;
+ }
+
+ /* write lengths, names to file */
+ fwrite(&len1, sizeof(len1), 1, fd);
+ fwrite(&len2, sizeof(len2), 1, fd);
+ for (n = 0; n < group.group_ref.nfiles; n++)
+ fprintf(fd, "%s %s\n", group.group_ref.file[idx[n]].name,
+ group.group_ref.file[idx[n]].mapset);
+ fclose(fd);
+
+ G_free(idx);
+
+ return 0;
+}
+
+static int cmp(const void *aa, const void *bb)
+{
+ const int *a = aa, *b = bb;
+ int n;
+
+ if ((n =
+ strcmp(group.group_ref.file[*a].mapset,
+ group.group_ref.file[*b].mapset)) != 0)
+ return n;
+ return strcmp(group.group_ref.file[*a].name,
+ group.group_ref.file[*b].name);
+}
+
+/* ask the user to pick a file */
+int choose_groupfile(char *name, char *mapset)
+{
+ return ask_gis_files("cell", group_list, name, mapset, -1);
+}
Deleted: grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2image/input.c
===================================================================
--- grass/branches/develbranch_6/imagery/i.ortho.photo/i.photo.2image/input.c 2010-12-01 09:34:37 UTC (rev 44501)
+++ grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2image/input.c 2010-12-22 10:05:10 UTC (rev 44654)
@@ -1,259 +0,0 @@
-#include <grass/raster.h>
-#include "globals.h"
-
-static int active = 0;
-static int replot;
-static int mouse(Objects *, int, int, int);
-static int use_mouse_msg(void);
-static int draw_objects(Objects *);
-static Objects *find(Objects *, int, int);
-static int select_option(Objects *, Objects *);
-static int draw_option_boxes(Objects *);
-static int visible(Objects *);
-
-#define TEXT_COLOR BLACK
-#define FILL_COLOR GREY
-#define OUTLINE_COLOR WHITE
-
-/* Input: drive mouse. returns status of handler that returns != 0 */
-int Input_pointer(Objects * objects)
-{
- return mouse(objects, 0, 0, 0);
-}
-
-int Input_box(Objects * objects, int ax, int ay)
-{
- return mouse(objects, ax, ay, 1);
-}
-
-int Input_other(int (*function) (), char *type)
-{
- int stat;
- char msg[1024];
-
- sprintf(msg, "%s input required", type);
- Menu_msg(msg);
- stat = (*function) ();
- if (active)
- use_mouse_msg();
-
- Menu_msg("");
- return stat;
-}
-
-static int mouse(Objects * objects, int ax, int ay, int box)
-{
- int first;
- int stat;
- int x, y, button;
- Objects *obj;
-
- first = !active;
- active = 1;
- if (first)
- use_mouse_msg();
-
- if (box) {
- x = ax + 20;
- y = ay + 20;
- }
- stat = 0;
- replot = 1;
- while (stat == 0) {
- if (replot) {
- replot = 0;
- draw_objects(objects);
- }
- if (box)
- Mouse_box_anchored(ax, ay, &x, &y, &button);
- else
- Mouse_pointer(&x, &y, &button);
-
- if (!(obj = find(objects, x, y)))
- continue;
-
- switch (obj->type) {
- case MENU_OBJECT:
- case OTHER_OBJECT:
- stat = (*obj->handler) (x, y, button);
- break;
- case OPTION_OBJECT:
- select_option(objects, obj);
- draw_option_boxes(objects);
- break;
- }
- }
-
- /* if we are first call, mark not active
- * indicate that objects above use must be replotted.
- */
- if (first)
- active = 0;
- Menu_msg("");
-
- return stat;
-}
-
-static int use_mouse_msg(void)
-{
- Curses_write_window(PROMPT_WINDOW, 1, 1, "Use mouse now ...\n");
-
- return 0;
-}
-
-static int draw_objects(Objects * objects)
-{
- Objects *obj;
- int top, bottom, left, right;
- int size, edge;
-
-
- /* erase the menu window */
- Erase_view(VIEW_MENU);
- R_flush();
-
- /* determine sizes and text indentation */
- size = VIEW_MENU->nrows - 4;
- edge = 2;
-
- R_text_size(size, size);
-
- left = VIEW_MENU->left;
- top = VIEW_MENU->top;
- bottom = VIEW_MENU->bottom;
-
-
- /* put the (boxed) text on the menu view */
- for (obj = objects; obj->type; obj++) {
- if (!visible(obj))
- continue;
- switch (obj->type) {
- case OPTION_OBJECT:
- case MENU_OBJECT:
- right = left + 2 * edge + Text_width(obj->label);
- obj->left = left;
- obj->right = right;
- obj->top = top;
- obj->bottom = bottom;
-
- R_standard_color(FILL_COLOR);
- R_box_abs(left, top, right, bottom);
-
- R_standard_color(TEXT_COLOR);
- Text(obj->label, top, bottom, left, right, edge);
-
- R_standard_color(OUTLINE_COLOR);
- Outline_box(top, bottom, left, right);
-
- left = right;
- break;
-
- case INFO_OBJECT:
- if (*obj->label == 0)
- break;
- if (*obj->status < 0)
- break;
- right = left + 2 * edge + Text_width(obj->label);
- R_standard_color(WHITE);
- Text(obj->label, top, bottom, left, right, edge);
-
- left = right;
- break;
- }
- }
- draw_option_boxes(objects);
- R_flush();
-
- return 0;
-}
-
-static Objects *find(Objects * objects, int x, int y)
-{
- Objects *other;
-
- other = NULL;
- for (; objects->type; objects++) {
- if (!visible(objects))
- continue;
- switch (objects->type) {
- case MENU_OBJECT:
- case OPTION_OBJECT:
- if (x >= objects->left && x <= objects->right
- && y >= objects->top && y <= objects->bottom)
- return objects;
- break;
- case OTHER_OBJECT:
- other = objects;
- break;
- }
- }
- return other;
-}
-
-static int select_option(Objects * objects, Objects * obj)
-{
- while (objects->type) {
- if (objects->type == OPTION_OBJECT && *objects->status >= 0 &&
- objects->binding == obj->binding)
- *objects->status = 0;
- objects++;
- }
- *obj->status = 1;
-
- return 0;
-}
-
-static int draw_option_boxes(Objects * objects)
-{
- Objects *x;
-
- R_standard_color(OUTLINE_COLOR);
- for (x = objects; x->type; x++) {
- if (x->type == OPTION_OBJECT && *x->status == 0)
- Outline_box(x->top +1, x->bottom, x->left, x->right -1);
- }
- R_standard_color(GREEN);
- for (x = objects; x->type; x++) {
- if (x->type == OPTION_OBJECT && *x->status > 0)
- Outline_box(x->top +1, x->bottom, x->left, x->right -1);
- }
- R_flush();
-
- return 0;
-}
-
-static int visible(Objects * object)
-{
- if (object->type == OPTION_OBJECT)
- return (*object->status >= 0);
- return (*object->status > 0);
-}
-
-int Menu_msg(char *msg)
-{
- int size, edge;
-
- size = VIEW_MENU->nrows - 4;
- edge = 2;
-
- Erase_view(VIEW_MENU);
-
- if (*msg) {
- R_text_size(size, size);
- R_standard_color(WHITE);
- Text(msg, VIEW_MENU->top, VIEW_MENU->bottom,
- VIEW_MENU->left, VIEW_MENU->right, edge);
- }
- R_flush();
- replot = 1;
-
- return 0;
-}
-
-int Start_mouse_in_menu(void)
-{
- Set_mouse_xy((VIEW_MENU->left + 2 * VIEW_MENU->right) / 3,
- (VIEW_MENU->top + VIEW_MENU->bottom) / 2);
-
- return 0;
-}
Copied: grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2image/input.c (from rev 44501, grass/branches/develbranch_6/imagery/i.ortho.photo/i.photo.2image/input.c)
===================================================================
--- grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2image/input.c (rev 0)
+++ grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2image/input.c 2010-12-22 10:05:10 UTC (rev 44654)
@@ -0,0 +1,259 @@
+#include <grass/raster.h>
+#include "globals.h"
+
+static int active = 0;
+static int replot;
+static int mouse(Objects *, int, int, int);
+static int use_mouse_msg(void);
+static int draw_objects(Objects *);
+static Objects *find(Objects *, int, int);
+static int select_option(Objects *, Objects *);
+static int draw_option_boxes(Objects *);
+static int visible(Objects *);
+
+#define TEXT_COLOR BLACK
+#define FILL_COLOR GREY
+#define OUTLINE_COLOR WHITE
+
+/* Input: drive mouse. returns status of handler that returns != 0 */
+int Input_pointer(Objects * objects)
+{
+ return mouse(objects, 0, 0, 0);
+}
+
+int Input_box(Objects * objects, int ax, int ay)
+{
+ return mouse(objects, ax, ay, 1);
+}
+
+int Input_other(int (*function) (), char *type)
+{
+ int stat;
+ char msg[1024];
+
+ sprintf(msg, "%s input required", type);
+ Menu_msg(msg);
+ stat = (*function) ();
+ if (active)
+ use_mouse_msg();
+
+ Menu_msg("");
+ return stat;
+}
+
+static int mouse(Objects * objects, int ax, int ay, int box)
+{
+ int first;
+ int stat;
+ int x, y, button;
+ Objects *obj;
+
+ first = !active;
+ active = 1;
+ if (first)
+ use_mouse_msg();
+
+ if (box) {
+ x = ax + 20;
+ y = ay + 20;
+ }
+ stat = 0;
+ replot = 1;
+ while (stat == 0) {
+ if (replot) {
+ replot = 0;
+ draw_objects(objects);
+ }
+ if (box)
+ Mouse_box_anchored(ax, ay, &x, &y, &button);
+ else
+ Mouse_pointer(&x, &y, &button);
+
+ if (!(obj = find(objects, x, y)))
+ continue;
+
+ switch (obj->type) {
+ case MENU_OBJECT:
+ case OTHER_OBJECT:
+ stat = (*obj->handler) (x, y, button);
+ break;
+ case OPTION_OBJECT:
+ select_option(objects, obj);
+ draw_option_boxes(objects);
+ break;
+ }
+ }
+
+ /* if we are first call, mark not active
+ * indicate that objects above use must be replotted.
+ */
+ if (first)
+ active = 0;
+ Menu_msg("");
+
+ return stat;
+}
+
+static int use_mouse_msg(void)
+{
+ Curses_write_window(PROMPT_WINDOW, 1, 1, "Use mouse now ...\n");
+
+ return 0;
+}
+
+static int draw_objects(Objects * objects)
+{
+ Objects *obj;
+ int top, bottom, left, right;
+ int size, edge;
+
+
+ /* erase the menu window */
+ Erase_view(VIEW_MENU);
+ R_flush();
+
+ /* determine sizes and text indentation */
+ size = VIEW_MENU->nrows - 4;
+ edge = 2;
+
+ R_text_size(size, size);
+
+ left = VIEW_MENU->left;
+ top = VIEW_MENU->top;
+ bottom = VIEW_MENU->bottom;
+
+
+ /* put the (boxed) text on the menu view */
+ for (obj = objects; obj->type; obj++) {
+ if (!visible(obj))
+ continue;
+ switch (obj->type) {
+ case OPTION_OBJECT:
+ case MENU_OBJECT:
+ right = left + 2 * edge + Text_width(obj->label);
+ obj->left = left;
+ obj->right = right;
+ obj->top = top;
+ obj->bottom = bottom;
+
+ R_standard_color(FILL_COLOR);
+ R_box_abs(left, top, right, bottom);
+
+ R_standard_color(TEXT_COLOR);
+ Text(obj->label, top, bottom, left, right, edge);
+
+ R_standard_color(OUTLINE_COLOR);
+ Outline_box(top, bottom, left, right);
+
+ left = right;
+ break;
+
+ case INFO_OBJECT:
+ if (*obj->label == 0)
+ break;
+ if (*obj->status < 0)
+ break;
+ right = left + 2 * edge + Text_width(obj->label);
+ R_standard_color(WHITE);
+ Text(obj->label, top, bottom, left, right, edge);
+
+ left = right;
+ break;
+ }
+ }
+ draw_option_boxes(objects);
+ R_flush();
+
+ return 0;
+}
+
+static Objects *find(Objects * objects, int x, int y)
+{
+ Objects *other;
+
+ other = NULL;
+ for (; objects->type; objects++) {
+ if (!visible(objects))
+ continue;
+ switch (objects->type) {
+ case MENU_OBJECT:
+ case OPTION_OBJECT:
+ if (x >= objects->left && x <= objects->right
+ && y >= objects->top && y <= objects->bottom)
+ return objects;
+ break;
+ case OTHER_OBJECT:
+ other = objects;
+ break;
+ }
+ }
+ return other;
+}
+
+static int select_option(Objects * objects, Objects * obj)
+{
+ while (objects->type) {
+ if (objects->type == OPTION_OBJECT && *objects->status >= 0 &&
+ objects->binding == obj->binding)
+ *objects->status = 0;
+ objects++;
+ }
+ *obj->status = 1;
+
+ return 0;
+}
+
+static int draw_option_boxes(Objects * objects)
+{
+ Objects *x;
+
+ R_standard_color(OUTLINE_COLOR);
+ for (x = objects; x->type; x++) {
+ if (x->type == OPTION_OBJECT && *x->status == 0)
+ Outline_box(x->top +1, x->bottom, x->left, x->right -1);
+ }
+ R_standard_color(GREEN);
+ for (x = objects; x->type; x++) {
+ if (x->type == OPTION_OBJECT && *x->status > 0)
+ Outline_box(x->top +1, x->bottom, x->left, x->right -1);
+ }
+ R_flush();
+
+ return 0;
+}
+
+static int visible(Objects * object)
+{
+ if (object->type == OPTION_OBJECT)
+ return (*object->status >= 0);
+ return (*object->status > 0);
+}
+
+int Menu_msg(char *msg)
+{
+ int size, edge;
+
+ size = VIEW_MENU->nrows - 4;
+ edge = 2;
+
+ Erase_view(VIEW_MENU);
+
+ if (*msg) {
+ R_text_size(size, size);
+ R_standard_color(WHITE);
+ Text(msg, VIEW_MENU->top, VIEW_MENU->bottom,
+ VIEW_MENU->left, VIEW_MENU->right, edge);
+ }
+ R_flush();
+ replot = 1;
+
+ return 0;
+}
+
+int Start_mouse_in_menu(void)
+{
+ Set_mouse_xy((VIEW_MENU->left + 2 * VIEW_MENU->right) / 3,
+ (VIEW_MENU->top + VIEW_MENU->bottom) / 2);
+
+ return 0;
+}
Deleted: grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2image/local_proto.h
===================================================================
--- grass/branches/develbranch_6/imagery/i.ortho.photo/i.photo.2image/local_proto.h 2010-12-01 09:34:37 UTC (rev 44501)
+++ grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2image/local_proto.h 2010-12-22 10:05:10 UTC (rev 44654)
@@ -1,6 +0,0 @@
-/* ask_target.c */
-int ask_target(char *, char *, char *);
-int list_locations(void);
-int no_location(char *);
-int list_mapsets(void);
-int mapset_ok(char *);
Copied: grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2image/local_proto.h (from rev 44501, grass/branches/develbranch_6/imagery/i.ortho.photo/i.photo.2image/local_proto.h)
===================================================================
--- grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2image/local_proto.h (rev 0)
+++ grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2image/local_proto.h 2010-12-22 10:05:10 UTC (rev 44654)
@@ -0,0 +1,6 @@
+/* ask_target.c */
+int ask_target(char *, char *, char *);
+int list_locations(void);
+int no_location(char *);
+int list_mapsets(void);
+int mapset_ok(char *);
Deleted: grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2image/main.c
===================================================================
--- grass/branches/develbranch_6/imagery/i.ortho.photo/i.photo.2image/main.c 2010-12-01 09:34:37 UTC (rev 44501)
+++ grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2image/main.c 2010-12-22 10:05:10 UTC (rev 44654)
@@ -1,206 +0,0 @@
-
-/****************************************************************************
- *
- * MODULE: i.photo.2image
- * AUTHOR(S): Mike Baba, DBA Systems, Inc. (original contributor)
- * Markus Neteler <neteler itc.it>,
- * Roberto Flor <flor itc.it>,
- * Bernhard Reiter <bernhard intevation.de>,
- * Brad Douglas <rez touchofmadness.com>,
- * Glynn Clements <glynn gclements.plus.com>
- * Hamish Bowman
- *
- * PURPOSE: Mark fiducial or reseau points on an image
- * COPYRIGHT: (C) 1999-2008 by the GRASS Development Team
- *
- * This program is free software under the GNU General Public
- * License (>=v2). Read the file COPYING that comes with GRASS
- * for details.
- *
- *****************************************************************************/
-#define GLOBAL
-
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-#include <signal.h>
-#include <grass/gis.h>
-#include <grass/raster.h>
-#include <grass/imagery.h>
-#include <grass/glocale.h>
-#include "globals.h"
-
-
-int main(int argc, char *argv[])
-{
- struct GModule *module;
- struct Option *group_opt;
-
- char mapset[GMAPSET_MAX];
- char name[GNAME_MAX];
-
- char *camera;
- int nfiles;
- struct Cell_head cellhd;
- /* struct Ortho_Image_Group group; -- in globals.h */
-
-
- /* must run in a term window */
- G_putenv("GRASS_UI_TERM", "1");
-
- G_gisinit(argv[0]);
-
- module = G_define_module();
- module->keywords = _("imagery, orthorectify");
- module->description =
- _("Interactively mark fiducial or reseau points on an image.");
-
- group_opt = G_define_standard_option(G_OPT_I_GROUP);
- group_opt->description =
- _("Name of imagery group for ortho-rectification");
-
- if (G_parser(argc, argv))
- exit(EXIT_FAILURE);
-
- G_suppress_masking(); /* need to do this for target location */
-
- strcpy(name, group_opt->answer);
- camera = (char *)G_malloc(40 * sizeof(char));
-
-
- interrupt_char = G_intr_char();
- tempfile1 = G_tempfile();
- tempfile2 = G_tempfile();
- tempfile3 = G_tempfile();
- cell_list = G_tempfile();
- vect_list = G_tempfile();
- group_list = G_tempfile();
- digit_points = G_tempfile();
-
- if (R_open_driver() != 0)
- G_fatal_error(_("No graphics device selected"));
-
- /* get image group and image group referenc file */
- strcpy(group.name, name);
- if (!I_find_group(group.name))
- G_fatal_error(_("Image Group [%s] not found"), group.name);
-
- /* get the group ref */
- I_get_group_ref(group.name, &group.group_ref);
- nfiles = group.group_ref.nfiles;
-
- /* write block files to block list file */
- prepare_group_list();
-
- /** look for camera info for this block **/
- G_suppress_warnings(1);
- if (!I_get_group_camera(group.name, camera))
- G_fatal_error(_("No camera reference file selected for group [%s]"),
- group.name);
-
- if (!I_get_cam_info(camera, &group.camera_ref))
- G_fatal_error(_("Bad format in camera file for group [%s]"),
- group.name);
- G_suppress_warnings(0);
-
- /* read block reference points, if any */
- G_suppress_warnings(1);
- if (!I_get_ref_points(group.name, &group.photo_points))
- group.photo_points.count = 0;
- G_suppress_warnings(0);
-
- /* determine transformation equation */
- Compute_equation();
-
- signal(SIGINT, SIG_IGN);
-#ifdef SIGQUIT
- signal(SIGQUIT, SIG_IGN);
-#endif
-
- Init_graphics();
- display_title(VIEW_MAP1);
- select_current_env();
-
- Begin_curses();
- G_set_error_routine(error);
-
- /*
- #ifdef SIGTSTP
- signal (SIGTSTP, SIG_IGN);
- #endif
- */
-
- /* ask user for raster map to be displayed */
- do {
- if (!choose_groupfile(name, mapset))
- quit(EXIT_SUCCESS);
- } while (G_get_cellhd(name, mapset, &cellhd) < 0);
-
- /* display this file in "map1" */
- G_adjust_window_to_box(&cellhd, &VIEW_MAP1->cell.head, VIEW_MAP1->nrows,
- VIEW_MAP1->ncols);
- Configure_view(VIEW_MAP1, name, mapset, cellhd.ns_res, cellhd.ew_res);
-
- drawcell(VIEW_MAP1);
- display_ref_points(1);
- Curses_clear_window(PROMPT_WINDOW);
-
- /* determine initial input method. */
- if (setup_camera_file() < 0)
- quit(EXIT_SUCCESS);
- if (use_camera_file) {
- from_keyboard = 0;
- from_screen = 1;
- from_flag = 1;
- }
- else {
- from_keyboard = 1;
- from_screen = 0;
- from_flag = 0;
- }
-
-
- /* go do the work */
- driver();
- /* leave */
- quit(EXIT_SUCCESS);
-}
-
-int quit(int n)
-{
- End_curses();
- R_close_driver();
- unlink(tempfile1);
- unlink(tempfile2);
- unlink(tempfile3);
- unlink(cell_list);
- unlink(group_list);
- unlink(vect_list);
- unlink(digit_points);
- exit(n);
-}
-
-int error(const char *msg, int fatal)
-{
- static char buf[200];
- int x, y, button;
-
- Curses_clear_window(PROMPT_WINDOW);
- Curses_write_window(PROMPT_WINDOW, 1, 1, "LOCATION:\n");
- Curses_write_window(PROMPT_WINDOW, 1, 12, G_location());
- Curses_write_window(PROMPT_WINDOW, 2, 1, "MAPSET:\n");
- Curses_write_window(PROMPT_WINDOW, 2, 12, G_location());
- Beep();
- if (fatal)
- sprintf(buf, _("ERROR: %s"), msg);
- else
- sprintf(buf, _("WARNING: %s (click mouse to continue)"), msg);
- Menu_msg(buf);
-
- if (fatal)
- quit(EXIT_FAILURE);
- Mouse_pointer(&x, &y, &button);
- Curses_clear_window(PROMPT_WINDOW);
-
- return 0;
-}
Copied: grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2image/main.c (from rev 44501, grass/branches/develbranch_6/imagery/i.ortho.photo/i.photo.2image/main.c)
===================================================================
--- grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2image/main.c (rev 0)
+++ grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2image/main.c 2010-12-22 10:05:10 UTC (rev 44654)
@@ -0,0 +1,206 @@
+
+/****************************************************************************
+ *
+ * MODULE: i.photo.2image
+ * AUTHOR(S): Mike Baba, DBA Systems, Inc. (original contributor)
+ * Markus Neteler <neteler itc.it>,
+ * Roberto Flor <flor itc.it>,
+ * Bernhard Reiter <bernhard intevation.de>,
+ * Brad Douglas <rez touchofmadness.com>,
+ * Glynn Clements <glynn gclements.plus.com>
+ * Hamish Bowman
+ *
+ * PURPOSE: Mark fiducial or reseau points on an image
+ * COPYRIGHT: (C) 1999-2008 by the GRASS Development Team
+ *
+ * This program is free software under the GNU General Public
+ * License (>=v2). Read the file COPYING that comes with GRASS
+ * for details.
+ *
+ *****************************************************************************/
+#define GLOBAL
+
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+#include <signal.h>
+#include <grass/gis.h>
+#include <grass/raster.h>
+#include <grass/imagery.h>
+#include <grass/glocale.h>
+#include "globals.h"
+
+
+int main(int argc, char *argv[])
+{
+ struct GModule *module;
+ struct Option *group_opt;
+
+ char mapset[GMAPSET_MAX];
+ char name[GNAME_MAX];
+
+ char *camera;
+ int nfiles;
+ struct Cell_head cellhd;
+ /* struct Ortho_Image_Group group; -- in globals.h */
+
+
+ /* must run in a term window */
+ G_putenv("GRASS_UI_TERM", "1");
+
+ G_gisinit(argv[0]);
+
+ module = G_define_module();
+ module->keywords = _("imagery, orthorectify");
+ module->description =
+ _("Interactively mark fiducial or reseau points on an image.");
+
+ group_opt = G_define_standard_option(G_OPT_I_GROUP);
+ group_opt->description =
+ _("Name of imagery group for ortho-rectification");
+
+ if (G_parser(argc, argv))
+ exit(EXIT_FAILURE);
+
+ G_suppress_masking(); /* need to do this for target location */
+
+ strcpy(name, group_opt->answer);
+ camera = (char *)G_malloc(40 * sizeof(char));
+
+
+ interrupt_char = G_intr_char();
+ tempfile1 = G_tempfile();
+ tempfile2 = G_tempfile();
+ tempfile3 = G_tempfile();
+ cell_list = G_tempfile();
+ vect_list = G_tempfile();
+ group_list = G_tempfile();
+ digit_points = G_tempfile();
+
+ if (R_open_driver() != 0)
+ G_fatal_error(_("No graphics device selected"));
+
+ /* get image group and image group referenc file */
+ strcpy(group.name, name);
+ if (!I_find_group(group.name))
+ G_fatal_error(_("Image Group [%s] not found"), group.name);
+
+ /* get the group ref */
+ I_get_group_ref(group.name, &group.group_ref);
+ nfiles = group.group_ref.nfiles;
+
+ /* write block files to block list file */
+ prepare_group_list();
+
+ /** look for camera info for this block **/
+ G_suppress_warnings(1);
+ if (!I_get_group_camera(group.name, camera))
+ G_fatal_error(_("No camera reference file selected for group [%s]"),
+ group.name);
+
+ if (!I_get_cam_info(camera, &group.camera_ref))
+ G_fatal_error(_("Bad format in camera file for group [%s]"),
+ group.name);
+ G_suppress_warnings(0);
+
+ /* read block reference points, if any */
+ G_suppress_warnings(1);
+ if (!I_get_ref_points(group.name, &group.photo_points))
+ group.photo_points.count = 0;
+ G_suppress_warnings(0);
+
+ /* determine transformation equation */
+ Compute_equation();
+
+ signal(SIGINT, SIG_IGN);
+#ifdef SIGQUIT
+ signal(SIGQUIT, SIG_IGN);
+#endif
+
+ Init_graphics();
+ display_title(VIEW_MAP1);
+ select_current_env();
+
+ Begin_curses();
+ G_set_error_routine(error);
+
+ /*
+ #ifdef SIGTSTP
+ signal (SIGTSTP, SIG_IGN);
+ #endif
+ */
+
+ /* ask user for raster map to be displayed */
+ do {
+ if (!choose_groupfile(name, mapset))
+ quit(EXIT_SUCCESS);
+ } while (G_get_cellhd(name, mapset, &cellhd) < 0);
+
+ /* display this file in "map1" */
+ G_adjust_window_to_box(&cellhd, &VIEW_MAP1->cell.head, VIEW_MAP1->nrows,
+ VIEW_MAP1->ncols);
+ Configure_view(VIEW_MAP1, name, mapset, cellhd.ns_res, cellhd.ew_res);
+
+ drawcell(VIEW_MAP1);
+ display_ref_points(1);
+ Curses_clear_window(PROMPT_WINDOW);
+
+ /* determine initial input method. */
+ if (setup_camera_file() < 0)
+ quit(EXIT_SUCCESS);
+ if (use_camera_file) {
+ from_keyboard = 0;
+ from_screen = 1;
+ from_flag = 1;
+ }
+ else {
+ from_keyboard = 1;
+ from_screen = 0;
+ from_flag = 0;
+ }
+
+
+ /* go do the work */
+ driver();
+ /* leave */
+ quit(EXIT_SUCCESS);
+}
+
+int quit(int n)
+{
+ End_curses();
+ R_close_driver();
+ unlink(tempfile1);
+ unlink(tempfile2);
+ unlink(tempfile3);
+ unlink(cell_list);
+ unlink(group_list);
+ unlink(vect_list);
+ unlink(digit_points);
+ exit(n);
+}
+
+int error(const char *msg, int fatal)
+{
+ static char buf[200];
+ int x, y, button;
+
+ Curses_clear_window(PROMPT_WINDOW);
+ Curses_write_window(PROMPT_WINDOW, 1, 1, "LOCATION:\n");
+ Curses_write_window(PROMPT_WINDOW, 1, 12, G_location());
+ Curses_write_window(PROMPT_WINDOW, 2, 1, "MAPSET:\n");
+ Curses_write_window(PROMPT_WINDOW, 2, 12, G_location());
+ Beep();
+ if (fatal)
+ sprintf(buf, _("ERROR: %s"), msg);
+ else
+ sprintf(buf, _("WARNING: %s (click mouse to continue)"), msg);
+ Menu_msg(buf);
+
+ if (fatal)
+ quit(EXIT_FAILURE);
+ Mouse_pointer(&x, &y, &button);
+ Curses_clear_window(PROMPT_WINDOW);
+
+ return 0;
+}
Deleted: grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2image/mark.c
===================================================================
--- grass/branches/develbranch_6/imagery/i.ortho.photo/i.photo.2image/mark.c 2010-12-01 09:34:37 UTC (rev 44501)
+++ grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2image/mark.c 2010-12-22 10:05:10 UTC (rev 44654)
@@ -1,455 +0,0 @@
-#include <string.h>
-#include <grass/raster.h>
-#include "globals.h"
-#include "camera_ref.h"
-
-
-#undef DEBUG
-
-/* define MOUSE_YN to answer y/n by mouse click */
-#define MOUSE_YN
-
-
-static char buf[300];
-static int get_point2(double *, double *);
-static int keyboard(void);
-static int _keyboard(void);
-static int fromfile(void);
-static int _drawcam(void);
-static int uparrow(struct box *, int);
-static int downarrow(struct box *, int);
-static int pick(int, int);
-static int done(void);
-static int cancel_which(void);
-static int inbox(struct box *, int, int);
-static int dotext(char *, int, int, int, int, int, int);
-
-#ifdef DEBUG
-static int show_point(int, int);
-static int debug(char *);
-#endif
-
-
-int mark(int x, int y, int button)
-{
- if (button != 1)
- return where(x, y);
-
- if (VIEW_MAP1->cell.configured && In_view(VIEW_MAP1, x, y))
- mark_point(VIEW_MAP1, x, y);
- else if (VIEW_MAP1_ZOOM->cell.configured && In_view(VIEW_MAP1_ZOOM, x, y))
- mark_point(VIEW_MAP1_ZOOM, x, y);
- return 0; /* return but don't quit */
-}
-
-int mark_point(View * view, int x, int y)
-{
- double e1, n1;
- double e2, n2;
- int row, col;
-
- char buf[100];
-
- /* convert x,y to east,north at center of cell */
- col = view_to_col(view, x);
- e1 = col_to_easting(&view->cell.head, col, 0.5);
- row = view_to_row(view, y);
- n1 = row_to_northing(&view->cell.head, row, 0.5);
-
- Curses_clear_window(MENU_WINDOW);
- sprintf(buf, "Point %d marked at IMAGE COORDINATES:",
- group.photo_points.count + 1);
- Curses_write_window(MENU_WINDOW, 1, 1, buf);
- sprintf(buf, "East: %10.2f", e1);
- Curses_write_window(MENU_WINDOW, 3, 3, buf);
- sprintf(buf, "North: %10.2f", n1);
- Curses_write_window(MENU_WINDOW, 4, 3, buf);
- Curses_clear_window(INFO_WINDOW);
-
- R_standard_color(ORANGE);
- save_under_dot(x, y);
- dot(x, y);
-
- if (!get_point2(&e2, &n2)) {
- Curses_clear_window(MENU_WINDOW);
- restore_under_dot();
- }
- else {
-
- sprintf(buf, "Point %d referenced to PHOTO COORDINATES:",
- group.photo_points.count + 1);
- Curses_write_window(MENU_WINDOW, 7, 1, buf);
- sprintf(buf, "X: %10.2f", e2);
- Curses_write_window(MENU_WINDOW, 9, 3, buf);
- sprintf(buf, "Y: %10.2f", n2);
- Curses_write_window(MENU_WINDOW, 10, 3, buf);
- I_new_ref_point(&group.photo_points, e1, n1, e2, n2, 1);
- I_put_ref_points(group.name, &group.photo_points);
- Compute_equation();
- display_ref_points(1);
- }
- release_under_dot();
-
- return 0;
-}
-
-static double N, E;
-
-static int get_point2(double *east, double *north)
-{
- int stat;
-
- if (from_screen < 0) {
- from_flag = 1;
- from_screen = 0;
- if (from_keyboard < 0) {
- from_keyboard = 0;
- from_screen = 1;
- }
- }
-
- if (from_screen > 0) {
- stat = Input_other(fromfile, "CAMERA FILE");
- set_colors(&VIEW_MAP1->cell.colors);
- }
- else
- stat = Input_other(keyboard, "KEYBOARD");
-
- if (stat) {
- *east = E;
- *north = N;
- }
-
- return stat;
-}
-
-static int keyboard(void)
-{
- int ok;
-
- Curses_clear_window(INFO_WINDOW);
- ok = _keyboard();
- Curses_clear_window(INFO_WINDOW);
- return ok;
-}
-
-static int _keyboard(void)
-{
- char buf[100];
-
- while (1) {
- Curses_prompt_gets("Enter PHOTO COORDINATES as X Y: ", buf);
- G_strip(buf);
- if (*buf == 0) {
- return 0;
- }
- if (sscanf(buf, "%lf %lf", &E, &N) != 2) {
- Beep();
- continue;
- }
- Curses_clear_window(INFO_WINDOW);
- sprintf(buf, "X: %f\n", E);
- Curses_write_window(INFO_WINDOW, 3, 2, buf);
- sprintf(buf, "Y: %f\n", N);
- Curses_write_window(INFO_WINDOW, 4, 2, buf);
-#ifdef MOUSE_YN
- Curses_write_window(INFO_WINDOW, 5, 2,
- "Look ok? (Left: y / Right: n) ");
-#else
- Curses_write_window(INFO_WINDOW, 5, 2, "Look ok? (y/n) ");
-#endif
-
- while (1) {
-#ifdef MOUSE_YN
- int x, y, b;
-
- R_get_location_with_pointer(&x, &y, &b);
- if (b == 1)
- return 1;
- else if (b == 3)
- break;
-#else
- int c;
-
- c = Curses_getch(0);
- if (c == 'y' || c == 'Y')
- return 1;
- if (c == 'n' || c == 'N')
- break;
-#endif
- Beep();
- }
- }
-}
-
-
-static int fromfile(void)
-{
- /* int ok; */
- Curses_clear_window(INFO_WINDOW);
- _drawcam();
- Curses_clear_window(INFO_WINDOW);
- return ok;
-}
-
-static int _drawcam(void)
-{
- static int use = 1;
- static Objects objects[] = {
- MENU("CANCEL", done, &use),
- INFO(" Double click on point to be referenced", &use),
- OTHER(pick, &use),
- {0}
- };
-
- /* to give user a response of some sort */
- Menu_msg("Preparing Camera Reference File...");
-
- /*
- * more, less, and report boxes defined in use_camera.c
- *
- */
-
- /* allocate predicted values */
- Xf = (double *)G_calloc(group.camera_ref.num_fid, sizeof(double));
- Yf = (double *)G_calloc(group.camera_ref.num_fid, sizeof(double));
-
- /* redraw current report */
-
-/****
- R_standard_color (GREY);
- R_box_abs (report.left, report.top, report.right, report.bottom);
- R_standard_color (BACKGROUND);
-****/
-
- /* lets do it */
- /* curp = first_point = 0; */
- pager = 0;
- while (1) {
- if (pager) {
- R_standard_color(GREY);
- R_box_abs(report.left, report.top, report.right, report.bottom);
- R_standard_color(BACKGROUND);
- line = 0;
- curp = first_point;
- }
-
- R_text_size(tsize, tsize);
- cury = report.top;
- /* line = 0; */
-
- while (1) {
- if (line >= nlines || curp >= group.camera_ref.num_fid)
- break;
- line++;
- color = BLACK;
- if (pager) {
- FMT1(buf, group.camera_ref.fiducials[curp].fid_id,
- group.camera_ref.fiducials[curp].Xf,
- group.camera_ref.fiducials[curp].Yf);
- dotext(buf, cury, cury + height, left, right - 1, 0, color);
- }
- cury += height;
- curp++;
- report.bottom = cury;
- }
-
- downarrow(&more,
- curp < group.camera_ref.num_fid ? BLACK : BACKGROUND);
- uparrow(&less, first_point > 0 ? BLACK : BACKGROUND);
-
- pager = 0;
- which = -1;
- if (Input_pointer(objects) < 0)
- break;
- }
- return 1;
-}
-
-static int uparrow(struct box *box, int color)
-{
- R_standard_color(color);
- Uparrow(box->top + edge, box->bottom - edge, box->left + edge,
- box->right - edge);
-
- return 0;
-}
-
-static int downarrow(struct box *box, int color)
-{
- R_standard_color(color);
- Downarrow(box->top + edge, box->bottom - edge, box->left + edge,
- box->right - edge);
-
- return 0;
-}
-
-static int pick(int x, int y)
-{
- int n;
- int cur;
-
- cur = which;
- cancel_which();
- if (inbox(&more, x, y)) {
- if (curp >= group.camera_ref.num_fid)
- return 0;
- first_point = curp;
- pager = 1;
- return 1;
- }
- if (inbox(&less, x, y)) {
- if (first_point == 0)
- return 0;
- first_point -= nlines;
- if (first_point < 0)
- first_point = 0;
- pager = 1;
- return 1;
- }
- if (!inbox(&report, x, y)) {
- return 0;
- }
-
- n = (y - report.top) / height;
- /* debug ("n = %d",n);
- debug ("cur = %d",cur); */
-
- if (n == cur) { /* second click! */
-
- /* debug ("Getting point %d E = %f N = %f",n, E, N); */
-
- E = group.camera_ref.fiducials[first_point + n].Xf;
- N = group.camera_ref.fiducials[first_point + n].Yf;
- /* debug ("Got point %d E = %f N = %f",n, E, N); */
- Curses_clear_window(INFO_WINDOW);
- sprintf(buf, "X: %f\n", E);
- Curses_write_window(INFO_WINDOW, 3, 2, buf);
- sprintf(buf, "Y: %f\n", N);
- Curses_write_window(INFO_WINDOW, 4, 2, buf);
-#ifdef MOUSE_YN
- Curses_write_window(INFO_WINDOW, 5, 1,
- "Look ok? (Left: y / Right: n) ");
-#else
- Curses_write_window(INFO_WINDOW, 5, 1, "Look ok? (y/n) ");
- Curses_write_window(PROMPT_WINDOW, 1, 1, "Keyboard Input Required ");
-#endif
-
- while (1) {
-#ifdef MOUSE_YN
- int x, y, b;
-
- R_get_location_with_pointer(&x, &y, &b);
- if (b == 1) {
- ok = 1;
- return -1;
- }
- else if (b == 3) {
- ok = 0;
- break;
- }
-#else
- int c;
-
- c = Curses_getch(0);
- if (c == 'y' || c == 'Y') {
- ok = 1;
- return -1;
- }
- if (c == 'n' || c == 'N') {
- ok = 0;
- break;
- }
-#endif
- Beep();
- }
-
-#ifdef DEBUG
- show_point(first_point + n, 1);
-#endif
- Curses_clear_window(INFO_WINDOW);
- Curses_write_window(PROMPT_WINDOW, 1, 1, "Use Mouse Now \n");
- return 1;
- }
- which = n;
-#ifdef DEBUG
- show_point(first_point + n, 0);
-#endif
- R_standard_color(RED);
- Outline_box(report.top + n * height, report.top + (n + 1) * height,
- report.left, report.right - 1);
- Curses_write_window(PROMPT_WINDOW, 1, 1, "Use Mouse Now \n");
-
- return 0; /* ignore first click */
-}
-
-static int done(void)
-{
- cancel_which();
- ok = 0;
- return -1;
-}
-
-static int cancel_which(void)
-{
- if (which >= 0) {
- R_standard_color(BACKGROUND);
- Outline_box(report.top + which * height,
- report.top + (which + 1) * height, report.left,
- report.right - 1);
-#ifdef DEBUG
- show_point(first_point + which, 1);
-#endif
- }
- which = -1;
-
- return 0;
-}
-
-static int inbox(struct box *box, int x, int y)
-{
- return (x > box->left && x < box->right && y > box->top &&
- y < box->bottom);
-}
-
-static int dotext(char *text,
- int top, int bottom, int left, int right, int centered,
- int color)
-{
- R_standard_color(BACKGROUND);
- R_box_abs(left, top, right, bottom);
- R_standard_color(color);
- R_move_abs(left + 1 + edge, bottom - 1 - edge);
- if (centered)
- R_move_rel((right - left - strlen(text) * size) / 2, 0);
- R_set_window(top, bottom, left, right); /* for text clipping */
- R_text(text);
- R_set_window(SCREEN_TOP, SCREEN_BOTTOM, SCREEN_LEFT, SCREEN_RIGHT);
-
- return 0;
-}
-
-
-#ifdef DEBUG
-static int show_point(int n, int true_color)
-{
- if (!true_color)
- R_standard_color(ORANGE);
- else if (group.photo_points.status[n])
- R_standard_color(GREEN);
- else
- R_standard_color(RED);
-
- return 0;
-}
-
-
-static int debug(char *msg)
-{
- R_stabilize();
- Curses_write_window(PROMPT_WINDOW, 1, 1, msg);
- Curses_getch(0);
-
- return 0;
-}
-#endif
Copied: grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2image/mark.c (from rev 44501, grass/branches/develbranch_6/imagery/i.ortho.photo/i.photo.2image/mark.c)
===================================================================
--- grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2image/mark.c (rev 0)
+++ grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2image/mark.c 2010-12-22 10:05:10 UTC (rev 44654)
@@ -0,0 +1,455 @@
+#include <string.h>
+#include <grass/raster.h>
+#include "globals.h"
+#include "camera_ref.h"
+
+
+#undef DEBUG
+
+/* define MOUSE_YN to answer y/n by mouse click */
+#define MOUSE_YN
+
+
+static char buf[300];
+static int get_point2(double *, double *);
+static int keyboard(void);
+static int _keyboard(void);
+static int fromfile(void);
+static int _drawcam(void);
+static int uparrow(struct box *, int);
+static int downarrow(struct box *, int);
+static int pick(int, int);
+static int done(void);
+static int cancel_which(void);
+static int inbox(struct box *, int, int);
+static int dotext(char *, int, int, int, int, int, int);
+
+#ifdef DEBUG
+static int show_point(int, int);
+static int debug(char *);
+#endif
+
+
+int mark(int x, int y, int button)
+{
+ if (button != 1)
+ return where(x, y);
+
+ if (VIEW_MAP1->cell.configured && In_view(VIEW_MAP1, x, y))
+ mark_point(VIEW_MAP1, x, y);
+ else if (VIEW_MAP1_ZOOM->cell.configured && In_view(VIEW_MAP1_ZOOM, x, y))
+ mark_point(VIEW_MAP1_ZOOM, x, y);
+ return 0; /* return but don't quit */
+}
+
+int mark_point(View * view, int x, int y)
+{
+ double e1, n1;
+ double e2, n2;
+ int row, col;
+
+ char buf[100];
+
+ /* convert x,y to east,north at center of cell */
+ col = view_to_col(view, x);
+ e1 = col_to_easting(&view->cell.head, col, 0.5);
+ row = view_to_row(view, y);
+ n1 = row_to_northing(&view->cell.head, row, 0.5);
+
+ Curses_clear_window(MENU_WINDOW);
+ sprintf(buf, "Point %d marked at IMAGE COORDINATES:",
+ group.photo_points.count + 1);
+ Curses_write_window(MENU_WINDOW, 1, 1, buf);
+ sprintf(buf, "East: %10.2f", e1);
+ Curses_write_window(MENU_WINDOW, 3, 3, buf);
+ sprintf(buf, "North: %10.2f", n1);
+ Curses_write_window(MENU_WINDOW, 4, 3, buf);
+ Curses_clear_window(INFO_WINDOW);
+
+ R_standard_color(ORANGE);
+ save_under_dot(x, y);
+ dot(x, y);
+
+ if (!get_point2(&e2, &n2)) {
+ Curses_clear_window(MENU_WINDOW);
+ restore_under_dot();
+ }
+ else {
+
+ sprintf(buf, "Point %d referenced to PHOTO COORDINATES:",
+ group.photo_points.count + 1);
+ Curses_write_window(MENU_WINDOW, 7, 1, buf);
+ sprintf(buf, "X: %10.2f", e2);
+ Curses_write_window(MENU_WINDOW, 9, 3, buf);
+ sprintf(buf, "Y: %10.2f", n2);
+ Curses_write_window(MENU_WINDOW, 10, 3, buf);
+ I_new_ref_point(&group.photo_points, e1, n1, e2, n2, 1);
+ I_put_ref_points(group.name, &group.photo_points);
+ Compute_equation();
+ display_ref_points(1);
+ }
+ release_under_dot();
+
+ return 0;
+}
+
+static double N, E;
+
+static int get_point2(double *east, double *north)
+{
+ int stat;
+
+ if (from_screen < 0) {
+ from_flag = 1;
+ from_screen = 0;
+ if (from_keyboard < 0) {
+ from_keyboard = 0;
+ from_screen = 1;
+ }
+ }
+
+ if (from_screen > 0) {
+ stat = Input_other(fromfile, "CAMERA FILE");
+ set_colors(&VIEW_MAP1->cell.colors);
+ }
+ else
+ stat = Input_other(keyboard, "KEYBOARD");
+
+ if (stat) {
+ *east = E;
+ *north = N;
+ }
+
+ return stat;
+}
+
+static int keyboard(void)
+{
+ int ok;
+
+ Curses_clear_window(INFO_WINDOW);
+ ok = _keyboard();
+ Curses_clear_window(INFO_WINDOW);
+ return ok;
+}
+
+static int _keyboard(void)
+{
+ char buf[100];
+
+ while (1) {
+ Curses_prompt_gets("Enter PHOTO COORDINATES as X Y: ", buf);
+ G_strip(buf);
+ if (*buf == 0) {
+ return 0;
+ }
+ if (sscanf(buf, "%lf %lf", &E, &N) != 2) {
+ Beep();
+ continue;
+ }
+ Curses_clear_window(INFO_WINDOW);
+ sprintf(buf, "X: %f\n", E);
+ Curses_write_window(INFO_WINDOW, 3, 2, buf);
+ sprintf(buf, "Y: %f\n", N);
+ Curses_write_window(INFO_WINDOW, 4, 2, buf);
+#ifdef MOUSE_YN
+ Curses_write_window(INFO_WINDOW, 5, 2,
+ "Look ok? (Left: y / Right: n) ");
+#else
+ Curses_write_window(INFO_WINDOW, 5, 2, "Look ok? (y/n) ");
+#endif
+
+ while (1) {
+#ifdef MOUSE_YN
+ int x, y, b;
+
+ R_get_location_with_pointer(&x, &y, &b);
+ if (b == 1)
+ return 1;
+ else if (b == 3)
+ break;
+#else
+ int c;
+
+ c = Curses_getch(0);
+ if (c == 'y' || c == 'Y')
+ return 1;
+ if (c == 'n' || c == 'N')
+ break;
+#endif
+ Beep();
+ }
+ }
+}
+
+
+static int fromfile(void)
+{
+ /* int ok; */
+ Curses_clear_window(INFO_WINDOW);
+ _drawcam();
+ Curses_clear_window(INFO_WINDOW);
+ return ok;
+}
+
+static int _drawcam(void)
+{
+ static int use = 1;
+ static Objects objects[] = {
+ MENU("CANCEL", done, &use),
+ INFO(" Double click on point to be referenced", &use),
+ OTHER(pick, &use),
+ {0}
+ };
+
+ /* to give user a response of some sort */
+ Menu_msg("Preparing Camera Reference File...");
+
+ /*
+ * more, less, and report boxes defined in use_camera.c
+ *
+ */
+
+ /* allocate predicted values */
+ Xf = (double *)G_calloc(group.camera_ref.num_fid, sizeof(double));
+ Yf = (double *)G_calloc(group.camera_ref.num_fid, sizeof(double));
+
+ /* redraw current report */
+
+/****
+ R_standard_color (GREY);
+ R_box_abs (report.left, report.top, report.right, report.bottom);
+ R_standard_color (BACKGROUND);
+****/
+
+ /* lets do it */
+ /* curp = first_point = 0; */
+ pager = 0;
+ while (1) {
+ if (pager) {
+ R_standard_color(GREY);
+ R_box_abs(report.left, report.top, report.right, report.bottom);
+ R_standard_color(BACKGROUND);
+ line = 0;
+ curp = first_point;
+ }
+
+ R_text_size(tsize, tsize);
+ cury = report.top;
+ /* line = 0; */
+
+ while (1) {
+ if (line >= nlines || curp >= group.camera_ref.num_fid)
+ break;
+ line++;
+ color = BLACK;
+ if (pager) {
+ FMT1(buf, group.camera_ref.fiducials[curp].fid_id,
+ group.camera_ref.fiducials[curp].Xf,
+ group.camera_ref.fiducials[curp].Yf);
+ dotext(buf, cury, cury + height, left, right - 1, 0, color);
+ }
+ cury += height;
+ curp++;
+ report.bottom = cury;
+ }
+
+ downarrow(&more,
+ curp < group.camera_ref.num_fid ? BLACK : BACKGROUND);
+ uparrow(&less, first_point > 0 ? BLACK : BACKGROUND);
+
+ pager = 0;
+ which = -1;
+ if (Input_pointer(objects) < 0)
+ break;
+ }
+ return 1;
+}
+
+static int uparrow(struct box *box, int color)
+{
+ R_standard_color(color);
+ Uparrow(box->top + edge, box->bottom - edge, box->left + edge,
+ box->right - edge);
+
+ return 0;
+}
+
+static int downarrow(struct box *box, int color)
+{
+ R_standard_color(color);
+ Downarrow(box->top + edge, box->bottom - edge, box->left + edge,
+ box->right - edge);
+
+ return 0;
+}
+
+static int pick(int x, int y)
+{
+ int n;
+ int cur;
+
+ cur = which;
+ cancel_which();
+ if (inbox(&more, x, y)) {
+ if (curp >= group.camera_ref.num_fid)
+ return 0;
+ first_point = curp;
+ pager = 1;
+ return 1;
+ }
+ if (inbox(&less, x, y)) {
+ if (first_point == 0)
+ return 0;
+ first_point -= nlines;
+ if (first_point < 0)
+ first_point = 0;
+ pager = 1;
+ return 1;
+ }
+ if (!inbox(&report, x, y)) {
+ return 0;
+ }
+
+ n = (y - report.top) / height;
+ /* debug ("n = %d",n);
+ debug ("cur = %d",cur); */
+
+ if (n == cur) { /* second click! */
+
+ /* debug ("Getting point %d E = %f N = %f",n, E, N); */
+
+ E = group.camera_ref.fiducials[first_point + n].Xf;
+ N = group.camera_ref.fiducials[first_point + n].Yf;
+ /* debug ("Got point %d E = %f N = %f",n, E, N); */
+ Curses_clear_window(INFO_WINDOW);
+ sprintf(buf, "X: %f\n", E);
+ Curses_write_window(INFO_WINDOW, 3, 2, buf);
+ sprintf(buf, "Y: %f\n", N);
+ Curses_write_window(INFO_WINDOW, 4, 2, buf);
+#ifdef MOUSE_YN
+ Curses_write_window(INFO_WINDOW, 5, 1,
+ "Look ok? (Left: y / Right: n) ");
+#else
+ Curses_write_window(INFO_WINDOW, 5, 1, "Look ok? (y/n) ");
+ Curses_write_window(PROMPT_WINDOW, 1, 1, "Keyboard Input Required ");
+#endif
+
+ while (1) {
+#ifdef MOUSE_YN
+ int x, y, b;
+
+ R_get_location_with_pointer(&x, &y, &b);
+ if (b == 1) {
+ ok = 1;
+ return -1;
+ }
+ else if (b == 3) {
+ ok = 0;
+ break;
+ }
+#else
+ int c;
+
+ c = Curses_getch(0);
+ if (c == 'y' || c == 'Y') {
+ ok = 1;
+ return -1;
+ }
+ if (c == 'n' || c == 'N') {
+ ok = 0;
+ break;
+ }
+#endif
+ Beep();
+ }
+
+#ifdef DEBUG
+ show_point(first_point + n, 1);
+#endif
+ Curses_clear_window(INFO_WINDOW);
+ Curses_write_window(PROMPT_WINDOW, 1, 1, "Use Mouse Now \n");
+ return 1;
+ }
+ which = n;
+#ifdef DEBUG
+ show_point(first_point + n, 0);
+#endif
+ R_standard_color(RED);
+ Outline_box(report.top + n * height, report.top + (n + 1) * height,
+ report.left, report.right - 1);
+ Curses_write_window(PROMPT_WINDOW, 1, 1, "Use Mouse Now \n");
+
+ return 0; /* ignore first click */
+}
+
+static int done(void)
+{
+ cancel_which();
+ ok = 0;
+ return -1;
+}
+
+static int cancel_which(void)
+{
+ if (which >= 0) {
+ R_standard_color(BACKGROUND);
+ Outline_box(report.top + which * height,
+ report.top + (which + 1) * height, report.left,
+ report.right - 1);
+#ifdef DEBUG
+ show_point(first_point + which, 1);
+#endif
+ }
+ which = -1;
+
+ return 0;
+}
+
+static int inbox(struct box *box, int x, int y)
+{
+ return (x > box->left && x < box->right && y > box->top &&
+ y < box->bottom);
+}
+
+static int dotext(char *text,
+ int top, int bottom, int left, int right, int centered,
+ int color)
+{
+ R_standard_color(BACKGROUND);
+ R_box_abs(left, top, right, bottom);
+ R_standard_color(color);
+ R_move_abs(left + 1 + edge, bottom - 1 - edge);
+ if (centered)
+ R_move_rel((right - left - strlen(text) * size) / 2, 0);
+ R_set_window(top, bottom, left, right); /* for text clipping */
+ R_text(text);
+ R_set_window(SCREEN_TOP, SCREEN_BOTTOM, SCREEN_LEFT, SCREEN_RIGHT);
+
+ return 0;
+}
+
+
+#ifdef DEBUG
+static int show_point(int n, int true_color)
+{
+ if (!true_color)
+ R_standard_color(ORANGE);
+ else if (group.photo_points.status[n])
+ R_standard_color(GREEN);
+ else
+ R_standard_color(RED);
+
+ return 0;
+}
+
+
+static int debug(char *msg)
+{
+ R_stabilize();
+ Curses_write_window(PROMPT_WINDOW, 1, 1, msg);
+ Curses_getch(0);
+
+ return 0;
+}
+#endif
Deleted: grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2image/mouse.c
===================================================================
--- grass/branches/develbranch_6/imagery/i.ortho.photo/i.photo.2image/mouse.c 2010-12-01 09:34:37 UTC (rev 44501)
+++ grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2image/mouse.c 2010-12-22 10:05:10 UTC (rev 44654)
@@ -1,56 +0,0 @@
-#include <grass/raster.h>
-#include "globals.h"
-
-static int first = 1;
-static int curx, cury;
-
-int Mouse_pointer(int *x, int *y, int *button)
-{
- if (first) {
- curx = (SCREEN_LEFT + SCREEN_RIGHT) / 2;
- cury = (SCREEN_TOP + SCREEN_BOTTOM) / 2;
- first = 0;
- }
- R_get_location_with_pointer(&curx, &cury, button);
- *x = curx;
- *y = cury;
-
-#ifdef BUTTON3
- if (*button == 3)
- quit(0);
-#endif
-
- return 0;
-}
-
-int Mouse_box_anchored(int x1, int y1, int *x2, int *y2, int *button)
-{
- R_get_location_with_box(x1, y1, x2, y2, button);
- curx = *x2;
- cury = *y2;
- first = 0;
-
-#ifdef BUTTON3
- if (*button == 3)
- quit(0);
-#endif
-
- return 0;
-}
-
-int Get_mouse_xy(int *x, int *y)
-{
- *x = curx;
- *y = cury;
-
- return 0;
-}
-
-int Set_mouse_xy(int x, int y)
-{
- first = 0;
- curx = x;
- cury = y;
-
- return 0;
-}
Copied: grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2image/mouse.c (from rev 44501, grass/branches/develbranch_6/imagery/i.ortho.photo/i.photo.2image/mouse.c)
===================================================================
--- grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2image/mouse.c (rev 0)
+++ grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2image/mouse.c 2010-12-22 10:05:10 UTC (rev 44654)
@@ -0,0 +1,56 @@
+#include <grass/raster.h>
+#include "globals.h"
+
+static int first = 1;
+static int curx, cury;
+
+int Mouse_pointer(int *x, int *y, int *button)
+{
+ if (first) {
+ curx = (SCREEN_LEFT + SCREEN_RIGHT) / 2;
+ cury = (SCREEN_TOP + SCREEN_BOTTOM) / 2;
+ first = 0;
+ }
+ R_get_location_with_pointer(&curx, &cury, button);
+ *x = curx;
+ *y = cury;
+
+#ifdef BUTTON3
+ if (*button == 3)
+ quit(0);
+#endif
+
+ return 0;
+}
+
+int Mouse_box_anchored(int x1, int y1, int *x2, int *y2, int *button)
+{
+ R_get_location_with_box(x1, y1, x2, y2, button);
+ curx = *x2;
+ cury = *y2;
+ first = 0;
+
+#ifdef BUTTON3
+ if (*button == 3)
+ quit(0);
+#endif
+
+ return 0;
+}
+
+int Get_mouse_xy(int *x, int *y)
+{
+ *x = curx;
+ *y = cury;
+
+ return 0;
+}
+
+int Set_mouse_xy(int x, int y)
+{
+ first = 0;
+ curx = x;
+ cury = y;
+
+ return 0;
+}
Deleted: grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2image/points.c
===================================================================
--- grass/branches/develbranch_6/imagery/i.ortho.photo/i.photo.2image/points.c 2010-12-01 09:34:37 UTC (rev 44501)
+++ grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2image/points.c 2010-12-22 10:05:10 UTC (rev 44654)
@@ -1,58 +0,0 @@
-#include <grass/raster.h>
-#include "globals.h"
-int display_ref_points(int in_color)
-{
- display_ref_points_in_view(VIEW_MAP1, in_color,
- group.photo_points.e1, group.photo_points.n1,
- group.photo_points.status,
- group.photo_points.count);
-
- display_ref_points_in_view(VIEW_MAP1_ZOOM, in_color,
- group.photo_points.e1, group.photo_points.n1,
- group.photo_points.status,
- group.photo_points.count);
- /*
- display_ref_points_in_view (VIEW_MAP2, in_color,
- group.photo_points.e2, group.photo_points.n2,
- group.photo_points.status, group.photo_points.count);
-
- display_ref_points_in_view (VIEW_MAP2_ZOOM, in_color,
- group.photo_points.e2, group.photo_points.n2,
- group.photo_points.status, group.photo_points.count); */
-
- return 0;
-}
-
-int display_ref_points_in_view(View * view, int in_color,
- double *east, double *north, int *status,
- int count)
-{
- if (!view->cell.configured)
- return 1;
- while (count-- > 0) {
- if (in_color && (*status > 0))
- R_standard_color(GREEN);
- else if (in_color && (*status == 0))
- R_standard_color(RED);
- else
- R_standard_color(GREY);
- status++;
- display_one_point(view, *east++, *north++);
- }
-
- return 0;
-}
-
-int display_one_point(View * view, double east, double north)
-{
- int row, col, x, y;
-
- row = northing_to_row(&view->cell.head, north) + .5;
- col = easting_to_col(&view->cell.head, east) + .5;
- y = row_to_view(view, row);
- x = col_to_view(view, col);
- if (In_view(view, x, y))
- dot(x, y);
-
- return 0;
-}
Copied: grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2image/points.c (from rev 44501, grass/branches/develbranch_6/imagery/i.ortho.photo/i.photo.2image/points.c)
===================================================================
--- grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2image/points.c (rev 0)
+++ grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2image/points.c 2010-12-22 10:05:10 UTC (rev 44654)
@@ -0,0 +1,58 @@
+#include <grass/raster.h>
+#include "globals.h"
+int display_ref_points(int in_color)
+{
+ display_ref_points_in_view(VIEW_MAP1, in_color,
+ group.photo_points.e1, group.photo_points.n1,
+ group.photo_points.status,
+ group.photo_points.count);
+
+ display_ref_points_in_view(VIEW_MAP1_ZOOM, in_color,
+ group.photo_points.e1, group.photo_points.n1,
+ group.photo_points.status,
+ group.photo_points.count);
+ /*
+ display_ref_points_in_view (VIEW_MAP2, in_color,
+ group.photo_points.e2, group.photo_points.n2,
+ group.photo_points.status, group.photo_points.count);
+
+ display_ref_points_in_view (VIEW_MAP2_ZOOM, in_color,
+ group.photo_points.e2, group.photo_points.n2,
+ group.photo_points.status, group.photo_points.count); */
+
+ return 0;
+}
+
+int display_ref_points_in_view(View * view, int in_color,
+ double *east, double *north, int *status,
+ int count)
+{
+ if (!view->cell.configured)
+ return 1;
+ while (count-- > 0) {
+ if (in_color && (*status > 0))
+ R_standard_color(GREEN);
+ else if (in_color && (*status == 0))
+ R_standard_color(RED);
+ else
+ R_standard_color(GREY);
+ status++;
+ display_one_point(view, *east++, *north++);
+ }
+
+ return 0;
+}
+
+int display_one_point(View * view, double east, double north)
+{
+ int row, col, x, y;
+
+ row = northing_to_row(&view->cell.head, north) + .5;
+ col = easting_to_col(&view->cell.head, east) + .5;
+ y = row_to_view(view, row);
+ x = col_to_view(view, col);
+ if (In_view(view, x, y))
+ dot(x, y);
+
+ return 0;
+}
Deleted: grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2image/target.c
===================================================================
--- grass/branches/develbranch_6/imagery/i.ortho.photo/i.photo.2image/target.c 2010-12-01 09:34:37 UTC (rev 44501)
+++ grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2image/target.c 2010-12-22 10:05:10 UTC (rev 44654)
@@ -1,74 +0,0 @@
-#include <unistd.h>
-#include <string.h>
-#include <grass/gis.h>
-#include <grass/imagery.h>
-#include "globals.h"
-
-
-/* read the target for the group and cast it into the alternate GRASS env */
-
-
-static int which_env;
-static char buf[1024];
-
-
-int get_target(void)
-{
- char location[40];
- char mapset[40];
- int stat;
-
- if (!I_get_target(group.name, location, mapset)) {
- sprintf(buf, "Target information for group [%s] missing\n",
- group.name);
- goto error;
- }
-
- sprintf(buf, "%s/%s", G_gisdbase(), location);
- if (access(buf, 0) != 0) {
- sprintf(buf, "Target location [%s] not found\n", location);
- goto error;
- }
- G__create_alt_env();
- G__setenv("LOCATION_NAME", location);
- stat = G__mapset_permissions(mapset);
- if (stat > 0) {
- G__setenv("MAPSET", mapset);
- G__create_alt_search_path();
- G__switch_env();
- G__switch_search_path();
- which_env = 0;
- return 1;
- }
- sprintf(buf, "Mapset [%s] in target location [%s] - ", mapset, location);
- strcat(buf, stat == 0 ? "permission denied\n" : "not found\n");
-
- error:
- strcat(buf, "Please run i.target for group ");
- strcat(buf, group.name);
- G_fatal_error(buf);
-
- return -1;
-}
-
-int select_current_env(void)
-{
- if (which_env != 0) {
- G__switch_env();
- G__switch_search_path();
- which_env = 0;
- }
-
- return 0;
-}
-
-int select_target_env(void)
-{
- if (which_env != 1) {
- G__switch_env();
- G__switch_search_path();
- which_env = 1;
- }
-
- return 0;
-}
Copied: grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2image/target.c (from rev 44501, grass/branches/develbranch_6/imagery/i.ortho.photo/i.photo.2image/target.c)
===================================================================
--- grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2image/target.c (rev 0)
+++ grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2image/target.c 2010-12-22 10:05:10 UTC (rev 44654)
@@ -0,0 +1,74 @@
+#include <unistd.h>
+#include <string.h>
+#include <grass/gis.h>
+#include <grass/imagery.h>
+#include "globals.h"
+
+
+/* read the target for the group and cast it into the alternate GRASS env */
+
+
+static int which_env;
+static char buf[1024];
+
+
+int get_target(void)
+{
+ char location[40];
+ char mapset[40];
+ int stat;
+
+ if (!I_get_target(group.name, location, mapset)) {
+ sprintf(buf, "Target information for group [%s] missing\n",
+ group.name);
+ goto error;
+ }
+
+ sprintf(buf, "%s/%s", G_gisdbase(), location);
+ if (access(buf, 0) != 0) {
+ sprintf(buf, "Target location [%s] not found\n", location);
+ goto error;
+ }
+ G__create_alt_env();
+ G__setenv("LOCATION_NAME", location);
+ stat = G__mapset_permissions(mapset);
+ if (stat > 0) {
+ G__setenv("MAPSET", mapset);
+ G__create_alt_search_path();
+ G__switch_env();
+ G__switch_search_path();
+ which_env = 0;
+ return 1;
+ }
+ sprintf(buf, "Mapset [%s] in target location [%s] - ", mapset, location);
+ strcat(buf, stat == 0 ? "permission denied\n" : "not found\n");
+
+ error:
+ strcat(buf, "Please run i.target for group ");
+ strcat(buf, group.name);
+ G_fatal_error(buf);
+
+ return -1;
+}
+
+int select_current_env(void)
+{
+ if (which_env != 0) {
+ G__switch_env();
+ G__switch_search_path();
+ which_env = 0;
+ }
+
+ return 0;
+}
+
+int select_target_env(void)
+{
+ if (which_env != 1) {
+ G__switch_env();
+ G__switch_search_path();
+ which_env = 1;
+ }
+
+ return 0;
+}
Deleted: grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2image/title.c
===================================================================
--- grass/branches/develbranch_6/imagery/i.ortho.photo/i.photo.2image/title.c 2010-12-01 09:34:37 UTC (rev 44501)
+++ grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2image/title.c 2010-12-22 10:05:10 UTC (rev 44654)
@@ -1,51 +0,0 @@
-#include <grass/gis.h>
-#include <grass/raster.h>
-#include "globals.h"
-
-
-int display_title(View * view)
-{
- View *title = NULL;
- char left[100], center[100];
- int size;
-
- *left = 0;
- *center = 0;
-
- if (view->cell.configured) {
- sprintf(center, "%s (mag %.1f)",
- view->cell.name, magnification(view));
- }
-
- if (view == VIEW_MAP1) {
- sprintf(left, "%s", G_location());
- title = VIEW_TITLE1;
- }
- else if (view == VIEW_MAP1_ZOOM) {
- title = VIEW_TITLE1_ZOOM;
- }
- /*
- if (view == VIEW_MAP2)
- {
- sprintf (left, "%s", G_location());
- title = VIEW_TITLE2;
- }
- else if (view == VIEW_MAP2_ZOOM)
- {
- title = VIEW_TITLE2_ZOOM;
- }
- */
- Erase_view(title);
- R_standard_color(WHITE);
- size = title->nrows - 4;
- R_text_size(size, size);
- Text(left, title->top, title->bottom, title->left, title->right, 2);
- if (*center) {
- R_standard_color(YELLOW);
- Text(center, title->top, title->bottom,
- (title->left + title->right - Text_width(center)) / 2,
- title->right, 2);
- }
-
- return 0;
-}
Copied: grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2image/title.c (from rev 44501, grass/branches/develbranch_6/imagery/i.ortho.photo/i.photo.2image/title.c)
===================================================================
--- grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2image/title.c (rev 0)
+++ grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2image/title.c 2010-12-22 10:05:10 UTC (rev 44654)
@@ -0,0 +1,51 @@
+#include <grass/gis.h>
+#include <grass/raster.h>
+#include "globals.h"
+
+
+int display_title(View * view)
+{
+ View *title = NULL;
+ char left[100], center[100];
+ int size;
+
+ *left = 0;
+ *center = 0;
+
+ if (view->cell.configured) {
+ sprintf(center, "%s (mag %.1f)",
+ view->cell.name, magnification(view));
+ }
+
+ if (view == VIEW_MAP1) {
+ sprintf(left, "%s", G_location());
+ title = VIEW_TITLE1;
+ }
+ else if (view == VIEW_MAP1_ZOOM) {
+ title = VIEW_TITLE1_ZOOM;
+ }
+ /*
+ if (view == VIEW_MAP2)
+ {
+ sprintf (left, "%s", G_location());
+ title = VIEW_TITLE2;
+ }
+ else if (view == VIEW_MAP2_ZOOM)
+ {
+ title = VIEW_TITLE2_ZOOM;
+ }
+ */
+ Erase_view(title);
+ R_standard_color(WHITE);
+ size = title->nrows - 4;
+ R_text_size(size, size);
+ Text(left, title->top, title->bottom, title->left, title->right, 2);
+ if (*center) {
+ R_standard_color(YELLOW);
+ Text(center, title->top, title->bottom,
+ (title->left + title->right - Text_width(center)) / 2,
+ title->right, 2);
+ }
+
+ return 0;
+}
Deleted: grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2image/use_camera.c
===================================================================
--- grass/branches/develbranch_6/imagery/i.ortho.photo/i.photo.2image/use_camera.c 2010-12-01 09:34:37 UTC (rev 44501)
+++ grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2image/use_camera.c 2010-12-22 10:05:10 UTC (rev 44654)
@@ -1,342 +0,0 @@
-#include <string.h>
-#include <grass/gis.h>
-#include <grass/raster.h>
-#include <grass/imagery.h>
-#include "globals.h"
-#define GLOBALCAM
-#include "camera_ref.h"
-
-
-static char buf[300];
-
-#if 0
-static int no(void);
-#endif
-static int yes(void);
-static int drawcamnew(void);
-static int uparrow(struct box *, int);
-static int downarrow(struct box *, int);
-static int pick(int, int);
-static int done(void);
-static int cancel_which(void);
-static int inbox(struct box *, int, int);
-static int dotext(char *, int, int, int, int, int, int);
-
-
-int setup_camera_file(void)
-{
- char *camera;
-
-#if 0
- static int use = 1;
- static Objects objects[] = {
- INFO("Do you wish to use the camera reference file? ", &use),
- MENU("YES", yes, &use),
- MENU("NO", no, &use),
- {0}
- };
-#endif
-
- camera = (char *)G_malloc(40 * sizeof(char));
- use_camera_file = 1;
-
-/** look for camera info for this group **/
- if (!I_get_group_camera(group.name, camera)) {
- use_camera_file = 0;
- return 0;
- }
- if (!I_get_cam_info(camera, &group.camera_ref)) {
- use_camera_file = 0;
- return 0;
- }
- yes();
- return (0);
-
-#if 0
-
-/*** camera required
- Start_mouse_in_menu();
- if (Input_pointer (objects) < 0) return (1);
- else return 0;
-****/
-#endif
-}
-
-#if 0
-static int no(void)
-{
- use_camera_file = 0;
- return -1;
-}
-#endif
-
-static int yes(void)
-{
- use_camera_file = 1;
- drawcamnew();
- return -1;
-}
-
-
-static int drawcamnew(void)
-{
- static int use = 1;
- static Objects objects[] = {
- MENU("CANCEL", done, &use),
- INFO("Click mouse to continue.", &use),
- OTHER(pick, &use),
- {0}
- };
-
- /* to give user a response of some sort */
- Menu_msg("Preparing Camera Reference File...");
-
- /*
- * build a popup window at center of the screen.
- * 45% the height and wide enough to hold the report
- *
- */
-
- /* height of 1 line, based on NLINES taking up 45% vertical space */
- height = (.45 * (SCREEN_BOTTOM - SCREEN_TOP)) / NLINES + 1;
-
- /* size of text, 80% of line height */
- tsize = .8 * height;
- size = tsize - 2; /* fudge for computing pixels width of text */
-
- /* indent for the text */
- edge = .1 * height + 1;
-
- /* determine the length, in chars, of printed line */
- FMT0f(buf, 0.0);
- nums = strlen(buf) * size;
- FMT1(buf, " ", 0.0, 0.0);
- len = strlen(buf);
- middle = len * size;
-
- /* width is for max chars plus sidecar for ess */
- width = len * size + nums + (2 * height);
- if ((SCREEN_RIGHT - SCREEN_LEFT) < width)
- width = SCREEN_RIGHT - SCREEN_LEFT;
-
-
- /* define the window */
- bottom = VIEW_MENU->top - 1;
- top = bottom - height * NLINES;
-
-
- left = SCREEN_LEFT;
- right = left + width;
- middle += left + nums;
- nums += left;
-
- /* save what is under this area, so it can be restored */
- R_panel_save(tempfile1, top, bottom, left, right);
-
-
- /* fill it with white */
- R_standard_color(BACKGROUND);
- R_box_abs(left, top, right, bottom);
-
- right -= 2 * height; /* reduce it to exclude sidecar */
-
- /* print messages in message area */
- R_text_size(tsize, tsize);
-
-
- /* setup the more/less boxes in the sidecar */
- R_standard_color(BLACK);
- less.top = top;
- less.bottom = top + 2 * height;
- less.left = right;
- less.right = right + 2 * height;
- Outline_box(less.top, less.bottom, less.left, less.right);
-
- more.top = bottom - 2 * height;
- more.bottom = bottom;
- more.left = right;
- more.right = right + 2 * height;
- Outline_box(more.top, more.bottom, more.left, more.right);
-
- /*
- * top eight lines are for column labels
- * last two line is for overall rms error.
- */
- nlines = NLINES - 11;
- first_point = 0;
-
- /* allocate predicted values */
- Xf = (double *)G_calloc(group.camera_ref.num_fid, sizeof(double));
- Yf = (double *)G_calloc(group.camera_ref.num_fid, sizeof(double));
-
-
- /* put head on the report */
- cury = top;
- dotext(LHEAD1, cury, cury + height, left, right - 1, 0, BLACK);
- cury += height;
- dotext(LHEAD2, cury, cury + height, left, right - 1, 0, BLACK);
- cury += height;
-
- FMT2(buf, group.camera_ref.cam_name);
- dotext(buf, cury, cury + height, left, right - 1, 0, color);
- cury += height;
- FMT3(buf, group.camera_ref.cam_id);
- dotext(buf, cury, cury + height, left, right - 1, 0, color);
- cury += height;
- FMT4(buf, group.camera_ref.CFL);
- dotext(buf, cury, cury + height, left, right - 1, 0, color);
- cury += height;
- FMT5(buf, group.camera_ref.Xp);
- dotext(buf, cury, cury + height, left, right - 1, 0, color);
- cury += height;
- FMT6(buf, group.camera_ref.Yp);
- dotext(buf, cury, cury + height, left, right - 1, 0, color);
- cury += height;
- FMT7(buf, group.camera_ref.num_fid);
- dotext(buf, cury, cury + height, left, right - 1, 0, color);
- cury += height;
-
- dotext(LHEAD3, cury, cury + height, left, right - 1, 0, BLACK);
- cury += height;
- dotext(LHEAD4, cury, cury + height, left, right - 1, 0, BLACK);
- cury += height;
-
- R_move_abs(left, cury - 1);
- R_cont_abs(right, cury - 1);
-
- /* isolate the sidecar */
- R_move_abs(right, top);
- R_cont_abs(right, bottom);
-
- /* define report box */
- /* report.top = top + (10*height); */
- report.top = cury;
- report.left = left;
- report.right = right - 1;
-
- /* lets do it */
- pager = 1;
- while (1) {
- R_text_size(tsize, tsize);
- line = 0;
- curp = first_point;
- cury = top + 10 * height;
- while (1) {
- if (line >= nlines || curp >= group.camera_ref.num_fid)
- break;
- line++;
- color = BLACK;
- if (pager) {
- FMT1(buf, group.camera_ref.fiducials[curp].fid_id,
- group.camera_ref.fiducials[curp].Xf,
- group.camera_ref.fiducials[curp].Yf);
- dotext(buf, cury, cury + height, left, right - 1, 0, color);
- }
- cury += height;
- curp++;
- }
- report.bottom = cury;
- downarrow(&more,
- curp < group.camera_ref.num_fid ? BLACK : BACKGROUND);
- uparrow(&less, first_point > 0 ? BLACK : BACKGROUND);
- R_standard_color(BACKGROUND);
- R_box_abs(left, cury, right - 1, bottom);
- R_standard_color(BLACK);
- R_move_abs(left, bottom - height);
- R_cont_abs(right - 1, bottom - height);
-
- pager = 0;
- which = -1;
- if (Input_pointer(objects) < 0)
- break;
- }
- return 1; /* return but don't QUIT */
-}
-
-
-static int uparrow(struct box *box, int color)
-{
- R_standard_color(color);
- Uparrow(box->top + edge, box->bottom - edge, box->left + edge,
- box->right - edge);
-
- return 0;
-}
-
-static int downarrow(struct box *box, int color)
-{
- R_standard_color(color);
- Downarrow(box->top + edge, box->bottom - edge, box->left + edge,
- box->right - edge);
-
- return 0;
-}
-
-static int pick(int x, int y)
-{
- int cur;
-
- cur = which;
- if (inbox(&more, x, y)) {
- if (curp >= group.camera_ref.num_fid)
- return 0;
- first_point = curp;
- pager = 1;
- return 1;
- }
- if (inbox(&less, x, y)) {
- if (first_point == 0)
- return 0;
- first_point -= nlines;
- if (first_point < 0)
- first_point = 0;
- pager = 1;
- return 1;
- }
- return -1; /* keep going */
- /* return 0; ignore first click */
-}
-
-static int done(void)
-{
- cancel_which();
- ok = 0;
- return -1;
-}
-
-static int cancel_which(void)
-{
- if (which >= 0) {
- R_standard_color(BACKGROUND);
- Outline_box(report.top + which * height,
- report.top + (which + 1) * height, report.left,
- report.right - 1);
- /* show_point (first_point+which, 1); */
- }
- which = -1;
-
- return 0;
-}
-
-static int inbox(struct box *box, int x, int y)
-{
- return (x > box->left && x < box->right && y > box->top &&
- y < box->bottom);
-}
-
-static int dotext(char *text,
- int top, int bottom, int left, int right, int centered,
- int color)
-{
- R_standard_color(BACKGROUND);
- R_box_abs(left, top, right, bottom);
- R_standard_color(color);
- R_move_abs(left + 1 + edge, bottom - 1 - edge);
- if (centered)
- R_move_rel((right - left - strlen(text) * size) / 2, 0);
- R_set_window(top, bottom, left, right); /* for text clipping */
- R_text(text);
- R_set_window(SCREEN_TOP, SCREEN_BOTTOM, SCREEN_LEFT, SCREEN_RIGHT);
-
- return 0;
-}
Copied: grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2image/use_camera.c (from rev 44501, grass/branches/develbranch_6/imagery/i.ortho.photo/i.photo.2image/use_camera.c)
===================================================================
--- grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2image/use_camera.c (rev 0)
+++ grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2image/use_camera.c 2010-12-22 10:05:10 UTC (rev 44654)
@@ -0,0 +1,342 @@
+#include <string.h>
+#include <grass/gis.h>
+#include <grass/raster.h>
+#include <grass/imagery.h>
+#include "globals.h"
+#define GLOBALCAM
+#include "camera_ref.h"
+
+
+static char buf[300];
+
+#if 0
+static int no(void);
+#endif
+static int yes(void);
+static int drawcamnew(void);
+static int uparrow(struct box *, int);
+static int downarrow(struct box *, int);
+static int pick(int, int);
+static int done(void);
+static int cancel_which(void);
+static int inbox(struct box *, int, int);
+static int dotext(char *, int, int, int, int, int, int);
+
+
+int setup_camera_file(void)
+{
+ char *camera;
+
+#if 0
+ static int use = 1;
+ static Objects objects[] = {
+ INFO("Do you wish to use the camera reference file? ", &use),
+ MENU("YES", yes, &use),
+ MENU("NO", no, &use),
+ {0}
+ };
+#endif
+
+ camera = (char *)G_malloc(40 * sizeof(char));
+ use_camera_file = 1;
+
+/** look for camera info for this group **/
+ if (!I_get_group_camera(group.name, camera)) {
+ use_camera_file = 0;
+ return 0;
+ }
+ if (!I_get_cam_info(camera, &group.camera_ref)) {
+ use_camera_file = 0;
+ return 0;
+ }
+ yes();
+ return (0);
+
+#if 0
+
+/*** camera required
+ Start_mouse_in_menu();
+ if (Input_pointer (objects) < 0) return (1);
+ else return 0;
+****/
+#endif
+}
+
+#if 0
+static int no(void)
+{
+ use_camera_file = 0;
+ return -1;
+}
+#endif
+
+static int yes(void)
+{
+ use_camera_file = 1;
+ drawcamnew();
+ return -1;
+}
+
+
+static int drawcamnew(void)
+{
+ static int use = 1;
+ static Objects objects[] = {
+ MENU("CANCEL", done, &use),
+ INFO("Click mouse to continue.", &use),
+ OTHER(pick, &use),
+ {0}
+ };
+
+ /* to give user a response of some sort */
+ Menu_msg("Preparing Camera Reference File...");
+
+ /*
+ * build a popup window at center of the screen.
+ * 45% the height and wide enough to hold the report
+ *
+ */
+
+ /* height of 1 line, based on NLINES taking up 45% vertical space */
+ height = (.45 * (SCREEN_BOTTOM - SCREEN_TOP)) / NLINES + 1;
+
+ /* size of text, 80% of line height */
+ tsize = .8 * height;
+ size = tsize - 2; /* fudge for computing pixels width of text */
+
+ /* indent for the text */
+ edge = .1 * height + 1;
+
+ /* determine the length, in chars, of printed line */
+ FMT0f(buf, 0.0);
+ nums = strlen(buf) * size;
+ FMT1(buf, " ", 0.0, 0.0);
+ len = strlen(buf);
+ middle = len * size;
+
+ /* width is for max chars plus sidecar for ess */
+ width = len * size + nums + (2 * height);
+ if ((SCREEN_RIGHT - SCREEN_LEFT) < width)
+ width = SCREEN_RIGHT - SCREEN_LEFT;
+
+
+ /* define the window */
+ bottom = VIEW_MENU->top - 1;
+ top = bottom - height * NLINES;
+
+
+ left = SCREEN_LEFT;
+ right = left + width;
+ middle += left + nums;
+ nums += left;
+
+ /* save what is under this area, so it can be restored */
+ R_panel_save(tempfile1, top, bottom, left, right);
+
+
+ /* fill it with white */
+ R_standard_color(BACKGROUND);
+ R_box_abs(left, top, right, bottom);
+
+ right -= 2 * height; /* reduce it to exclude sidecar */
+
+ /* print messages in message area */
+ R_text_size(tsize, tsize);
+
+
+ /* setup the more/less boxes in the sidecar */
+ R_standard_color(BLACK);
+ less.top = top;
+ less.bottom = top + 2 * height;
+ less.left = right;
+ less.right = right + 2 * height;
+ Outline_box(less.top, less.bottom, less.left, less.right);
+
+ more.top = bottom - 2 * height;
+ more.bottom = bottom;
+ more.left = right;
+ more.right = right + 2 * height;
+ Outline_box(more.top, more.bottom, more.left, more.right);
+
+ /*
+ * top eight lines are for column labels
+ * last two line is for overall rms error.
+ */
+ nlines = NLINES - 11;
+ first_point = 0;
+
+ /* allocate predicted values */
+ Xf = (double *)G_calloc(group.camera_ref.num_fid, sizeof(double));
+ Yf = (double *)G_calloc(group.camera_ref.num_fid, sizeof(double));
+
+
+ /* put head on the report */
+ cury = top;
+ dotext(LHEAD1, cury, cury + height, left, right - 1, 0, BLACK);
+ cury += height;
+ dotext(LHEAD2, cury, cury + height, left, right - 1, 0, BLACK);
+ cury += height;
+
+ FMT2(buf, group.camera_ref.cam_name);
+ dotext(buf, cury, cury + height, left, right - 1, 0, color);
+ cury += height;
+ FMT3(buf, group.camera_ref.cam_id);
+ dotext(buf, cury, cury + height, left, right - 1, 0, color);
+ cury += height;
+ FMT4(buf, group.camera_ref.CFL);
+ dotext(buf, cury, cury + height, left, right - 1, 0, color);
+ cury += height;
+ FMT5(buf, group.camera_ref.Xp);
+ dotext(buf, cury, cury + height, left, right - 1, 0, color);
+ cury += height;
+ FMT6(buf, group.camera_ref.Yp);
+ dotext(buf, cury, cury + height, left, right - 1, 0, color);
+ cury += height;
+ FMT7(buf, group.camera_ref.num_fid);
+ dotext(buf, cury, cury + height, left, right - 1, 0, color);
+ cury += height;
+
+ dotext(LHEAD3, cury, cury + height, left, right - 1, 0, BLACK);
+ cury += height;
+ dotext(LHEAD4, cury, cury + height, left, right - 1, 0, BLACK);
+ cury += height;
+
+ R_move_abs(left, cury - 1);
+ R_cont_abs(right, cury - 1);
+
+ /* isolate the sidecar */
+ R_move_abs(right, top);
+ R_cont_abs(right, bottom);
+
+ /* define report box */
+ /* report.top = top + (10*height); */
+ report.top = cury;
+ report.left = left;
+ report.right = right - 1;
+
+ /* lets do it */
+ pager = 1;
+ while (1) {
+ R_text_size(tsize, tsize);
+ line = 0;
+ curp = first_point;
+ cury = top + 10 * height;
+ while (1) {
+ if (line >= nlines || curp >= group.camera_ref.num_fid)
+ break;
+ line++;
+ color = BLACK;
+ if (pager) {
+ FMT1(buf, group.camera_ref.fiducials[curp].fid_id,
+ group.camera_ref.fiducials[curp].Xf,
+ group.camera_ref.fiducials[curp].Yf);
+ dotext(buf, cury, cury + height, left, right - 1, 0, color);
+ }
+ cury += height;
+ curp++;
+ }
+ report.bottom = cury;
+ downarrow(&more,
+ curp < group.camera_ref.num_fid ? BLACK : BACKGROUND);
+ uparrow(&less, first_point > 0 ? BLACK : BACKGROUND);
+ R_standard_color(BACKGROUND);
+ R_box_abs(left, cury, right - 1, bottom);
+ R_standard_color(BLACK);
+ R_move_abs(left, bottom - height);
+ R_cont_abs(right - 1, bottom - height);
+
+ pager = 0;
+ which = -1;
+ if (Input_pointer(objects) < 0)
+ break;
+ }
+ return 1; /* return but don't QUIT */
+}
+
+
+static int uparrow(struct box *box, int color)
+{
+ R_standard_color(color);
+ Uparrow(box->top + edge, box->bottom - edge, box->left + edge,
+ box->right - edge);
+
+ return 0;
+}
+
+static int downarrow(struct box *box, int color)
+{
+ R_standard_color(color);
+ Downarrow(box->top + edge, box->bottom - edge, box->left + edge,
+ box->right - edge);
+
+ return 0;
+}
+
+static int pick(int x, int y)
+{
+ int cur;
+
+ cur = which;
+ if (inbox(&more, x, y)) {
+ if (curp >= group.camera_ref.num_fid)
+ return 0;
+ first_point = curp;
+ pager = 1;
+ return 1;
+ }
+ if (inbox(&less, x, y)) {
+ if (first_point == 0)
+ return 0;
+ first_point -= nlines;
+ if (first_point < 0)
+ first_point = 0;
+ pager = 1;
+ return 1;
+ }
+ return -1; /* keep going */
+ /* return 0; ignore first click */
+}
+
+static int done(void)
+{
+ cancel_which();
+ ok = 0;
+ return -1;
+}
+
+static int cancel_which(void)
+{
+ if (which >= 0) {
+ R_standard_color(BACKGROUND);
+ Outline_box(report.top + which * height,
+ report.top + (which + 1) * height, report.left,
+ report.right - 1);
+ /* show_point (first_point+which, 1); */
+ }
+ which = -1;
+
+ return 0;
+}
+
+static int inbox(struct box *box, int x, int y)
+{
+ return (x > box->left && x < box->right && y > box->top &&
+ y < box->bottom);
+}
+
+static int dotext(char *text,
+ int top, int bottom, int left, int right, int centered,
+ int color)
+{
+ R_standard_color(BACKGROUND);
+ R_box_abs(left, top, right, bottom);
+ R_standard_color(color);
+ R_move_abs(left + 1 + edge, bottom - 1 - edge);
+ if (centered)
+ R_move_rel((right - left - strlen(text) * size) / 2, 0);
+ R_set_window(top, bottom, left, right); /* for text clipping */
+ R_text(text);
+ R_set_window(SCREEN_TOP, SCREEN_BOTTOM, SCREEN_LEFT, SCREEN_RIGHT);
+
+ return 0;
+}
Deleted: grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2image/view.c
===================================================================
--- grass/branches/develbranch_6/imagery/i.ortho.photo/i.photo.2image/view.c 2010-12-01 09:34:37 UTC (rev 44501)
+++ grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2image/view.c 2010-12-22 10:05:10 UTC (rev 44654)
@@ -1,49 +0,0 @@
-#include <string.h>
-#include <grass/raster.h>
-#include "globals.h"
-
-int Configure_view(View * view, char *name, char *mapset, double ns_res, double ew_res /* original map resolution */
- )
-{
- Erase_view(view);
- view->cell.configured = 0;
-
- /* copy the cell name into the view */
- strcpy(view->cell.name, name);
- strcpy(view->cell.mapset, mapset);
-
- /* determine the map edges */
- view->cell.left = view->left + (view->ncols - view->cell.head.cols) / 2;
- view->cell.right = view->cell.left + view->cell.head.cols - 1;
- view->cell.top = view->top + (view->nrows - view->cell.head.rows) / 2;
- view->cell.bottom = view->cell.top + view->cell.head.rows - 1;
-
- /* remember original resolutions */
- view->cell.ns_res = ns_res;
- view->cell.ew_res = ew_res;
-
- view->cell.configured = 1;
-
- return 0;
-}
-
-int In_view(View * view, int x, int y)
-{
- return (x >= view->left && x <= view->right && y >= view->top &&
- y <= view->bottom);
-}
-
-int Erase_view(View * view)
-{
- R_standard_color(BLACK);
- R_box_abs(view->left, view->top, view->right, view->bottom);
-
- return 0;
-}
-
-double magnification(View * view)
-{
- if (!view->cell.configured)
- return ((double)0.0);
- return (view->cell.ew_res / view->cell.head.ew_res);
-}
Copied: grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2image/view.c (from rev 44501, grass/branches/develbranch_6/imagery/i.ortho.photo/i.photo.2image/view.c)
===================================================================
--- grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2image/view.c (rev 0)
+++ grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2image/view.c 2010-12-22 10:05:10 UTC (rev 44654)
@@ -0,0 +1,49 @@
+#include <string.h>
+#include <grass/raster.h>
+#include "globals.h"
+
+int Configure_view(View * view, char *name, char *mapset, double ns_res, double ew_res /* original map resolution */
+ )
+{
+ Erase_view(view);
+ view->cell.configured = 0;
+
+ /* copy the cell name into the view */
+ strcpy(view->cell.name, name);
+ strcpy(view->cell.mapset, mapset);
+
+ /* determine the map edges */
+ view->cell.left = view->left + (view->ncols - view->cell.head.cols) / 2;
+ view->cell.right = view->cell.left + view->cell.head.cols - 1;
+ view->cell.top = view->top + (view->nrows - view->cell.head.rows) / 2;
+ view->cell.bottom = view->cell.top + view->cell.head.rows - 1;
+
+ /* remember original resolutions */
+ view->cell.ns_res = ns_res;
+ view->cell.ew_res = ew_res;
+
+ view->cell.configured = 1;
+
+ return 0;
+}
+
+int In_view(View * view, int x, int y)
+{
+ return (x >= view->left && x <= view->right && y >= view->top &&
+ y <= view->bottom);
+}
+
+int Erase_view(View * view)
+{
+ R_standard_color(BLACK);
+ R_box_abs(view->left, view->top, view->right, view->bottom);
+
+ return 0;
+}
+
+double magnification(View * view)
+{
+ if (!view->cell.configured)
+ return ((double)0.0);
+ return (view->cell.ew_res / view->cell.head.ew_res);
+}
Deleted: grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2image/where.c
===================================================================
--- grass/branches/develbranch_6/imagery/i.ortho.photo/i.photo.2image/where.c 2010-12-01 09:34:37 UTC (rev 44501)
+++ grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2image/where.c 2010-12-22 10:05:10 UTC (rev 44654)
@@ -1,72 +0,0 @@
-#include <grass/imagery.h>
-#include "globals.h"
-
-
-static char buf[300];
-
-static int where_12(View *, int, int);
-static int where_21(View *, int, int);
-static int where_am_i(View *, int, int, Window *, double *, double *,
- Window *);
-
-
-int where(int x, int y)
-{
- if (VIEW_MAP1->cell.configured && In_view(VIEW_MAP1, x, y))
- where_12(VIEW_MAP1, x, y);
- else if (VIEW_MAP1_ZOOM->cell.configured && In_view(VIEW_MAP1_ZOOM, x, y))
- where_12(VIEW_MAP1_ZOOM, x, y);
- /*
- else if (VIEW_MAP2->cell.configured && In_view (VIEW_MAP2, x, y))
- where_21 (VIEW_MAP2, x, y);
- else if (VIEW_MAP2_ZOOM->cell.configured && In_view (VIEW_MAP2_ZOOM, x, y))
- where_21 (VIEW_MAP2_ZOOM, x, y);
- */
- return 0; /* return but don't quit */
-}
-
-static int where_12(View * view, int x, int y)
-{
- where_am_i(view, x, y, MENU_WINDOW, group.E12, group.N12, INFO_WINDOW);
-
- return 0;
-}
-
-static int where_21(View * view, int x, int y)
-{
- where_am_i(view, x, y, INFO_WINDOW, group.E21, group.N21, MENU_WINDOW);
-
- return 0;
-}
-
-static int where_am_i(View * view, int x, int y, Window * w1, double *E,
- double *N, Window * w2)
-{
- double e1, n1, e2, n2;
- int row, col;
-
- /* convert x,y to east,north at center of cell */
- col = view_to_col(view, x);
- e1 = col_to_easting(&view->cell.head, col, 0.5);
- row = view_to_row(view, y);
- n1 = row_to_northing(&view->cell.head, row, 0.5);
-
- Curses_clear_window(w1);
- sprintf(buf, "East: %10.2f", e1);
- Curses_write_window(w1, 3, 3, buf);
- sprintf(buf, "North: %10.2f", n1);
- Curses_write_window(w1, 4, 3, buf);
-
- /* if transformation equation is useable, determine point via equation */
- if (group.ref_equation_stat <= 0)
- return 1;
-
- I_georef(e1, n1, &e2, &n2, E, N);
- Curses_clear_window(w2);
- sprintf(buf, "East: %10.2f", e2);
- Curses_write_window(w2, 3, 3, buf);
- sprintf(buf, "North: %10.2f", n2);
- Curses_write_window(w2, 4, 3, buf);
-
- return 0;
-}
Copied: grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2image/where.c (from rev 44501, grass/branches/develbranch_6/imagery/i.ortho.photo/i.photo.2image/where.c)
===================================================================
--- grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2image/where.c (rev 0)
+++ grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2image/where.c 2010-12-22 10:05:10 UTC (rev 44654)
@@ -0,0 +1,72 @@
+#include <grass/imagery.h>
+#include "globals.h"
+
+
+static char buf[300];
+
+static int where_12(View *, int, int);
+static int where_21(View *, int, int);
+static int where_am_i(View *, int, int, Window *, double *, double *,
+ Window *);
+
+
+int where(int x, int y)
+{
+ if (VIEW_MAP1->cell.configured && In_view(VIEW_MAP1, x, y))
+ where_12(VIEW_MAP1, x, y);
+ else if (VIEW_MAP1_ZOOM->cell.configured && In_view(VIEW_MAP1_ZOOM, x, y))
+ where_12(VIEW_MAP1_ZOOM, x, y);
+ /*
+ else if (VIEW_MAP2->cell.configured && In_view (VIEW_MAP2, x, y))
+ where_21 (VIEW_MAP2, x, y);
+ else if (VIEW_MAP2_ZOOM->cell.configured && In_view (VIEW_MAP2_ZOOM, x, y))
+ where_21 (VIEW_MAP2_ZOOM, x, y);
+ */
+ return 0; /* return but don't quit */
+}
+
+static int where_12(View * view, int x, int y)
+{
+ where_am_i(view, x, y, MENU_WINDOW, group.E12, group.N12, INFO_WINDOW);
+
+ return 0;
+}
+
+static int where_21(View * view, int x, int y)
+{
+ where_am_i(view, x, y, INFO_WINDOW, group.E21, group.N21, MENU_WINDOW);
+
+ return 0;
+}
+
+static int where_am_i(View * view, int x, int y, Window * w1, double *E,
+ double *N, Window * w2)
+{
+ double e1, n1, e2, n2;
+ int row, col;
+
+ /* convert x,y to east,north at center of cell */
+ col = view_to_col(view, x);
+ e1 = col_to_easting(&view->cell.head, col, 0.5);
+ row = view_to_row(view, y);
+ n1 = row_to_northing(&view->cell.head, row, 0.5);
+
+ Curses_clear_window(w1);
+ sprintf(buf, "East: %10.2f", e1);
+ Curses_write_window(w1, 3, 3, buf);
+ sprintf(buf, "North: %10.2f", n1);
+ Curses_write_window(w1, 4, 3, buf);
+
+ /* if transformation equation is useable, determine point via equation */
+ if (group.ref_equation_stat <= 0)
+ return 1;
+
+ I_georef(e1, n1, &e2, &n2, E, N);
+ Curses_clear_window(w2);
+ sprintf(buf, "East: %10.2f", e2);
+ Curses_write_window(w2, 3, 3, buf);
+ sprintf(buf, "North: %10.2f", n2);
+ Curses_write_window(w2, 4, 3, buf);
+
+ return 0;
+}
Deleted: grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2image/zoom.c
===================================================================
--- grass/branches/develbranch_6/imagery/i.ortho.photo/i.photo.2image/zoom.c 2010-12-01 09:34:37 UTC (rev 44501)
+++ grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2image/zoom.c 2010-12-22 10:05:10 UTC (rev 44654)
@@ -1,24 +0,0 @@
-#include "globals.h"
-
-static int cancel(void);
-
-int zoom(void)
-{
- static int use = 1;
-
- static Objects objects[] = {
- MENU("CANCEL", cancel, &use),
- MENU("BOX", zoom_box, &use),
- MENU("POINT", zoom_point, &use),
- INFO("Select type of zoom", &use),
- {0}
- };
-
- Input_pointer(objects);
- return 0; /* return, but don't QUIT */
-}
-
-static int cancel(void)
-{
- return -1;
-}
Copied: grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2image/zoom.c (from rev 44501, grass/branches/develbranch_6/imagery/i.ortho.photo/i.photo.2image/zoom.c)
===================================================================
--- grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2image/zoom.c (rev 0)
+++ grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2image/zoom.c 2010-12-22 10:05:10 UTC (rev 44654)
@@ -0,0 +1,24 @@
+#include "globals.h"
+
+static int cancel(void);
+
+int zoom(void)
+{
+ static int use = 1;
+
+ static Objects objects[] = {
+ MENU("CANCEL", cancel, &use),
+ MENU("BOX", zoom_box, &use),
+ MENU("POINT", zoom_point, &use),
+ INFO("Select type of zoom", &use),
+ {0}
+ };
+
+ Input_pointer(objects);
+ return 0; /* return, but don't QUIT */
+}
+
+static int cancel(void)
+{
+ return -1;
+}
Deleted: grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2image/zoom_box.c
===================================================================
--- grass/branches/develbranch_6/imagery/i.ortho.photo/i.photo.2image/zoom_box.c 2010-12-01 09:34:37 UTC (rev 44501)
+++ grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2image/zoom_box.c 2010-12-22 10:05:10 UTC (rev 44654)
@@ -1,190 +0,0 @@
-#include <grass/gis.h>
-#include <grass/raster.h>
-#include "globals.h"
-
-
-static int x1, y1, x2, y2;
-static View *pick_view, *zoom_view, *main_view;
-static int target_flag;
-static int cancel(void);
-static int zoom1(int, int);
-static int zoom2(int, int);
-
-
-int zoom_box(void)
-{
- static int use = 1;
-
- static Objects objects[] = {
- MENU("CANCEL", cancel, &use),
- INFO(" Mark first corner of window ", &use),
- OTHER(zoom1, &use),
- {0}
- };
-
- Input_pointer(objects);
- return 1;
-}
-
-static int zoom1( /* called by Input_pointer */
- int x, int y)
-{ /* called by Input_pointer */
- static int use = 1;
- static Objects objects[] = {
- MENU("CANCEL", cancel, &use),
- INFO(" Define the window ", &use),
- OTHER(zoom2, &use),
- {0}
- };
-
- /*
- * user has marked first corner
- * this determines which view is being zoomed
- */
- x1 = x;
- y1 = y;
-
- if (In_view(pick_view = VIEW_MAP1, x1, y1)) {
- main_view = VIEW_MAP1;
- zoom_view = VIEW_MAP1_ZOOM;
- target_flag = 0;
- }
- /*
- else if (In_view (pick_view = VIEW_MAP2, x1, y1))
- {
- if (!pick_view->cell.configured)
- return 0; *//* ignore the mouse event *//*
- main_view = VIEW_MAP2;
- zoom_view = VIEW_MAP2_ZOOM;
- target_flag = 1;
- }
- */
- else if (In_view(pick_view = VIEW_MAP1_ZOOM, x1, y1)) {
- if (!pick_view->cell.configured)
- return 0; /* ignore the mouse event */
- main_view = VIEW_MAP1;
- zoom_view = VIEW_MAP1_ZOOM;
- target_flag = 0;
- }
- /*
- else if (In_view (pick_view = VIEW_MAP2_ZOOM, x1, y1))
- {
- if (!pick_view->cell.configured)
- return 0; *//* ignore the mouse event *//*
- main_view = VIEW_MAP2;
- zoom_view = VIEW_MAP2_ZOOM;
- target_flag = 1;
- }
- */
- else
- return 0; /* ignore the mouse event */
- if (!pick_view->cell.configured)
- return 0; /* just to be sure */
-
- return Input_box(objects, x, y);
-}
-
-static int zoom2(int x, int y)
-{
- int top, bottom, left, right;
- int row, col;
- struct Cell_head cellhd;
-
- x2 = x;
- y2 = y;
- /*
- * user has completed the zoom window.
- * must be in same view as first corner
- */
- if (x1 == x2 || y1 == y2)
- return 0; /* ignore event */
- if (!In_view(pick_view, x2, y2))
- return 0;
- /*
- * ok, erase menu messages
- */
- Menu_msg("");
-
- /*
- * assign window coordinates to top,bottom,left,right
- */
- if (x1 < x2) {
- left = x1;
- right = x2;
- }
- else {
- left = x2;
- right = x1;
- }
- if (y1 < y2) {
- top = y1;
- bottom = y2;
- }
- else {
- top = y2;
- bottom = y1;
- }
-
- /*
- * Determine the the zoom window (ie, cellhd)
- * must copy the current view cellhd first, to preserve header info
- * (such as projection, zone, and other items.)
- * compute zoom window northings,eastings, rows, cols, and resolution
- */
-
- G_copy(&cellhd, &pick_view->cell.head, sizeof(cellhd));
-
- /* convert top to northing at top edge of cell
- * left to easting at left edge
- */
- col = view_to_col(pick_view, left);
- row = view_to_row(pick_view, top);
- cellhd.north = row_to_northing(&pick_view->cell.head, row, 0.0);
- cellhd.west = col_to_easting(&pick_view->cell.head, col, 0.0);
-
- /* convert bottom to northing at bottom edge of cell
- * right to easting at right edge
- */
- col = view_to_col(pick_view, right);
- row = view_to_row(pick_view, bottom);
- cellhd.south = row_to_northing(&pick_view->cell.head, row, 1.0);
- cellhd.east = col_to_easting(&pick_view->cell.head, col, 1.0);
-
-
- cellhd.rows = bottom - top + 1;
- cellhd.cols = right - left + 1;
- cellhd.ns_res = (cellhd.north - cellhd.south) / cellhd.rows;
- cellhd.ew_res = (cellhd.east - cellhd.west) / cellhd.cols;
-
- /*
- * Outline the zoom window on the main map
- * Turn previous one to grey.
- */
- if (zoom_view->cell.configured) {
- R_standard_color(GREY);
- Outline_cellhd(main_view, &zoom_view->cell.head);
- }
- R_standard_color(RED);
- Outline_cellhd(main_view, &cellhd);
-
-
- /*
- * zoom
- */
- if (target_flag)
- select_target_env();
- G_adjust_window_to_box(&cellhd, &zoom_view->cell.head, zoom_view->nrows,
- zoom_view->ncols);
- Configure_view(zoom_view, pick_view->cell.name, pick_view->cell.mapset,
- pick_view->cell.ns_res, pick_view->cell.ew_res);
- drawcell(zoom_view);
- select_current_env();
- display_ref_points(1);
- return 1; /* pop back */
-}
-
-
-static int cancel(void)
-{
- return -1;
-}
Copied: grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2image/zoom_box.c (from rev 44501, grass/branches/develbranch_6/imagery/i.ortho.photo/i.photo.2image/zoom_box.c)
===================================================================
--- grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2image/zoom_box.c (rev 0)
+++ grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2image/zoom_box.c 2010-12-22 10:05:10 UTC (rev 44654)
@@ -0,0 +1,190 @@
+#include <grass/gis.h>
+#include <grass/raster.h>
+#include "globals.h"
+
+
+static int x1, y1, x2, y2;
+static View *pick_view, *zoom_view, *main_view;
+static int target_flag;
+static int cancel(void);
+static int zoom1(int, int);
+static int zoom2(int, int);
+
+
+int zoom_box(void)
+{
+ static int use = 1;
+
+ static Objects objects[] = {
+ MENU("CANCEL", cancel, &use),
+ INFO(" Mark first corner of window ", &use),
+ OTHER(zoom1, &use),
+ {0}
+ };
+
+ Input_pointer(objects);
+ return 1;
+}
+
+static int zoom1( /* called by Input_pointer */
+ int x, int y)
+{ /* called by Input_pointer */
+ static int use = 1;
+ static Objects objects[] = {
+ MENU("CANCEL", cancel, &use),
+ INFO(" Define the window ", &use),
+ OTHER(zoom2, &use),
+ {0}
+ };
+
+ /*
+ * user has marked first corner
+ * this determines which view is being zoomed
+ */
+ x1 = x;
+ y1 = y;
+
+ if (In_view(pick_view = VIEW_MAP1, x1, y1)) {
+ main_view = VIEW_MAP1;
+ zoom_view = VIEW_MAP1_ZOOM;
+ target_flag = 0;
+ }
+ /*
+ else if (In_view (pick_view = VIEW_MAP2, x1, y1))
+ {
+ if (!pick_view->cell.configured)
+ return 0; *//* ignore the mouse event *//*
+ main_view = VIEW_MAP2;
+ zoom_view = VIEW_MAP2_ZOOM;
+ target_flag = 1;
+ }
+ */
+ else if (In_view(pick_view = VIEW_MAP1_ZOOM, x1, y1)) {
+ if (!pick_view->cell.configured)
+ return 0; /* ignore the mouse event */
+ main_view = VIEW_MAP1;
+ zoom_view = VIEW_MAP1_ZOOM;
+ target_flag = 0;
+ }
+ /*
+ else if (In_view (pick_view = VIEW_MAP2_ZOOM, x1, y1))
+ {
+ if (!pick_view->cell.configured)
+ return 0; *//* ignore the mouse event *//*
+ main_view = VIEW_MAP2;
+ zoom_view = VIEW_MAP2_ZOOM;
+ target_flag = 1;
+ }
+ */
+ else
+ return 0; /* ignore the mouse event */
+ if (!pick_view->cell.configured)
+ return 0; /* just to be sure */
+
+ return Input_box(objects, x, y);
+}
+
+static int zoom2(int x, int y)
+{
+ int top, bottom, left, right;
+ int row, col;
+ struct Cell_head cellhd;
+
+ x2 = x;
+ y2 = y;
+ /*
+ * user has completed the zoom window.
+ * must be in same view as first corner
+ */
+ if (x1 == x2 || y1 == y2)
+ return 0; /* ignore event */
+ if (!In_view(pick_view, x2, y2))
+ return 0;
+ /*
+ * ok, erase menu messages
+ */
+ Menu_msg("");
+
+ /*
+ * assign window coordinates to top,bottom,left,right
+ */
+ if (x1 < x2) {
+ left = x1;
+ right = x2;
+ }
+ else {
+ left = x2;
+ right = x1;
+ }
+ if (y1 < y2) {
+ top = y1;
+ bottom = y2;
+ }
+ else {
+ top = y2;
+ bottom = y1;
+ }
+
+ /*
+ * Determine the the zoom window (ie, cellhd)
+ * must copy the current view cellhd first, to preserve header info
+ * (such as projection, zone, and other items.)
+ * compute zoom window northings,eastings, rows, cols, and resolution
+ */
+
+ G_copy(&cellhd, &pick_view->cell.head, sizeof(cellhd));
+
+ /* convert top to northing at top edge of cell
+ * left to easting at left edge
+ */
+ col = view_to_col(pick_view, left);
+ row = view_to_row(pick_view, top);
+ cellhd.north = row_to_northing(&pick_view->cell.head, row, 0.0);
+ cellhd.west = col_to_easting(&pick_view->cell.head, col, 0.0);
+
+ /* convert bottom to northing at bottom edge of cell
+ * right to easting at right edge
+ */
+ col = view_to_col(pick_view, right);
+ row = view_to_row(pick_view, bottom);
+ cellhd.south = row_to_northing(&pick_view->cell.head, row, 1.0);
+ cellhd.east = col_to_easting(&pick_view->cell.head, col, 1.0);
+
+
+ cellhd.rows = bottom - top + 1;
+ cellhd.cols = right - left + 1;
+ cellhd.ns_res = (cellhd.north - cellhd.south) / cellhd.rows;
+ cellhd.ew_res = (cellhd.east - cellhd.west) / cellhd.cols;
+
+ /*
+ * Outline the zoom window on the main map
+ * Turn previous one to grey.
+ */
+ if (zoom_view->cell.configured) {
+ R_standard_color(GREY);
+ Outline_cellhd(main_view, &zoom_view->cell.head);
+ }
+ R_standard_color(RED);
+ Outline_cellhd(main_view, &cellhd);
+
+
+ /*
+ * zoom
+ */
+ if (target_flag)
+ select_target_env();
+ G_adjust_window_to_box(&cellhd, &zoom_view->cell.head, zoom_view->nrows,
+ zoom_view->ncols);
+ Configure_view(zoom_view, pick_view->cell.name, pick_view->cell.mapset,
+ pick_view->cell.ns_res, pick_view->cell.ew_res);
+ drawcell(zoom_view);
+ select_current_env();
+ display_ref_points(1);
+ return 1; /* pop back */
+}
+
+
+static int cancel(void)
+{
+ return -1;
+}
Deleted: grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2image/zoom_pnt.c
===================================================================
--- grass/branches/develbranch_6/imagery/i.ortho.photo/i.photo.2image/zoom_pnt.c 2010-12-01 09:34:37 UTC (rev 44501)
+++ grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2image/zoom_pnt.c 2010-12-22 10:05:10 UTC (rev 44654)
@@ -1,195 +0,0 @@
-#include <math.h>
-#include <grass/gis.h>
-#include <grass/raster.h>
-#include "globals.h"
-
-
-static View *pick_view, *zoom_view, *main_view;
-static int target_flag;
-static int zoom1(int, int);
-static int cancel(void);
-
-
-int zoom_point(void)
-{
- static int use = 1;
-
- static Objects objects[] = {
- MENU("CANCEL", cancel, &use),
- INFO(" Mark center of area to be zoomed ", &use),
- OTHER(zoom1, &use),
- {0}
- };
-
- Input_pointer(objects);
- return 1;
-}
-
-static int zoom1(int x, int y)
-{ /* called by Input_pointer */
- int top, bottom, left, right;
- int n, row, col;
- int nrows, ncols;
- struct Cell_head cellhd;
- int mag;
- double north, south, east, west;
-
- if (In_view(pick_view = VIEW_MAP1, x, y)) {
- main_view = VIEW_MAP1;
- zoom_view = VIEW_MAP1_ZOOM;
- target_flag = 0;
- }
- /*
- else if (In_view (pick_view = VIEW_MAP2, x, y))
- {
- if (!pick_view->cell.configured)
- return 0; *//* ignore the mouse event *//*
- main_view = VIEW_MAP2;
- zoom_view = VIEW_MAP2_ZOOM;
- target_flag = 1;
- }
- */
- else if (In_view(pick_view = VIEW_MAP1_ZOOM, x, y)) {
- if (!pick_view->cell.configured)
- return 0; /* ignore the mouse event */
- main_view = VIEW_MAP1;
- zoom_view = VIEW_MAP1_ZOOM;
- target_flag = 0;
- }
- /*
- else if (In_view (pick_view = VIEW_MAP2_ZOOM, x, y))
- {
- if (!pick_view->cell.configured)
- return 0; *//* ignore the mouse event *//*
- main_view = VIEW_MAP2;
- zoom_view = VIEW_MAP2_ZOOM;
- target_flag = 1;
- }
- */
- else
- return 0; /* ignore the mouse event */
- if (!pick_view->cell.configured)
- return 0; /* just to be sure */
- /*
- * make sure point is within edges of image as well
- */
- if (x <= pick_view->cell.left)
- return 0;
- if (x >= pick_view->cell.right)
- return 0;
- if (y <= pick_view->cell.top)
- return 0;
- if (y >= pick_view->cell.bottom)
- return 0;
-
-
- /*
- * ok, erase menu messages
- */
- Menu_msg("");
-
- /* determine magnification of zoom */
- if (zoom_view->cell.configured) {
- if (zoom_view == pick_view)
- mag = floor(magnification(zoom_view) + 1.0) + .1;
- else
- mag = ceil(magnification(zoom_view)) + .1;
- }
- else {
- mag = floor(magnification(main_view) + 1.0) + .1;
- }
- if (!ask_magnification(&mag))
- return 1;
- /*
- * Determine the the zoom window (ie, cellhd)
- */
-
- G_copy(&cellhd, &main_view->cell.head, sizeof(cellhd));
- cellhd.ns_res = main_view->cell.ns_res / mag;
- cellhd.ew_res = main_view->cell.ew_res / mag;
- cellhd.cols = (cellhd.east - cellhd.west) / cellhd.ew_res;
- cellhd.rows = (cellhd.north - cellhd.south) / cellhd.ns_res;
-
-
- /* convert x,y to col,row */
-
- col = view_to_col(pick_view, x);
- east = col_to_easting(&pick_view->cell.head, col, 0.5);
- col = easting_to_col(&cellhd, east);
-
- row = view_to_row(pick_view, y);
- north = row_to_northing(&pick_view->cell.head, row, 0.5);
- row = northing_to_row(&cellhd, north);
-
- ncols = zoom_view->ncols;
- nrows = zoom_view->nrows;
-
-
- n = cellhd.cols - col;
- if (n > col)
- n = col;
- if (n + n + 1 >= ncols) {
- n = ncols / 2;
- if (n + n + 1 >= ncols)
- n--;
- }
- left = col - n;
- right = col + n;
-
- n = cellhd.rows - row;
- if (n > row)
- n = row;
- if (n + n + 1 >= nrows) {
- n = nrows / 2;
- if (n + n + 1 >= nrows)
- n--;
- }
- top = row - n;
- bottom = row + n;
-
-
- north = row_to_northing(&cellhd, top, 0.0);
- west = col_to_easting(&cellhd, left, 0.0);
- south = row_to_northing(&cellhd, bottom, 1.0);
- east = col_to_easting(&cellhd, right, 1.0);
-
-
- cellhd.north = north;
- cellhd.south = south;
- cellhd.east = east;
- cellhd.west = west;
-
- cellhd.rows = (cellhd.north - cellhd.south) / cellhd.ns_res;
- cellhd.cols = (cellhd.east - cellhd.west) / cellhd.ew_res;
-
- /*
- * Outline the zoom window on the main map
- * Turn previous one to grey.
- */
- if (zoom_view->cell.configured) {
- R_standard_color(GREY);
- Outline_cellhd(main_view, &zoom_view->cell.head);
- }
- R_standard_color(RED);
- Outline_cellhd(main_view, &cellhd);
-
-
- /*
- * zoom
- */
- if (target_flag)
- select_target_env();
- G_copy(&zoom_view->cell.head, &cellhd, sizeof(cellhd));
- Configure_view(zoom_view, pick_view->cell.name, pick_view->cell.mapset,
- pick_view->cell.ns_res, pick_view->cell.ew_res);
- drawcell(zoom_view);
- select_current_env();
- display_ref_points(1);
-
- return 1; /* pop back */
-}
-
-static int cancel(void)
-{
- return -1;
-}
Copied: grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2image/zoom_pnt.c (from rev 44501, grass/branches/develbranch_6/imagery/i.ortho.photo/i.photo.2image/zoom_pnt.c)
===================================================================
--- grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2image/zoom_pnt.c (rev 0)
+++ grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2image/zoom_pnt.c 2010-12-22 10:05:10 UTC (rev 44654)
@@ -0,0 +1,195 @@
+#include <math.h>
+#include <grass/gis.h>
+#include <grass/raster.h>
+#include "globals.h"
+
+
+static View *pick_view, *zoom_view, *main_view;
+static int target_flag;
+static int zoom1(int, int);
+static int cancel(void);
+
+
+int zoom_point(void)
+{
+ static int use = 1;
+
+ static Objects objects[] = {
+ MENU("CANCEL", cancel, &use),
+ INFO(" Mark center of area to be zoomed ", &use),
+ OTHER(zoom1, &use),
+ {0}
+ };
+
+ Input_pointer(objects);
+ return 1;
+}
+
+static int zoom1(int x, int y)
+{ /* called by Input_pointer */
+ int top, bottom, left, right;
+ int n, row, col;
+ int nrows, ncols;
+ struct Cell_head cellhd;
+ int mag;
+ double north, south, east, west;
+
+ if (In_view(pick_view = VIEW_MAP1, x, y)) {
+ main_view = VIEW_MAP1;
+ zoom_view = VIEW_MAP1_ZOOM;
+ target_flag = 0;
+ }
+ /*
+ else if (In_view (pick_view = VIEW_MAP2, x, y))
+ {
+ if (!pick_view->cell.configured)
+ return 0; *//* ignore the mouse event *//*
+ main_view = VIEW_MAP2;
+ zoom_view = VIEW_MAP2_ZOOM;
+ target_flag = 1;
+ }
+ */
+ else if (In_view(pick_view = VIEW_MAP1_ZOOM, x, y)) {
+ if (!pick_view->cell.configured)
+ return 0; /* ignore the mouse event */
+ main_view = VIEW_MAP1;
+ zoom_view = VIEW_MAP1_ZOOM;
+ target_flag = 0;
+ }
+ /*
+ else if (In_view (pick_view = VIEW_MAP2_ZOOM, x, y))
+ {
+ if (!pick_view->cell.configured)
+ return 0; *//* ignore the mouse event *//*
+ main_view = VIEW_MAP2;
+ zoom_view = VIEW_MAP2_ZOOM;
+ target_flag = 1;
+ }
+ */
+ else
+ return 0; /* ignore the mouse event */
+ if (!pick_view->cell.configured)
+ return 0; /* just to be sure */
+ /*
+ * make sure point is within edges of image as well
+ */
+ if (x <= pick_view->cell.left)
+ return 0;
+ if (x >= pick_view->cell.right)
+ return 0;
+ if (y <= pick_view->cell.top)
+ return 0;
+ if (y >= pick_view->cell.bottom)
+ return 0;
+
+
+ /*
+ * ok, erase menu messages
+ */
+ Menu_msg("");
+
+ /* determine magnification of zoom */
+ if (zoom_view->cell.configured) {
+ if (zoom_view == pick_view)
+ mag = floor(magnification(zoom_view) + 1.0) + .1;
+ else
+ mag = ceil(magnification(zoom_view)) + .1;
+ }
+ else {
+ mag = floor(magnification(main_view) + 1.0) + .1;
+ }
+ if (!ask_magnification(&mag))
+ return 1;
+ /*
+ * Determine the the zoom window (ie, cellhd)
+ */
+
+ G_copy(&cellhd, &main_view->cell.head, sizeof(cellhd));
+ cellhd.ns_res = main_view->cell.ns_res / mag;
+ cellhd.ew_res = main_view->cell.ew_res / mag;
+ cellhd.cols = (cellhd.east - cellhd.west) / cellhd.ew_res;
+ cellhd.rows = (cellhd.north - cellhd.south) / cellhd.ns_res;
+
+
+ /* convert x,y to col,row */
+
+ col = view_to_col(pick_view, x);
+ east = col_to_easting(&pick_view->cell.head, col, 0.5);
+ col = easting_to_col(&cellhd, east);
+
+ row = view_to_row(pick_view, y);
+ north = row_to_northing(&pick_view->cell.head, row, 0.5);
+ row = northing_to_row(&cellhd, north);
+
+ ncols = zoom_view->ncols;
+ nrows = zoom_view->nrows;
+
+
+ n = cellhd.cols - col;
+ if (n > col)
+ n = col;
+ if (n + n + 1 >= ncols) {
+ n = ncols / 2;
+ if (n + n + 1 >= ncols)
+ n--;
+ }
+ left = col - n;
+ right = col + n;
+
+ n = cellhd.rows - row;
+ if (n > row)
+ n = row;
+ if (n + n + 1 >= nrows) {
+ n = nrows / 2;
+ if (n + n + 1 >= nrows)
+ n--;
+ }
+ top = row - n;
+ bottom = row + n;
+
+
+ north = row_to_northing(&cellhd, top, 0.0);
+ west = col_to_easting(&cellhd, left, 0.0);
+ south = row_to_northing(&cellhd, bottom, 1.0);
+ east = col_to_easting(&cellhd, right, 1.0);
+
+
+ cellhd.north = north;
+ cellhd.south = south;
+ cellhd.east = east;
+ cellhd.west = west;
+
+ cellhd.rows = (cellhd.north - cellhd.south) / cellhd.ns_res;
+ cellhd.cols = (cellhd.east - cellhd.west) / cellhd.ew_res;
+
+ /*
+ * Outline the zoom window on the main map
+ * Turn previous one to grey.
+ */
+ if (zoom_view->cell.configured) {
+ R_standard_color(GREY);
+ Outline_cellhd(main_view, &zoom_view->cell.head);
+ }
+ R_standard_color(RED);
+ Outline_cellhd(main_view, &cellhd);
+
+
+ /*
+ * zoom
+ */
+ if (target_flag)
+ select_target_env();
+ G_copy(&zoom_view->cell.head, &cellhd, sizeof(cellhd));
+ Configure_view(zoom_view, pick_view->cell.name, pick_view->cell.mapset,
+ pick_view->cell.ns_res, pick_view->cell.ew_res);
+ drawcell(zoom_view);
+ select_current_env();
+ display_ref_points(1);
+
+ return 1; /* pop back */
+}
+
+static int cancel(void)
+{
+ return -1;
+}
Property changes on: grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2target
___________________________________________________________________
Added: svn:ignore
+ *.tmp.html
*OBJ*
Deleted: grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2target/Makefile
===================================================================
--- grass/branches/develbranch_6/imagery/i.ortho.photo/i.photo.2target/Makefile 2010-12-01 09:34:37 UTC (rev 44501)
+++ grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2target/Makefile 2010-12-22 10:05:10 UTC (rev 44654)
@@ -1,15 +0,0 @@
-MODULE_TOPDIR = ../../..
-
-PGM = i.photo.2target
-
-EXTRA_CFLAGS = -I../libes
-
-LIBES = $(IMAGERYLIB) $(DISPLAYLIB) $(RASTERLIB) $(GISLIB) $(IORTHOLIB) $(VASKLIB) $(CURSES) $(GMATHLIB)
-DEPENDENCIES= $(IMAGERYDEP) $(DISPLAYDEP) $(RASTERDEP) $(IORTHODEP) $(GISDEP) $(VASKDEP) $(GMATHDEP)
-
-include $(MODULE_TOPDIR)/include/Make/Module.make
-
-default: etc
-
-$(PGM).tmp.html: $(ETC)/$(PGM)$(EXE)
- $(call htmldesc,$(ETC)/$(PGM)$(EXE))
Copied: grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2target/Makefile (from rev 44501, grass/branches/develbranch_6/imagery/i.ortho.photo/i.photo.2target/Makefile)
===================================================================
--- grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2target/Makefile (rev 0)
+++ grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2target/Makefile 2010-12-22 10:05:10 UTC (rev 44654)
@@ -0,0 +1,15 @@
+MODULE_TOPDIR = ../../..
+
+PGM = i.photo.2target
+
+EXTRA_CFLAGS = -I../libes
+
+LIBES = $(IMAGERYLIB) $(DISPLAYLIB) $(RASTERLIB) $(GISLIB) $(IORTHOLIB) $(VASKLIB) $(CURSES) $(GMATHLIB)
+DEPENDENCIES= $(IMAGERYDEP) $(DISPLAYDEP) $(RASTERDEP) $(IORTHODEP) $(GISDEP) $(VASKDEP) $(GMATHDEP)
+
+include $(MODULE_TOPDIR)/include/Make/Module.make
+
+default: etc
+
+$(PGM).tmp.html: $(ETC)/$(PGM)$(EXE)
+ $(call htmldesc,$(ETC)/$(PGM)$(EXE))
Deleted: grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2target/analyze.c
===================================================================
--- grass/branches/develbranch_6/imagery/i.ortho.photo/i.photo.2target/analyze.c 2010-12-01 09:34:37 UTC (rev 44501)
+++ grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2target/analyze.c 2010-12-22 10:05:10 UTC (rev 44654)
@@ -1,610 +0,0 @@
-/* analyze.c */
-#include <math.h>
-#include <unistd.h>
-#include <string.h>
-#include <grass/raster.h>
-#include "globals.h"
-#include "local_proto.h"
-
-#define NLINES 18
-struct box
-{
- int top, bottom, left, right;
-};
-
-static int which;
-static struct box more, less, report;
-static int height, size, edge, nlines;
-static int curp, first_point, i;
-static double rms;
-static double *xres, *yres, *gnd;
-static int pager;
-static int xmax, ymax, gmax;
-static char buf[300];
-static int uparrow(struct box *, int);
-static int downarrow(struct box *, int);
-static int pick(int, int);
-static int done(void);
-static int cancel_which(void);
-static int inbox(struct box *, int, int);
-static int dotext(char *, int, int, int, int, int, int);
-static int compute_transformation(void);
-static int debug(char *);
-static int to_file(void);
-static int askfile(void);
-static int to_printer(void);
-static int do_report(FILE *);
-static int printcentered(FILE *, char *, int);
-static int show_point(int, int);
-
-#define FMT0(buf,n) \
- sprintf (buf, "%3d ", n)
-#define FMT1(buf,xres,yres,gnd) \
- sprintf (buf, "%5.1f %5.1f %6.1f ", xres,yres,gnd)
-#define LHEAD1 " error "
-#define LHEAD2 " # east north target "
-
-#define FMT2(buf,e1,n1,e2,n2,z2) \
- sprintf (buf, "%9.1f %9.1f %9.1f %9.1f %9.1f ", e1,n1,e2,n2,z2)
-#define RHEAD1 " image target "
-#define RHEAD2 " east north east north elev."
-
-#define BACKGROUND GREY
-
-int analyze(void)
-{
- static int use = 1;
- static Objects objects[] = {
- MENU("DONE", done, &use),
- MENU("PRINT", to_printer, &use),
- MENU("FILE", to_file, &use),
- INFO(" Double click on point to be included/excluded ", &use),
- OTHER(pick, &use),
- {0}
- };
-
- int color;
- int tsize;
- int cury;
- int len;
- int line;
- int top, bottom, left, right, width, middle, nums;
-
- /* to give user a response of some sort */
- Menu_msg("Preparing analysis ...");
-
- /*
- * build a popup window at center of the screen.
- * 35% the height and wide enough to hold the report
- *
- */
-
- /* height of 1 line, based on NLINES taking up 35% vertical space */
- height = (.35 * (SCREEN_BOTTOM - SCREEN_TOP)) / NLINES + 1;
-
- /* size of text, 80% of line height */
- tsize = .8 * height;
- size = tsize - 2; /* fudge for computing pixels width of text */
-
- /* indent for the text */
- edge = .1 * height + 1;
-
- /* determine the length, in chars, of printed line */
- FMT0(buf, 0);
- nums = strlen(buf) * size;
- FMT1(buf, 0.0, 0.0, 0.0);
- len = strlen(buf);
- middle = len * size;
- FMT2(buf, 0.0, 0.0, 0.0, 0.0, 0.0);
- len += strlen(buf);
-
- /* width is for max chars plus sidecar for more/less */
- width = len * size + nums + 2 * height;
- if ((SCREEN_RIGHT - SCREEN_LEFT) < width)
- width = SCREEN_RIGHT - SCREEN_LEFT;
-
-
- /* define the window */
- bottom = VIEW_MENU->top - 1;
- top = bottom - height * NLINES;
-
-
- left = SCREEN_LEFT;
- right = left + width;
- middle += left + nums;
- nums += left;
-
- /* save what is under this area, so it can be restored */
- R_panel_save(tempfile1, top, bottom+1, left, right+1);
-
-
- /* fill it with white */
- R_standard_color(BACKGROUND);
- R_box_abs(left, top, right, bottom);
-
- right -= 2 * height; /* reduce it to exclude sidecar */
-
- /* print messages in message area */
- R_text_size(tsize, tsize);
-
-
- /* setup the more/less boxes in the sidecar */
- R_standard_color(BLACK);
- less.top = top;
- less.bottom = top + 2 * height;
- less.left = right;
- less.right = right + 2 * height;
- Outline_box(less.top, less.bottom, less.left, less.right);
-
- more.top = bottom - 2 * height;
- more.bottom = bottom;
- more.left = right;
- more.right = right + 2 * height;
- Outline_box(more.top, more.bottom, more.left, more.right);
-
- /*
- * top two lines are for column labels
- * last two line is for overall rms error.
- */
- nlines = NLINES - 3;
- first_point = 0;
-
- /* allocate predicted values */
- xres = (double *)G_calloc(group.control_points.count, sizeof(double));
- yres = (double *)G_calloc(group.control_points.count, sizeof(double));
- gnd = (double *)G_calloc(group.control_points.count, sizeof(double));
-
- /* compute transformation for the first time */
- compute_transformation();
-
-
- /* put head on the report */
- cury = top;
- dotext(LHEAD1, cury, cury + height, left, middle, 0, BLACK);
- dotext(RHEAD1, cury, cury + height, middle, right - 1, 0, BLACK);
- cury += height;
- dotext(LHEAD2, cury, cury + height, left, middle, 0, BLACK);
- dotext(RHEAD2, cury, cury + height, middle, right - 1, 0, BLACK);
- cury += height;
- R_move_abs(left, cury - 1);
- R_cont_abs(right, cury - 1);
-
- /* isolate the sidecar */
- R_move_abs(right, top);
- R_cont_abs(right, bottom);
-
- /* define report box */
- report.top = cury;
- report.left = left;
- report.right = right;
-
- /* lets do it */
- pager = 1;
- while (1) {
- R_text_size(tsize, tsize);
- line = 0;
- curp = first_point;
- cury = top + 2 * height;
- while (1) {
- if (line >= nlines || curp >= group.control_points.count)
- break;
- line++;
- if (group.con_equation_stat > 0 &&
- group.control_points.status[curp] > 0) {
- color = BLACK;
- FMT1(buf, xres[curp], yres[curp], gnd[curp]);
- if (curp == xmax || curp == ymax || curp == gmax)
- color = RED;
- dotext(buf, cury, cury + height, nums, middle, 0, color);
- }
- else if (group.control_points.status[curp] > 0)
- dotext("?", cury, cury + height, nums, middle, 1, BLACK);
- else
- dotext("not used", cury, cury + height, nums, middle, 1,
- BLACK);
- if (pager) {
- FMT0(buf, curp + 1);
- dotext(buf, cury, cury + height, left, nums, 0, BLACK);
- FMT2(buf,
- group.control_points.e1[curp],
- group.control_points.n1[curp],
- group.control_points.e2[curp],
- group.control_points.n2[curp],
- group.control_points.z2[curp]);
- dotext(buf, cury, cury + height, middle, right - 1, 0, BLACK);
- }
- cury += height;
- curp++;
- }
- report.bottom = cury;
- downarrow(&more, curp < group.control_points.count ? BLACK :
- BACKGROUND);
- uparrow(&less, first_point > 0 ? BLACK : BACKGROUND);
- R_standard_color(BACKGROUND);
- R_box_abs(left, cury, right - 1, bottom);
- if (group.con_equation_stat < 0) {
- color = RED;
- strcpy(buf, "Poorly placed control points");
- }
- else if (group.con_equation_stat == 0) {
- color = RED;
- strcpy(buf, "No active control points");
- }
- else {
- color = BLACK;
- sprintf(buf, "Overall rms error: %.2f", rms);
- }
- dotext(buf, bottom - height, bottom, left, right - 1, 0, color);
- R_standard_color(BLACK);
- R_move_abs(left, bottom - height);
- R_cont_abs(right - 1, bottom - height);
-
- pager = 0;
- which = -1;
- if (Input_pointer(objects) < 0)
- break;
- }
-
- /* all done. restore what was under the window */
- right += 2 * height; /* move it back over the sidecar */
- R_standard_color(BACKGROUND);
- R_box_abs(left, top, right, bottom);
- R_panel_restore(tempfile1);
- R_panel_delete(tempfile1);
- R_flush();
-
- G_free(xres);
- G_free(yres);
- G_free(gnd);
- for (i = 0; i < group.control_points.count; i++)
- group.control_points.status[i] = group.control_points.status[i];
- I_put_con_points(group.name, &group.control_points);
- display_conz_points(1);
- return 0; /* return but don't QUIT */
-}
-
-static int uparrow(struct box *box, int color)
-{
- R_standard_color(color);
- Uparrow(box->top + edge, box->bottom - edge, box->left + edge,
- box->right - edge);
-
- return 0;
-}
-
-static int downarrow(struct box *box, int color)
-{
- R_standard_color(color);
- Downarrow(box->top + edge, box->bottom - edge, box->left + edge,
- box->right - edge);
-
- return 0;
-}
-
-static int pick(int x, int y)
-{
- int n;
- int cur;
-
- cur = which;
- cancel_which();
- if (inbox(&more, x, y)) {
- if (curp >= group.control_points.count)
- return 0;
- first_point = curp;
- pager = 1;
- return 1;
- }
- if (inbox(&less, x, y)) {
- if (first_point == 0)
- return 0;
- first_point -= nlines;
- if (first_point < 0)
- first_point = 0;
- pager = 1;
- return 1;
- }
- if (!inbox(&report, x, y)) {
- return 0;
- }
-
- n = (y - report.top) / height;
- if (n == cur) { /* second click! */
- group.control_points.status[first_point + n] =
- !group.control_points.status[first_point + n];
- Menu_msg("Computing equations...");
- compute_transformation();
- show_point(first_point + n, 1);
- return 1;
- }
-
- /* first click */
- which = n;
- show_point(first_point + n, 0);
- R_standard_color(RED);
- Outline_box((report.top + n * height)+1, report.top + (n + 1) * height,
- report.left, report.right - 1);
- R_flush();
- return 0; /* ignore first click */
-
-}
-
-static int done(void)
-{
- cancel_which();
- return -1;
-}
-
-static int cancel_which(void)
-{
- if (which >= 0) {
- R_standard_color(BACKGROUND);
- Outline_box((report.top + which * height)+1,
- report.top + (which + 1) * height, report.left,
- report.right - 1);
- show_point(first_point + which, 1);
- }
- which = -1;
-
- return 0;
-}
-
-static int inbox(struct box *box, int x, int y)
-{
- return (x > box->left && x < box->right && y > box->top &&
- y < box->bottom);
-}
-
-static int dotext(char *text, int top, int bottom, int left, int right,
- int centered, int color)
-{
- R_standard_color(BACKGROUND);
- R_box_abs(left, top, right, bottom);
- R_standard_color(color);
- R_move_abs(left + 1 + edge, bottom - 1 - edge);
- if (centered)
- R_move_rel((right - left - strlen(text) * size) / 2, 0);
- R_set_window(top, bottom, left, right); /* for text clipping */
- R_text(text);
- R_set_window(SCREEN_TOP, SCREEN_BOTTOM, SCREEN_LEFT, SCREEN_RIGHT);
-
- return 0;
-}
-
-static int compute_transformation(void)
-{
- int n, count;
- double d, d1, d2, sum;
- double e1, n1, z1;
- double xval, yval, gval;
-
- G_debug(2, "INVERSE ORTHO:\n");
-
- xmax = ymax = gmax = 0;
- xval = yval = gval = 0.0;
-
- Compute_ortho_equation();
- if (group.con_equation_stat <= 0)
- return 1;
-
- /* compute the row,col error plus ground error keep track of largest
- and second largest error */
- sum = 0.0;
- rms = 0.0;
- count = 0;
- for (n = 0; n < group.control_points.count; n++) {
- if (group.control_points.status[n] <= 0)
- continue;
- count++;
-
- G_debug(2, "Photo coordinates \te1 = %f \tn1 = %f \tz2 = %f",
- group.control_points.e1[n], group.control_points.n1[n],
- group.control_points.z2[n]);
- G_debug(2, "Camera \txc = %f \tyc = %f \tzc = %f",
- group.XC, group.YC, group.ZC);
- G_debug(2, " \tomega = %f \tphi = %f \tkappa = %f",
- group.omega, group.phi, group.kappa);
-
- I_inverse_ortho_ref(temp_points.e1[n],
- temp_points.n1[n],
- temp_points.z2[n],
- &e1, &n1, &z1,
- &group.camera_ref,
- group.XC, group.YC, group.ZC, group.MI);
-
-/*****
- I_inverse_ortho_ref (group.control_points.e1[n],
- group.control_points.n1[n],
- group.control_points.z2[n],
- &e1, &n1, &z1,
- &group.camera_ref,
- group.XC, group.YC, group.ZC,
- group.omega, group.phi, group.kappa);
-*****/
-
- G_debug(2, "Ground coordinates \tx = %f \ty = %f", e1, n1);
-
- d = e1 - group.control_points.e2[n];
- xres[n] = d;
- if (d < 0)
- d = -d;
- if (d > xval) {
- xmax = n;
- xval = d;
- }
-
- d = n1 - group.control_points.n2[n];
- yres[n] = d;
- if (d < 0)
- d = -d;
- if (d > yval) {
- ymax = n;
- yval = d;
- }
-
- /* compute target error (ie along diagonal) */
- d1 = e1 - group.control_points.e2[n];
- d2 = n1 - group.control_points.n2[n];
- d = d1 * d1 + d2 * d2;
- sum += d; /* add it to rms sum, before taking sqrt */
- d = sqrt(d);
- gnd[n] = d;
- if (d > gval) { /* is this one the max? */
- gmax = n;
- gval = d;
- }
- }
-
- /* compute overall rms error */
- if (count)
- rms = sqrt(sum / count);
-
- return 0;
-}
-
-static int debug(char *msg)
-{
- R_stabilize();
- Curses_write_window(PROMPT_WINDOW, 1, 1, msg);
- Curses_getch(0);
-
- return 0;
-}
-
-static int to_file(void)
-{
- FILE *fd;
- char msg[1024];
-
- cancel_which();
- if (Input_other(askfile, "Keyboard") < 0) {
- return 0;
- }
-
- fd = fopen(buf, "w");
- if (fd == NULL) {
- sprintf(msg, "** Unable to create file %s\n", buf);
- Beep();
- Curses_write_window(PROMPT_WINDOW, 2, 1, msg);
- }
- else {
- do_report(fd);
- fclose(fd);
- sprintf(msg, "Report saved in file %s\n", buf);
- Curses_write_window(PROMPT_WINDOW, 2, 1, msg);
- }
- return 0;
-}
-
-static int askfile(void)
-{
- char file[100];
-
- while (1) {
- Curses_prompt_gets("Enter file to hold report: ", file);
- G_strip(file);
- if (*file == 0)
- return -1;
- if (G_index(file, '/'))
- strcpy(buf, file);
- else
- sprintf(buf, "%s/%s", G_home(), file);
- if (access(buf, 0) != 0)
- return 1;
- sprintf(buf, "** %s already exists. choose another file", file);
- Beep();
- Curses_write_window(PROMPT_WINDOW, 2, 1, buf);
- }
-
- return 0;
-}
-
-static int to_printer(void)
-{
- FILE *fd;
-
- cancel_which();
- Menu_msg("sending report to printer ...");
-
- fd = popen("lpr", "w");
- do_report(fd);
- pclose(fd);
- return 0;
-}
-
-static int do_report(FILE * fd)
-{
- char buf[100];
- int n;
- int width;
-
- fprintf(fd, "LOCATION: %-20s GROUP: %-20s MAPSET: %s\n\n",
- G_location(), group.name, G_mapset());
- fprintf(fd, "%15sAnalysis of control point registration\n\n", "");
- fprintf(fd, "%s %s\n", LHEAD1, RHEAD1);
- fprintf(fd, "%s %s\n", LHEAD2, RHEAD2);
-
- FMT1(buf, 0.0, 0.0, 0.0);
- width = strlen(buf);
-
- for (n = 0; n < group.control_points.count; n++) {
- FMT0(buf, n + 1);
- fprintf(fd, "%s", buf);
- if (group.con_equation_stat > 0 && group.control_points.status[n] > 0) {
- FMT1(buf, xres[n], yres[n], gnd[n]);
- fprintf(fd, "%s", buf);
- }
- else if (group.control_points.status[n] > 0)
- printcentered(fd, "?", width);
- else
- printcentered(fd, "not used", width);
- FMT2(buf,
- group.control_points.e1[n],
- group.control_points.n1[n],
- group.control_points.e2[n],
- group.control_points.n2[n], group.control_points.z2[n]);
- fprintf(fd, " %s\n", buf);
- }
- fprintf(fd, "\n");
- if (group.con_equation_stat < 0)
- fprintf(fd, "Poorly place control points\n");
- else if (group.con_equation_stat == 0)
- fprintf(fd, "No active control points\n");
- else
- fprintf(fd, "Overall rms error: %.2f\n", rms);
-
- return 0;
-}
-
-static int printcentered(FILE * fd, char *buf, int width)
-{
- int len;
- int n;
- int i;
-
- len = strlen(buf);
- n = (width - len) / 2;
-
- for (i = 0; i < n; i++)
- fprintf(fd, " ");
- fprintf(fd, "%s", buf);
- i += len;
- while (i++ < width)
- fprintf(fd, " ");
-
- return 0;
-}
-
-static int show_point(int n, int true_color)
-{
- if (!true_color)
- R_standard_color(ORANGE);
- else if (group.control_points.status[n])
- R_standard_color(GREEN);
- else
- R_standard_color(RED);
- display_one_point(VIEW_MAP1, group.control_points.e1[n],
- group.control_points.n1[n]);
-
- return 0;
-}
Copied: grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2target/analyze.c (from rev 44501, grass/branches/develbranch_6/imagery/i.ortho.photo/i.photo.2target/analyze.c)
===================================================================
--- grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2target/analyze.c (rev 0)
+++ grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2target/analyze.c 2010-12-22 10:05:10 UTC (rev 44654)
@@ -0,0 +1,610 @@
+/* analyze.c */
+#include <math.h>
+#include <unistd.h>
+#include <string.h>
+#include <grass/raster.h>
+#include "globals.h"
+#include "local_proto.h"
+
+#define NLINES 18
+struct box
+{
+ int top, bottom, left, right;
+};
+
+static int which;
+static struct box more, less, report;
+static int height, size, edge, nlines;
+static int curp, first_point, i;
+static double rms;
+static double *xres, *yres, *gnd;
+static int pager;
+static int xmax, ymax, gmax;
+static char buf[300];
+static int uparrow(struct box *, int);
+static int downarrow(struct box *, int);
+static int pick(int, int);
+static int done(void);
+static int cancel_which(void);
+static int inbox(struct box *, int, int);
+static int dotext(char *, int, int, int, int, int, int);
+static int compute_transformation(void);
+static int debug(char *);
+static int to_file(void);
+static int askfile(void);
+static int to_printer(void);
+static int do_report(FILE *);
+static int printcentered(FILE *, char *, int);
+static int show_point(int, int);
+
+#define FMT0(buf,n) \
+ sprintf (buf, "%3d ", n)
+#define FMT1(buf,xres,yres,gnd) \
+ sprintf (buf, "%5.1f %5.1f %6.1f ", xres,yres,gnd)
+#define LHEAD1 " error "
+#define LHEAD2 " # east north target "
+
+#define FMT2(buf,e1,n1,e2,n2,z2) \
+ sprintf (buf, "%9.1f %9.1f %9.1f %9.1f %9.1f ", e1,n1,e2,n2,z2)
+#define RHEAD1 " image target "
+#define RHEAD2 " east north east north elev."
+
+#define BACKGROUND GREY
+
+int analyze(void)
+{
+ static int use = 1;
+ static Objects objects[] = {
+ MENU("DONE", done, &use),
+ MENU("PRINT", to_printer, &use),
+ MENU("FILE", to_file, &use),
+ INFO(" Double click on point to be included/excluded ", &use),
+ OTHER(pick, &use),
+ {0}
+ };
+
+ int color;
+ int tsize;
+ int cury;
+ int len;
+ int line;
+ int top, bottom, left, right, width, middle, nums;
+
+ /* to give user a response of some sort */
+ Menu_msg("Preparing analysis ...");
+
+ /*
+ * build a popup window at center of the screen.
+ * 35% the height and wide enough to hold the report
+ *
+ */
+
+ /* height of 1 line, based on NLINES taking up 35% vertical space */
+ height = (.35 * (SCREEN_BOTTOM - SCREEN_TOP)) / NLINES + 1;
+
+ /* size of text, 80% of line height */
+ tsize = .8 * height;
+ size = tsize - 2; /* fudge for computing pixels width of text */
+
+ /* indent for the text */
+ edge = .1 * height + 1;
+
+ /* determine the length, in chars, of printed line */
+ FMT0(buf, 0);
+ nums = strlen(buf) * size;
+ FMT1(buf, 0.0, 0.0, 0.0);
+ len = strlen(buf);
+ middle = len * size;
+ FMT2(buf, 0.0, 0.0, 0.0, 0.0, 0.0);
+ len += strlen(buf);
+
+ /* width is for max chars plus sidecar for more/less */
+ width = len * size + nums + 2 * height;
+ if ((SCREEN_RIGHT - SCREEN_LEFT) < width)
+ width = SCREEN_RIGHT - SCREEN_LEFT;
+
+
+ /* define the window */
+ bottom = VIEW_MENU->top - 1;
+ top = bottom - height * NLINES;
+
+
+ left = SCREEN_LEFT;
+ right = left + width;
+ middle += left + nums;
+ nums += left;
+
+ /* save what is under this area, so it can be restored */
+ R_panel_save(tempfile1, top, bottom+1, left, right+1);
+
+
+ /* fill it with white */
+ R_standard_color(BACKGROUND);
+ R_box_abs(left, top, right, bottom);
+
+ right -= 2 * height; /* reduce it to exclude sidecar */
+
+ /* print messages in message area */
+ R_text_size(tsize, tsize);
+
+
+ /* setup the more/less boxes in the sidecar */
+ R_standard_color(BLACK);
+ less.top = top;
+ less.bottom = top + 2 * height;
+ less.left = right;
+ less.right = right + 2 * height;
+ Outline_box(less.top, less.bottom, less.left, less.right);
+
+ more.top = bottom - 2 * height;
+ more.bottom = bottom;
+ more.left = right;
+ more.right = right + 2 * height;
+ Outline_box(more.top, more.bottom, more.left, more.right);
+
+ /*
+ * top two lines are for column labels
+ * last two line is for overall rms error.
+ */
+ nlines = NLINES - 3;
+ first_point = 0;
+
+ /* allocate predicted values */
+ xres = (double *)G_calloc(group.control_points.count, sizeof(double));
+ yres = (double *)G_calloc(group.control_points.count, sizeof(double));
+ gnd = (double *)G_calloc(group.control_points.count, sizeof(double));
+
+ /* compute transformation for the first time */
+ compute_transformation();
+
+
+ /* put head on the report */
+ cury = top;
+ dotext(LHEAD1, cury, cury + height, left, middle, 0, BLACK);
+ dotext(RHEAD1, cury, cury + height, middle, right - 1, 0, BLACK);
+ cury += height;
+ dotext(LHEAD2, cury, cury + height, left, middle, 0, BLACK);
+ dotext(RHEAD2, cury, cury + height, middle, right - 1, 0, BLACK);
+ cury += height;
+ R_move_abs(left, cury - 1);
+ R_cont_abs(right, cury - 1);
+
+ /* isolate the sidecar */
+ R_move_abs(right, top);
+ R_cont_abs(right, bottom);
+
+ /* define report box */
+ report.top = cury;
+ report.left = left;
+ report.right = right;
+
+ /* lets do it */
+ pager = 1;
+ while (1) {
+ R_text_size(tsize, tsize);
+ line = 0;
+ curp = first_point;
+ cury = top + 2 * height;
+ while (1) {
+ if (line >= nlines || curp >= group.control_points.count)
+ break;
+ line++;
+ if (group.con_equation_stat > 0 &&
+ group.control_points.status[curp] > 0) {
+ color = BLACK;
+ FMT1(buf, xres[curp], yres[curp], gnd[curp]);
+ if (curp == xmax || curp == ymax || curp == gmax)
+ color = RED;
+ dotext(buf, cury, cury + height, nums, middle, 0, color);
+ }
+ else if (group.control_points.status[curp] > 0)
+ dotext("?", cury, cury + height, nums, middle, 1, BLACK);
+ else
+ dotext("not used", cury, cury + height, nums, middle, 1,
+ BLACK);
+ if (pager) {
+ FMT0(buf, curp + 1);
+ dotext(buf, cury, cury + height, left, nums, 0, BLACK);
+ FMT2(buf,
+ group.control_points.e1[curp],
+ group.control_points.n1[curp],
+ group.control_points.e2[curp],
+ group.control_points.n2[curp],
+ group.control_points.z2[curp]);
+ dotext(buf, cury, cury + height, middle, right - 1, 0, BLACK);
+ }
+ cury += height;
+ curp++;
+ }
+ report.bottom = cury;
+ downarrow(&more, curp < group.control_points.count ? BLACK :
+ BACKGROUND);
+ uparrow(&less, first_point > 0 ? BLACK : BACKGROUND);
+ R_standard_color(BACKGROUND);
+ R_box_abs(left, cury, right - 1, bottom);
+ if (group.con_equation_stat < 0) {
+ color = RED;
+ strcpy(buf, "Poorly placed control points");
+ }
+ else if (group.con_equation_stat == 0) {
+ color = RED;
+ strcpy(buf, "No active control points");
+ }
+ else {
+ color = BLACK;
+ sprintf(buf, "Overall rms error: %.2f", rms);
+ }
+ dotext(buf, bottom - height, bottom, left, right - 1, 0, color);
+ R_standard_color(BLACK);
+ R_move_abs(left, bottom - height);
+ R_cont_abs(right - 1, bottom - height);
+
+ pager = 0;
+ which = -1;
+ if (Input_pointer(objects) < 0)
+ break;
+ }
+
+ /* all done. restore what was under the window */
+ right += 2 * height; /* move it back over the sidecar */
+ R_standard_color(BACKGROUND);
+ R_box_abs(left, top, right, bottom);
+ R_panel_restore(tempfile1);
+ R_panel_delete(tempfile1);
+ R_flush();
+
+ G_free(xres);
+ G_free(yres);
+ G_free(gnd);
+ for (i = 0; i < group.control_points.count; i++)
+ group.control_points.status[i] = group.control_points.status[i];
+ I_put_con_points(group.name, &group.control_points);
+ display_conz_points(1);
+ return 0; /* return but don't QUIT */
+}
+
+static int uparrow(struct box *box, int color)
+{
+ R_standard_color(color);
+ Uparrow(box->top + edge, box->bottom - edge, box->left + edge,
+ box->right - edge);
+
+ return 0;
+}
+
+static int downarrow(struct box *box, int color)
+{
+ R_standard_color(color);
+ Downarrow(box->top + edge, box->bottom - edge, box->left + edge,
+ box->right - edge);
+
+ return 0;
+}
+
+static int pick(int x, int y)
+{
+ int n;
+ int cur;
+
+ cur = which;
+ cancel_which();
+ if (inbox(&more, x, y)) {
+ if (curp >= group.control_points.count)
+ return 0;
+ first_point = curp;
+ pager = 1;
+ return 1;
+ }
+ if (inbox(&less, x, y)) {
+ if (first_point == 0)
+ return 0;
+ first_point -= nlines;
+ if (first_point < 0)
+ first_point = 0;
+ pager = 1;
+ return 1;
+ }
+ if (!inbox(&report, x, y)) {
+ return 0;
+ }
+
+ n = (y - report.top) / height;
+ if (n == cur) { /* second click! */
+ group.control_points.status[first_point + n] =
+ !group.control_points.status[first_point + n];
+ Menu_msg("Computing equations...");
+ compute_transformation();
+ show_point(first_point + n, 1);
+ return 1;
+ }
+
+ /* first click */
+ which = n;
+ show_point(first_point + n, 0);
+ R_standard_color(RED);
+ Outline_box((report.top + n * height)+1, report.top + (n + 1) * height,
+ report.left, report.right - 1);
+ R_flush();
+ return 0; /* ignore first click */
+
+}
+
+static int done(void)
+{
+ cancel_which();
+ return -1;
+}
+
+static int cancel_which(void)
+{
+ if (which >= 0) {
+ R_standard_color(BACKGROUND);
+ Outline_box((report.top + which * height)+1,
+ report.top + (which + 1) * height, report.left,
+ report.right - 1);
+ show_point(first_point + which, 1);
+ }
+ which = -1;
+
+ return 0;
+}
+
+static int inbox(struct box *box, int x, int y)
+{
+ return (x > box->left && x < box->right && y > box->top &&
+ y < box->bottom);
+}
+
+static int dotext(char *text, int top, int bottom, int left, int right,
+ int centered, int color)
+{
+ R_standard_color(BACKGROUND);
+ R_box_abs(left, top, right, bottom);
+ R_standard_color(color);
+ R_move_abs(left + 1 + edge, bottom - 1 - edge);
+ if (centered)
+ R_move_rel((right - left - strlen(text) * size) / 2, 0);
+ R_set_window(top, bottom, left, right); /* for text clipping */
+ R_text(text);
+ R_set_window(SCREEN_TOP, SCREEN_BOTTOM, SCREEN_LEFT, SCREEN_RIGHT);
+
+ return 0;
+}
+
+static int compute_transformation(void)
+{
+ int n, count;
+ double d, d1, d2, sum;
+ double e1, n1, z1;
+ double xval, yval, gval;
+
+ G_debug(2, "INVERSE ORTHO:\n");
+
+ xmax = ymax = gmax = 0;
+ xval = yval = gval = 0.0;
+
+ Compute_ortho_equation();
+ if (group.con_equation_stat <= 0)
+ return 1;
+
+ /* compute the row,col error plus ground error keep track of largest
+ and second largest error */
+ sum = 0.0;
+ rms = 0.0;
+ count = 0;
+ for (n = 0; n < group.control_points.count; n++) {
+ if (group.control_points.status[n] <= 0)
+ continue;
+ count++;
+
+ G_debug(2, "Photo coordinates \te1 = %f \tn1 = %f \tz2 = %f",
+ group.control_points.e1[n], group.control_points.n1[n],
+ group.control_points.z2[n]);
+ G_debug(2, "Camera \txc = %f \tyc = %f \tzc = %f",
+ group.XC, group.YC, group.ZC);
+ G_debug(2, " \tomega = %f \tphi = %f \tkappa = %f",
+ group.omega, group.phi, group.kappa);
+
+ I_inverse_ortho_ref(temp_points.e1[n],
+ temp_points.n1[n],
+ temp_points.z2[n],
+ &e1, &n1, &z1,
+ &group.camera_ref,
+ group.XC, group.YC, group.ZC, group.MI);
+
+/*****
+ I_inverse_ortho_ref (group.control_points.e1[n],
+ group.control_points.n1[n],
+ group.control_points.z2[n],
+ &e1, &n1, &z1,
+ &group.camera_ref,
+ group.XC, group.YC, group.ZC,
+ group.omega, group.phi, group.kappa);
+*****/
+
+ G_debug(2, "Ground coordinates \tx = %f \ty = %f", e1, n1);
+
+ d = e1 - group.control_points.e2[n];
+ xres[n] = d;
+ if (d < 0)
+ d = -d;
+ if (d > xval) {
+ xmax = n;
+ xval = d;
+ }
+
+ d = n1 - group.control_points.n2[n];
+ yres[n] = d;
+ if (d < 0)
+ d = -d;
+ if (d > yval) {
+ ymax = n;
+ yval = d;
+ }
+
+ /* compute target error (ie along diagonal) */
+ d1 = e1 - group.control_points.e2[n];
+ d2 = n1 - group.control_points.n2[n];
+ d = d1 * d1 + d2 * d2;
+ sum += d; /* add it to rms sum, before taking sqrt */
+ d = sqrt(d);
+ gnd[n] = d;
+ if (d > gval) { /* is this one the max? */
+ gmax = n;
+ gval = d;
+ }
+ }
+
+ /* compute overall rms error */
+ if (count)
+ rms = sqrt(sum / count);
+
+ return 0;
+}
+
+static int debug(char *msg)
+{
+ R_stabilize();
+ Curses_write_window(PROMPT_WINDOW, 1, 1, msg);
+ Curses_getch(0);
+
+ return 0;
+}
+
+static int to_file(void)
+{
+ FILE *fd;
+ char msg[1024];
+
+ cancel_which();
+ if (Input_other(askfile, "Keyboard") < 0) {
+ return 0;
+ }
+
+ fd = fopen(buf, "w");
+ if (fd == NULL) {
+ sprintf(msg, "** Unable to create file %s\n", buf);
+ Beep();
+ Curses_write_window(PROMPT_WINDOW, 2, 1, msg);
+ }
+ else {
+ do_report(fd);
+ fclose(fd);
+ sprintf(msg, "Report saved in file %s\n", buf);
+ Curses_write_window(PROMPT_WINDOW, 2, 1, msg);
+ }
+ return 0;
+}
+
+static int askfile(void)
+{
+ char file[100];
+
+ while (1) {
+ Curses_prompt_gets("Enter file to hold report: ", file);
+ G_strip(file);
+ if (*file == 0)
+ return -1;
+ if (G_index(file, '/'))
+ strcpy(buf, file);
+ else
+ sprintf(buf, "%s/%s", G_home(), file);
+ if (access(buf, 0) != 0)
+ return 1;
+ sprintf(buf, "** %s already exists. choose another file", file);
+ Beep();
+ Curses_write_window(PROMPT_WINDOW, 2, 1, buf);
+ }
+
+ return 0;
+}
+
+static int to_printer(void)
+{
+ FILE *fd;
+
+ cancel_which();
+ Menu_msg("sending report to printer ...");
+
+ fd = popen("lpr", "w");
+ do_report(fd);
+ pclose(fd);
+ return 0;
+}
+
+static int do_report(FILE * fd)
+{
+ char buf[100];
+ int n;
+ int width;
+
+ fprintf(fd, "LOCATION: %-20s GROUP: %-20s MAPSET: %s\n\n",
+ G_location(), group.name, G_mapset());
+ fprintf(fd, "%15sAnalysis of control point registration\n\n", "");
+ fprintf(fd, "%s %s\n", LHEAD1, RHEAD1);
+ fprintf(fd, "%s %s\n", LHEAD2, RHEAD2);
+
+ FMT1(buf, 0.0, 0.0, 0.0);
+ width = strlen(buf);
+
+ for (n = 0; n < group.control_points.count; n++) {
+ FMT0(buf, n + 1);
+ fprintf(fd, "%s", buf);
+ if (group.con_equation_stat > 0 && group.control_points.status[n] > 0) {
+ FMT1(buf, xres[n], yres[n], gnd[n]);
+ fprintf(fd, "%s", buf);
+ }
+ else if (group.control_points.status[n] > 0)
+ printcentered(fd, "?", width);
+ else
+ printcentered(fd, "not used", width);
+ FMT2(buf,
+ group.control_points.e1[n],
+ group.control_points.n1[n],
+ group.control_points.e2[n],
+ group.control_points.n2[n], group.control_points.z2[n]);
+ fprintf(fd, " %s\n", buf);
+ }
+ fprintf(fd, "\n");
+ if (group.con_equation_stat < 0)
+ fprintf(fd, "Poorly place control points\n");
+ else if (group.con_equation_stat == 0)
+ fprintf(fd, "No active control points\n");
+ else
+ fprintf(fd, "Overall rms error: %.2f\n", rms);
+
+ return 0;
+}
+
+static int printcentered(FILE * fd, char *buf, int width)
+{
+ int len;
+ int n;
+ int i;
+
+ len = strlen(buf);
+ n = (width - len) / 2;
+
+ for (i = 0; i < n; i++)
+ fprintf(fd, " ");
+ fprintf(fd, "%s", buf);
+ i += len;
+ while (i++ < width)
+ fprintf(fd, " ");
+
+ return 0;
+}
+
+static int show_point(int n, int true_color)
+{
+ if (!true_color)
+ R_standard_color(ORANGE);
+ else if (group.control_points.status[n])
+ R_standard_color(GREEN);
+ else
+ R_standard_color(RED);
+ display_one_point(VIEW_MAP1, group.control_points.e1[n],
+ group.control_points.n1[n]);
+
+ return 0;
+}
Deleted: grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2target/ask.c
===================================================================
--- grass/branches/develbranch_6/imagery/i.ortho.photo/i.photo.2target/ask.c 2010-12-01 09:34:37 UTC (rev 44501)
+++ grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2target/ask.c 2010-12-22 10:05:10 UTC (rev 44654)
@@ -1,386 +0,0 @@
-/* ask.c */
-#include <string.h>
-#include <grass/raster.h>
-#include "globals.h"
-#include "local_proto.h"
-
-#define NLINES 18
-struct box
-{
- int top, bottom, left, right;
-};
-
-static int text_size;
-static int which;
-static struct box cancel, more, less;
-static int height, size, edge, count;
-static int page, npages;
-
-static int dobox(struct box *, char *, int, int, int, int, int);
-static int uparrow(struct box *, int);
-static int downarrow(struct box *, int);
-static int pick(int, int);
-static int cancel_which(void);
-static int inbox(struct box *, int, int);
-static int dotext(char *, int, int, int, int, int);
-
-static struct
-{
- char name[30], mapset[30];
- struct box box;
-} list[NLINES * 2];
-
-int ask_gis_files(char *type, char *file,
- char *xname, char *xmapset, int position)
-{
- static int use = 1;
- static Objects objects[] = {
- OTHER(pick, &use),
- {0}
- };
-
- char msg[100];
- FILE *fd;
- int width;
- int len1, len2, len;
- long offset;
- long *page_offset;
- int col, nlist;
- int line;
- int stat;
- char buf[100];
- int top, bottom, left, right, center;
- int topx, bottomx, leftx, rightx, widthx;
- char name[30], mapset[30], cur_mapset[30];
- int new_mapset;
-
- Menu_msg("");
-
- fd = fopen(file, "r");
- if (fd == NULL)
- G_fatal_error("ask_gis_files: can't read tempfile");
- if (fread(&len1, sizeof(len1), 1, fd) != 1
- || fread(&len2, sizeof(len2), 1, fd) != 1 || len1 <= 0 || len2 <= 0) {
- fclose(fd);
- return 0;
- }
-
- sprintf(msg, "Double click on %s file to be plotted", type);
-
- /*
- * build a popup window at center of the screen.
- * 35% the height and wide enough to hold 2 columms of file names
- *
- * the window is for choosing file names and will be laid out in 2 columns
- *
- * ------------------------------------------
- * | CANCEL | (MORE) | (LESS) |
- * ------------------------------------------
- * | mapset |
- * ------------------------------------------
- * | name1 | name2 |
- * ------------------------------------------
- * | name3 | name4 |
- * ------------------------------------------
- * | name5 | name6 |
- * | . |
- * | . |
- * | . |
- * ------------------------------------------
- */
-
- /* height of 1 line, based on NLINES taking up 35% vertical space */
- height = (.35 * (SCREEN_BOTTOM - SCREEN_TOP)) / NLINES + 1;
-
- /* size of text, 80% of line height */
- text_size = .8 * height;
- size = text_size - 1; /* fudge for computing pixels width of text */
-
- /* indent for the text */
- edge = .1 * height + 1;
-
- /* this is a fudge to determine the length of the largest text */
- len1 = 2 * len1; /* name in 2 columns */
- len2 += strlen("mapset ");
- len = (len1 > len2 ? len1 : len2);
-
- /* width is for max chars plus sidecar for more/less */
- width = len * size + height;
- widthx = strlen(msg) * size;
- if (widthx < width)
- widthx = width;
-
- /* define the window */
- top = (SCREEN_TOP + SCREEN_BOTTOM - height * NLINES) / 2;
- bottom = top + height * NLINES;
-
- center = (SCREEN_LEFT + SCREEN_RIGHT) / 2;
- if (position > 0) {
- right = (center + SCREEN_RIGHT + width) / 2;
- if (right >= SCREEN_RIGHT)
- right = SCREEN_RIGHT - 1;
- left = right - width;
- }
- else if (position < 0) {
- left = (center + SCREEN_LEFT - width) / 2;
- if (left <= SCREEN_LEFT)
- left = SCREEN_LEFT + 1;
- right = left + width;
- }
- else {
- left = center + width / 2;
- right = left + width;
- }
-
- topx = top - 3 * height;
- bottomx = topx + 2 * height;
- leftx = (left + right - widthx) / 2;
- if (leftx < SCREEN_LEFT)
- leftx = SCREEN_LEFT;
- rightx = leftx + widthx;
-
- /* save what is under these areas, so they can be restored */
- R_panel_save(tempfile1, top, bottom+1, left, right+1);
- R_panel_save(tempfile2, topx, bottomx+1, leftx, rightx+1);
-
- /* fill it top with GREY, pick area with white */
- R_standard_color(WHITE);
- R_box_abs(left, top, right, bottom);
- R_standard_color(GREY);
- R_box_abs(leftx, topx, rightx, bottomx);
-
- R_standard_color(BLACK);
- Outline_box(top, bottom, left, right);
- right -= height; /* reduce it to exclude sidecar */
- Outline_box(top, bottom, left, right);
-
- /* print messages above the files */
- dotext(msg, topx, topx + height, leftx, rightx, 1);
- dotext("Double click here to cancel", topx + height, bottomx, leftx,
- rightx, 1);
- cancel.top = topx;
- cancel.bottom = bottomx;
- cancel.left = leftx;
- cancel.right = rightx;
-
- /* start the mouse in the cancel box */
- Set_mouse_xy((leftx + rightx) / 2, (topx + bottomx) / 2);
-
- dobox(&less, "", WHITE, top, right, right + height, 0);
- dobox(&more, "", WHITE, bottom - height, right, right + height, 0);
-
- /* as we read the file of names, keep track of pages so we can
- * page backward
- */
- page = 0;
- page_offset = (long *)G_calloc(npages = 1, sizeof(long));
- *page_offset = ftell(fd);
-
- nlist = sizeof(list) / sizeof(list[0]);
- for (stat = -1; stat < 0;) {
- line = 0;
- count = 0;
- *cur_mapset = 0;
- col = 0;
- while (1) {
- offset = ftell(fd);
- if (fgets(buf, sizeof buf, fd) == NULL
- || sscanf(buf, "%s %s", name, mapset) != 2)
- break;
- if ((new_mapset = (strcmp(cur_mapset, mapset)) != 0)) {
- if (line)
- line++;
- if (col)
- line++;
- col = 0;
- }
- if (count >= nlist || line + new_mapset >= NLINES) {
- if (page + 1 == npages) {
- npages++;
- page_offset =
- (long *)G_realloc(page_offset, npages * sizeof(long));
- page_offset[npages - 1] = offset;
- }
- break;
- }
- if (new_mapset) {
- struct box dummy;
- char label[100];
-
- strcpy(cur_mapset, mapset);
- sprintf(label, "Mapset %s", mapset);
- dobox(&dummy, label, WHITE, top + line * height, left, right,
- 0);
- line++;
- }
- if (col) {
- dobox(&list[count].box, name, GREY, top + line * height,
- left + width / 2, right, 0);
- line++;
- col = 0;
- }
- else {
- dobox(&list[count].box, name, GREY, top + line * height, left,
- left + width / 2, 0);
- col = 1;
- }
- strcpy(list[count].name, name);
- strcpy(list[count].mapset, mapset);
- count++;
- }
- downarrow(&more, page + 1 < npages ? BLACK : WHITE);
- uparrow(&less, page > 0 ? BLACK : WHITE);
- which = -1;
- switch (Input_pointer(objects)) {
- case -1: /* more or less */
- break;
- case -2: /* cancel */
- stat = 0;
- continue;
- default: /* file picked */
- strcpy(xname, list[which].name);
- strcpy(xmapset, list[which].mapset);
- stat = 1;
- continue;
- }
- fseek(fd, page_offset[page], 0);
- R_standard_color(WHITE);
- R_box_abs(left + 1, top + 1, right - 1, bottom - 1);
- }
-
- /* all done. restore what was under the window */
- right += height; /* move it back over the sidecar */
- R_standard_color(WHITE);
- R_box_abs(left, top, right, bottom);
- R_panel_restore(tempfile1);
- R_panel_restore(tempfile2);
- R_panel_delete(tempfile1);
- R_panel_delete(tempfile2);
- R_flush();
-
- G_free(page_offset);
- return stat;
-}
-
-static int dobox(struct box *box, char *text, int color, int top, int left,
- int right, int centered)
-{
- int bottom;
-
- bottom = top + height;
- /* fill inside of box with color */
- R_standard_color(color);
- R_box_abs(left + 1, top + 1, right - 1, bottom - 1);
-
- /* draw box outline and text in black */
- R_standard_color(BLACK);
- Outline_box(top, bottom, left, right);
- dotext(text, top, bottom, left, right, centered);
- R_flush();
-
- box->top = top;
- box->bottom = bottom;
- box->left = left;
- box->right = right;
-
- return 0;
-}
-
-static int uparrow(struct box *box, int color)
-{
- R_standard_color(color);
- Uparrow(box->top + edge, box->bottom - edge, box->left + edge,
- box->right - edge);
-
- return 0;
-}
-
-static int downarrow(struct box *box, int color)
-{
- R_standard_color(color);
- Downarrow(box->top + edge, box->bottom - edge, box->left + edge,
- box->right - edge);
- return 0;
-}
-
-static int pick(int x, int y)
-{
- int n;
-
- if (inbox(&more, x, y)) {
- cancel_which();
- if (page + 1 >= npages)
- return 0;
- page++;
- return -1;
- }
- if (inbox(&less, x, y)) {
- cancel_which();
- if (page == 0)
- return 0;
- page--;
- return -1;
- }
- if (inbox(&cancel, x, y)) {
- if (which == -2)
- return -2;
- cancel_which();
- which = -2;
- R_standard_color(RED);
- Outline_box(cancel.top, cancel.bottom, cancel.left, cancel.right);
- R_flush();
- return 0;
- }
- /* search name list. handle double click */
- for (n = 0; n < count; n++)
- if (inbox(&list[n].box, x, y)) {
- if (n == which) /* second click! */
- return 1;
- cancel_which();
- which = n;
- R_standard_color(RED);
- Outline_box(list[n].box.top, list[n].box.bottom,
- list[n].box.left, list[n].box.right);
- R_flush();
- return 0; /* ignore first click */
- }
-
- cancel_which();
- return 0;
-}
-
-static int cancel_which(void)
-{
- if (which == -2) {
- R_standard_color(BLACK);
- Outline_box(cancel.top, cancel.bottom, cancel.left, cancel.right);
- }
- else if (which >= 0) {
- R_standard_color(BLACK);
- Outline_box(list[which].box.top, list[which].box.bottom,
- list[which].box.left, list[which].box.right);
- }
- which = -1;
-
- return 0;
-}
-
-static int inbox(struct box *box, int x, int y)
-{
- return (x > box->left && x < box->right && y > box->top &&
- y < box->bottom);
-}
-
-static int dotext(char *text, int top, int bottom, int left, int right,
- int centered)
-{
- R_text_size(text_size, text_size);
- R_move_abs(left + 1 + edge, bottom - 1 - edge);
- if (centered)
- R_move_rel((right - left - strlen(text) * size) / 2, 0);
- R_set_window(top, bottom, left, right); /* for text clipping */
- R_text(text);
- R_set_window(SCREEN_TOP, SCREEN_BOTTOM, SCREEN_LEFT, SCREEN_RIGHT);
-
- return 0;
-}
Copied: grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2target/ask.c (from rev 44501, grass/branches/develbranch_6/imagery/i.ortho.photo/i.photo.2target/ask.c)
===================================================================
--- grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2target/ask.c (rev 0)
+++ grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2target/ask.c 2010-12-22 10:05:10 UTC (rev 44654)
@@ -0,0 +1,386 @@
+/* ask.c */
+#include <string.h>
+#include <grass/raster.h>
+#include "globals.h"
+#include "local_proto.h"
+
+#define NLINES 18
+struct box
+{
+ int top, bottom, left, right;
+};
+
+static int text_size;
+static int which;
+static struct box cancel, more, less;
+static int height, size, edge, count;
+static int page, npages;
+
+static int dobox(struct box *, char *, int, int, int, int, int);
+static int uparrow(struct box *, int);
+static int downarrow(struct box *, int);
+static int pick(int, int);
+static int cancel_which(void);
+static int inbox(struct box *, int, int);
+static int dotext(char *, int, int, int, int, int);
+
+static struct
+{
+ char name[30], mapset[30];
+ struct box box;
+} list[NLINES * 2];
+
+int ask_gis_files(char *type, char *file,
+ char *xname, char *xmapset, int position)
+{
+ static int use = 1;
+ static Objects objects[] = {
+ OTHER(pick, &use),
+ {0}
+ };
+
+ char msg[100];
+ FILE *fd;
+ int width;
+ int len1, len2, len;
+ long offset;
+ long *page_offset;
+ int col, nlist;
+ int line;
+ int stat;
+ char buf[100];
+ int top, bottom, left, right, center;
+ int topx, bottomx, leftx, rightx, widthx;
+ char name[30], mapset[30], cur_mapset[30];
+ int new_mapset;
+
+ Menu_msg("");
+
+ fd = fopen(file, "r");
+ if (fd == NULL)
+ G_fatal_error("ask_gis_files: can't read tempfile");
+ if (fread(&len1, sizeof(len1), 1, fd) != 1
+ || fread(&len2, sizeof(len2), 1, fd) != 1 || len1 <= 0 || len2 <= 0) {
+ fclose(fd);
+ return 0;
+ }
+
+ sprintf(msg, "Double click on %s file to be plotted", type);
+
+ /*
+ * build a popup window at center of the screen.
+ * 35% the height and wide enough to hold 2 columms of file names
+ *
+ * the window is for choosing file names and will be laid out in 2 columns
+ *
+ * ------------------------------------------
+ * | CANCEL | (MORE) | (LESS) |
+ * ------------------------------------------
+ * | mapset |
+ * ------------------------------------------
+ * | name1 | name2 |
+ * ------------------------------------------
+ * | name3 | name4 |
+ * ------------------------------------------
+ * | name5 | name6 |
+ * | . |
+ * | . |
+ * | . |
+ * ------------------------------------------
+ */
+
+ /* height of 1 line, based on NLINES taking up 35% vertical space */
+ height = (.35 * (SCREEN_BOTTOM - SCREEN_TOP)) / NLINES + 1;
+
+ /* size of text, 80% of line height */
+ text_size = .8 * height;
+ size = text_size - 1; /* fudge for computing pixels width of text */
+
+ /* indent for the text */
+ edge = .1 * height + 1;
+
+ /* this is a fudge to determine the length of the largest text */
+ len1 = 2 * len1; /* name in 2 columns */
+ len2 += strlen("mapset ");
+ len = (len1 > len2 ? len1 : len2);
+
+ /* width is for max chars plus sidecar for more/less */
+ width = len * size + height;
+ widthx = strlen(msg) * size;
+ if (widthx < width)
+ widthx = width;
+
+ /* define the window */
+ top = (SCREEN_TOP + SCREEN_BOTTOM - height * NLINES) / 2;
+ bottom = top + height * NLINES;
+
+ center = (SCREEN_LEFT + SCREEN_RIGHT) / 2;
+ if (position > 0) {
+ right = (center + SCREEN_RIGHT + width) / 2;
+ if (right >= SCREEN_RIGHT)
+ right = SCREEN_RIGHT - 1;
+ left = right - width;
+ }
+ else if (position < 0) {
+ left = (center + SCREEN_LEFT - width) / 2;
+ if (left <= SCREEN_LEFT)
+ left = SCREEN_LEFT + 1;
+ right = left + width;
+ }
+ else {
+ left = center + width / 2;
+ right = left + width;
+ }
+
+ topx = top - 3 * height;
+ bottomx = topx + 2 * height;
+ leftx = (left + right - widthx) / 2;
+ if (leftx < SCREEN_LEFT)
+ leftx = SCREEN_LEFT;
+ rightx = leftx + widthx;
+
+ /* save what is under these areas, so they can be restored */
+ R_panel_save(tempfile1, top, bottom+1, left, right+1);
+ R_panel_save(tempfile2, topx, bottomx+1, leftx, rightx+1);
+
+ /* fill it top with GREY, pick area with white */
+ R_standard_color(WHITE);
+ R_box_abs(left, top, right, bottom);
+ R_standard_color(GREY);
+ R_box_abs(leftx, topx, rightx, bottomx);
+
+ R_standard_color(BLACK);
+ Outline_box(top, bottom, left, right);
+ right -= height; /* reduce it to exclude sidecar */
+ Outline_box(top, bottom, left, right);
+
+ /* print messages above the files */
+ dotext(msg, topx, topx + height, leftx, rightx, 1);
+ dotext("Double click here to cancel", topx + height, bottomx, leftx,
+ rightx, 1);
+ cancel.top = topx;
+ cancel.bottom = bottomx;
+ cancel.left = leftx;
+ cancel.right = rightx;
+
+ /* start the mouse in the cancel box */
+ Set_mouse_xy((leftx + rightx) / 2, (topx + bottomx) / 2);
+
+ dobox(&less, "", WHITE, top, right, right + height, 0);
+ dobox(&more, "", WHITE, bottom - height, right, right + height, 0);
+
+ /* as we read the file of names, keep track of pages so we can
+ * page backward
+ */
+ page = 0;
+ page_offset = (long *)G_calloc(npages = 1, sizeof(long));
+ *page_offset = ftell(fd);
+
+ nlist = sizeof(list) / sizeof(list[0]);
+ for (stat = -1; stat < 0;) {
+ line = 0;
+ count = 0;
+ *cur_mapset = 0;
+ col = 0;
+ while (1) {
+ offset = ftell(fd);
+ if (fgets(buf, sizeof buf, fd) == NULL
+ || sscanf(buf, "%s %s", name, mapset) != 2)
+ break;
+ if ((new_mapset = (strcmp(cur_mapset, mapset)) != 0)) {
+ if (line)
+ line++;
+ if (col)
+ line++;
+ col = 0;
+ }
+ if (count >= nlist || line + new_mapset >= NLINES) {
+ if (page + 1 == npages) {
+ npages++;
+ page_offset =
+ (long *)G_realloc(page_offset, npages * sizeof(long));
+ page_offset[npages - 1] = offset;
+ }
+ break;
+ }
+ if (new_mapset) {
+ struct box dummy;
+ char label[100];
+
+ strcpy(cur_mapset, mapset);
+ sprintf(label, "Mapset %s", mapset);
+ dobox(&dummy, label, WHITE, top + line * height, left, right,
+ 0);
+ line++;
+ }
+ if (col) {
+ dobox(&list[count].box, name, GREY, top + line * height,
+ left + width / 2, right, 0);
+ line++;
+ col = 0;
+ }
+ else {
+ dobox(&list[count].box, name, GREY, top + line * height, left,
+ left + width / 2, 0);
+ col = 1;
+ }
+ strcpy(list[count].name, name);
+ strcpy(list[count].mapset, mapset);
+ count++;
+ }
+ downarrow(&more, page + 1 < npages ? BLACK : WHITE);
+ uparrow(&less, page > 0 ? BLACK : WHITE);
+ which = -1;
+ switch (Input_pointer(objects)) {
+ case -1: /* more or less */
+ break;
+ case -2: /* cancel */
+ stat = 0;
+ continue;
+ default: /* file picked */
+ strcpy(xname, list[which].name);
+ strcpy(xmapset, list[which].mapset);
+ stat = 1;
+ continue;
+ }
+ fseek(fd, page_offset[page], 0);
+ R_standard_color(WHITE);
+ R_box_abs(left + 1, top + 1, right - 1, bottom - 1);
+ }
+
+ /* all done. restore what was under the window */
+ right += height; /* move it back over the sidecar */
+ R_standard_color(WHITE);
+ R_box_abs(left, top, right, bottom);
+ R_panel_restore(tempfile1);
+ R_panel_restore(tempfile2);
+ R_panel_delete(tempfile1);
+ R_panel_delete(tempfile2);
+ R_flush();
+
+ G_free(page_offset);
+ return stat;
+}
+
+static int dobox(struct box *box, char *text, int color, int top, int left,
+ int right, int centered)
+{
+ int bottom;
+
+ bottom = top + height;
+ /* fill inside of box with color */
+ R_standard_color(color);
+ R_box_abs(left + 1, top + 1, right - 1, bottom - 1);
+
+ /* draw box outline and text in black */
+ R_standard_color(BLACK);
+ Outline_box(top, bottom, left, right);
+ dotext(text, top, bottom, left, right, centered);
+ R_flush();
+
+ box->top = top;
+ box->bottom = bottom;
+ box->left = left;
+ box->right = right;
+
+ return 0;
+}
+
+static int uparrow(struct box *box, int color)
+{
+ R_standard_color(color);
+ Uparrow(box->top + edge, box->bottom - edge, box->left + edge,
+ box->right - edge);
+
+ return 0;
+}
+
+static int downarrow(struct box *box, int color)
+{
+ R_standard_color(color);
+ Downarrow(box->top + edge, box->bottom - edge, box->left + edge,
+ box->right - edge);
+ return 0;
+}
+
+static int pick(int x, int y)
+{
+ int n;
+
+ if (inbox(&more, x, y)) {
+ cancel_which();
+ if (page + 1 >= npages)
+ return 0;
+ page++;
+ return -1;
+ }
+ if (inbox(&less, x, y)) {
+ cancel_which();
+ if (page == 0)
+ return 0;
+ page--;
+ return -1;
+ }
+ if (inbox(&cancel, x, y)) {
+ if (which == -2)
+ return -2;
+ cancel_which();
+ which = -2;
+ R_standard_color(RED);
+ Outline_box(cancel.top, cancel.bottom, cancel.left, cancel.right);
+ R_flush();
+ return 0;
+ }
+ /* search name list. handle double click */
+ for (n = 0; n < count; n++)
+ if (inbox(&list[n].box, x, y)) {
+ if (n == which) /* second click! */
+ return 1;
+ cancel_which();
+ which = n;
+ R_standard_color(RED);
+ Outline_box(list[n].box.top, list[n].box.bottom,
+ list[n].box.left, list[n].box.right);
+ R_flush();
+ return 0; /* ignore first click */
+ }
+
+ cancel_which();
+ return 0;
+}
+
+static int cancel_which(void)
+{
+ if (which == -2) {
+ R_standard_color(BLACK);
+ Outline_box(cancel.top, cancel.bottom, cancel.left, cancel.right);
+ }
+ else if (which >= 0) {
+ R_standard_color(BLACK);
+ Outline_box(list[which].box.top, list[which].box.bottom,
+ list[which].box.left, list[which].box.right);
+ }
+ which = -1;
+
+ return 0;
+}
+
+static int inbox(struct box *box, int x, int y)
+{
+ return (x > box->left && x < box->right && y > box->top &&
+ y < box->bottom);
+}
+
+static int dotext(char *text, int top, int bottom, int left, int right,
+ int centered)
+{
+ R_text_size(text_size, text_size);
+ R_move_abs(left + 1 + edge, bottom - 1 - edge);
+ if (centered)
+ R_move_rel((right - left - strlen(text) * size) / 2, 0);
+ R_set_window(top, bottom, left, right); /* for text clipping */
+ R_text(text);
+ R_set_window(SCREEN_TOP, SCREEN_BOTTOM, SCREEN_LEFT, SCREEN_RIGHT);
+
+ return 0;
+}
Deleted: grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2target/ask_mag.c
===================================================================
--- grass/branches/develbranch_6/imagery/i.ortho.photo/i.photo.2target/ask_mag.c 2010-12-01 09:34:37 UTC (rev 44501)
+++ grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2target/ask_mag.c 2010-12-22 10:05:10 UTC (rev 44654)
@@ -1,164 +0,0 @@
-/* ask_mag.c */
-#include <grass/raster.h>
-#include "globals.h"
-#include "local_proto.h"
-
-struct box
-{
- int top, bottom, left, right;
-};
-
-static struct box plus, minus, value;
-static struct box cancel, accept;
-static int mag;
-static int incr(int, int);
-static int dotext(char *, int, int, int, int, int);
-static int inbox(struct box *, int, int);
-
-int ask_magnification(int *magnification)
-{
- static int use = 1;
- int x, y;
- int height;
- int stat;
- int width;
- int top, bottom, left, right;
-
- static Objects objects[] = {
- OTHER(incr, &use),
- {0}
- };
-
- Menu_msg("");
-
- mag = *magnification;
- if (mag < 1)
- mag = 1;
-
- height = VIEW_MENU->nrows;
- R_text_size(height - 4, height - 4);
-
-
- Get_mouse_xy(&x, &y);
- top = y - height / 2;
- if (top < SCREEN_TOP)
- top = SCREEN_TOP;
- bottom = top + 4 * height;
- if (bottom >= VIEW_MENU->top) {
- top -= bottom - (VIEW_MENU->top - 1);
- bottom = VIEW_MENU->top - 1;
- }
- width = Text_width("MAGNIFICATION") + 4;
- left = x - width / 2;
- if (left < SCREEN_LEFT)
- left = SCREEN_LEFT;
- right = left + width;
- if (right > SCREEN_RIGHT) {
- left -= right - SCREEN_RIGHT;
- right = SCREEN_RIGHT;
- }
-
- R_panel_save(tempfile1, top, bottom, left, right);
- R_standard_color(WHITE);
- R_box_abs(left, top, right, bottom);
- R_standard_color(BLACK);
- Outline_box(top, bottom, left, right);
-
- plus.top = top + height;
- plus.bottom = plus.top + height;
- plus.left = left;
- plus.right = plus.left + Text_width("++") + 4;
- Outline_box(plus.top, plus.bottom, plus.left, plus.right);
-
- minus.top = top + height;
- minus.bottom = minus.top + height;
- minus.right = right;
- minus.left = minus.right - Text_width("--") - 4;
- Outline_box(minus.top, minus.bottom, minus.left, minus.right);
-
- value.top = top + height;
- value.bottom = value.top + height;
- value.left = plus.right;
- value.right = minus.left;
- Outline_box(value.top, value.bottom, value.left, value.right);
-
- accept.top = value.bottom;
- accept.bottom = accept.top + height;
- accept.left = left;
- accept.right = right;
- Outline_box(accept.top, accept.bottom, accept.left, accept.right);
-
- cancel.top = accept.bottom;
- cancel.bottom = cancel.top + height;
- cancel.left = left;
- cancel.right = right;
- Outline_box(cancel.top, cancel.bottom, cancel.left, cancel.right);
-
- dotext("MAGNIFICATION", top, top + height, left, right, WHITE);
- dotext("+", plus.top, plus.bottom, plus.left, plus.right, GREY);
- dotext("-", minus.top, minus.bottom, minus.left, minus.right, GREY);
- dotext("ACCEPT", accept.top, accept.bottom, accept.left, accept.right,
- GREY);
- dotext("CANCEL", cancel.top, cancel.bottom, cancel.left, cancel.right,
- GREY);
- draw_mag();
-
- stat = Input_pointer(objects);
-
- /* to respond to user */
- R_standard_color(WHITE);
- R_box_abs(left, top, right, bottom);
- R_flush();
-
- R_panel_restore(tempfile1);
- R_panel_delete(tempfile1);
-
- *magnification = mag;
- return stat > 0;
-}
-
-int draw_mag(void)
-{
- char buf[10];
-
- sprintf(buf, "%d", mag);
- dotext(buf, value.top, value.bottom, value.left, value.right, WHITE);
-
- return 0;
-}
-
-static int incr(int x, int y)
-{
- if (inbox(&accept, x, y))
- return 1;
- if (inbox(&cancel, x, y))
- return -1;
- if (inbox(&plus, x, y)) {
- mag++;
- draw_mag();
- }
- else if (inbox(&minus, x, y) && mag > 1) {
- mag--;
- draw_mag();
- }
- return 0;
-}
-
-static int dotext(char *text, int top, int bottom, int left, int right,
- int background)
-{
- R_standard_color(background);
- R_box_abs(left + 1, top + 1, right - 1, bottom - 1);
- R_standard_color(BLACK);
- /* center the text */
- left = (left + right - Text_width(text)) / 2;
- Text(text, top, bottom, left, right, 2);
-
- return 0;
-}
-
-static int inbox(struct box *box, int x, int y)
-{
- return (x > box->left && x < box->right && y > box->top &&
- y < box->bottom);
-}
Copied: grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2target/ask_mag.c (from rev 44501, grass/branches/develbranch_6/imagery/i.ortho.photo/i.photo.2target/ask_mag.c)
===================================================================
--- grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2target/ask_mag.c (rev 0)
+++ grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2target/ask_mag.c 2010-12-22 10:05:10 UTC (rev 44654)
@@ -0,0 +1,164 @@
+/* ask_mag.c */
+#include <grass/raster.h>
+#include "globals.h"
+#include "local_proto.h"
+
+struct box
+{
+ int top, bottom, left, right;
+};
+
+static struct box plus, minus, value;
+static struct box cancel, accept;
+static int mag;
+static int incr(int, int);
+static int dotext(char *, int, int, int, int, int);
+static int inbox(struct box *, int, int);
+
+int ask_magnification(int *magnification)
+{
+ static int use = 1;
+ int x, y;
+ int height;
+ int stat;
+ int width;
+ int top, bottom, left, right;
+
+ static Objects objects[] = {
+ OTHER(incr, &use),
+ {0}
+ };
+
+ Menu_msg("");
+
+ mag = *magnification;
+ if (mag < 1)
+ mag = 1;
+
+ height = VIEW_MENU->nrows;
+ R_text_size(height - 4, height - 4);
+
+
+ Get_mouse_xy(&x, &y);
+ top = y - height / 2;
+ if (top < SCREEN_TOP)
+ top = SCREEN_TOP;
+ bottom = top + 4 * height;
+ if (bottom >= VIEW_MENU->top) {
+ top -= bottom - (VIEW_MENU->top - 1);
+ bottom = VIEW_MENU->top - 1;
+ }
+ width = Text_width("MAGNIFICATION") + 4;
+ left = x - width / 2;
+ if (left < SCREEN_LEFT)
+ left = SCREEN_LEFT;
+ right = left + width;
+ if (right > SCREEN_RIGHT) {
+ left -= right - SCREEN_RIGHT;
+ right = SCREEN_RIGHT;
+ }
+
+ R_panel_save(tempfile1, top, bottom, left, right);
+ R_standard_color(WHITE);
+ R_box_abs(left, top, right, bottom);
+ R_standard_color(BLACK);
+ Outline_box(top, bottom, left, right);
+
+ plus.top = top + height;
+ plus.bottom = plus.top + height;
+ plus.left = left;
+ plus.right = plus.left + Text_width("++") + 4;
+ Outline_box(plus.top, plus.bottom, plus.left, plus.right);
+
+ minus.top = top + height;
+ minus.bottom = minus.top + height;
+ minus.right = right;
+ minus.left = minus.right - Text_width("--") - 4;
+ Outline_box(minus.top, minus.bottom, minus.left, minus.right);
+
+ value.top = top + height;
+ value.bottom = value.top + height;
+ value.left = plus.right;
+ value.right = minus.left;
+ Outline_box(value.top, value.bottom, value.left, value.right);
+
+ accept.top = value.bottom;
+ accept.bottom = accept.top + height;
+ accept.left = left;
+ accept.right = right;
+ Outline_box(accept.top, accept.bottom, accept.left, accept.right);
+
+ cancel.top = accept.bottom;
+ cancel.bottom = cancel.top + height;
+ cancel.left = left;
+ cancel.right = right;
+ Outline_box(cancel.top, cancel.bottom, cancel.left, cancel.right);
+
+ dotext("MAGNIFICATION", top, top + height, left, right, WHITE);
+ dotext("+", plus.top, plus.bottom, plus.left, plus.right, GREY);
+ dotext("-", minus.top, minus.bottom, minus.left, minus.right, GREY);
+ dotext("ACCEPT", accept.top, accept.bottom, accept.left, accept.right,
+ GREY);
+ dotext("CANCEL", cancel.top, cancel.bottom, cancel.left, cancel.right,
+ GREY);
+ draw_mag();
+
+ stat = Input_pointer(objects);
+
+ /* to respond to user */
+ R_standard_color(WHITE);
+ R_box_abs(left, top, right, bottom);
+ R_flush();
+
+ R_panel_restore(tempfile1);
+ R_panel_delete(tempfile1);
+
+ *magnification = mag;
+ return stat > 0;
+}
+
+int draw_mag(void)
+{
+ char buf[10];
+
+ sprintf(buf, "%d", mag);
+ dotext(buf, value.top, value.bottom, value.left, value.right, WHITE);
+
+ return 0;
+}
+
+static int incr(int x, int y)
+{
+ if (inbox(&accept, x, y))
+ return 1;
+ if (inbox(&cancel, x, y))
+ return -1;
+ if (inbox(&plus, x, y)) {
+ mag++;
+ draw_mag();
+ }
+ else if (inbox(&minus, x, y) && mag > 1) {
+ mag--;
+ draw_mag();
+ }
+ return 0;
+}
+
+static int dotext(char *text, int top, int bottom, int left, int right,
+ int background)
+{
+ R_standard_color(background);
+ R_box_abs(left + 1, top + 1, right - 1, bottom - 1);
+ R_standard_color(BLACK);
+ /* center the text */
+ left = (left + right - Text_width(text)) / 2;
+ Text(text, top, bottom, left, right, 2);
+
+ return 0;
+}
+
+static int inbox(struct box *box, int x, int y)
+{
+ return (x > box->left && x < box->right && y > box->top &&
+ y < box->bottom);
+}
Deleted: grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2target/call.c
===================================================================
--- grass/branches/develbranch_6/imagery/i.ortho.photo/i.photo.2target/call.c 2010-12-01 09:34:37 UTC (rev 44501)
+++ grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2target/call.c 2010-12-22 10:05:10 UTC (rev 44654)
@@ -1,58 +0,0 @@
-#include <stdlib.h>
-#include <unistd.h>
-#include <sys/types.h>
-#ifdef __MINGW32__
-#include <process.h>
-#else
-#include <sys/wait.h>
-#endif
-#include <grass/raster.h>
-#include "globals.h"
-#include "local_proto.h"
-
-/*
- * call a subroutine, but as a child process
- * allowing interrupts for the child
- */
-#include <signal.h>
-
-int call(int (*function) (void), char *msg)
-{
- int pid;
- int w, status;
- char i_msg[80];
-
- /*
- * build interrupt msg
- */
- sprintf(i_msg, "Hit %s %s\n", G_unctrl(interrupt_char), msg);
- /*
- * make sure all graphics have gotten to the monitor
- */
- R_stabilize();
-
- /* fork to create child */
- pid = fork();
- if (pid < 0) {
- End_curses();
- perror("Can't fork");
- exit(1);
- }
-
- /* parent just waits for child */
- Curses_allow_interrupts(1);
- if (pid) {
- Curses_write_window(PROMPT_WINDOW, 1, 1, i_msg);
- while ((w = wait(&status)) != pid && w != -1) ;
- Curses_allow_interrupts(0);
- Curses_write_window(PROMPT_WINDOW, 1, 1, "\n");
- }
-
- /* child turns on interrupts and calls the function */
- else {
- signal(SIGINT, SIG_DFL);
- (*function) ();
- exit(0);
- }
- return 0;
-}
Copied: grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2target/call.c (from rev 44501, grass/branches/develbranch_6/imagery/i.ortho.photo/i.photo.2target/call.c)
===================================================================
--- grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2target/call.c (rev 0)
+++ grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2target/call.c 2010-12-22 10:05:10 UTC (rev 44654)
@@ -0,0 +1,58 @@
+#include <stdlib.h>
+#include <unistd.h>
+#include <sys/types.h>
+#ifdef __MINGW32__
+#include <process.h>
+#else
+#include <sys/wait.h>
+#endif
+#include <grass/raster.h>
+#include "globals.h"
+#include "local_proto.h"
+
+/*
+ * call a subroutine, but as a child process
+ * allowing interrupts for the child
+ */
+#include <signal.h>
+
+int call(int (*function) (void), char *msg)
+{
+ int pid;
+ int w, status;
+ char i_msg[80];
+
+ /*
+ * build interrupt msg
+ */
+ sprintf(i_msg, "Hit %s %s\n", G_unctrl(interrupt_char), msg);
+ /*
+ * make sure all graphics have gotten to the monitor
+ */
+ R_stabilize();
+
+ /* fork to create child */
+ pid = fork();
+ if (pid < 0) {
+ End_curses();
+ perror("Can't fork");
+ exit(1);
+ }
+
+ /* parent just waits for child */
+ Curses_allow_interrupts(1);
+ if (pid) {
+ Curses_write_window(PROMPT_WINDOW, 1, 1, i_msg);
+ while ((w = wait(&status)) != pid && w != -1) ;
+ Curses_allow_interrupts(0);
+ Curses_write_window(PROMPT_WINDOW, 1, 1, "\n");
+ }
+
+ /* child turns on interrupts and calls the function */
+ else {
+ signal(SIGINT, SIG_DFL);
+ (*function) ();
+ exit(0);
+ }
+ return 0;
+}
Deleted: grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2target/cell.c
===================================================================
--- grass/branches/develbranch_6/imagery/i.ortho.photo/i.photo.2target/cell.c 2010-12-01 09:34:37 UTC (rev 44501)
+++ grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2target/cell.c 2010-12-22 10:05:10 UTC (rev 44654)
@@ -1,103 +0,0 @@
-#include <unistd.h>
-#include "globals.h"
-#include "local_proto.h"
-
-static int use = 1;
-static int cancel(void);
-static int plot(int, int);
-static int choose_cellfile(char *, char *);
-
-int plotcell(int x, int y)
-{
- static Objects objects[] = {
- MENU("CANCEL", cancel, &use),
- INFO("Indicate which side should be plotted", &use),
- OTHER(plot, &use),
- {0}
- };
- /*
- * if the target raster map list is ready, ask the user which side
- * should be plotted, otherwise can only plot group files
- */
- if (access(cell_list, 0) == 0)
- Input_pointer(objects);
- else
- plot(VIEW_MAP1->left + 1, 0);
- return 0;
-}
-
-static int cancel(void)
-{
- return 1;
-}
-
-
-static int plot(int x, int y)
-{
- char name[40], mapset[40];
- struct Cell_head cellhd;
-
- if (x > VIEW_MAP1->left && x < VIEW_MAP1->right) {
- /* must close and reopen elev layer buffer */
- /* G_close_cell (elev); */
-
- select_current_env();
- if (!choose_groupfile(name, mapset))
- return 1;
- if (G_get_cellhd(name, mapset, &cellhd) < 0)
- return 1;
-
- Erase_view(VIEW_MAP1_ZOOM);
- Erase_view(VIEW_TITLE1_ZOOM);
- VIEW_MAP1_ZOOM->cell.configured = 0;
-
- G_adjust_window_to_box(&cellhd, &VIEW_MAP1->cell.head,
- VIEW_MAP1->nrows, VIEW_MAP1->ncols);
- Configure_view(VIEW_MAP1, name, mapset, cellhd.ns_res, cellhd.ew_res);
- drawcell(VIEW_MAP1);
-
- }
- else if (x > VIEW_MAP2->left && x < VIEW_MAP2->right) {
- /* must close and reopen elev layer buffer */
- /* G_close_cell (elev); */
-
- select_target_env();
- if (!choose_cellfile(name, mapset))
- return 1;
-
- if (G_get_cellhd(name, mapset, &cellhd) < 0) {
- select_current_env();
- return 1;
- }
-
- Erase_view(VIEW_MAP2_ZOOM);
- Erase_view(VIEW_TITLE2_ZOOM);
- VIEW_MAP2_ZOOM->cell.configured = 0;
-
- G_adjust_window_to_box(&cellhd, &VIEW_MAP2->cell.head,
- VIEW_MAP2->nrows, VIEW_MAP2->ncols);
- Configure_view(VIEW_MAP2, name, mapset, cellhd.ns_res, cellhd.ew_res);
- select_target_env();
- drawcell(VIEW_MAP2);
-
- select_current_env();
- if (from_screen < 0) {
- from_flag = 1;
- from_screen = 0;
- if (from_keyboard < 0) {
- from_keyboard = 0;
- from_screen = 1;
- }
- }
- }
- else
- return 0; /* ignore mouse click */
-
- display_conz_points(1);
- return 1;
-}
-
-static int choose_cellfile(char *name, char *mapset)
-{
- return ask_gis_files("cell", cell_list, name, mapset, 1);
-}
Copied: grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2target/cell.c (from rev 44501, grass/branches/develbranch_6/imagery/i.ortho.photo/i.photo.2target/cell.c)
===================================================================
--- grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2target/cell.c (rev 0)
+++ grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2target/cell.c 2010-12-22 10:05:10 UTC (rev 44654)
@@ -0,0 +1,103 @@
+#include <unistd.h>
+#include "globals.h"
+#include "local_proto.h"
+
+static int use = 1;
+static int cancel(void);
+static int plot(int, int);
+static int choose_cellfile(char *, char *);
+
+int plotcell(int x, int y)
+{
+ static Objects objects[] = {
+ MENU("CANCEL", cancel, &use),
+ INFO("Indicate which side should be plotted", &use),
+ OTHER(plot, &use),
+ {0}
+ };
+ /*
+ * if the target raster map list is ready, ask the user which side
+ * should be plotted, otherwise can only plot group files
+ */
+ if (access(cell_list, 0) == 0)
+ Input_pointer(objects);
+ else
+ plot(VIEW_MAP1->left + 1, 0);
+ return 0;
+}
+
+static int cancel(void)
+{
+ return 1;
+}
+
+
+static int plot(int x, int y)
+{
+ char name[40], mapset[40];
+ struct Cell_head cellhd;
+
+ if (x > VIEW_MAP1->left && x < VIEW_MAP1->right) {
+ /* must close and reopen elev layer buffer */
+ /* G_close_cell (elev); */
+
+ select_current_env();
+ if (!choose_groupfile(name, mapset))
+ return 1;
+ if (G_get_cellhd(name, mapset, &cellhd) < 0)
+ return 1;
+
+ Erase_view(VIEW_MAP1_ZOOM);
+ Erase_view(VIEW_TITLE1_ZOOM);
+ VIEW_MAP1_ZOOM->cell.configured = 0;
+
+ G_adjust_window_to_box(&cellhd, &VIEW_MAP1->cell.head,
+ VIEW_MAP1->nrows, VIEW_MAP1->ncols);
+ Configure_view(VIEW_MAP1, name, mapset, cellhd.ns_res, cellhd.ew_res);
+ drawcell(VIEW_MAP1);
+
+ }
+ else if (x > VIEW_MAP2->left && x < VIEW_MAP2->right) {
+ /* must close and reopen elev layer buffer */
+ /* G_close_cell (elev); */
+
+ select_target_env();
+ if (!choose_cellfile(name, mapset))
+ return 1;
+
+ if (G_get_cellhd(name, mapset, &cellhd) < 0) {
+ select_current_env();
+ return 1;
+ }
+
+ Erase_view(VIEW_MAP2_ZOOM);
+ Erase_view(VIEW_TITLE2_ZOOM);
+ VIEW_MAP2_ZOOM->cell.configured = 0;
+
+ G_adjust_window_to_box(&cellhd, &VIEW_MAP2->cell.head,
+ VIEW_MAP2->nrows, VIEW_MAP2->ncols);
+ Configure_view(VIEW_MAP2, name, mapset, cellhd.ns_res, cellhd.ew_res);
+ select_target_env();
+ drawcell(VIEW_MAP2);
+
+ select_current_env();
+ if (from_screen < 0) {
+ from_flag = 1;
+ from_screen = 0;
+ if (from_keyboard < 0) {
+ from_keyboard = 0;
+ from_screen = 1;
+ }
+ }
+ }
+ else
+ return 0; /* ignore mouse click */
+
+ display_conz_points(1);
+ return 1;
+}
+
+static int choose_cellfile(char *name, char *mapset)
+{
+ return ask_gis_files("cell", cell_list, name, mapset, 1);
+}
Deleted: grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2target/cellhd.c
===================================================================
--- grass/branches/develbranch_6/imagery/i.ortho.photo/i.photo.2target/cellhd.c 2010-12-01 09:34:37 UTC (rev 44501)
+++ grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2target/cellhd.c 2010-12-22 10:05:10 UTC (rev 44654)
@@ -1,45 +0,0 @@
-#include <grass/raster.h>
-#include "globals.h"
-#include "local_proto.h"
-
-int Outline_cellhd(View * view, struct Cell_head *cellhd)
-{
- int row, col;
- int top, bottom, left, right;
-
- row = northing_to_row(&view->cell.head, cellhd->north) + .5;
- top = row_to_view(view, row);
-
- col = easting_to_col(&view->cell.head, cellhd->west) + .5;
- left = col_to_view(view, col);
-
- row = northing_to_row(&view->cell.head, cellhd->south) + .5;
- bottom = row_to_view(view, row);
-
- col = easting_to_col(&view->cell.head, cellhd->east) + .5;
- right = col_to_view(view, col);
-
- Outline_box(top, bottom, left, right);
-
- return 0;
-}
-
-void Save_cellhd(View * view, struct Cell_head *cellhd, char *file)
-{
- int row, col;
- int top, bottom, left, right;
-
- row = northing_to_row(&view->cell.head, cellhd->north) + .5;
- top = view->cell.top + row - 5;
-
- col = easting_to_col(&view->cell.head, cellhd->west) + .5;
- left = view->cell.left + col - 5;
-
- row = northing_to_row(&view->cell.head, cellhd->south) + .5;
- bottom = view->cell.top + row + 5;
-
- col = easting_to_col(&view->cell.head, cellhd->east) + .5;
- right = view->cell.left + col + 5;
-
- R_panel_save(file, top, bottom, left, right);
-}
Copied: grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2target/cellhd.c (from rev 44501, grass/branches/develbranch_6/imagery/i.ortho.photo/i.photo.2target/cellhd.c)
===================================================================
--- grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2target/cellhd.c (rev 0)
+++ grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2target/cellhd.c 2010-12-22 10:05:10 UTC (rev 44654)
@@ -0,0 +1,45 @@
+#include <grass/raster.h>
+#include "globals.h"
+#include "local_proto.h"
+
+int Outline_cellhd(View * view, struct Cell_head *cellhd)
+{
+ int row, col;
+ int top, bottom, left, right;
+
+ row = northing_to_row(&view->cell.head, cellhd->north) + .5;
+ top = row_to_view(view, row);
+
+ col = easting_to_col(&view->cell.head, cellhd->west) + .5;
+ left = col_to_view(view, col);
+
+ row = northing_to_row(&view->cell.head, cellhd->south) + .5;
+ bottom = row_to_view(view, row);
+
+ col = easting_to_col(&view->cell.head, cellhd->east) + .5;
+ right = col_to_view(view, col);
+
+ Outline_box(top, bottom, left, right);
+
+ return 0;
+}
+
+void Save_cellhd(View * view, struct Cell_head *cellhd, char *file)
+{
+ int row, col;
+ int top, bottom, left, right;
+
+ row = northing_to_row(&view->cell.head, cellhd->north) + .5;
+ top = view->cell.top + row - 5;
+
+ col = easting_to_col(&view->cell.head, cellhd->west) + .5;
+ left = view->cell.left + col - 5;
+
+ row = northing_to_row(&view->cell.head, cellhd->south) + .5;
+ bottom = view->cell.top + row + 5;
+
+ col = easting_to_col(&view->cell.head, cellhd->east) + .5;
+ right = view->cell.left + col + 5;
+
+ R_panel_save(file, top, bottom, left, right);
+}
Deleted: grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2target/colors.c
===================================================================
--- grass/branches/develbranch_6/imagery/i.ortho.photo/i.photo.2target/colors.c 2010-12-01 09:34:37 UTC (rev 44501)
+++ grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2target/colors.c 2010-12-22 10:05:10 UTC (rev 44654)
@@ -1,7 +0,0 @@
-#include <grass/gis.h>
-#include <grass/display.h>
-
-int set_colors(struct Colors *colors)
-{
- return 0;
-}
Copied: grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2target/colors.c (from rev 44501, grass/branches/develbranch_6/imagery/i.ortho.photo/i.photo.2target/colors.c)
===================================================================
--- grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2target/colors.c (rev 0)
+++ grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2target/colors.c 2010-12-22 10:05:10 UTC (rev 44654)
@@ -0,0 +1,7 @@
+#include <grass/gis.h>
+#include <grass/display.h>
+
+int set_colors(struct Colors *colors)
+{
+ return 0;
+}
Deleted: grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2target/conv.c
===================================================================
--- grass/branches/develbranch_6/imagery/i.ortho.photo/i.photo.2target/conv.c 2010-12-01 09:34:37 UTC (rev 44501)
+++ grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2target/conv.c 2010-12-22 10:05:10 UTC (rev 44654)
@@ -1,49 +0,0 @@
-#include "globals.h"
-/* conversion routines to convert from view x,y to cell col,row
- * as well as cell col,row to cell east,north
- */
-int view_to_col(View * view, int x)
-{
- return x - view->cell.left;
-}
-
-int view_to_row(View * view, int y)
-{
- return y - view->cell.top;
-}
-
-int col_to_view(View * view, int col)
-{
- return view->cell.left + col;
-}
-
-int row_to_view(View * view, int row)
-{
- return view->cell.top + row;
-}
-
-/* in these next 2 routines, location determines if we are
- * converting from center of the cell (location == .5)
- * top or left edge (location == 0.0)
- * bottom or right edge (location == 1.0)
- */
-
-double row_to_northing(struct Cell_head *cellhd, int row, double location)
-{
- return cellhd->north - (row + location) * cellhd->ns_res;
-}
-
-double col_to_easting(struct Cell_head *cellhd, int col, double location)
-{
- return cellhd->west + (col + location) * cellhd->ew_res;
-}
-
-double northing_to_row(struct Cell_head *cellhd, double north)
-{
- return (cellhd->north - north) / cellhd->ns_res;
-}
-
-double easting_to_col(struct Cell_head *cellhd, double east)
-{
- return (east - cellhd->west) / cellhd->ew_res;
-}
Copied: grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2target/conv.c (from rev 44501, grass/branches/develbranch_6/imagery/i.ortho.photo/i.photo.2target/conv.c)
===================================================================
--- grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2target/conv.c (rev 0)
+++ grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2target/conv.c 2010-12-22 10:05:10 UTC (rev 44654)
@@ -0,0 +1,49 @@
+#include "globals.h"
+/* conversion routines to convert from view x,y to cell col,row
+ * as well as cell col,row to cell east,north
+ */
+int view_to_col(View * view, int x)
+{
+ return x - view->cell.left;
+}
+
+int view_to_row(View * view, int y)
+{
+ return y - view->cell.top;
+}
+
+int col_to_view(View * view, int col)
+{
+ return view->cell.left + col;
+}
+
+int row_to_view(View * view, int row)
+{
+ return view->cell.top + row;
+}
+
+/* in these next 2 routines, location determines if we are
+ * converting from center of the cell (location == .5)
+ * top or left edge (location == 0.0)
+ * bottom or right edge (location == 1.0)
+ */
+
+double row_to_northing(struct Cell_head *cellhd, int row, double location)
+{
+ return cellhd->north - (row + location) * cellhd->ns_res;
+}
+
+double col_to_easting(struct Cell_head *cellhd, int col, double location)
+{
+ return cellhd->west + (col + location) * cellhd->ew_res;
+}
+
+double northing_to_row(struct Cell_head *cellhd, double north)
+{
+ return (cellhd->north - north) / cellhd->ns_res;
+}
+
+double easting_to_col(struct Cell_head *cellhd, double east)
+{
+ return (east - cellhd->west) / cellhd->ew_res;
+}
Deleted: grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2target/curses.c
===================================================================
--- grass/branches/develbranch_6/imagery/i.ortho.photo/i.photo.2target/curses.c 2010-12-01 09:34:37 UTC (rev 44501)
+++ grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2target/curses.c 2010-12-22 10:05:10 UTC (rev 44654)
@@ -1,261 +0,0 @@
-#include <curses.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <grass/gis.h>
-#include <grass/glocale.h>
-#include "globals.h"
-#include "local_proto.h"
-
-static int inited = 0;
-
-static WINDOW *save;
-WINDOW *newwin();
-
-
-static Window *make_window(int top, int bottom, int left, int right)
-{
- Window *window;
-
- if (top < 0 || bottom >= LINES || left < 0 || right >= COLS
- || bottom - top <= 1 || right - left <= 1) {
- End_curses();
- G_warning(_("make_window(%d,%d,%d,%d): illegal screen values."),
- top, bottom, left, right);
- G_sleep(3);
- exit(1);
- }
- window = (Window *) G_malloc(sizeof(Window));
- window->top = top;
- window->bottom = bottom;
- window->left = left;
- window->right = right;
- Curses_clear_window(window);
- return window;
-}
-
-int Begin_curses(void)
-{
- /* should only be called once at program outset */
-
- initscr(); /* initialize curses standard screens */
- raw(); /* set tty modes via curses calls */
- noecho();
- nonl();
-
- inited = 1;
-
- /* make a window to save stdscr */
- save = newwin(LINES, COLS, 0, 0);
-
- /* make_window (nrows, ncols, start_row, start_col) */
- INFO_WINDOW = make_window(0, LINES - 4, COLS / 2, COLS - 1);
- MENU_WINDOW = make_window(0, LINES - 4, 0, COLS / 2);
- PROMPT_WINDOW = make_window(LINES - 4, LINES - 1, 0, COLS - 1);
- refresh();
-
- return 0;
-}
-
-int End_curses(void)
-{
- /* should only be called upon program exit */
-
- clear(); /* clear the screen */
- refresh();
- endwin(); /* let curses reset the tty now */
- return 0;
-}
-
-int Suspend_curses(void)
-{
- overwrite(stdscr, save);
- clear();
- refresh();
- endwin();
-
- return 0;
-}
-
-int Resume_curses(void)
-{
- clear();
- refresh();
- overwrite(save, stdscr);
- refresh();
- return 0;
-}
-
-int Curses_allow_interrupts(int ok)
-{
- refresh();
- if (ok)
- noraw();
- else
- raw();
- return 0;
-}
-
-int Curses_clear_window(Window * window)
-{
- int y, x;
-
- if (!inited)
- return 1;
- for (y = window->top + 1; y < window->bottom; y++) {
- move(y, x = window->left + 1);
- while (x++ < window->right)
- addch(' ');
- }
- Curses_outline_window(window);
- refresh();
- return 0;
-}
-
-int Curses_outline_window(Window * window)
-{
- int x, y;
-
- move(window->top, x = window->left + 1);
- while (x++ < window->right)
- addch('-');
- move(window->bottom, x = window->left + 1);
- while (x++ < window->right)
- addch('-');
- for (y = window->top + 1; y < window->bottom; y++) {
- move(y, window->left);
- addch('|');
- move(y, window->right);
- addch('|');
- }
- move(window->top, window->left);
- addch('+');
- move(window->top, window->right);
- addch('+');
- move(window->bottom, window->left);
- addch('+');
- if (window->bottom < LINES - 1 || window->right < COLS - 1) {
- move(window->bottom, window->right);
- addch('+');
- }
- return 0;
-}
-
-int Curses_write_window(Window * window, int line, int col, char *message)
-{
- int y, x, i;
-
- if (!inited) {
- G_message(_("%s"), message);
- return 1;
- }
- if (line <= 0 || line >= window->bottom - window->top)
- return 1;
- if (col <= 0 || col >= window->right - window->left)
- return 1;
- move(y = window->top + line, x = window->left + col);
- while (*message != 0 && *message != '\n' && x < window->right) {
- addch(*message);
- message++;
- x++;
- }
- if (*message == '\n')
- for (i = x; i < window->right; i++)
- addch(' ');
- move(y, x);
- refresh();
- return 0;
-}
-
-
-int Curses_replot_screen(void)
-{
- int x, y;
-
- getyx(stdscr, y, x);
- wrefresh(curscr);
- move(y, x);
- refresh();
- return 0;
-}
-
-int Curses_prompt_gets(char *prompt, char *answer)
-{
- char c;
- int n;
- int y, x;
-
- *answer = 0;
- n = 0;
-
- Curses_write_window(PROMPT_WINDOW, 1, 1, "\n");
- Curses_write_window(PROMPT_WINDOW, 1, 1, prompt);
-
- for (;;) {
- refresh();
- c = Curses_getch(0);
- if (c == '\n' || c == '\r')
- break;
-
- getyx(stdscr, y, x);
- if (c > '\037' && c < '\177') { /* octal codes: accept space to '~' */
- if (x < PROMPT_WINDOW->right) {
- *answer++ = c;
- *answer = 0;
- addch(c);
- n++;
- }
- continue;
- }
- if (c == '\b' || c == '\177') { /* backspace or DEL (decimal 8,127) */
- if (n > 0) {
- answer--;
- *answer = 0;
- move(y, x - 1);
- addch(' ');
- move(y, x - 1);
- n--;
- }
- continue;
- }
- Beep();
- }
- return 0;
-}
-
-int Beep(void)
-{
- putchar('\7');
- fflush(stdout);
- return 0;
-}
-
-int Curses_getch(int with_echo)
-{
- char achar;
- int c;
- int kill;
-
- if (!inited)
- return 0;
- kill = 0;
- while (1) {
- c = getch() & 0177;
- if (c == interrupt_char) {
- if (kill++ >= 3) {
- End_curses();
- exit(0);
- }
- continue;
- }
- kill = 0;
- if (c != 18)
- break;
- Curses_replot_screen();
- }
- if (with_echo) {
- achar = c;
- addch(achar);
- refresh();
- }
- return c;
-}
Copied: grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2target/curses.c (from rev 44501, grass/branches/develbranch_6/imagery/i.ortho.photo/i.photo.2target/curses.c)
===================================================================
--- grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2target/curses.c (rev 0)
+++ grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2target/curses.c 2010-12-22 10:05:10 UTC (rev 44654)
@@ -0,0 +1,261 @@
+#include <curses.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <grass/gis.h>
+#include <grass/glocale.h>
+#include "globals.h"
+#include "local_proto.h"
+
+static int inited = 0;
+
+static WINDOW *save;
+WINDOW *newwin();
+
+
+static Window *make_window(int top, int bottom, int left, int right)
+{
+ Window *window;
+
+ if (top < 0 || bottom >= LINES || left < 0 || right >= COLS
+ || bottom - top <= 1 || right - left <= 1) {
+ End_curses();
+ G_warning(_("make_window(%d,%d,%d,%d): illegal screen values."),
+ top, bottom, left, right);
+ G_sleep(3);
+ exit(1);
+ }
+ window = (Window *) G_malloc(sizeof(Window));
+ window->top = top;
+ window->bottom = bottom;
+ window->left = left;
+ window->right = right;
+ Curses_clear_window(window);
+ return window;
+}
+
+int Begin_curses(void)
+{
+ /* should only be called once at program outset */
+
+ initscr(); /* initialize curses standard screens */
+ raw(); /* set tty modes via curses calls */
+ noecho();
+ nonl();
+
+ inited = 1;
+
+ /* make a window to save stdscr */
+ save = newwin(LINES, COLS, 0, 0);
+
+ /* make_window (nrows, ncols, start_row, start_col) */
+ INFO_WINDOW = make_window(0, LINES - 4, COLS / 2, COLS - 1);
+ MENU_WINDOW = make_window(0, LINES - 4, 0, COLS / 2);
+ PROMPT_WINDOW = make_window(LINES - 4, LINES - 1, 0, COLS - 1);
+ refresh();
+
+ return 0;
+}
+
+int End_curses(void)
+{
+ /* should only be called upon program exit */
+
+ clear(); /* clear the screen */
+ refresh();
+ endwin(); /* let curses reset the tty now */
+ return 0;
+}
+
+int Suspend_curses(void)
+{
+ overwrite(stdscr, save);
+ clear();
+ refresh();
+ endwin();
+
+ return 0;
+}
+
+int Resume_curses(void)
+{
+ clear();
+ refresh();
+ overwrite(save, stdscr);
+ refresh();
+ return 0;
+}
+
+int Curses_allow_interrupts(int ok)
+{
+ refresh();
+ if (ok)
+ noraw();
+ else
+ raw();
+ return 0;
+}
+
+int Curses_clear_window(Window * window)
+{
+ int y, x;
+
+ if (!inited)
+ return 1;
+ for (y = window->top + 1; y < window->bottom; y++) {
+ move(y, x = window->left + 1);
+ while (x++ < window->right)
+ addch(' ');
+ }
+ Curses_outline_window(window);
+ refresh();
+ return 0;
+}
+
+int Curses_outline_window(Window * window)
+{
+ int x, y;
+
+ move(window->top, x = window->left + 1);
+ while (x++ < window->right)
+ addch('-');
+ move(window->bottom, x = window->left + 1);
+ while (x++ < window->right)
+ addch('-');
+ for (y = window->top + 1; y < window->bottom; y++) {
+ move(y, window->left);
+ addch('|');
+ move(y, window->right);
+ addch('|');
+ }
+ move(window->top, window->left);
+ addch('+');
+ move(window->top, window->right);
+ addch('+');
+ move(window->bottom, window->left);
+ addch('+');
+ if (window->bottom < LINES - 1 || window->right < COLS - 1) {
+ move(window->bottom, window->right);
+ addch('+');
+ }
+ return 0;
+}
+
+int Curses_write_window(Window * window, int line, int col, char *message)
+{
+ int y, x, i;
+
+ if (!inited) {
+ G_message(_("%s"), message);
+ return 1;
+ }
+ if (line <= 0 || line >= window->bottom - window->top)
+ return 1;
+ if (col <= 0 || col >= window->right - window->left)
+ return 1;
+ move(y = window->top + line, x = window->left + col);
+ while (*message != 0 && *message != '\n' && x < window->right) {
+ addch(*message);
+ message++;
+ x++;
+ }
+ if (*message == '\n')
+ for (i = x; i < window->right; i++)
+ addch(' ');
+ move(y, x);
+ refresh();
+ return 0;
+}
+
+
+int Curses_replot_screen(void)
+{
+ int x, y;
+
+ getyx(stdscr, y, x);
+ wrefresh(curscr);
+ move(y, x);
+ refresh();
+ return 0;
+}
+
+int Curses_prompt_gets(char *prompt, char *answer)
+{
+ char c;
+ int n;
+ int y, x;
+
+ *answer = 0;
+ n = 0;
+
+ Curses_write_window(PROMPT_WINDOW, 1, 1, "\n");
+ Curses_write_window(PROMPT_WINDOW, 1, 1, prompt);
+
+ for (;;) {
+ refresh();
+ c = Curses_getch(0);
+ if (c == '\n' || c == '\r')
+ break;
+
+ getyx(stdscr, y, x);
+ if (c > '\037' && c < '\177') { /* octal codes: accept space to '~' */
+ if (x < PROMPT_WINDOW->right) {
+ *answer++ = c;
+ *answer = 0;
+ addch(c);
+ n++;
+ }
+ continue;
+ }
+ if (c == '\b' || c == '\177') { /* backspace or DEL (decimal 8,127) */
+ if (n > 0) {
+ answer--;
+ *answer = 0;
+ move(y, x - 1);
+ addch(' ');
+ move(y, x - 1);
+ n--;
+ }
+ continue;
+ }
+ Beep();
+ }
+ return 0;
+}
+
+int Beep(void)
+{
+ putchar('\7');
+ fflush(stdout);
+ return 0;
+}
+
+int Curses_getch(int with_echo)
+{
+ char achar;
+ int c;
+ int kill;
+
+ if (!inited)
+ return 0;
+ kill = 0;
+ while (1) {
+ c = getch() & 0177;
+ if (c == interrupt_char) {
+ if (kill++ >= 3) {
+ End_curses();
+ exit(0);
+ }
+ continue;
+ }
+ kill = 0;
+ if (c != 18)
+ break;
+ Curses_replot_screen();
+ }
+ if (with_echo) {
+ achar = c;
+ addch(achar);
+ refresh();
+ }
+ return c;
+}
Deleted: grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2target/defs.h
===================================================================
--- grass/branches/develbranch_6/imagery/i.ortho.photo/i.photo.2target/defs.h 2010-12-01 09:34:37 UTC (rev 44501)
+++ grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2target/defs.h 2010-12-22 10:05:10 UTC (rev 44654)
@@ -1,52 +0,0 @@
-#include "orthophoto.h"
-#include <grass/rowio.h>
-#include <curses.h>
-
-/* this is a curses structure */
-typedef struct
-{
- int top, left, bottom, right;
-} Window;
-
-/* this is a graphics structure */
-typedef struct
-{
- int top, bottom, left, right;
- int nrows, ncols;
- struct
- {
- int configured;
- struct Cell_head head;
- struct Colors colors;
- char name[30];
- char mapset[30];
- int top, bottom, left, right;
- double ew_res, ns_res; /* original map resolution */
- } cell;
-} View;
-
-
-typedef struct
-{
- int type; /* object type */
- int (*handler) (); /* routine to handle the event */
- char *label; /* label to display if MENU or OPTION */
- int binding; /* OPTION bindings */
- int *status; /* MENU,OPTION status */
- int top, bottom, left, right;
-} Objects;
-
-#define MENU_OBJECT 1
-#define OPTION_OBJECT 2
-#define INFO_OBJECT 3
-#define OTHER_OBJECT 4
-
-
-#define MENU(label,handler,status) \
- {MENU_OBJECT,handler,label,0,status,0,0,0,0}
-#define OPTION(label,binding,status) \
- {OPTION_OBJECT,NULL,label,binding,status,0,0,0,0}
-#define INFO(label,status) \
- {INFO_OBJECT,NULL,label,0,status,0,0,0,0}
-#define OTHER(handler,status) \
- {OTHER_OBJECT,handler,NULL,0,status,0,0,0,0}
Copied: grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2target/defs.h (from rev 44501, grass/branches/develbranch_6/imagery/i.ortho.photo/i.photo.2target/defs.h)
===================================================================
--- grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2target/defs.h (rev 0)
+++ grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2target/defs.h 2010-12-22 10:05:10 UTC (rev 44654)
@@ -0,0 +1,52 @@
+#include "orthophoto.h"
+#include <grass/rowio.h>
+#include <curses.h>
+
+/* this is a curses structure */
+typedef struct
+{
+ int top, left, bottom, right;
+} Window;
+
+/* this is a graphics structure */
+typedef struct
+{
+ int top, bottom, left, right;
+ int nrows, ncols;
+ struct
+ {
+ int configured;
+ struct Cell_head head;
+ struct Colors colors;
+ char name[30];
+ char mapset[30];
+ int top, bottom, left, right;
+ double ew_res, ns_res; /* original map resolution */
+ } cell;
+} View;
+
+
+typedef struct
+{
+ int type; /* object type */
+ int (*handler) (); /* routine to handle the event */
+ char *label; /* label to display if MENU or OPTION */
+ int binding; /* OPTION bindings */
+ int *status; /* MENU,OPTION status */
+ int top, bottom, left, right;
+} Objects;
+
+#define MENU_OBJECT 1
+#define OPTION_OBJECT 2
+#define INFO_OBJECT 3
+#define OTHER_OBJECT 4
+
+
+#define MENU(label,handler,status) \
+ {MENU_OBJECT,handler,label,0,status,0,0,0,0}
+#define OPTION(label,binding,status) \
+ {OPTION_OBJECT,NULL,label,binding,status,0,0,0,0}
+#define INFO(label,status) \
+ {INFO_OBJECT,NULL,label,0,status,0,0,0,0}
+#define OTHER(handler,status) \
+ {OTHER_OBJECT,handler,NULL,0,status,0,0,0,0}
Deleted: grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2target/description.html
===================================================================
--- grass/branches/develbranch_6/imagery/i.ortho.photo/i.photo.2target/description.html 2010-12-01 09:34:37 UTC (rev 44501)
+++ grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2target/description.html 2010-12-22 10:05:10 UTC (rev 44654)
@@ -1,383 +0,0 @@
-<H2>DESCRIPTION</H2>
-
-<EM>i.photo.2target</EM>
-is an imagery function that enables you to
-mark control points on an image to be ortho-rectified
-and then input the coordinates of each point for calculation
-of rectification parameters.
-
-Rectification is the mapping of an image from one coordinate
-system to another. The geometry of an image extracted into
-a GRASS LOCATION having an x,y coordinate system is not
-planimetric. To create a planimetric image, that is, to
-convert the x,y coordinate system into a standard coordinate
-system (for example, the UTM coordinate system or the State
-Plane coordinate system), points from a map having the
-standard coordinates must be associated with the same points
-on the image to be rectified.
-
-The ortho-rectification parameters are computed in two
-phases. The first phase computes a transformation matrix between image
-(row,col) coordinates and photo (x,y) coordinates relative to the
-perspective center. The transformation matrix is computed
-explicitly in the option <EM>
-<A HREF="i.photo.2image.html">i.photo.2image</A>
-</EM>.
-
-The second phase, <EM>i.photo.2target</EM>, enables you
-to mark control points on the image
-and then input the standard coordinates
-(Easting,Northing, and elevation) to determine the
-parameters for a three dimensional projective transformation.
-
-<EM>
-<A HREF="i.photo.init.html">i.photo.init</A>
-</EM> may be run before
-running <EM>i.photo.2target</EM>
-to modify the initial camera exposure station parameters, and/or
-modify the standard deviation of these parameters.
-<EM>
-<A HREF="i.photo.init.html">i.photo.init</A>
-</EM> is not required but generally is helpful.
-
-
-<P>
-
-During the process of marking control points and entering standard
-coordinates, you may compute the RMS (root mean square)
-error for each control point entered. <EM>i.photo.2target</EM> does this by
-calculating the transformation equation, and then
-plugging these results into an equation for RMS error.
-
-
-<P>
-
-<EM>i.photo.2target</EM> offers a zoom option to locate precisely the point
-to be marked on an image. This program also offers you the option
-of acquiring standard coordinates for a marked point from a map
-layer in the target database, or from a digitizer.
-
-
-<P>
-
-To run <EM>i.photo.2target</EM>, a graphics monitor is required.
-
-
-<P>
-
-The procedure for marking points, entering coordinates, and calculating RMS
-error is described below.
-
-
-<P>
-
-The terminal screen displays the following message:
-
-
-<P>
-<B>use mouse now...</B>
-<P>
-The graphics monitor displays the following screen:
-<P>
-<PRE>
-+-----------------------------+--------------------------------+
-|imagery filename (mag) | target filename (mag) |
-+-----------------------------+--------------------------------+
-| | |
-| | |
-| | |
-| | |
-| | |
-| | |
-| | |
-+-----------------------------+--------------------------------+
-| | |
-| | |
-| | |
-| | |
-| | |
-| | |
-+-----------------------------+--------------------------------+
-|QUIT ZOOM PLOTCELL ANALYZE | |
-+-----------------------------+--------------------------------+
-</PRE>
-<P>
-A pop-down menu like that shown below will be superimposed on the
-left half of the screen:
-<P>
-<PRE>
- +------------------------------------------+
- | Double click on raster map to be plotted |
- | Double click here to cancel |
- +------------------------------------------+
- +--------------------+
- | Mapset PERMANENT |
- +---------+----------+
- |gs13.1 | gs14.1 |
- +---------+----------+
- |gs21.1 | gs22.2 |
- +---------+----------+
-
-</PRE>
-<P>
-Any single file in the imagery group may be used to mark
-points, and you can mark points on more than one file
-in the imagery group to accumulate the 12 points suggested minimum.
-Any file in the imagery group can be rectified (using
-<EM>
-<A HREF="i.photo.rectify.html">i.photo.rectify</A>
-</EM>) based on the rectification parameters
-computed from these control points.
-<P>
-The imagery file you select is displayed in the upper
-left quadrant of the screen.
-
-<H2>ZOOM</H2>
-
-To magnify the displayed file, you must
-place the mouse cross hairs on the word ZOOM. The following menu
-will then be displayed at the bottom of the screen:
-<P>
-<PRE>
-
- +-------+-----+-------++--------------------+
- |Cancel | Box | Point ||Select type of ZOOM |
- +-------+-----+-------++--------------------+
-</PRE>
-<P>
-You may identifying the zoom window either by using
-the mouse to make a box, or by using the mouse to mark the center of
-the window and entering a magnification factor.
-The terminal screen will display a mouse button menu to guide you in
-identifying the window.
-<P>
-It is also possible to start zoom by box with middle mouse button
-and pan by right mouse button.
-<P>
-<H2>MARKING POINTS</H2>
-To mark the points on the image that correspond to the points on a
-standard coordinate system map, you must place the mouse
-cross hairs on the corresponding location on the image to be marked
-and press the
-left hand button on the mouse. A diamond shaped symbol will be
-marked on the image. The terminal will display the following
-menu:
-<P>
-<PRE>
- +------------------------------------+--------------------------+
- |Point 1 marked at IMAGE COORDINATES | |
- |IMAGE X: 1023.77 | |
- |IMAGE Y: -164.41 | |
- | | |
- +------------------------------------+--------------------------+
- |Enter CONTROL COORDINATES as east,north,elevation: |
- +---------------------------------------------------------------+
-</PRE>
-<P>
-You then enter the easting, northing, and elevation for the point
-marked on the image. If you wish not to enter a
-coordinate, simply hit RETURN to return control
-to the mouse; the marked point then disappears.
-<P>
-Entered point can be canceled by right mouse button click.
-<P>
-<H2>PLOT CELL</H2>
-
-In addition to acquiring control points from a standard map,
-you have the option of acquiring the points from
-a cell-map in the target database. The database map is displayed by
-placing the mouse cross hairs on the words PLOT CELL. The
-following line is then displayed at the bottom of the monitor:
-<P>
-<PRE>
- +-------+---------------------------------------+
- |Cancel | Indicate which side should be plotted |
- +-------+---------------------------------------+
-</PRE>
-<P>
-Which side of the monitor is to be plotted
-is indicated by placing the mouse cross hairs on the
-half of the monitor screen that you would like to use,
-and pressing the left mouse button. The following pop-down
-menu will be superimposed on the half of the screen that was
-chosen:
-<P>
-<PRE>
- +------------------------------------------+
- | Double click on raster map to be plotted |
- | Double click here to cancel |
- +------------------------------------------+
-</PRE>
-<PRE>
- +-----------------------------+
- | Mapset user1 |
- +--------------+--------------+
- |tm.rectified | |
- +--------------+--------------+
- |tm.classified | |
- +--------------+--------------+
- | Mapset PERMANENT |
- +--------------+--------------+
- |elevation | geology |
- +--------------+--------------+
- |slope | soils |
- +--------------+--------------+
- |aspect | |
- +--------------+--------------+
- |roads | |
- +--------------+--------------+
- |streams | |
- +--------------+--------------+
- |airfields | |
- +--------------+--------------+
-</PRE>
-<P>
-After the map is displayed the following message appears at
-the bottom of the monitor:
-<P>
-<PRE>
- +-----------------+----------+--------+
- |input method -> | keyboard | screen |
- +-----------------+----------+--------+
-</PRE>
-<P>
-If you wish to use the plotted map only as a
-comparative reference, the keyboard can be chosen as
-the means to input coordinates corresponding to the marked
-control points. This is done by placing the mouse
-cross hairs on the word KEYBOARD and pressing the left
-button on the mouse.
-<P>
-If you select the SCREEN option, points marked on
-the image will automatically be associated with the
-coordinates from the corresponding points on the target
-database map, and a corresponding elevation from the cell-file
-selected for elevation data. In this option, when you mark a point
-on the image, the following menu is displayed on the
-terminal:
-<P>
-<PRE>
- +------------------------------------+--------------------------+
- |Point 5 marked at IMAGE COORDINATES | |
- |IMAGE X: 1023.77 | |
- |IMAGE Y: -164.41 | |
- | | |
- | | |
- |Control Point location | |
- |East: 679132.57 | |
- |North: 4351080.67 | |
- |Elevation: 1010.00 | |
- | | |
- | | |
- | | |
- +------------------------------------+--------------------------+
- |use mouse now... |
- +---------------------------------------------------------------+
-</PRE>
-<P>
-The coordinates for the target database map are automatically saved
-as the coordinates corresponding to the marked control point on the image.
-
-<H2>ANALYZE</H2>
-
-After a number of points have been marked (4 to 7), you can
-check the RMS error of the points marked on the image. This is done
-by placing the mouse cross hairs on the word ANALYZE at the bottom
-of the monitor. An error report resembling that shown below
-is superimposed on the monitor:
-<P>
-<PRE>
-+--------------------------------------------------------------------------+
-| error |
-|# east north target east north east north elev. |
-+--------------------------------------------------------------------------+
-|1 0.0 -0.9 1.0 48.5 4.8 79132.5 351080.6 10.0 |
-|2 0.4 1.0 1.3 53.1 7.2 84314.7 399001.4 239.3 |
-|3 -1.2 -0.5 0.6 52.8 6.5 67841.4 457682.8 209.5 |
-|4 1.1 0.5 1.3 34.0 9.2 77573.8 352626.4 432.5 |
-|5 -2.7 14.0 14.2 48.6 -144.9 79132.6 351080.7 985.0 |
-| |
-+--------------------------------------------------------------------------+
-| overall rms error: 4.46 |
-+--------------------------------------------------------------------------+
-</PRE>
-<P>
- The following menu then appears at the bottom of the monitor:
-<P>
-<PRE>
- +-----+------------+------------------------------------------------+
- |DONE | PRINT FILE | Double click on point to be included/excluded |
- +-----+------------+------------------------------------------------+
-</PRE>
-<P>
-The RMS error for the image is given under the column TITLEd "error"
-and subTITLEd "east" and "north". In the above report, point number 1
-is 0.0 and -0.9 meters (east and north)
-from the predicted location calculated from
-the transformation equation.
-The RMS error for the target map is listed under the heading "target".
-This is the RMS error for the east and north coordinates of the
-target map but it is presented in the table using one general value.
-The overall RMS error is displayed at the bottom of the screen in meters.
-Points that create high RMS error are displayed in red on the monitor
-(represented here in italics).
-<P>
-The image coordinates of the point marked on the
-imagery group file is given under the heading "image" and the
-subheadings "east" and "north". The location of the control point in the
-target database is given under the heading "control" and the
-subheadings "east","north", and "elev". If you would like to
-exclude or include a control point, this can be accomplished by placing
-the mouse cross hairs on the control point number to be included (if the
-point is absent) or excluded (if the point is displayed) and
-pressing the left button on the mouse twice.
-When a point is excluded, it is not afterwards included in the calculation
-of the RMS error, or included in the final rectification parameters.
-However, it can be retrieved within <EM>i.photo.2target</EM> at any time
-by double clicking with the mouse as described above.
-
-<H2>QUIT</H2>
-
-To end the <EM>i.photo.2target</EM> program place the mouse cross hairs
-on the word QUIT; the marked control points (including coordinates)
-will be saved.
-
-<H2>NOTES</H2>
-
-During the course of marking control points and computing
-the ortho-rectification parameters, a matrix inversion error may occur.
-This is caused by trying to invert a non-singular normal equation matrix.
-When this situation
-arises, the status of all previously selected control points are modified,
-the control points are excluded. Running
-<EM>
-<A HREF="i.photo.init.html">i.photo.init</A>
-</EM> for the selected imagery group with accurate
-camera exposure station parameters should remedy the situation.
-The excluded control points may again be included as described in the section
-ANALYZE.
-<P>
-<P>
-A good rule of thumb is to mark at least 12 to 15 points which are
-evenly distributed over the entire imagery group file in order to obtain
-an accurate transformation parameters for the rectification process.
-The RMS error may increase with more points added, but the
-transformation parameters will be more accurate over the entire image.
-<P>
-An RMS error of less than or equal to approximately one resolution
-unit (pixel) for the image being rectified is generally considered
-acceptable.
-
-<H2>SEE ALSO</H2>
-
-<EM><A HREF="i.ortho.photo.html">i.ortho.photo</A></EM>,
-<EM><A HREF="i.photo.camera.html">i.photo.camera</A></EM>,
-<EM><A HREF="i.photo.2image.html">i.photo.2image</A></EM>,
-<EM><A HREF="i.photo.init.html">i.photo.init</A></EM>,
-<EM><A HREF="i.photo.rectify.html">i.photo.rectify</A></EM>
-
-<H2>AUTHOR</H2>
-
-Mike Baba, DBA Systems, Inc.
-
-<p><i>Last changed: $Date$</i>
Copied: grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2target/description.html (from rev 44501, grass/branches/develbranch_6/imagery/i.ortho.photo/i.photo.2target/description.html)
===================================================================
--- grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2target/description.html (rev 0)
+++ grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2target/description.html 2010-12-22 10:05:10 UTC (rev 44654)
@@ -0,0 +1,383 @@
+<H2>DESCRIPTION</H2>
+
+<EM>i.photo.2target</EM>
+is an imagery function that enables you to
+mark control points on an image to be ortho-rectified
+and then input the coordinates of each point for calculation
+of rectification parameters.
+
+Rectification is the mapping of an image from one coordinate
+system to another. The geometry of an image extracted into
+a GRASS LOCATION having an x,y coordinate system is not
+planimetric. To create a planimetric image, that is, to
+convert the x,y coordinate system into a standard coordinate
+system (for example, the UTM coordinate system or the State
+Plane coordinate system), points from a map having the
+standard coordinates must be associated with the same points
+on the image to be rectified.
+
+The ortho-rectification parameters are computed in two
+phases. The first phase computes a transformation matrix between image
+(row,col) coordinates and photo (x,y) coordinates relative to the
+perspective center. The transformation matrix is computed
+explicitly in the option <EM>
+<A HREF="i.photo.2image.html">i.photo.2image</A>
+</EM>.
+
+The second phase, <EM>i.photo.2target</EM>, enables you
+to mark control points on the image
+and then input the standard coordinates
+(Easting,Northing, and elevation) to determine the
+parameters for a three dimensional projective transformation.
+
+<EM>
+<A HREF="i.photo.init.html">i.photo.init</A>
+</EM> may be run before
+running <EM>i.photo.2target</EM>
+to modify the initial camera exposure station parameters, and/or
+modify the standard deviation of these parameters.
+<EM>
+<A HREF="i.photo.init.html">i.photo.init</A>
+</EM> is not required but generally is helpful.
+
+
+<P>
+
+During the process of marking control points and entering standard
+coordinates, you may compute the RMS (root mean square)
+error for each control point entered. <EM>i.photo.2target</EM> does this by
+calculating the transformation equation, and then
+plugging these results into an equation for RMS error.
+
+
+<P>
+
+<EM>i.photo.2target</EM> offers a zoom option to locate precisely the point
+to be marked on an image. This program also offers you the option
+of acquiring standard coordinates for a marked point from a map
+layer in the target database, or from a digitizer.
+
+
+<P>
+
+To run <EM>i.photo.2target</EM>, a graphics monitor is required.
+
+
+<P>
+
+The procedure for marking points, entering coordinates, and calculating RMS
+error is described below.
+
+
+<P>
+
+The terminal screen displays the following message:
+
+
+<P>
+<B>use mouse now...</B>
+<P>
+The graphics monitor displays the following screen:
+<P>
+<PRE>
++-----------------------------+--------------------------------+
+|imagery filename (mag) | target filename (mag) |
++-----------------------------+--------------------------------+
+| | |
+| | |
+| | |
+| | |
+| | |
+| | |
+| | |
++-----------------------------+--------------------------------+
+| | |
+| | |
+| | |
+| | |
+| | |
+| | |
++-----------------------------+--------------------------------+
+|QUIT ZOOM PLOTCELL ANALYZE | |
++-----------------------------+--------------------------------+
+</PRE>
+<P>
+A pop-down menu like that shown below will be superimposed on the
+left half of the screen:
+<P>
+<PRE>
+ +------------------------------------------+
+ | Double click on raster map to be plotted |
+ | Double click here to cancel |
+ +------------------------------------------+
+ +--------------------+
+ | Mapset PERMANENT |
+ +---------+----------+
+ |gs13.1 | gs14.1 |
+ +---------+----------+
+ |gs21.1 | gs22.2 |
+ +---------+----------+
+
+</PRE>
+<P>
+Any single file in the imagery group may be used to mark
+points, and you can mark points on more than one file
+in the imagery group to accumulate the 12 points suggested minimum.
+Any file in the imagery group can be rectified (using
+<EM>
+<A HREF="i.photo.rectify.html">i.photo.rectify</A>
+</EM>) based on the rectification parameters
+computed from these control points.
+<P>
+The imagery file you select is displayed in the upper
+left quadrant of the screen.
+
+<H2>ZOOM</H2>
+
+To magnify the displayed file, you must
+place the mouse cross hairs on the word ZOOM. The following menu
+will then be displayed at the bottom of the screen:
+<P>
+<PRE>
+
+ +-------+-----+-------++--------------------+
+ |Cancel | Box | Point ||Select type of ZOOM |
+ +-------+-----+-------++--------------------+
+</PRE>
+<P>
+You may identifying the zoom window either by using
+the mouse to make a box, or by using the mouse to mark the center of
+the window and entering a magnification factor.
+The terminal screen will display a mouse button menu to guide you in
+identifying the window.
+<P>
+It is also possible to start zoom by box with middle mouse button
+and pan by right mouse button.
+<P>
+<H2>MARKING POINTS</H2>
+To mark the points on the image that correspond to the points on a
+standard coordinate system map, you must place the mouse
+cross hairs on the corresponding location on the image to be marked
+and press the
+left hand button on the mouse. A diamond shaped symbol will be
+marked on the image. The terminal will display the following
+menu:
+<P>
+<PRE>
+ +------------------------------------+--------------------------+
+ |Point 1 marked at IMAGE COORDINATES | |
+ |IMAGE X: 1023.77 | |
+ |IMAGE Y: -164.41 | |
+ | | |
+ +------------------------------------+--------------------------+
+ |Enter CONTROL COORDINATES as east,north,elevation: |
+ +---------------------------------------------------------------+
+</PRE>
+<P>
+You then enter the easting, northing, and elevation for the point
+marked on the image. If you wish not to enter a
+coordinate, simply hit RETURN to return control
+to the mouse; the marked point then disappears.
+<P>
+Entered point can be canceled by right mouse button click.
+<P>
+<H2>PLOT CELL</H2>
+
+In addition to acquiring control points from a standard map,
+you have the option of acquiring the points from
+a cell-map in the target database. The database map is displayed by
+placing the mouse cross hairs on the words PLOT CELL. The
+following line is then displayed at the bottom of the monitor:
+<P>
+<PRE>
+ +-------+---------------------------------------+
+ |Cancel | Indicate which side should be plotted |
+ +-------+---------------------------------------+
+</PRE>
+<P>
+Which side of the monitor is to be plotted
+is indicated by placing the mouse cross hairs on the
+half of the monitor screen that you would like to use,
+and pressing the left mouse button. The following pop-down
+menu will be superimposed on the half of the screen that was
+chosen:
+<P>
+<PRE>
+ +------------------------------------------+
+ | Double click on raster map to be plotted |
+ | Double click here to cancel |
+ +------------------------------------------+
+</PRE>
+<PRE>
+ +-----------------------------+
+ | Mapset user1 |
+ +--------------+--------------+
+ |tm.rectified | |
+ +--------------+--------------+
+ |tm.classified | |
+ +--------------+--------------+
+ | Mapset PERMANENT |
+ +--------------+--------------+
+ |elevation | geology |
+ +--------------+--------------+
+ |slope | soils |
+ +--------------+--------------+
+ |aspect | |
+ +--------------+--------------+
+ |roads | |
+ +--------------+--------------+
+ |streams | |
+ +--------------+--------------+
+ |airfields | |
+ +--------------+--------------+
+</PRE>
+<P>
+After the map is displayed the following message appears at
+the bottom of the monitor:
+<P>
+<PRE>
+ +-----------------+----------+--------+
+ |input method -> | keyboard | screen |
+ +-----------------+----------+--------+
+</PRE>
+<P>
+If you wish to use the plotted map only as a
+comparative reference, the keyboard can be chosen as
+the means to input coordinates corresponding to the marked
+control points. This is done by placing the mouse
+cross hairs on the word KEYBOARD and pressing the left
+button on the mouse.
+<P>
+If you select the SCREEN option, points marked on
+the image will automatically be associated with the
+coordinates from the corresponding points on the target
+database map, and a corresponding elevation from the cell-file
+selected for elevation data. In this option, when you mark a point
+on the image, the following menu is displayed on the
+terminal:
+<P>
+<PRE>
+ +------------------------------------+--------------------------+
+ |Point 5 marked at IMAGE COORDINATES | |
+ |IMAGE X: 1023.77 | |
+ |IMAGE Y: -164.41 | |
+ | | |
+ | | |
+ |Control Point location | |
+ |East: 679132.57 | |
+ |North: 4351080.67 | |
+ |Elevation: 1010.00 | |
+ | | |
+ | | |
+ | | |
+ +------------------------------------+--------------------------+
+ |use mouse now... |
+ +---------------------------------------------------------------+
+</PRE>
+<P>
+The coordinates for the target database map are automatically saved
+as the coordinates corresponding to the marked control point on the image.
+
+<H2>ANALYZE</H2>
+
+After a number of points have been marked (4 to 7), you can
+check the RMS error of the points marked on the image. This is done
+by placing the mouse cross hairs on the word ANALYZE at the bottom
+of the monitor. An error report resembling that shown below
+is superimposed on the monitor:
+<P>
+<PRE>
++--------------------------------------------------------------------------+
+| error |
+|# east north target east north east north elev. |
++--------------------------------------------------------------------------+
+|1 0.0 -0.9 1.0 48.5 4.8 79132.5 351080.6 10.0 |
+|2 0.4 1.0 1.3 53.1 7.2 84314.7 399001.4 239.3 |
+|3 -1.2 -0.5 0.6 52.8 6.5 67841.4 457682.8 209.5 |
+|4 1.1 0.5 1.3 34.0 9.2 77573.8 352626.4 432.5 |
+|5 -2.7 14.0 14.2 48.6 -144.9 79132.6 351080.7 985.0 |
+| |
++--------------------------------------------------------------------------+
+| overall rms error: 4.46 |
++--------------------------------------------------------------------------+
+</PRE>
+<P>
+ The following menu then appears at the bottom of the monitor:
+<P>
+<PRE>
+ +-----+------------+------------------------------------------------+
+ |DONE | PRINT FILE | Double click on point to be included/excluded |
+ +-----+------------+------------------------------------------------+
+</PRE>
+<P>
+The RMS error for the image is given under the column TITLEd "error"
+and subTITLEd "east" and "north". In the above report, point number 1
+is 0.0 and -0.9 meters (east and north)
+from the predicted location calculated from
+the transformation equation.
+The RMS error for the target map is listed under the heading "target".
+This is the RMS error for the east and north coordinates of the
+target map but it is presented in the table using one general value.
+The overall RMS error is displayed at the bottom of the screen in meters.
+Points that create high RMS error are displayed in red on the monitor
+(represented here in italics).
+<P>
+The image coordinates of the point marked on the
+imagery group file is given under the heading "image" and the
+subheadings "east" and "north". The location of the control point in the
+target database is given under the heading "control" and the
+subheadings "east","north", and "elev". If you would like to
+exclude or include a control point, this can be accomplished by placing
+the mouse cross hairs on the control point number to be included (if the
+point is absent) or excluded (if the point is displayed) and
+pressing the left button on the mouse twice.
+When a point is excluded, it is not afterwards included in the calculation
+of the RMS error, or included in the final rectification parameters.
+However, it can be retrieved within <EM>i.photo.2target</EM> at any time
+by double clicking with the mouse as described above.
+
+<H2>QUIT</H2>
+
+To end the <EM>i.photo.2target</EM> program place the mouse cross hairs
+on the word QUIT; the marked control points (including coordinates)
+will be saved.
+
+<H2>NOTES</H2>
+
+During the course of marking control points and computing
+the ortho-rectification parameters, a matrix inversion error may occur.
+This is caused by trying to invert a non-singular normal equation matrix.
+When this situation
+arises, the status of all previously selected control points are modified,
+the control points are excluded. Running
+<EM>
+<A HREF="i.photo.init.html">i.photo.init</A>
+</EM> for the selected imagery group with accurate
+camera exposure station parameters should remedy the situation.
+The excluded control points may again be included as described in the section
+ANALYZE.
+<P>
+<P>
+A good rule of thumb is to mark at least 12 to 15 points which are
+evenly distributed over the entire imagery group file in order to obtain
+an accurate transformation parameters for the rectification process.
+The RMS error may increase with more points added, but the
+transformation parameters will be more accurate over the entire image.
+<P>
+An RMS error of less than or equal to approximately one resolution
+unit (pixel) for the image being rectified is generally considered
+acceptable.
+
+<H2>SEE ALSO</H2>
+
+<EM><A HREF="i.ortho.photo.html">i.ortho.photo</A></EM>,
+<EM><A HREF="i.photo.camera.html">i.photo.camera</A></EM>,
+<EM><A HREF="i.photo.2image.html">i.photo.2image</A></EM>,
+<EM><A HREF="i.photo.init.html">i.photo.init</A></EM>,
+<EM><A HREF="i.photo.rectify.html">i.photo.rectify</A></EM>
+
+<H2>AUTHOR</H2>
+
+Mike Baba, DBA Systems, Inc.
+
+<p><i>Last changed: $Date$</i>
Deleted: grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2target/digit.c
===================================================================
--- grass/branches/develbranch_6/imagery/i.ortho.photo/i.photo.2target/digit.c 2010-12-01 09:34:37 UTC (rev 44501)
+++ grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2target/digit.c 2010-12-22 10:05:10 UTC (rev 44654)
@@ -1,119 +0,0 @@
-#include <stdlib.h>
-#include <unistd.h>
-#include "globals.h"
-#include "local_proto.h"
-
-static int setup(void);
-static int oops(void);
-static int no(void);
-static int yes(void);
-
-int setup_digitizer(void)
-{
- static int use = 1;
- static Objects objects[] = {
- INFO("Do you wish to use the digitizer? ", &use),
- MENU("YES", yes, &use),
- MENU("NO", no, &use),
- {0}
- };
- char command[1024];
-
- use_digitizer = 0;
- /*
- * test to see if we have a digitizer (geo.quest)
- * make sure this program has execute permission first.
- * then run the program and check its exit status
- * 0 means can use digitizer, other means can't
- */
- sprintf(command, "%s/etc/geo.quest", G_gisbase());
- if (access(command, 1) != 0)
- return 0;
- if (system(command))
- return 0;
-
-
- /*
- * ask the user if he/she wishes to use it
- */
- Start_mouse_in_menu();
- Input_pointer(objects);
- if (use_digitizer)
- Input_other(setup, "Keyboard");
-
- return 0;
-}
-
-static int setup(void)
-{
- char command[1024];
-
- /*
- * setup the digitizer. system() call must exit with 0 to indicate
- * everything went fine
- */
- sprintf(command, "%s/etc/geo.reg %s %d",
- G_gisbase(), digit_points, getpid());
- Suspend_curses();
- if (system(command)) {
- use_digitizer = 0;
- G_sleep(3);
- }
- Resume_curses();
-
- return 0;
-}
-
-int digitizer_point(double *east, double *north)
-{
- char command[1024];
- FILE *fd;
- int stat;
-
- /* make sure digitzer is to be used */
- if (!use_digitizer)
- return 0;
-
- sprintf(command, "%s/etc/geo.point %s %s",
- G_gisbase(), digit_points, tempfile1);
-
- Suspend_curses();
- if (system(command)) {
- G_sleep(3);
- Resume_curses();
- oops();
- return 0;
- }
- Resume_curses();
- fd = fopen(tempfile1, "r");
- if (fd == NULL) {
- oops();
- return 0;
- }
- stat = (fscanf(fd, "%lf %lf", east, north) == 2);
- fclose(fd);
-
- if (stat == 0)
- oops();
- return stat;
-}
-
-static int oops(void)
-{
- Curses_clear_window(MENU_WINDOW);
- Curses_write_window(MENU_WINDOW, 3, 2, "Can't get data from digitizer");
-
- return 0;
-}
-
-static int no(void)
-{
- use_digitizer = 0;
- return 1;
-}
-
-static int yes(void)
-{
- use_digitizer = 1;
- return 1;
-}
Copied: grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2target/digit.c (from rev 44501, grass/branches/develbranch_6/imagery/i.ortho.photo/i.photo.2target/digit.c)
===================================================================
--- grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2target/digit.c (rev 0)
+++ grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2target/digit.c 2010-12-22 10:05:10 UTC (rev 44654)
@@ -0,0 +1,119 @@
+#include <stdlib.h>
+#include <unistd.h>
+#include "globals.h"
+#include "local_proto.h"
+
+static int setup(void);
+static int oops(void);
+static int no(void);
+static int yes(void);
+
+int setup_digitizer(void)
+{
+ static int use = 1;
+ static Objects objects[] = {
+ INFO("Do you wish to use the digitizer? ", &use),
+ MENU("YES", yes, &use),
+ MENU("NO", no, &use),
+ {0}
+ };
+ char command[1024];
+
+ use_digitizer = 0;
+ /*
+ * test to see if we have a digitizer (geo.quest)
+ * make sure this program has execute permission first.
+ * then run the program and check its exit status
+ * 0 means can use digitizer, other means can't
+ */
+ sprintf(command, "%s/etc/geo.quest", G_gisbase());
+ if (access(command, 1) != 0)
+ return 0;
+ if (system(command))
+ return 0;
+
+
+ /*
+ * ask the user if he/she wishes to use it
+ */
+ Start_mouse_in_menu();
+ Input_pointer(objects);
+ if (use_digitizer)
+ Input_other(setup, "Keyboard");
+
+ return 0;
+}
+
+static int setup(void)
+{
+ char command[1024];
+
+ /*
+ * setup the digitizer. system() call must exit with 0 to indicate
+ * everything went fine
+ */
+ sprintf(command, "%s/etc/geo.reg %s %d",
+ G_gisbase(), digit_points, getpid());
+ Suspend_curses();
+ if (system(command)) {
+ use_digitizer = 0;
+ G_sleep(3);
+ }
+ Resume_curses();
+
+ return 0;
+}
+
+int digitizer_point(double *east, double *north)
+{
+ char command[1024];
+ FILE *fd;
+ int stat;
+
+ /* make sure digitzer is to be used */
+ if (!use_digitizer)
+ return 0;
+
+ sprintf(command, "%s/etc/geo.point %s %s",
+ G_gisbase(), digit_points, tempfile1);
+
+ Suspend_curses();
+ if (system(command)) {
+ G_sleep(3);
+ Resume_curses();
+ oops();
+ return 0;
+ }
+ Resume_curses();
+ fd = fopen(tempfile1, "r");
+ if (fd == NULL) {
+ oops();
+ return 0;
+ }
+ stat = (fscanf(fd, "%lf %lf", east, north) == 2);
+ fclose(fd);
+
+ if (stat == 0)
+ oops();
+ return stat;
+}
+
+static int oops(void)
+{
+ Curses_clear_window(MENU_WINDOW);
+ Curses_write_window(MENU_WINDOW, 3, 2, "Can't get data from digitizer");
+
+ return 0;
+}
+
+static int no(void)
+{
+ use_digitizer = 0;
+ return 1;
+}
+
+static int yes(void)
+{
+ use_digitizer = 1;
+ return 1;
+}
Deleted: grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2target/dot.c
===================================================================
--- grass/branches/develbranch_6/imagery/i.ortho.photo/i.photo.2target/dot.c 2010-12-01 09:34:37 UTC (rev 44501)
+++ grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2target/dot.c 2010-12-22 10:05:10 UTC (rev 44654)
@@ -1,52 +0,0 @@
-#include <grass/raster.h>
-#include "globals.h"
-
-int dot(int x, int y)
-{
- int vx[5], vy[5];
-
- vx[0] = x;
- vy[0] = y - dotsize;
- vx[1] = x - dotsize;
- vy[1] = y;
- vx[2] = x;
- vy[2] = y + dotsize;
- vx[3] = x + dotsize;
- vy[3] = y;
- vx[4] = x;
- vy[4] = y - dotsize;
-
- R_polygon_abs(vx, vy, 5);
- /*
- int i;
-
- for (i = 0; i < dotsize; i++)
- {
- R_move_abs (x-i, y+i-dotsize);
- R_cont_rel (i+i,0);
- R_move_abs (x-i, y+dotsize-i);
- R_cont_rel (i+i,0);
- }
- R_move_abs (x-dotsize, y);
- R_cont_rel (dotsize+dotsize, 0);
- */
- return 0;
-}
-
-int save_under_dot(int x, int y, char *file)
-{
- R_panel_save(file, y - dotsize, y + dotsize, x - dotsize, x + dotsize);
- return 0;
-}
-
-int restore_under_dot(char *file)
-{
- R_panel_restore(file);
- return 0;
-}
-
-int release_under_dot(char *file)
-{
- R_panel_delete(file);
- return 0;
-}
Copied: grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2target/dot.c (from rev 44501, grass/branches/develbranch_6/imagery/i.ortho.photo/i.photo.2target/dot.c)
===================================================================
--- grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2target/dot.c (rev 0)
+++ grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2target/dot.c 2010-12-22 10:05:10 UTC (rev 44654)
@@ -0,0 +1,52 @@
+#include <grass/raster.h>
+#include "globals.h"
+
+int dot(int x, int y)
+{
+ int vx[5], vy[5];
+
+ vx[0] = x;
+ vy[0] = y - dotsize;
+ vx[1] = x - dotsize;
+ vy[1] = y;
+ vx[2] = x;
+ vy[2] = y + dotsize;
+ vx[3] = x + dotsize;
+ vy[3] = y;
+ vx[4] = x;
+ vy[4] = y - dotsize;
+
+ R_polygon_abs(vx, vy, 5);
+ /*
+ int i;
+
+ for (i = 0; i < dotsize; i++)
+ {
+ R_move_abs (x-i, y+i-dotsize);
+ R_cont_rel (i+i,0);
+ R_move_abs (x-i, y+dotsize-i);
+ R_cont_rel (i+i,0);
+ }
+ R_move_abs (x-dotsize, y);
+ R_cont_rel (dotsize+dotsize, 0);
+ */
+ return 0;
+}
+
+int save_under_dot(int x, int y, char *file)
+{
+ R_panel_save(file, y - dotsize, y + dotsize, x - dotsize, x + dotsize);
+ return 0;
+}
+
+int restore_under_dot(char *file)
+{
+ R_panel_restore(file);
+ return 0;
+}
+
+int release_under_dot(char *file)
+{
+ R_panel_delete(file);
+ return 0;
+}
Deleted: grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2target/drawcell.c
===================================================================
--- grass/branches/develbranch_6/imagery/i.ortho.photo/i.photo.2target/drawcell.c 2010-12-01 09:34:37 UTC (rev 44501)
+++ grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2target/drawcell.c 2010-12-22 10:05:10 UTC (rev 44654)
@@ -1,76 +0,0 @@
-#include <stdlib.h>
-#include <grass/display.h>
-#include <grass/raster.h>
-#include "globals.h"
-#include "local_proto.h"
-
-int drawcell(View * view)
-{
- int fd;
- int left, top;
- int ncols, nrows;
- int row;
- CELL *cell;
- struct Colors *colors;
- int read_colors;
- char msg[100];
-
-
- if (!view->cell.configured)
- return 0;
- if (view == VIEW_MAP1 || view == VIEW_MAP1_ZOOM) {
- colors = &VIEW_MAP1->cell.colors;
- read_colors = view == VIEW_MAP1;
- }
- else {
- colors = &VIEW_MAP2->cell.colors;
- read_colors = view == VIEW_MAP2;
- }
- if (read_colors) {
- G_free_colors(colors);
- if (G_read_colors(view->cell.name, view->cell.mapset, colors) < 0)
- return 0;
- }
-
-
- display_title(view);
-
- set_colors(colors);
-
- G_set_window(&view->cell.head);
- nrows = G_window_rows();
- ncols = G_window_cols();
-
- left = view->cell.left;
- top = view->cell.top;
-
- R_standard_color(BLUE);
- Outline_box(top, top + nrows - 1, left, left + ncols - 1);
-
- if (getenv("NO_DRAW"))
- return 1;
-
- fd = G_open_cell_old(view->cell.name, view->cell.mapset);
- if (fd < 0)
- return 0;
- cell = G_allocate_cell_buf();
-
-
- sprintf(msg, "Plotting %s ...", view->cell.name);
- Menu_msg(msg);
-
- D_cell_draw_setup(top, top + nrows, left, left + ncols);
- for (row = 0; row < nrows; row++) {
- if (G_get_map_row_nomask(fd, cell, row) < 0)
- break;
- D_draw_c_raster(row, cell, colors);
- }
- D_cell_draw_end();
- G_close_cell(fd);
- G_free(cell);
-
- if (colors != &VIEW_MAP1->cell.colors)
- set_colors(&VIEW_MAP1->cell.colors);
-
- return row == nrows;
-}
Copied: grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2target/drawcell.c (from rev 44501, grass/branches/develbranch_6/imagery/i.ortho.photo/i.photo.2target/drawcell.c)
===================================================================
--- grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2target/drawcell.c (rev 0)
+++ grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2target/drawcell.c 2010-12-22 10:05:10 UTC (rev 44654)
@@ -0,0 +1,76 @@
+#include <stdlib.h>
+#include <grass/display.h>
+#include <grass/raster.h>
+#include "globals.h"
+#include "local_proto.h"
+
+int drawcell(View * view)
+{
+ int fd;
+ int left, top;
+ int ncols, nrows;
+ int row;
+ CELL *cell;
+ struct Colors *colors;
+ int read_colors;
+ char msg[100];
+
+
+ if (!view->cell.configured)
+ return 0;
+ if (view == VIEW_MAP1 || view == VIEW_MAP1_ZOOM) {
+ colors = &VIEW_MAP1->cell.colors;
+ read_colors = view == VIEW_MAP1;
+ }
+ else {
+ colors = &VIEW_MAP2->cell.colors;
+ read_colors = view == VIEW_MAP2;
+ }
+ if (read_colors) {
+ G_free_colors(colors);
+ if (G_read_colors(view->cell.name, view->cell.mapset, colors) < 0)
+ return 0;
+ }
+
+
+ display_title(view);
+
+ set_colors(colors);
+
+ G_set_window(&view->cell.head);
+ nrows = G_window_rows();
+ ncols = G_window_cols();
+
+ left = view->cell.left;
+ top = view->cell.top;
+
+ R_standard_color(BLUE);
+ Outline_box(top, top + nrows - 1, left, left + ncols - 1);
+
+ if (getenv("NO_DRAW"))
+ return 1;
+
+ fd = G_open_cell_old(view->cell.name, view->cell.mapset);
+ if (fd < 0)
+ return 0;
+ cell = G_allocate_cell_buf();
+
+
+ sprintf(msg, "Plotting %s ...", view->cell.name);
+ Menu_msg(msg);
+
+ D_cell_draw_setup(top, top + nrows, left, left + ncols);
+ for (row = 0; row < nrows; row++) {
+ if (G_get_map_row_nomask(fd, cell, row) < 0)
+ break;
+ D_draw_c_raster(row, cell, colors);
+ }
+ D_cell_draw_end();
+ G_close_cell(fd);
+ G_free(cell);
+
+ if (colors != &VIEW_MAP1->cell.colors)
+ set_colors(&VIEW_MAP1->cell.colors);
+
+ return row == nrows;
+}
Deleted: grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2target/driver.c
===================================================================
--- grass/branches/develbranch_6/imagery/i.ortho.photo/i.photo.2target/driver.c 2010-12-01 09:34:37 UTC (rev 44501)
+++ grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2target/driver.c 2010-12-22 10:05:10 UTC (rev 44654)
@@ -1,54 +0,0 @@
-#include "globals.h"
-#include "local_proto.h"
-
-static int use = 1;
-static int really_quit(void);
-static int dont_stop(void);
-static int stop(void);
-
-int driver(void)
-{
- static Objects objects[] = {
- MENU("QUIT", really_quit, &use),
- MENU("ZOOM", zoom, &use),
- MENU("PLOT CELL", plotcell, &use),
- MENU("ANALYZE", analyze, &use),
- INFO(" Input method -> ", &from_flag),
- OPTION("DIGITIZER", 2, &from_digitizer),
- OPTION("KEYBOARD", 2, &from_keyboard),
- OPTION("SCREEN", 2, &from_screen),
- INFO(" Auto zoom -> ", &autozoom_flag),
- OPTION("ON", 3, &autozoom_on),
- OPTION("OFF", 3, &autozoom_off),
- OTHER(mark, &use),
- {0}
- };
-
- Input_pointer(objects);
- Menu_msg("");
-
- return 0;
-}
-
-static int really_quit(void)
-{
- static Objects objects[] = {
- INFO("really quit? ", &use),
- MENU("NO", dont_stop, &use),
- MENU("YES", stop, &use),
- {0}
- };
- if (Input_pointer(objects) < 0)
- return -1;
- return 0; /* don't quit */
-}
-
-static int dont_stop(void)
-{
- return 1;
-}
-
-static int stop(void)
-{
- return -1;
-}
Copied: grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2target/driver.c (from rev 44501, grass/branches/develbranch_6/imagery/i.ortho.photo/i.photo.2target/driver.c)
===================================================================
--- grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2target/driver.c (rev 0)
+++ grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2target/driver.c 2010-12-22 10:05:10 UTC (rev 44654)
@@ -0,0 +1,54 @@
+#include "globals.h"
+#include "local_proto.h"
+
+static int use = 1;
+static int really_quit(void);
+static int dont_stop(void);
+static int stop(void);
+
+int driver(void)
+{
+ static Objects objects[] = {
+ MENU("QUIT", really_quit, &use),
+ MENU("ZOOM", zoom, &use),
+ MENU("PLOT CELL", plotcell, &use),
+ MENU("ANALYZE", analyze, &use),
+ INFO(" Input method -> ", &from_flag),
+ OPTION("DIGITIZER", 2, &from_digitizer),
+ OPTION("KEYBOARD", 2, &from_keyboard),
+ OPTION("SCREEN", 2, &from_screen),
+ INFO(" Auto zoom -> ", &autozoom_flag),
+ OPTION("ON", 3, &autozoom_on),
+ OPTION("OFF", 3, &autozoom_off),
+ OTHER(mark, &use),
+ {0}
+ };
+
+ Input_pointer(objects);
+ Menu_msg("");
+
+ return 0;
+}
+
+static int really_quit(void)
+{
+ static Objects objects[] = {
+ INFO("really quit? ", &use),
+ MENU("NO", dont_stop, &use),
+ MENU("YES", stop, &use),
+ {0}
+ };
+ if (Input_pointer(objects) < 0)
+ return -1;
+ return 0; /* don't quit */
+}
+
+static int dont_stop(void)
+{
+ return 1;
+}
+
+static int stop(void)
+{
+ return -1;
+}
Deleted: grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2target/equ.c
===================================================================
--- grass/branches/develbranch_6/imagery/i.ortho.photo/i.photo.2target/equ.c 2010-12-01 09:34:37 UTC (rev 44501)
+++ grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2target/equ.c 2010-12-22 10:05:10 UTC (rev 44654)
@@ -1,55 +0,0 @@
-#include "globals.h"
-
-int Compute_ortho_equation(void)
-{
- /* struct Ortho_Control_Points temp_points; */
- double e0, e1, e2, n0, n1, n2, z1, z2;
- int status, i;
-
- /* alloc and fill temp control points */
- temp_points.count = 0;
- temp_points.status = NULL;
- temp_points.e1 = NULL;
- temp_points.n1 = NULL;
- temp_points.z1 = NULL;
- temp_points.e2 = NULL;
- temp_points.n2 = NULL;
- temp_points.z2 = NULL;
-
- /* e0, n0, equal photo coordinates not image coords */
- for (i = 0; i < group.control_points.count; i++) {
- status = group.control_points.status[i];
- e1 = group.control_points.e1[i];
- n1 = group.control_points.n1[i];
- z1 = group.control_points.z1[i];
- e2 = group.control_points.e2[i];
- n2 = group.control_points.n2[i];
- z2 = group.control_points.z2[i];
-
- I_georef(e1, n1, &e0, &n0, group.E12, group.N12);
- I_new_con_point(&temp_points, e0, n0, z1, e2, n2, z2, status);
- }
-
-
- group.con_equation_stat = I_compute_ortho_equations(&temp_points,
- &group.camera_ref,
- &group.camera_exp,
- &group.XC, &group.YC,
- &group.ZC,
- &group.omega,
- &group.phi,
- &group.kappa,
- &group.M,
- &group.MI);
-
- return 0;
-}
-
-int Compute_ref_equation(void)
-{
- group.ref_equation_stat = I_compute_ref_equations(&group.photo_points,
- group.E12, group.N12,
- group.E21, group.N21);
-
- return 0;
-}
Copied: grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2target/equ.c (from rev 44501, grass/branches/develbranch_6/imagery/i.ortho.photo/i.photo.2target/equ.c)
===================================================================
--- grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2target/equ.c (rev 0)
+++ grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2target/equ.c 2010-12-22 10:05:10 UTC (rev 44654)
@@ -0,0 +1,55 @@
+#include "globals.h"
+
+int Compute_ortho_equation(void)
+{
+ /* struct Ortho_Control_Points temp_points; */
+ double e0, e1, e2, n0, n1, n2, z1, z2;
+ int status, i;
+
+ /* alloc and fill temp control points */
+ temp_points.count = 0;
+ temp_points.status = NULL;
+ temp_points.e1 = NULL;
+ temp_points.n1 = NULL;
+ temp_points.z1 = NULL;
+ temp_points.e2 = NULL;
+ temp_points.n2 = NULL;
+ temp_points.z2 = NULL;
+
+ /* e0, n0, equal photo coordinates not image coords */
+ for (i = 0; i < group.control_points.count; i++) {
+ status = group.control_points.status[i];
+ e1 = group.control_points.e1[i];
+ n1 = group.control_points.n1[i];
+ z1 = group.control_points.z1[i];
+ e2 = group.control_points.e2[i];
+ n2 = group.control_points.n2[i];
+ z2 = group.control_points.z2[i];
+
+ I_georef(e1, n1, &e0, &n0, group.E12, group.N12);
+ I_new_con_point(&temp_points, e0, n0, z1, e2, n2, z2, status);
+ }
+
+
+ group.con_equation_stat = I_compute_ortho_equations(&temp_points,
+ &group.camera_ref,
+ &group.camera_exp,
+ &group.XC, &group.YC,
+ &group.ZC,
+ &group.omega,
+ &group.phi,
+ &group.kappa,
+ &group.M,
+ &group.MI);
+
+ return 0;
+}
+
+int Compute_ref_equation(void)
+{
+ group.ref_equation_stat = I_compute_ref_equations(&group.photo_points,
+ group.E12, group.N12,
+ group.E21, group.N21);
+
+ return 0;
+}
Deleted: grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2target/find.c
===================================================================
--- grass/branches/develbranch_6/imagery/i.ortho.photo/i.photo.2target/find.c 2010-12-01 09:34:37 UTC (rev 44501)
+++ grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2target/find.c 2010-12-22 10:05:10 UTC (rev 44654)
@@ -1,48 +0,0 @@
-#include <stdlib.h>
-#include <unistd.h>
-#include <sys/types.h>
-#ifdef __MINGW32__
-#include <process.h>
-#else
-#include <sys/wait.h>
-#endif
-#include "globals.h"
-#include "local_proto.h"
-
-/*
- * run etc/i.find command in background to find all cell, vect files
- * in the target location.
- */
-int find_target_files(void)
-{
- int pid, w, status;
-
- select_target_env();
- pid = G_fork(); /* use G_fork() to inhibit signals */
- if (pid < 0) {
- perror("fork");
- exit(1);
- }
-
- /*
- * parent waits for child. this wait will be short since child
- * simply forks and exits. The grandchild runs in background
- * and grandma continues
- */
- if (pid) {
- while ((w = wait(&status)) != pid && w != -1) ;
- }
- else {
- char command[1024];
-
- sprintf(command, "%s/etc/i.find", G_gisbase());
- if (fork())
- exit(0); /* go into background */
- execl(command, "i.find",
- G_location(), G_mapset(),
- "cell", cell_list, "dig", vect_list, (char *)0);
- }
- select_current_env();
-
- return 0;
-}
Copied: grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2target/find.c (from rev 44501, grass/branches/develbranch_6/imagery/i.ortho.photo/i.photo.2target/find.c)
===================================================================
--- grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2target/find.c (rev 0)
+++ grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2target/find.c 2010-12-22 10:05:10 UTC (rev 44654)
@@ -0,0 +1,48 @@
+#include <stdlib.h>
+#include <unistd.h>
+#include <sys/types.h>
+#ifdef __MINGW32__
+#include <process.h>
+#else
+#include <sys/wait.h>
+#endif
+#include "globals.h"
+#include "local_proto.h"
+
+/*
+ * run etc/i.find command in background to find all cell, vect files
+ * in the target location.
+ */
+int find_target_files(void)
+{
+ int pid, w, status;
+
+ select_target_env();
+ pid = G_fork(); /* use G_fork() to inhibit signals */
+ if (pid < 0) {
+ perror("fork");
+ exit(1);
+ }
+
+ /*
+ * parent waits for child. this wait will be short since child
+ * simply forks and exits. The grandchild runs in background
+ * and grandma continues
+ */
+ if (pid) {
+ while ((w = wait(&status)) != pid && w != -1) ;
+ }
+ else {
+ char command[1024];
+
+ sprintf(command, "%s/etc/i.find", G_gisbase());
+ if (fork())
+ exit(0); /* go into background */
+ execl(command, "i.find",
+ G_location(), G_mapset(),
+ "cell", cell_list, "dig", vect_list, (char *)0);
+ }
+ select_current_env();
+
+ return 0;
+}
Deleted: grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2target/globals.h
===================================================================
--- grass/branches/develbranch_6/imagery/i.ortho.photo/i.photo.2target/globals.h 2010-12-01 09:34:37 UTC (rev 44501)
+++ grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2target/globals.h 2010-12-22 10:05:10 UTC (rev 44654)
@@ -1,86 +0,0 @@
-#include "defs.h"
-
-
-/* #define DEBUG2 1 */
-
-#ifndef GLOBAL
-# define GLOBAL extern
-# define INIT(x)
-#else
-# define INIT(x) = x
-#endif
-
-GLOBAL int SCREEN_TOP;
-GLOBAL int SCREEN_BOTTOM;
-GLOBAL int SCREEN_LEFT;
-GLOBAL int SCREEN_RIGHT;
-
-GLOBAL Window *INFO_WINDOW;
-GLOBAL Window *MENU_WINDOW;
-GLOBAL Window *PROMPT_WINDOW;
-
-GLOBAL View *VIEW_MAP1;
-GLOBAL View *VIEW_TITLE1;
-GLOBAL View *VIEW_MAP1_ZOOM;
-GLOBAL View *VIEW_TITLE1_ZOOM;
-
-GLOBAL View *VIEW_MAP2;
-GLOBAL View *VIEW_TITLE2;
-GLOBAL View *VIEW_MAP2_ZOOM;
-GLOBAL View *VIEW_TITLE2_ZOOM;
-
-GLOBAL View *VIEW_ELEV;
-GLOBAL View *VIEW_TITLE_ELEV;
-
-GLOBAL void *elevbuf;
-GLOBAL int elev;
-GLOBAL char *elev_layer;
-GLOBAL char *mapset_elev;
-
-GLOBAL View *VIEW_MENU;
-
-GLOBAL struct Ortho_Image_Group group;
-GLOBAL struct Ortho_Control_Points temp_points;
-
-GLOBAL char interrupt_char;
-GLOBAL char *tempfile1;
-GLOBAL char *tempfile2;
-GLOBAL char *tempfile_dot;
-GLOBAL char *tempfile_dot2;
-GLOBAL char *tempfile_win;
-GLOBAL char *tempfile_win2;
-GLOBAL char *tempfile_elev;
-GLOBAL char *digit_points; /* digitizer control points */
-GLOBAL int use_digitizer INIT(0); /* is there a digitizer out there? */
-
-/* group file list, target cell,vector files */
-GLOBAL char *group_list INIT(NULL);
-GLOBAL char *cell_list INIT(NULL);
-GLOBAL char *vect_list INIT(NULL);
-
-GLOBAL int from_keyboard INIT(-1); /* input method */
-GLOBAL int from_digitizer INIT(-1);
-GLOBAL int from_screen INIT(-1);
-GLOBAL int from_flag INIT(0);
-
-GLOBAL int autozoom_flag INIT(1);
-GLOBAL int autozoom_on INIT(1);
-GLOBAL int autozoom_off INIT(0);
-
-GLOBAL int dotsize INIT(4);
-
-
-GLOBAL int COLOR[10];
-
-#define BLACK COLOR[0]
-#define BLUE COLOR[1]
-#define BROWN COLOR[2]
-#define GREEN COLOR[3]
-#define GREY COLOR[4]
-#define ORANGE COLOR[5]
-#define PURPLE COLOR[6]
-#define RED COLOR[7]
-#define WHITE COLOR[8]
-#define YELLOW COLOR[9]
-
-#undef INIT
Copied: grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2target/globals.h (from rev 44501, grass/branches/develbranch_6/imagery/i.ortho.photo/i.photo.2target/globals.h)
===================================================================
--- grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2target/globals.h (rev 0)
+++ grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2target/globals.h 2010-12-22 10:05:10 UTC (rev 44654)
@@ -0,0 +1,86 @@
+#include "defs.h"
+
+
+/* #define DEBUG2 1 */
+
+#ifndef GLOBAL
+# define GLOBAL extern
+# define INIT(x)
+#else
+# define INIT(x) = x
+#endif
+
+GLOBAL int SCREEN_TOP;
+GLOBAL int SCREEN_BOTTOM;
+GLOBAL int SCREEN_LEFT;
+GLOBAL int SCREEN_RIGHT;
+
+GLOBAL Window *INFO_WINDOW;
+GLOBAL Window *MENU_WINDOW;
+GLOBAL Window *PROMPT_WINDOW;
+
+GLOBAL View *VIEW_MAP1;
+GLOBAL View *VIEW_TITLE1;
+GLOBAL View *VIEW_MAP1_ZOOM;
+GLOBAL View *VIEW_TITLE1_ZOOM;
+
+GLOBAL View *VIEW_MAP2;
+GLOBAL View *VIEW_TITLE2;
+GLOBAL View *VIEW_MAP2_ZOOM;
+GLOBAL View *VIEW_TITLE2_ZOOM;
+
+GLOBAL View *VIEW_ELEV;
+GLOBAL View *VIEW_TITLE_ELEV;
+
+GLOBAL void *elevbuf;
+GLOBAL int elev;
+GLOBAL char *elev_layer;
+GLOBAL char *mapset_elev;
+
+GLOBAL View *VIEW_MENU;
+
+GLOBAL struct Ortho_Image_Group group;
+GLOBAL struct Ortho_Control_Points temp_points;
+
+GLOBAL char interrupt_char;
+GLOBAL char *tempfile1;
+GLOBAL char *tempfile2;
+GLOBAL char *tempfile_dot;
+GLOBAL char *tempfile_dot2;
+GLOBAL char *tempfile_win;
+GLOBAL char *tempfile_win2;
+GLOBAL char *tempfile_elev;
+GLOBAL char *digit_points; /* digitizer control points */
+GLOBAL int use_digitizer INIT(0); /* is there a digitizer out there? */
+
+/* group file list, target cell,vector files */
+GLOBAL char *group_list INIT(NULL);
+GLOBAL char *cell_list INIT(NULL);
+GLOBAL char *vect_list INIT(NULL);
+
+GLOBAL int from_keyboard INIT(-1); /* input method */
+GLOBAL int from_digitizer INIT(-1);
+GLOBAL int from_screen INIT(-1);
+GLOBAL int from_flag INIT(0);
+
+GLOBAL int autozoom_flag INIT(1);
+GLOBAL int autozoom_on INIT(1);
+GLOBAL int autozoom_off INIT(0);
+
+GLOBAL int dotsize INIT(4);
+
+
+GLOBAL int COLOR[10];
+
+#define BLACK COLOR[0]
+#define BLUE COLOR[1]
+#define BROWN COLOR[2]
+#define GREEN COLOR[3]
+#define GREY COLOR[4]
+#define ORANGE COLOR[5]
+#define PURPLE COLOR[6]
+#define RED COLOR[7]
+#define WHITE COLOR[8]
+#define YELLOW COLOR[9]
+
+#undef INIT
Deleted: grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2target/graphics.c
===================================================================
--- grass/branches/develbranch_6/imagery/i.ortho.photo/i.photo.2target/graphics.c 2010-12-01 09:34:37 UTC (rev 44501)
+++ grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2target/graphics.c 2010-12-22 10:05:10 UTC (rev 44654)
@@ -1,139 +0,0 @@
-#include <grass/raster.h>
-#include <grass/display.h>
-#include "globals.h"
-#include "local_proto.h"
-
-static View *makeview(double bottom, double top, double left, double right)
-{
- View *view;
-
- view = (View *) G_malloc(sizeof(View));
-
- top = 100 - top;
- bottom = 100 - bottom;
-
- view->top = SCREEN_TOP + (SCREEN_BOTTOM - SCREEN_TOP) * top / 100.0;
- view->bottom = SCREEN_TOP + (SCREEN_BOTTOM - SCREEN_TOP) * bottom / 100.0;
- view->left = SCREEN_LEFT + (SCREEN_RIGHT - SCREEN_LEFT) * left / 100.0;
- view->right = SCREEN_LEFT + (SCREEN_RIGHT - SCREEN_LEFT) * right / 100.0;
-
- if (view->top < SCREEN_TOP)
- view->top = SCREEN_TOP;
- if (view->bottom > SCREEN_BOTTOM)
- view->bottom = SCREEN_BOTTOM;
- if (view->left < SCREEN_LEFT)
- view->left = SCREEN_LEFT;
- if (view->right > SCREEN_RIGHT)
- view->right = SCREEN_RIGHT;
-
- Outline_box(view->top, view->bottom, view->left, view->right);
-
- view->top++;
- view->bottom--;
- view->left++;
- view->right--;
-
- view->nrows = view->bottom - view->top + 1;
- view->ncols = view->right - view->left + 1;
- view->cell.configured = 0;
-
- return view;
-}
-
-int Init_graphics(void)
-{
- /* Dclearscreen(); */
- D_full_screen();
-
- SCREEN_TOP = R_screen_top();
- SCREEN_BOTTOM = R_screen_bot();
- SCREEN_LEFT = R_screen_left();
- SCREEN_RIGHT = R_screen_rite();
-
-
- BLACK = D_translate_color("black");
- BLUE = D_translate_color("blue");
- BROWN = D_translate_color("brown");
- GREEN = D_translate_color("green");
- GREY = D_translate_color("grey");
- ORANGE = D_translate_color("orange");
- PURPLE = D_translate_color("purple");
- RED = D_translate_color("red");
- WHITE = D_translate_color("white");
- YELLOW = D_translate_color("yellow");
-
- R_standard_color(WHITE);
-
- VIEW_TITLE1 = makeview(97.5, 100.0, 0.0, 50.0);
- VIEW_TITLE2 = makeview(97.5, 100.0, 50.0, 100.0);
- VIEW_MAP1 = makeview(51.0, 97.5, 0.0, 50.0);
- VIEW_MAP2 = makeview(51.0, 97.5, 50.0, 100.0);
- VIEW_TITLE1_ZOOM = makeview(47.5, 51.0, 0.0, 50.0);
- VIEW_TITLE2_ZOOM = makeview(47.5, 51.0, 50.0, 100.0);
- VIEW_MAP1_ZOOM = makeview(2.5, 47.5, 0.0, 50.0);
- VIEW_MAP2_ZOOM = makeview(2.5, 47.5, 50.0, 100.0);
- VIEW_MENU = makeview(0.0, 2.5, 0.0, 100.0);
-
- /* suppress color allocation warnings */
- G_suppress_warnings(1);
- G_init_colors(&VIEW_MAP1->cell.colors);
- G_init_colors(&VIEW_MAP2->cell.colors);
- G_suppress_warnings(0);
-
- return 0;
-}
-
-int Outline_box(int top, int bottom, int left, int right)
-{
- R_move_abs(left, top);
- R_cont_abs(left, bottom);
- R_cont_abs(right, bottom);
- R_cont_abs(right, top);
- R_cont_abs(left, top);
-
- return 0;
-}
-
-int Text_width(char *text)
-{
- int top, bottom, left, right;
-
- R_get_text_box(text, &top, &bottom, &left, &right);
-
- if (right > left)
- return right - left + 1;
- else
- return left - right + 1;
-}
-
-int Text(char *text, int top, int bottom, int left, int right, int the_border)
-{
- R_set_window(top, bottom, left, right);
- R_move_abs(left + the_border, bottom - the_border);
- R_text(text);
- R_set_window(SCREEN_TOP, SCREEN_BOTTOM, SCREEN_LEFT, SCREEN_RIGHT);
-
- return 0;
-}
-
-int Uparrow(int top, int bottom, int left, int right)
-{
- R_move_abs((left + right) / 2, bottom);
- R_cont_abs((left + right) / 2, top);
- R_cont_rel((left - right) / 2, (bottom - top) / 2);
- R_move_abs((left + right) / 2, top);
- R_cont_rel((right - left) / 2, (bottom - top) / 2);
-
- return 0;
-}
-
-int Downarrow(int top, int bottom, int left, int right)
-{
- R_move_abs((left + right) / 2, top);
- R_cont_abs((left + right) / 2, bottom);
- R_cont_rel((left - right) / 2, (top - bottom) / 2);
- R_move_abs((left + right) / 2, bottom);
- R_cont_rel((right - left) / 2, (top - bottom) / 2);
-
- return 0;
-}
Copied: grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2target/graphics.c (from rev 44501, grass/branches/develbranch_6/imagery/i.ortho.photo/i.photo.2target/graphics.c)
===================================================================
--- grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2target/graphics.c (rev 0)
+++ grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2target/graphics.c 2010-12-22 10:05:10 UTC (rev 44654)
@@ -0,0 +1,139 @@
+#include <grass/raster.h>
+#include <grass/display.h>
+#include "globals.h"
+#include "local_proto.h"
+
+static View *makeview(double bottom, double top, double left, double right)
+{
+ View *view;
+
+ view = (View *) G_malloc(sizeof(View));
+
+ top = 100 - top;
+ bottom = 100 - bottom;
+
+ view->top = SCREEN_TOP + (SCREEN_BOTTOM - SCREEN_TOP) * top / 100.0;
+ view->bottom = SCREEN_TOP + (SCREEN_BOTTOM - SCREEN_TOP) * bottom / 100.0;
+ view->left = SCREEN_LEFT + (SCREEN_RIGHT - SCREEN_LEFT) * left / 100.0;
+ view->right = SCREEN_LEFT + (SCREEN_RIGHT - SCREEN_LEFT) * right / 100.0;
+
+ if (view->top < SCREEN_TOP)
+ view->top = SCREEN_TOP;
+ if (view->bottom > SCREEN_BOTTOM)
+ view->bottom = SCREEN_BOTTOM;
+ if (view->left < SCREEN_LEFT)
+ view->left = SCREEN_LEFT;
+ if (view->right > SCREEN_RIGHT)
+ view->right = SCREEN_RIGHT;
+
+ Outline_box(view->top, view->bottom, view->left, view->right);
+
+ view->top++;
+ view->bottom--;
+ view->left++;
+ view->right--;
+
+ view->nrows = view->bottom - view->top + 1;
+ view->ncols = view->right - view->left + 1;
+ view->cell.configured = 0;
+
+ return view;
+}
+
+int Init_graphics(void)
+{
+ /* Dclearscreen(); */
+ D_full_screen();
+
+ SCREEN_TOP = R_screen_top();
+ SCREEN_BOTTOM = R_screen_bot();
+ SCREEN_LEFT = R_screen_left();
+ SCREEN_RIGHT = R_screen_rite();
+
+
+ BLACK = D_translate_color("black");
+ BLUE = D_translate_color("blue");
+ BROWN = D_translate_color("brown");
+ GREEN = D_translate_color("green");
+ GREY = D_translate_color("grey");
+ ORANGE = D_translate_color("orange");
+ PURPLE = D_translate_color("purple");
+ RED = D_translate_color("red");
+ WHITE = D_translate_color("white");
+ YELLOW = D_translate_color("yellow");
+
+ R_standard_color(WHITE);
+
+ VIEW_TITLE1 = makeview(97.5, 100.0, 0.0, 50.0);
+ VIEW_TITLE2 = makeview(97.5, 100.0, 50.0, 100.0);
+ VIEW_MAP1 = makeview(51.0, 97.5, 0.0, 50.0);
+ VIEW_MAP2 = makeview(51.0, 97.5, 50.0, 100.0);
+ VIEW_TITLE1_ZOOM = makeview(47.5, 51.0, 0.0, 50.0);
+ VIEW_TITLE2_ZOOM = makeview(47.5, 51.0, 50.0, 100.0);
+ VIEW_MAP1_ZOOM = makeview(2.5, 47.5, 0.0, 50.0);
+ VIEW_MAP2_ZOOM = makeview(2.5, 47.5, 50.0, 100.0);
+ VIEW_MENU = makeview(0.0, 2.5, 0.0, 100.0);
+
+ /* suppress color allocation warnings */
+ G_suppress_warnings(1);
+ G_init_colors(&VIEW_MAP1->cell.colors);
+ G_init_colors(&VIEW_MAP2->cell.colors);
+ G_suppress_warnings(0);
+
+ return 0;
+}
+
+int Outline_box(int top, int bottom, int left, int right)
+{
+ R_move_abs(left, top);
+ R_cont_abs(left, bottom);
+ R_cont_abs(right, bottom);
+ R_cont_abs(right, top);
+ R_cont_abs(left, top);
+
+ return 0;
+}
+
+int Text_width(char *text)
+{
+ int top, bottom, left, right;
+
+ R_get_text_box(text, &top, &bottom, &left, &right);
+
+ if (right > left)
+ return right - left + 1;
+ else
+ return left - right + 1;
+}
+
+int Text(char *text, int top, int bottom, int left, int right, int the_border)
+{
+ R_set_window(top, bottom, left, right);
+ R_move_abs(left + the_border, bottom - the_border);
+ R_text(text);
+ R_set_window(SCREEN_TOP, SCREEN_BOTTOM, SCREEN_LEFT, SCREEN_RIGHT);
+
+ return 0;
+}
+
+int Uparrow(int top, int bottom, int left, int right)
+{
+ R_move_abs((left + right) / 2, bottom);
+ R_cont_abs((left + right) / 2, top);
+ R_cont_rel((left - right) / 2, (bottom - top) / 2);
+ R_move_abs((left + right) / 2, top);
+ R_cont_rel((right - left) / 2, (bottom - top) / 2);
+
+ return 0;
+}
+
+int Downarrow(int top, int bottom, int left, int right)
+{
+ R_move_abs((left + right) / 2, top);
+ R_cont_abs((left + right) / 2, bottom);
+ R_cont_rel((left - right) / 2, (top - bottom) / 2);
+ R_move_abs((left + right) / 2, bottom);
+ R_cont_rel((right - left) / 2, (top - bottom) / 2);
+
+ return 0;
+}
Deleted: grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2target/group.c
===================================================================
--- grass/branches/develbranch_6/imagery/i.ortho.photo/i.photo.2target/group.c 2010-12-01 09:34:37 UTC (rev 44501)
+++ grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2target/group.c 2010-12-22 10:05:10 UTC (rev 44654)
@@ -1,70 +0,0 @@
-#include <string.h>
-#include <stdlib.h>
-#include "globals.h"
-#include "local_proto.h"
-
-static int cmp(const void *, const void *);
-
-int prepare_group_list(void)
-{
- FILE *fd;
- int *idx;
- int n;
- int len, len1, len2;
-
- /* open file to store group file names */
- fd = fopen(group_list, "w");
- if (fd == NULL)
- G_fatal_error("Can't open any tempfiles");
-
- /*
- * build sorted index into group files
- * so that all raster maps for a mapset to appear together
- */
- idx = (int *)G_calloc(group.group_ref.nfiles, sizeof(int));
- for (n = 0; n < group.group_ref.nfiles; n++)
- idx[n] = n;
- qsort(idx, group.group_ref.nfiles, sizeof(int), cmp);
-
- /* determine length of longest mapset name, and longest raster map name */
- len1 = len2 = 0;
- for (n = 0; n < group.group_ref.nfiles; n++) {
- len = strlen(group.group_ref.file[n].name);
- if (len > len1)
- len1 = len;
- len = strlen(group.group_ref.file[n].mapset);
- if (len > len2)
- len2 = len;
- }
-
- /* write lengths, names to file */
- fwrite(&len1, sizeof(len1), 1, fd);
- fwrite(&len2, sizeof(len2), 1, fd);
- for (n = 0; n < group.group_ref.nfiles; n++)
- fprintf(fd, "%s %s\n", group.group_ref.file[idx[n]].name,
- group.group_ref.file[idx[n]].mapset);
- fclose(fd);
-
- G_free(idx);
-
- return 0;
-}
-
-static int cmp(const void *aa, const void *bb)
-{
- const int *a = aa, *b = bb;
- int n;
-
- if ((n =
- strcmp(group.group_ref.file[*a].mapset,
- group.group_ref.file[*b].mapset)) != 0)
- return n;
- return strcmp(group.group_ref.file[*a].name,
- group.group_ref.file[*b].name);
-}
-
-/* ask the user to pick a file */
-int choose_groupfile(char *name, char *mapset)
-{
- return ask_gis_files("cell", group_list, name, mapset, -1);
-}
Copied: grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2target/group.c (from rev 44501, grass/branches/develbranch_6/imagery/i.ortho.photo/i.photo.2target/group.c)
===================================================================
--- grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2target/group.c (rev 0)
+++ grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2target/group.c 2010-12-22 10:05:10 UTC (rev 44654)
@@ -0,0 +1,70 @@
+#include <string.h>
+#include <stdlib.h>
+#include "globals.h"
+#include "local_proto.h"
+
+static int cmp(const void *, const void *);
+
+int prepare_group_list(void)
+{
+ FILE *fd;
+ int *idx;
+ int n;
+ int len, len1, len2;
+
+ /* open file to store group file names */
+ fd = fopen(group_list, "w");
+ if (fd == NULL)
+ G_fatal_error("Can't open any tempfiles");
+
+ /*
+ * build sorted index into group files
+ * so that all raster maps for a mapset to appear together
+ */
+ idx = (int *)G_calloc(group.group_ref.nfiles, sizeof(int));
+ for (n = 0; n < group.group_ref.nfiles; n++)
+ idx[n] = n;
+ qsort(idx, group.group_ref.nfiles, sizeof(int), cmp);
+
+ /* determine length of longest mapset name, and longest raster map name */
+ len1 = len2 = 0;
+ for (n = 0; n < group.group_ref.nfiles; n++) {
+ len = strlen(group.group_ref.file[n].name);
+ if (len > len1)
+ len1 = len;
+ len = strlen(group.group_ref.file[n].mapset);
+ if (len > len2)
+ len2 = len;
+ }
+
+ /* write lengths, names to file */
+ fwrite(&len1, sizeof(len1), 1, fd);
+ fwrite(&len2, sizeof(len2), 1, fd);
+ for (n = 0; n < group.group_ref.nfiles; n++)
+ fprintf(fd, "%s %s\n", group.group_ref.file[idx[n]].name,
+ group.group_ref.file[idx[n]].mapset);
+ fclose(fd);
+
+ G_free(idx);
+
+ return 0;
+}
+
+static int cmp(const void *aa, const void *bb)
+{
+ const int *a = aa, *b = bb;
+ int n;
+
+ if ((n =
+ strcmp(group.group_ref.file[*a].mapset,
+ group.group_ref.file[*b].mapset)) != 0)
+ return n;
+ return strcmp(group.group_ref.file[*a].name,
+ group.group_ref.file[*b].name);
+}
+
+/* ask the user to pick a file */
+int choose_groupfile(char *name, char *mapset)
+{
+ return ask_gis_files("cell", group_list, name, mapset, -1);
+}
Deleted: grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2target/input.c
===================================================================
--- grass/branches/develbranch_6/imagery/i.ortho.photo/i.photo.2target/input.c 2010-12-01 09:34:37 UTC (rev 44501)
+++ grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2target/input.c 2010-12-22 10:05:10 UTC (rev 44654)
@@ -1,262 +0,0 @@
-#include <grass/raster.h>
-#include "globals.h"
-#include "local_proto.h"
-
-static int active = 0;
-static int replot;
-
-#define TEXT_COLOR BLACK
-#define FILL_COLOR GREY
-#define OUTLINE_COLOR WHITE
-
-static int mouse(Objects *, int, int, int);
-static int use_mouse_msg(void);
-static int draw_objects(Objects *);
-static Objects *find(Objects *, int, int);
-static int select_option(Objects *, Objects *);
-static int draw_option_boxes(Objects *);
-static int visible(Objects *);
-
-/* Input: drive mouse. returns status of handler that returns != 0 */
-int Input_pointer(Objects * objects)
-{
- return mouse(objects, 0, 0, 0);
-}
-
-int Input_box(Objects * objects, int ax, int ay)
-{
- return mouse(objects, ax, ay, 1);
-}
-
-int Input_other(int (*function) (void), char *type)
-{
- int stat;
- char msg[1024];
-
- sprintf(msg, "%s input required", type);
- Menu_msg(msg);
- stat = (*function) ();
- if (active)
- use_mouse_msg();
-
- return stat;
-}
-
-static int mouse(Objects * objects, int ax, int ay, int box)
-{
- int first;
- int stat;
- int x, y, button;
- Objects *obj;
-
- first = !active;
- active = 1;
- if (first)
- use_mouse_msg();
-
- if (box) {
- x = ax + 20;
- y = ay + 20;
- }
- stat = 0;
- replot = 1;
- while (stat == 0) {
- if (replot) {
- replot = 0;
- draw_objects(objects);
- }
- R_stabilize();
- if (box)
- Mouse_box_anchored(ax, ay, &x, &y, &button);
- else
- Mouse_pointer(&x, &y, &button);
-
- if (!(obj = find(objects, x, y)))
- continue;
-
- switch (obj->type) {
- case MENU_OBJECT:
- case OTHER_OBJECT:
- stat = (*obj->handler) (x, y, button);
- break;
- case OPTION_OBJECT:
- select_option(objects, obj);
- draw_option_boxes(objects);
- break;
- }
- }
-
- /* if we are first call, mark not active
- * indicate that objects above use must be replotted.
- */
- if (first)
- active = 0;
- Menu_msg("");
-
- return stat;
-}
-
-
-static int use_mouse_msg(void)
-{
- Curses_write_window(PROMPT_WINDOW, 1, 1, "Use mouse now ...\n");
-
- return 0;
-}
-
-static int draw_objects(Objects * objects)
-{
- Objects *obj;
- int top, bottom, left, right;
- int size, edge;
-
-
- /* erase the menu window */
- Erase_view(VIEW_MENU);
- R_flush();
-
- /* determine sizes and text indentation */
- size = VIEW_MENU->nrows - 4;
- edge = 2;
-
- R_text_size(size, size);
-
- left = VIEW_MENU->left;
- top = VIEW_MENU->top;
- bottom = VIEW_MENU->bottom;
-
-
- /* put the (boxed) text on the menu view */
- for (obj = objects; obj->type; obj++) {
- if (!visible(obj))
- continue;
- switch (obj->type) {
- case OPTION_OBJECT:
- case MENU_OBJECT:
- right = left + 2 * edge + Text_width(obj->label);
- obj->left = left;
- obj->right = right;
- obj->top = top;
- obj->bottom = bottom;
-
- R_standard_color(FILL_COLOR);
- R_box_abs(left, top, right, bottom);
-
- R_standard_color(TEXT_COLOR);
- Text(obj->label, top, bottom, left, right, edge);
-
- R_standard_color(OUTLINE_COLOR);
- Outline_box(top, bottom, left, right);
-
- left = right;
- break;
-
- case INFO_OBJECT:
- if (*obj->label == 0)
- break;
- if (*obj->status < 0)
- break;
- right = left + 2 * edge + Text_width(obj->label);
- R_standard_color(WHITE);
- Text(obj->label, top, bottom, left, right, edge);
-
- left = right;
- break;
- }
- }
- draw_option_boxes(objects);
- R_flush();
-
- return 0;
-}
-
-static Objects *find(Objects * objects, int x, int y)
-{
- Objects *other;
-
- other = NULL;
- for (; objects->type; objects++) {
- if (!visible(objects))
- continue;
- switch (objects->type) {
- case MENU_OBJECT:
- case OPTION_OBJECT:
- if (x >= objects->left && x <= objects->right
- && y >= objects->top && y <= objects->bottom)
- return objects;
- break;
- case OTHER_OBJECT:
- other = objects;
- break;
- }
- }
- return other;
-}
-
-static int select_option(Objects * objects, Objects * obj)
-{
- while (objects->type) {
- if (objects->type == OPTION_OBJECT && *objects->status >= 0 &&
- objects->binding == obj->binding)
- *objects->status = 0;
- objects++;
- }
- *obj->status = 1;
-
- return 0;
-}
-
-static int draw_option_boxes(Objects * objects)
-{
- Objects *x;
-
- R_standard_color(OUTLINE_COLOR);
- for (x = objects; x->type; x++) {
- if (x->type == OPTION_OBJECT && *x->status == 0)
- Outline_box(x->top +1, x->bottom, x->left, x->right -1);
- }
- R_standard_color(GREEN);
- for (x = objects; x->type; x++) {
- if (x->type == OPTION_OBJECT && *x->status > 0)
- Outline_box(x->top +1, x->bottom, x->left, x->right -1);
- }
- R_flush();
-
- return 0;
-}
-
-static int visible(Objects * object)
-{
- if (object->type == OPTION_OBJECT)
- return (*object->status >= 0);
- return (*object->status > 0);
-}
-
-int Menu_msg(char *msg)
-{
- int size, edge;
-
- size = VIEW_MENU->nrows - 4;
- edge = 2;
-
- Erase_view(VIEW_MENU);
-
- if (*msg) {
- R_text_size(size, size);
- R_standard_color(WHITE);
- Text(msg, VIEW_MENU->top, VIEW_MENU->bottom,
- VIEW_MENU->left, VIEW_MENU->right, edge);
- }
- R_flush();
- replot = 1;
-
- return 0;
-}
-
-int Start_mouse_in_menu(void)
-{
- Set_mouse_xy((VIEW_MENU->left + 2 * VIEW_MENU->right) / 3,
- (VIEW_MENU->top + VIEW_MENU->bottom) / 2);
-
- return 0;
-}
Copied: grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2target/input.c (from rev 44501, grass/branches/develbranch_6/imagery/i.ortho.photo/i.photo.2target/input.c)
===================================================================
--- grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2target/input.c (rev 0)
+++ grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2target/input.c 2010-12-22 10:05:10 UTC (rev 44654)
@@ -0,0 +1,262 @@
+#include <grass/raster.h>
+#include "globals.h"
+#include "local_proto.h"
+
+static int active = 0;
+static int replot;
+
+#define TEXT_COLOR BLACK
+#define FILL_COLOR GREY
+#define OUTLINE_COLOR WHITE
+
+static int mouse(Objects *, int, int, int);
+static int use_mouse_msg(void);
+static int draw_objects(Objects *);
+static Objects *find(Objects *, int, int);
+static int select_option(Objects *, Objects *);
+static int draw_option_boxes(Objects *);
+static int visible(Objects *);
+
+/* Input: drive mouse. returns status of handler that returns != 0 */
+int Input_pointer(Objects * objects)
+{
+ return mouse(objects, 0, 0, 0);
+}
+
+int Input_box(Objects * objects, int ax, int ay)
+{
+ return mouse(objects, ax, ay, 1);
+}
+
+int Input_other(int (*function) (void), char *type)
+{
+ int stat;
+ char msg[1024];
+
+ sprintf(msg, "%s input required", type);
+ Menu_msg(msg);
+ stat = (*function) ();
+ if (active)
+ use_mouse_msg();
+
+ return stat;
+}
+
+static int mouse(Objects * objects, int ax, int ay, int box)
+{
+ int first;
+ int stat;
+ int x, y, button;
+ Objects *obj;
+
+ first = !active;
+ active = 1;
+ if (first)
+ use_mouse_msg();
+
+ if (box) {
+ x = ax + 20;
+ y = ay + 20;
+ }
+ stat = 0;
+ replot = 1;
+ while (stat == 0) {
+ if (replot) {
+ replot = 0;
+ draw_objects(objects);
+ }
+ R_stabilize();
+ if (box)
+ Mouse_box_anchored(ax, ay, &x, &y, &button);
+ else
+ Mouse_pointer(&x, &y, &button);
+
+ if (!(obj = find(objects, x, y)))
+ continue;
+
+ switch (obj->type) {
+ case MENU_OBJECT:
+ case OTHER_OBJECT:
+ stat = (*obj->handler) (x, y, button);
+ break;
+ case OPTION_OBJECT:
+ select_option(objects, obj);
+ draw_option_boxes(objects);
+ break;
+ }
+ }
+
+ /* if we are first call, mark not active
+ * indicate that objects above use must be replotted.
+ */
+ if (first)
+ active = 0;
+ Menu_msg("");
+
+ return stat;
+}
+
+
+static int use_mouse_msg(void)
+{
+ Curses_write_window(PROMPT_WINDOW, 1, 1, "Use mouse now ...\n");
+
+ return 0;
+}
+
+static int draw_objects(Objects * objects)
+{
+ Objects *obj;
+ int top, bottom, left, right;
+ int size, edge;
+
+
+ /* erase the menu window */
+ Erase_view(VIEW_MENU);
+ R_flush();
+
+ /* determine sizes and text indentation */
+ size = VIEW_MENU->nrows - 4;
+ edge = 2;
+
+ R_text_size(size, size);
+
+ left = VIEW_MENU->left;
+ top = VIEW_MENU->top;
+ bottom = VIEW_MENU->bottom;
+
+
+ /* put the (boxed) text on the menu view */
+ for (obj = objects; obj->type; obj++) {
+ if (!visible(obj))
+ continue;
+ switch (obj->type) {
+ case OPTION_OBJECT:
+ case MENU_OBJECT:
+ right = left + 2 * edge + Text_width(obj->label);
+ obj->left = left;
+ obj->right = right;
+ obj->top = top;
+ obj->bottom = bottom;
+
+ R_standard_color(FILL_COLOR);
+ R_box_abs(left, top, right, bottom);
+
+ R_standard_color(TEXT_COLOR);
+ Text(obj->label, top, bottom, left, right, edge);
+
+ R_standard_color(OUTLINE_COLOR);
+ Outline_box(top, bottom, left, right);
+
+ left = right;
+ break;
+
+ case INFO_OBJECT:
+ if (*obj->label == 0)
+ break;
+ if (*obj->status < 0)
+ break;
+ right = left + 2 * edge + Text_width(obj->label);
+ R_standard_color(WHITE);
+ Text(obj->label, top, bottom, left, right, edge);
+
+ left = right;
+ break;
+ }
+ }
+ draw_option_boxes(objects);
+ R_flush();
+
+ return 0;
+}
+
+static Objects *find(Objects * objects, int x, int y)
+{
+ Objects *other;
+
+ other = NULL;
+ for (; objects->type; objects++) {
+ if (!visible(objects))
+ continue;
+ switch (objects->type) {
+ case MENU_OBJECT:
+ case OPTION_OBJECT:
+ if (x >= objects->left && x <= objects->right
+ && y >= objects->top && y <= objects->bottom)
+ return objects;
+ break;
+ case OTHER_OBJECT:
+ other = objects;
+ break;
+ }
+ }
+ return other;
+}
+
+static int select_option(Objects * objects, Objects * obj)
+{
+ while (objects->type) {
+ if (objects->type == OPTION_OBJECT && *objects->status >= 0 &&
+ objects->binding == obj->binding)
+ *objects->status = 0;
+ objects++;
+ }
+ *obj->status = 1;
+
+ return 0;
+}
+
+static int draw_option_boxes(Objects * objects)
+{
+ Objects *x;
+
+ R_standard_color(OUTLINE_COLOR);
+ for (x = objects; x->type; x++) {
+ if (x->type == OPTION_OBJECT && *x->status == 0)
+ Outline_box(x->top +1, x->bottom, x->left, x->right -1);
+ }
+ R_standard_color(GREEN);
+ for (x = objects; x->type; x++) {
+ if (x->type == OPTION_OBJECT && *x->status > 0)
+ Outline_box(x->top +1, x->bottom, x->left, x->right -1);
+ }
+ R_flush();
+
+ return 0;
+}
+
+static int visible(Objects * object)
+{
+ if (object->type == OPTION_OBJECT)
+ return (*object->status >= 0);
+ return (*object->status > 0);
+}
+
+int Menu_msg(char *msg)
+{
+ int size, edge;
+
+ size = VIEW_MENU->nrows - 4;
+ edge = 2;
+
+ Erase_view(VIEW_MENU);
+
+ if (*msg) {
+ R_text_size(size, size);
+ R_standard_color(WHITE);
+ Text(msg, VIEW_MENU->top, VIEW_MENU->bottom,
+ VIEW_MENU->left, VIEW_MENU->right, edge);
+ }
+ R_flush();
+ replot = 1;
+
+ return 0;
+}
+
+int Start_mouse_in_menu(void)
+{
+ Set_mouse_xy((VIEW_MENU->left + 2 * VIEW_MENU->right) / 3,
+ (VIEW_MENU->top + VIEW_MENU->bottom) / 2);
+
+ return 0;
+}
Deleted: grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2target/local_proto.h
===================================================================
--- grass/branches/develbranch_6/imagery/i.ortho.photo/i.photo.2target/local_proto.h 2010-12-01 09:34:37 UTC (rev 44501)
+++ grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2target/local_proto.h 2010-12-22 10:05:10 UTC (rev 44654)
@@ -1,142 +0,0 @@
-/* analyze.c */
-int analyze(void);
-
-/* ask.c */
-int ask_gis_files(char *, char *, char *, char *, int);
-
-/* ask_mag.c */
-int ask_magnification(int *);
-int draw_mag(void);
-
-/* call.c */
-int call(int (*)(void), char *);
-
-/* cell.c */
-int plotcell(int, int);
-
-/* cellhd.c */
-int Outline_cellhd(View *, struct Cell_head *);
-void Save_cellhd(View * view, struct Cell_head *cellhd, char *file);
-
-/* colors.c */
-int set_colors(struct Colors *);
-
-/* conv.c */
-int view_to_col(View *, int);
-int view_to_row(View *, int);
-int col_to_view(View *, int);
-int row_to_view(View *, int);
-double row_to_northing(struct Cell_head *, int, double);
-double col_to_easting(struct Cell_head *, int, double);
-double northing_to_row(struct Cell_head *, double);
-double easting_to_col(struct Cell_head *, double);
-
-/* curses.c */
-int Begin_curses(void);
-int End_curses(void);
-int Suspend_curses(void);
-int Resume_curses(void);
-int Curses_allow_interrupts(int);
-int Curses_clear_window(Window *);
-int Curses_outline_window(Window *);
-int Curses_write_window(Window *, int, int, char *);
-int Curses_replot_screen(void);
-int Curses_prompt_gets(char *, char *);
-int Beep(void);
-int Curses_getch(int);
-
-/* digit.c */
-int setup_digitizer(void);
-int digitizer_point(double *, double *);
-
-/* dot.c */
-int dot(int, int);
-int save_under_dot(int, int, char *);
-int restore_under_dot(char *);
-int release_under_dot(char *);
-
-/* drawcell.c */
-int drawcell(View *);
-
-/* driver.c */
-int driver(void);
-
-/* equ.c */
-int Compute_ortho_equation(void);
-int Compute_ref_equation(void);
-
-/* find.c */
-int find_target_files(void);
-
-/* graphics.c */
-int Init_graphics(void);
-int Outline_box(int, int, int, int);
-int Text_width(char *);
-int Text(char *, int, int, int, int, int);
-int Uparrow(int, int, int, int);
-int Downarrow(int, int, int, int);
-
-/* group.c */
-int prepare_group_list(void);
-int choose_groupfile(char *, char *);
-
-/* input.c */
-int Input_pointer(Objects *);
-int Input_box(Objects *, int, int);
-int Input_other(int (*)(void), char *);
-int Menu_msg(char *);
-int Start_mouse_in_menu(void);
-
-/* main.c */
-#ifdef __GNUC_MINOR__
-int quit(int) __attribute__ ((__noreturn__));
-#else
-int quit(int);
-#endif
-int error(const char *, int);
-
-/* mark.c */
-int mark(int, int, int);
-int mark_point(View *, int, int);
-int get_z_from_cell(double, double);
-int get_z_from_cell2(double, double, double *);
-
-/* mouse.c */
-int Mouse_pointer(int *, int *, int *);
-int Mouse_box_anchored(int, int, int *, int *, int *);
-int Get_mouse_xy(int *, int *);
-int Set_mouse_xy(int, int);
-
-/* points.c */
-int display_conz_points(int);
-int display_conz_points_in_view(View *, int, double *, double *, int *, int);
-int display_one_point(View *, double, double);
-
-/* target.c */
-int get_target(void);
-int select_current_env(void);
-int select_target_env(void);
-
-/* title.c */
-int display_title(View *);
-
-/* view.c */
-int Configure_view(View *, char *, char *, double, double);
-int In_view(View *, int, int);
-int Erase_view(View *);
-double magnification(View *);
-
-/* where.c */
-int where(int, int);
-
-/* zoom.c */
-int zoom(void);
-void auto_zoom(void);
-
-/* zoom_box.c */
-int zoom_box(void);
-int zoom_box1(int, int);
-
-/* zoom_pnt.c */
-int zoom_point(void);
-int zoom_point2(int, int, int, double);
Copied: grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2target/local_proto.h (from rev 44501, grass/branches/develbranch_6/imagery/i.ortho.photo/i.photo.2target/local_proto.h)
===================================================================
--- grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2target/local_proto.h (rev 0)
+++ grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2target/local_proto.h 2010-12-22 10:05:10 UTC (rev 44654)
@@ -0,0 +1,142 @@
+/* analyze.c */
+int analyze(void);
+
+/* ask.c */
+int ask_gis_files(char *, char *, char *, char *, int);
+
+/* ask_mag.c */
+int ask_magnification(int *);
+int draw_mag(void);
+
+/* call.c */
+int call(int (*)(void), char *);
+
+/* cell.c */
+int plotcell(int, int);
+
+/* cellhd.c */
+int Outline_cellhd(View *, struct Cell_head *);
+void Save_cellhd(View * view, struct Cell_head *cellhd, char *file);
+
+/* colors.c */
+int set_colors(struct Colors *);
+
+/* conv.c */
+int view_to_col(View *, int);
+int view_to_row(View *, int);
+int col_to_view(View *, int);
+int row_to_view(View *, int);
+double row_to_northing(struct Cell_head *, int, double);
+double col_to_easting(struct Cell_head *, int, double);
+double northing_to_row(struct Cell_head *, double);
+double easting_to_col(struct Cell_head *, double);
+
+/* curses.c */
+int Begin_curses(void);
+int End_curses(void);
+int Suspend_curses(void);
+int Resume_curses(void);
+int Curses_allow_interrupts(int);
+int Curses_clear_window(Window *);
+int Curses_outline_window(Window *);
+int Curses_write_window(Window *, int, int, char *);
+int Curses_replot_screen(void);
+int Curses_prompt_gets(char *, char *);
+int Beep(void);
+int Curses_getch(int);
+
+/* digit.c */
+int setup_digitizer(void);
+int digitizer_point(double *, double *);
+
+/* dot.c */
+int dot(int, int);
+int save_under_dot(int, int, char *);
+int restore_under_dot(char *);
+int release_under_dot(char *);
+
+/* drawcell.c */
+int drawcell(View *);
+
+/* driver.c */
+int driver(void);
+
+/* equ.c */
+int Compute_ortho_equation(void);
+int Compute_ref_equation(void);
+
+/* find.c */
+int find_target_files(void);
+
+/* graphics.c */
+int Init_graphics(void);
+int Outline_box(int, int, int, int);
+int Text_width(char *);
+int Text(char *, int, int, int, int, int);
+int Uparrow(int, int, int, int);
+int Downarrow(int, int, int, int);
+
+/* group.c */
+int prepare_group_list(void);
+int choose_groupfile(char *, char *);
+
+/* input.c */
+int Input_pointer(Objects *);
+int Input_box(Objects *, int, int);
+int Input_other(int (*)(void), char *);
+int Menu_msg(char *);
+int Start_mouse_in_menu(void);
+
+/* main.c */
+#ifdef __GNUC_MINOR__
+int quit(int) __attribute__ ((__noreturn__));
+#else
+int quit(int);
+#endif
+int error(const char *, int);
+
+/* mark.c */
+int mark(int, int, int);
+int mark_point(View *, int, int);
+int get_z_from_cell(double, double);
+int get_z_from_cell2(double, double, double *);
+
+/* mouse.c */
+int Mouse_pointer(int *, int *, int *);
+int Mouse_box_anchored(int, int, int *, int *, int *);
+int Get_mouse_xy(int *, int *);
+int Set_mouse_xy(int, int);
+
+/* points.c */
+int display_conz_points(int);
+int display_conz_points_in_view(View *, int, double *, double *, int *, int);
+int display_one_point(View *, double, double);
+
+/* target.c */
+int get_target(void);
+int select_current_env(void);
+int select_target_env(void);
+
+/* title.c */
+int display_title(View *);
+
+/* view.c */
+int Configure_view(View *, char *, char *, double, double);
+int In_view(View *, int, int);
+int Erase_view(View *);
+double magnification(View *);
+
+/* where.c */
+int where(int, int);
+
+/* zoom.c */
+int zoom(void);
+void auto_zoom(void);
+
+/* zoom_box.c */
+int zoom_box(void);
+int zoom_box1(int, int);
+
+/* zoom_pnt.c */
+int zoom_point(void);
+int zoom_point2(int, int, int, double);
Deleted: grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2target/main.c
===================================================================
--- grass/branches/develbranch_6/imagery/i.ortho.photo/i.photo.2target/main.c 2010-12-01 09:34:37 UTC (rev 44501)
+++ grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2target/main.c 2010-12-22 10:05:10 UTC (rev 44654)
@@ -1,313 +0,0 @@
-
-/****************************************************************************
- *
- * MODULE: i.photo.2target
- * AUTHOR(S): Mike Baba, DBA Systems, Inc. (original contributor)
- * Markus Neteler <neteler itc.it>,
- * Bernhard Reiter <bernhard intevation.de>,
- * Glynn Clements <glynn gclements.plus.com>,
- * Radim Blazek <radim.blazek gmail.com>
- * Hamish Bowman
- *
- * PURPOSE: Allow user to mark control points on an image to be
- * ortho-rectified and then input the coordinates of each point
- * for calculation of rectification parameters
- * COPYRIGHT: (C) 1999-2008 by the GRASS Development Team
- *
- * This program is free software under the GNU General Public
- * License (>=v2). Read the file COPYING that comes with GRASS
- * for details.
- *
- *****************************************************************************/
-
-#define GLOBAL
-#include <unistd.h>
-#include <stdlib.h>
-#include <string.h>
-#include <signal.h>
-#include <grass/raster.h>
-#include <grass/imagery.h>
-#include <grass/ortholib.h>
-#include <grass/glocale.h>
-#include "globals.h"
-#include "local_proto.h"
-
-int main(int argc, char *argv[])
-{
- char mapset[GMAPSET_MAX];
- char name[GNAME_MAX];
- char *camera;
-
- struct GModule *module;
- struct Option *group_opt, *map_opt, *target_map_opt;
- struct Cell_head cellhd;
- int ok;
- int nfiles;
-
- /* must run in a term window */
- G_putenv("GRASS_UI_TERM", "1");
-
- G_gisinit(argv[0]);
-
- module = G_define_module();
- module->keywords = _("imagery, orthorectify");
- module->description = _("Creates control points on an image "
- "to be ortho-rectified.");
-
- group_opt = G_define_option();
- group_opt->key = "group";
- group_opt->type = TYPE_STRING;
- group_opt->required = YES;
- group_opt->multiple = NO;
- group_opt->description = _("Name of imagery group");
-
- map_opt = G_define_standard_option(G_OPT_R_MAP);
- map_opt->required = NO;
- map_opt->description = _("Name of image to be rectified which will "
- "be initially drawn on screen");
-
- target_map_opt = G_define_standard_option(G_OPT_R_MAP);
- target_map_opt->key = "target";
- target_map_opt->required = NO;
- target_map_opt->description = _("Name of a map from target mapset which "
- "will be initially drawn on screen");
-
- if (G_parser(argc, argv))
- exit(EXIT_FAILURE);
-
-
- G_suppress_masking(); /* need to do this for target location */
-
- camera = (char *)G_malloc(40 * sizeof(char));
- strcpy(name, group_opt->answer);
-
- interrupt_char = G_intr_char();
- tempfile1 = G_tempfile();
- tempfile2 = G_tempfile();
- tempfile_dot = G_tempfile();
- tempfile_dot2 = G_tempfile();
- tempfile_win = G_tempfile();
- tempfile_win2 = G_tempfile();
- cell_list = G_tempfile();
- vect_list = G_tempfile();
- group_list = G_tempfile();
- digit_points = G_tempfile();
-
- if (R_open_driver() != 0)
- G_fatal_error(_("No graphics device selected"));
-
- /* get group ref */
- strcpy(group.name, name);
- if (!I_find_group(group.name))
- G_fatal_error(_("Group [%s] not found"), group.name);
-
- /* get the group ref */
- I_get_group_ref(group.name, &group.group_ref);
- nfiles = group.group_ref.nfiles;
-
- /* write block files to block list file */
- prepare_group_list();
-
- /** look for camera info for this group**/
- G_suppress_warnings(1);
- if (!I_get_group_camera(group.name, camera))
- G_fatal_error(_("No camera reference file selected for group [%s]"),
- group.name);
-
- if (!I_get_cam_info(camera, &group.camera_ref))
- G_fatal_error(_("Bad format in camera file for group [%s]"),
- group.name);
-
- G_suppress_warnings(0);
-
- /* get initial camera exposure station, if any */
- if (!(ok = I_find_initial(group.name)))
- G_warning(_("No initial camera exposure station for group [%s]"),
- group.name);
-
- if (ok && (!I_get_init_info(group.name, &group.camera_exp)) )
- G_warning(_("Bad format in initial camera exposure station for group [%s]"),
- group.name);
-
- /* get target info and environment */
- G_suppress_warnings(1);
- get_target();
- find_target_files();
- G_suppress_warnings(0);
-
- /* read group reference points, if any */
- G_suppress_warnings(1);
- if (!I_get_ref_points(group.name, &group.photo_points)) {
- G_suppress_warnings(0);
- if (group.photo_points.count == 0)
- G_fatal_error(_("No photo points for group [%s]"), group.name);
- else if (group.ref_equation_stat == 0)
- G_fatal_error(_("Poorly placed photo points for group [%s]"),
- group.name);
- }
- G_suppress_warnings(0);
-
- /* determine transformation equation */
- Compute_ref_equation();
-
- /* read group control points, format: image x,y,cfl; target E,N,Z */
- G_suppress_warnings(1);
- if (!I_get_con_points(group.name, &group.control_points))
- group.control_points.count = 0;
- G_suppress_warnings(0);
-
- /* compute image coordinates of photo control points */
-
- /********
- I_convert_con_points (group.name, &group.control_points,
- &group.control_points, group.E12, group.N12);
- ********/
-
- /* determine transformation equation */
- G_message(_("Computing equations ..."));
- if (group.control_points.count > 0)
- Compute_ortho_equation();
-
-
- /* signal (SIGINT, SIG_IGN); */
- /* signal (SIGQUIT, SIG_IGN); */
-
- select_current_env();
- Init_graphics();
- display_title(VIEW_MAP1);
- select_target_env();
- display_title(VIEW_MAP2);
- select_current_env();
-
- Begin_curses();
- G_set_error_routine(error);
-
- /*
- #ifdef SIGTSTP
- signal (SIGTSTP, SIG_IGN);
- #endif
- */
-
- /* Set image to be rectified */
- if (map_opt->answer) {
- char *ms;
-
- ms = G_find_cell(map_opt->answer, "");
- if (ms == NULL) {
- G_fatal_error(_("Raster map <%s> not found"), map_opt->answer);
- }
- strcpy(name, map_opt->answer);
- strcpy(mapset, ms);
- if (G_get_cellhd(name, mapset, &cellhd) < 0) {
- G_fatal_error(_("Unable to read raster header of <%s>"), map_opt->answer);
- }
- }
- else {
- /* ask user for group file to be displayed */
- do {
- if (!choose_groupfile(name, mapset))
- quit(EXIT_SUCCESS);
- /* display this file in "map1" */
- } while (G_get_cellhd(name, mapset, &cellhd) < 0);
- }
-
- G_adjust_window_to_box(&cellhd, &VIEW_MAP1->cell.head, VIEW_MAP1->nrows,
- VIEW_MAP1->ncols);
- Configure_view(VIEW_MAP1, name, mapset, cellhd.ns_res, cellhd.ew_res);
-
- drawcell(VIEW_MAP1);
-
- /* Set target map if specified */
- if (target_map_opt->answer) {
- char *ms;
-
- select_target_env();
- ms = G_find_cell(target_map_opt->answer, "");
- if (ms == NULL) {
- G_fatal_error(_("Raster map <%s> not found"),
- target_map_opt->answer);
- }
- strcpy(name, target_map_opt->answer);
- strcpy(mapset, ms);
- if (G_get_cellhd(name, mapset, &cellhd) < 0) {
- G_fatal_error(_("Unable to read raster header of <%s>"),
- target_map_opt->answer);
- }
-
- G_adjust_window_to_box(&cellhd, &VIEW_MAP2->cell.head,
- VIEW_MAP2->nrows, VIEW_MAP2->ncols);
- Configure_view(VIEW_MAP2, name, mapset, cellhd.ns_res, cellhd.ew_res);
-
- drawcell(VIEW_MAP2);
-
- from_flag = 1;
- from_keyboard = 0;
- from_screen = 1;
- }
-
- display_conz_points(1);
-
- Curses_clear_window(PROMPT_WINDOW);
-
- /* determine initial input method. */
- setup_digitizer();
- if (use_digitizer) {
- from_digitizer = 1;
- from_keyboard = 0;
- from_flag = 1;
- }
-
- /* go do the work */
- driver();
-
- quit(EXIT_SUCCESS);
-}
-
-int quit(int n)
-{
- char command[1024];
-
- End_curses();
- R_close_driver();
- if (use_digitizer) {
- sprintf(command, "%s/etc/geo.unlock %s", G_gisbase(), digit_points);
- system(command);
- }
- unlink(tempfile1);
- unlink(tempfile2);
- unlink(cell_list);
- unlink(group_list);
- unlink(vect_list);
- unlink(digit_points);
- unlink(tempfile_elev);
- unlink(tempfile_dot);
- unlink(tempfile_dot2);
- unlink(tempfile_win);
- unlink(tempfile_win2);
- exit(n);
-}
-
-int error(const char *msg, int fatal)
-{
- char buf[200];
- int x, y, button;
-
- Curses_clear_window(PROMPT_WINDOW);
- Curses_write_window(PROMPT_WINDOW, 1, 1, "LOCATION:\n");
- Curses_write_window(PROMPT_WINDOW, 1, 12, G_location());
- Curses_write_window(PROMPT_WINDOW, 2, 1, "MAPSET:\n");
- Curses_write_window(PROMPT_WINDOW, 2, 12, G_mapset());
- Beep();
- if (fatal)
- sprintf(buf, _("ERROR: %s"), msg);
- else
- sprintf(buf, _("WARNING: %s (click mouse to continue)"), msg);
- Menu_msg(buf);
-
- if (fatal)
- quit(EXIT_FAILURE);
- Mouse_pointer(&x, &y, &button);
- Curses_clear_window(PROMPT_WINDOW);
-
- return 0;
-}
Copied: grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2target/main.c (from rev 44501, grass/branches/develbranch_6/imagery/i.ortho.photo/i.photo.2target/main.c)
===================================================================
--- grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2target/main.c (rev 0)
+++ grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2target/main.c 2010-12-22 10:05:10 UTC (rev 44654)
@@ -0,0 +1,313 @@
+
+/****************************************************************************
+ *
+ * MODULE: i.photo.2target
+ * AUTHOR(S): Mike Baba, DBA Systems, Inc. (original contributor)
+ * Markus Neteler <neteler itc.it>,
+ * Bernhard Reiter <bernhard intevation.de>,
+ * Glynn Clements <glynn gclements.plus.com>,
+ * Radim Blazek <radim.blazek gmail.com>
+ * Hamish Bowman
+ *
+ * PURPOSE: Allow user to mark control points on an image to be
+ * ortho-rectified and then input the coordinates of each point
+ * for calculation of rectification parameters
+ * COPYRIGHT: (C) 1999-2008 by the GRASS Development Team
+ *
+ * This program is free software under the GNU General Public
+ * License (>=v2). Read the file COPYING that comes with GRASS
+ * for details.
+ *
+ *****************************************************************************/
+
+#define GLOBAL
+#include <unistd.h>
+#include <stdlib.h>
+#include <string.h>
+#include <signal.h>
+#include <grass/raster.h>
+#include <grass/imagery.h>
+#include <grass/ortholib.h>
+#include <grass/glocale.h>
+#include "globals.h"
+#include "local_proto.h"
+
+int main(int argc, char *argv[])
+{
+ char mapset[GMAPSET_MAX];
+ char name[GNAME_MAX];
+ char *camera;
+
+ struct GModule *module;
+ struct Option *group_opt, *map_opt, *target_map_opt;
+ struct Cell_head cellhd;
+ int ok;
+ int nfiles;
+
+ /* must run in a term window */
+ G_putenv("GRASS_UI_TERM", "1");
+
+ G_gisinit(argv[0]);
+
+ module = G_define_module();
+ module->keywords = _("imagery, orthorectify");
+ module->description = _("Creates control points on an image "
+ "to be ortho-rectified.");
+
+ group_opt = G_define_option();
+ group_opt->key = "group";
+ group_opt->type = TYPE_STRING;
+ group_opt->required = YES;
+ group_opt->multiple = NO;
+ group_opt->description = _("Name of imagery group");
+
+ map_opt = G_define_standard_option(G_OPT_R_MAP);
+ map_opt->required = NO;
+ map_opt->description = _("Name of image to be rectified which will "
+ "be initially drawn on screen");
+
+ target_map_opt = G_define_standard_option(G_OPT_R_MAP);
+ target_map_opt->key = "target";
+ target_map_opt->required = NO;
+ target_map_opt->description = _("Name of a map from target mapset which "
+ "will be initially drawn on screen");
+
+ if (G_parser(argc, argv))
+ exit(EXIT_FAILURE);
+
+
+ G_suppress_masking(); /* need to do this for target location */
+
+ camera = (char *)G_malloc(40 * sizeof(char));
+ strcpy(name, group_opt->answer);
+
+ interrupt_char = G_intr_char();
+ tempfile1 = G_tempfile();
+ tempfile2 = G_tempfile();
+ tempfile_dot = G_tempfile();
+ tempfile_dot2 = G_tempfile();
+ tempfile_win = G_tempfile();
+ tempfile_win2 = G_tempfile();
+ cell_list = G_tempfile();
+ vect_list = G_tempfile();
+ group_list = G_tempfile();
+ digit_points = G_tempfile();
+
+ if (R_open_driver() != 0)
+ G_fatal_error(_("No graphics device selected"));
+
+ /* get group ref */
+ strcpy(group.name, name);
+ if (!I_find_group(group.name))
+ G_fatal_error(_("Group [%s] not found"), group.name);
+
+ /* get the group ref */
+ I_get_group_ref(group.name, &group.group_ref);
+ nfiles = group.group_ref.nfiles;
+
+ /* write block files to block list file */
+ prepare_group_list();
+
+ /** look for camera info for this group**/
+ G_suppress_warnings(1);
+ if (!I_get_group_camera(group.name, camera))
+ G_fatal_error(_("No camera reference file selected for group [%s]"),
+ group.name);
+
+ if (!I_get_cam_info(camera, &group.camera_ref))
+ G_fatal_error(_("Bad format in camera file for group [%s]"),
+ group.name);
+
+ G_suppress_warnings(0);
+
+ /* get initial camera exposure station, if any */
+ if (!(ok = I_find_initial(group.name)))
+ G_warning(_("No initial camera exposure station for group [%s]"),
+ group.name);
+
+ if (ok && (!I_get_init_info(group.name, &group.camera_exp)) )
+ G_warning(_("Bad format in initial camera exposure station for group [%s]"),
+ group.name);
+
+ /* get target info and environment */
+ G_suppress_warnings(1);
+ get_target();
+ find_target_files();
+ G_suppress_warnings(0);
+
+ /* read group reference points, if any */
+ G_suppress_warnings(1);
+ if (!I_get_ref_points(group.name, &group.photo_points)) {
+ G_suppress_warnings(0);
+ if (group.photo_points.count == 0)
+ G_fatal_error(_("No photo points for group [%s]"), group.name);
+ else if (group.ref_equation_stat == 0)
+ G_fatal_error(_("Poorly placed photo points for group [%s]"),
+ group.name);
+ }
+ G_suppress_warnings(0);
+
+ /* determine transformation equation */
+ Compute_ref_equation();
+
+ /* read group control points, format: image x,y,cfl; target E,N,Z */
+ G_suppress_warnings(1);
+ if (!I_get_con_points(group.name, &group.control_points))
+ group.control_points.count = 0;
+ G_suppress_warnings(0);
+
+ /* compute image coordinates of photo control points */
+
+ /********
+ I_convert_con_points (group.name, &group.control_points,
+ &group.control_points, group.E12, group.N12);
+ ********/
+
+ /* determine transformation equation */
+ G_message(_("Computing equations ..."));
+ if (group.control_points.count > 0)
+ Compute_ortho_equation();
+
+
+ /* signal (SIGINT, SIG_IGN); */
+ /* signal (SIGQUIT, SIG_IGN); */
+
+ select_current_env();
+ Init_graphics();
+ display_title(VIEW_MAP1);
+ select_target_env();
+ display_title(VIEW_MAP2);
+ select_current_env();
+
+ Begin_curses();
+ G_set_error_routine(error);
+
+ /*
+ #ifdef SIGTSTP
+ signal (SIGTSTP, SIG_IGN);
+ #endif
+ */
+
+ /* Set image to be rectified */
+ if (map_opt->answer) {
+ char *ms;
+
+ ms = G_find_cell(map_opt->answer, "");
+ if (ms == NULL) {
+ G_fatal_error(_("Raster map <%s> not found"), map_opt->answer);
+ }
+ strcpy(name, map_opt->answer);
+ strcpy(mapset, ms);
+ if (G_get_cellhd(name, mapset, &cellhd) < 0) {
+ G_fatal_error(_("Unable to read raster header of <%s>"), map_opt->answer);
+ }
+ }
+ else {
+ /* ask user for group file to be displayed */
+ do {
+ if (!choose_groupfile(name, mapset))
+ quit(EXIT_SUCCESS);
+ /* display this file in "map1" */
+ } while (G_get_cellhd(name, mapset, &cellhd) < 0);
+ }
+
+ G_adjust_window_to_box(&cellhd, &VIEW_MAP1->cell.head, VIEW_MAP1->nrows,
+ VIEW_MAP1->ncols);
+ Configure_view(VIEW_MAP1, name, mapset, cellhd.ns_res, cellhd.ew_res);
+
+ drawcell(VIEW_MAP1);
+
+ /* Set target map if specified */
+ if (target_map_opt->answer) {
+ char *ms;
+
+ select_target_env();
+ ms = G_find_cell(target_map_opt->answer, "");
+ if (ms == NULL) {
+ G_fatal_error(_("Raster map <%s> not found"),
+ target_map_opt->answer);
+ }
+ strcpy(name, target_map_opt->answer);
+ strcpy(mapset, ms);
+ if (G_get_cellhd(name, mapset, &cellhd) < 0) {
+ G_fatal_error(_("Unable to read raster header of <%s>"),
+ target_map_opt->answer);
+ }
+
+ G_adjust_window_to_box(&cellhd, &VIEW_MAP2->cell.head,
+ VIEW_MAP2->nrows, VIEW_MAP2->ncols);
+ Configure_view(VIEW_MAP2, name, mapset, cellhd.ns_res, cellhd.ew_res);
+
+ drawcell(VIEW_MAP2);
+
+ from_flag = 1;
+ from_keyboard = 0;
+ from_screen = 1;
+ }
+
+ display_conz_points(1);
+
+ Curses_clear_window(PROMPT_WINDOW);
+
+ /* determine initial input method. */
+ setup_digitizer();
+ if (use_digitizer) {
+ from_digitizer = 1;
+ from_keyboard = 0;
+ from_flag = 1;
+ }
+
+ /* go do the work */
+ driver();
+
+ quit(EXIT_SUCCESS);
+}
+
+int quit(int n)
+{
+ char command[1024];
+
+ End_curses();
+ R_close_driver();
+ if (use_digitizer) {
+ sprintf(command, "%s/etc/geo.unlock %s", G_gisbase(), digit_points);
+ system(command);
+ }
+ unlink(tempfile1);
+ unlink(tempfile2);
+ unlink(cell_list);
+ unlink(group_list);
+ unlink(vect_list);
+ unlink(digit_points);
+ unlink(tempfile_elev);
+ unlink(tempfile_dot);
+ unlink(tempfile_dot2);
+ unlink(tempfile_win);
+ unlink(tempfile_win2);
+ exit(n);
+}
+
+int error(const char *msg, int fatal)
+{
+ char buf[200];
+ int x, y, button;
+
+ Curses_clear_window(PROMPT_WINDOW);
+ Curses_write_window(PROMPT_WINDOW, 1, 1, "LOCATION:\n");
+ Curses_write_window(PROMPT_WINDOW, 1, 12, G_location());
+ Curses_write_window(PROMPT_WINDOW, 2, 1, "MAPSET:\n");
+ Curses_write_window(PROMPT_WINDOW, 2, 12, G_mapset());
+ Beep();
+ if (fatal)
+ sprintf(buf, _("ERROR: %s"), msg);
+ else
+ sprintf(buf, _("WARNING: %s (click mouse to continue)"), msg);
+ Menu_msg(buf);
+
+ if (fatal)
+ quit(EXIT_FAILURE);
+ Mouse_pointer(&x, &y, &button);
+ Curses_clear_window(PROMPT_WINDOW);
+
+ return 0;
+}
Deleted: grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2target/mark.c
===================================================================
--- grass/branches/develbranch_6/imagery/i.ortho.photo/i.photo.2target/mark.c 2010-12-01 09:34:37 UTC (rev 44501)
+++ grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2target/mark.c 2010-12-22 10:05:10 UTC (rev 44654)
@@ -1,441 +0,0 @@
-#include <unistd.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <grass/raster.h>
-#include "globals.h"
-#include "local_proto.h"
-
-/* define MOUSE_YN to answer y/n by mouse click */
-#define MOUSE_YN
-
-static int get_point2(double *, double *, double *);
-static int keyboard(void);
-static int _keyboard(void);
-static int digitizer(void);
-static int screen(int, int, int);
-static int cancel(void);
-
-int mark(int x, int y, int button)
-{
- if (button == 2) {
- zoom_box1(x, y);
- return 0;
- }
- else if (button == 3) {
- zoom_point2(x, y, 1, 1.);
- return 0;
- }
-
- if (VIEW_MAP1->cell.configured && In_view(VIEW_MAP1, x, y))
- mark_point(VIEW_MAP1, x, y);
- else if (VIEW_MAP1_ZOOM->cell.configured && In_view(VIEW_MAP1_ZOOM, x, y))
- mark_point(VIEW_MAP1_ZOOM, x, y);
-
- return 0; /* return but don't quit */
-}
-
-int mark_point(View * view, int x, int y)
-{
- double e0, n0;
- double e1, n1, z1;
- double e2, n2, z2;
- double ee1, nn1;
- int row, col;
- char buf[100];
-
-
- /* convert x,y to east,north at center of cell */
- col = view_to_col(view, x);
- e0 = col_to_easting(&view->cell.head, col, 0.5);
- row = view_to_row(view, y);
- n0 = row_to_northing(&view->cell.head, row, 0.5);
-
- /* These are image coordinates not photo coordinates */
- ee1 = e0;
- nn1 = n0;
-
- /* e1, n1 now become photo coordinates */
- I_georef(e0, n0, &e1, &n1, group.E12, group.N12);
- z1 = -group.camera_ref.CFL;
-
- Curses_clear_window(MENU_WINDOW);
- sprintf(buf, "Point %d marked at IMAGE COORDINATES:",
- group.control_points.count + 1);
- Curses_write_window(MENU_WINDOW, 1, 1, buf);
- sprintf(buf, "X: %10.2f", ee1);
- Curses_write_window(MENU_WINDOW, 3, 3, buf);
- sprintf(buf, "Y: %10.2f", nn1);
- Curses_write_window(MENU_WINDOW, 4, 3, buf);
- Curses_clear_window(INFO_WINDOW);
-
- R_standard_color(ORANGE);
- save_under_dot(x, y, tempfile_dot);
- dot(x, y);
-
- if (!get_point2(&e2, &n2, &z2)) {
- Curses_clear_window(MENU_WINDOW);
- Curses_clear_window(INFO_WINDOW);
- restore_under_dot(tempfile_dot);
- }
- else {
- Curses_write_window(MENU_WINDOW, 7, 1, "Target Point location:");
- sprintf(buf, "East: %10.2f", e2);
- Curses_write_window(MENU_WINDOW, 8, 3, buf);
- sprintf(buf, "North: %10.2f", n2);
- Curses_write_window(MENU_WINDOW, 9, 3, buf);
- if (G_is_d_null_value(&z2))
- sprintf(buf, "Elevation: NULL");
- else
- sprintf(buf, "Elevation: %10.2f", z2);
- Curses_write_window(MENU_WINDOW, 10, 3, buf);
-
- I_new_con_point(&group.control_points, ee1, nn1, z1, e2, n2, z2, 1);
- I_new_con_point((struct Ortho_Control_Points *)&group.photo_points,
- e1, n1, z1, e2, n2, z2, 1);
-
- I_put_con_points(group.name, &group.control_points);
-
- sprintf(buf, "Computing equations ...");
- Curses_write_window(MENU_WINDOW, 13, 1, buf);
- Compute_ortho_equation();
- display_conz_points(1);
- Curses_clear_window(MENU_WINDOW);
- Curses_clear_window(INFO_WINDOW);
- }
- release_under_dot(tempfile_dot);
-
- return 0;
-}
-
-static double N, E, Z;
-
-static int get_point2(double *east, double *north, double *elev)
-{
- int stat;
- static int use = 1;
- static Objects objects[] = {
- MENU("CANCEL", cancel, &use),
- INFO("Mark control point on target image", &use),
- OTHER(screen, &use),
- {0}
- };
-
-
- if (from_digitizer > 0)
- stat = Input_other(digitizer, "Digitizer") > 0;
- else if (from_screen > 0) {
- set_colors(&VIEW_MAP2->cell.colors);
- stat = Input_pointer(objects) > 0;
- set_colors(&VIEW_MAP1->cell.colors);
- }
- else
- stat = Input_other(keyboard, "Keyboard");
-
- if (stat) {
- *east = E;
- *north = N;
- if (G_is_d_null_value(&Z))
- G_set_d_null_value(elev, 1);
- else
- *elev = Z;
- }
-
- return stat;
-}
-
-static int keyboard(void)
-{
- int ok;
-
- ok = _keyboard();
- return ok;
-}
-
-static int _keyboard(void)
-{
- char buf[100];
-
- while (1) {
- Curses_clear_window(INFO_WINDOW);
- Curses_prompt_gets
- ("Enter CONTROL COORDINATES as east north elevation: ", buf);
- G_strip(buf);
- if (*buf == 0) {
- return 0;
- }
- if (sscanf(buf, "%lf %lf %lf", &E, &N, &Z) != 3) {
- Beep();
- continue;
- }
- Curses_clear_window(INFO_WINDOW);
- sprintf(buf, "East: %f\n", E);
- Curses_write_window(INFO_WINDOW, 2, 2, buf);
- sprintf(buf, "North: %f\n", N);
- Curses_write_window(INFO_WINDOW, 3, 2, buf);
- if (G_is_d_null_value(&Z))
- sprintf(buf, "Elevation: NULL");
- else
- sprintf(buf, "Elevation: %f\n", Z);
- Curses_write_window(INFO_WINDOW, 4, 2, buf);
-#ifdef MOUSE_YN
- Curses_write_window(INFO_WINDOW, 6, 1,
- "Look ok? (Left: y / Right: n) ");
-#else
- Curses_write_window(INFO_WINDOW, 6, 1, "Look ok? (y/n) ");
-#endif
-
- while (1) {
-#ifdef MOUSE_YN
- int x, y, b;
-
- R_get_location_with_pointer(&x, &y, &b);
- if (b == 1)
- return 1;
- else if (b == 3)
- break;
-#else
- int c;
-
- c = Curses_getch(0);
- if (c == 'y' || c == 'Y')
- return 1;
- if (c == 'n' || c == 'N')
- break;
-#endif
- Beep();
- }
- }
- /* return 0; dont get here */
-}
-
-static int digitizer(void)
-{
- int ok;
- char buf[100];
-
- ok = digitizer_point(&E, &N);
- if (ok) {
- if (!get_z_from_cell(N, E))
- return 0;
-
- Curses_clear_window(INFO_WINDOW);
- sprintf(buf, "East: %f\n", E);
- Curses_write_window(INFO_WINDOW, 3, 2, buf);
- sprintf(buf, "North: %f\n", N);
- Curses_write_window(INFO_WINDOW, 4, 2, buf);
- if (G_is_d_null_value(&Z))
- sprintf(buf, "Elevation: NULL");
- else
- sprintf(buf, "Elevation: %f\n", Z);
- Curses_write_window(INFO_WINDOW, 5, 2, buf);
-#ifdef MOUSE_YN
- Curses_write_window(INFO_WINDOW, 7, 1,
- "Look ok? (Left: y / Right: n) ");
-#else
- Curses_write_window(INFO_WINDOW, 7, 1, "Look ok? (y/n) ");
-#endif
-
- while (1) {
-#ifdef MOUSE_YN
- int x, y, b;
-
- R_get_location_with_pointer(&x, &y, &b);
- if (b == 1) {
- ok = 1;
- break;
- }
- else if (b == 3) {
- ok = -1;
- break;
- }
-#else
- c = Curses_getch(0);
- if (c == 'y' || c == 'Y') {
- ok = 1;
- break;
- }
- if (c == 'n' || c == 'N') {
- ok = -1;
- break;
- }
-#endif
- Beep();
- }
- Curses_clear_window(INFO_WINDOW);
- return ok;
- }
- return 0;
-}
-
-static int screen(int x, int y, int button)
-{
- int row, col, ok;
- char buf[50];
- View *view;
-
- if (button == 3) /* cancel */
- return -1;
-
- if (In_view(VIEW_MAP2, x, y) && VIEW_MAP2->cell.configured)
- view = VIEW_MAP2;
- else if (In_view(VIEW_MAP2_ZOOM, x, y) && VIEW_MAP2_ZOOM->cell.configured)
- view = VIEW_MAP2_ZOOM;
- else
- return 0; /* ignore mouse event */
-
- col = view_to_col(view, x);
- E = col_to_easting(&view->cell.head, col, 0.5);
- row = view_to_row(view, y);
- N = row_to_northing(&view->cell.head, row, 0.5);
-
- if (!get_z_from_cell(N, E))
- return 0;
-
- Curses_clear_window(INFO_WINDOW);
- sprintf(buf, "East: %10.2f\n", E);
- Curses_write_window(INFO_WINDOW, 3, 2, buf);
- sprintf(buf, "North: %10.2f\n", N);
- Curses_write_window(INFO_WINDOW, 4, 2, buf);
- if (G_is_d_null_value(&Z))
- sprintf(buf, "Elevation: NULL");
- else
- sprintf(buf, "Elevation: %10.2f\n", Z);
- Curses_write_window(INFO_WINDOW, 5, 2, buf);
-#ifdef MOUSE_YN
- Curses_write_window(INFO_WINDOW, 7, 1, "Look ok? (Left: y / Right: n) ");
-#else
- Curses_write_window(INFO_WINDOW, 7, 1, "Look ok? (y/n) ");
-#endif
-
- R_standard_color(ORANGE);
- save_under_dot(x, y, tempfile_dot2);
- dot(x, y);
- R_flush();
-
- while (1) {
-#ifdef MOUSE_YN
- int x, y, b;
-
- R_get_location_with_pointer(&x, &y, &b);
- if (b == 1) {
- ok = 1;
- break;
- }
- else if (b == 3) {
- restore_under_dot(tempfile_dot2);
- ok = 0;
- break;
- }
-#else
- int c;
-
- c = Curses_getch(0);
- if (c == 'y' || c == 'Y') {
- ok = 1;
- break;
- }
- if (c == 'n' || c == 'N') {
- ok = -1;
- break;
- }
-#endif
- Beep();
- }
- Curses_clear_window(INFO_WINDOW);
-
- return ok;
-}
-
-/* Get height from raster
- * return 1 if coors are in raster or cannot open rster
- * 0 if coors are outside raster
- */
-int get_z_from_cell2(double north, double east, double *height)
-{
- int row, col;
- struct Cell_head elevhd;
- RASTER_MAP_TYPE data_type;
-
- G_set_d_null_value(height, 1);
-
- /* allocate the elev buffer */
- select_target_env();
- G_get_cellhd(elev_layer, mapset_elev, &elevhd);
- G_set_window(&elevhd);
-
- elev = G_open_cell_old(elev_layer, mapset_elev);
- if (elev < 0)
- return 0;
- data_type = G_get_raster_map_type(elev);
-
- elevbuf = G_allocate_raster_buf(data_type);
-
- /* find row, col in elevation raster map */
- row = (int)northing_to_row(&elevhd, north);
- col = (int)easting_to_col(&elevhd, east);
-
- if (row < 0 || row >= elevhd.rows || col < 0 || col >= elevhd.cols) {
- G_close_cell(elev);
- G_free(elevbuf);
- return 0;
- }
-
- if (G_get_raster_row(elev, elevbuf, row, data_type) <= 0) {
- G_close_cell(elev);
- G_free(elevbuf);
- return 0;
- }
-
- if ((data_type == CELL_TYPE &&
- !G_is_c_null_value((CELL *) & ((CELL *) elevbuf)[col])) ||
- (data_type == FCELL_TYPE &&
- !G_is_f_null_value((FCELL *) & ((FCELL *) elevbuf)[col])) ||
- (data_type == DCELL_TYPE &&
- !G_is_d_null_value((DCELL *) & ((DCELL *) elevbuf)[col]))) {
- if (data_type == CELL_TYPE)
- *height = (double)((CELL *) elevbuf)[col];
- else if (data_type == FCELL_TYPE)
- *height = (double)((FCELL *) elevbuf)[col];
- else if (data_type == DCELL_TYPE)
- *height = (double)((DCELL *) elevbuf)[col];
- }
-
- G_close_cell(elev);
- G_free(elevbuf);
- select_current_env();
- return (1);
-}
-
-int get_z_from_cell(double north, double east)
-{
- char buf[100];
-
- if (!get_z_from_cell2(north, east, &Z)) {
- Curses_write_window(INFO_WINDOW, 5, 1, "point not on elevation map");
- Curses_write_window(INFO_WINDOW, 6, 1, "no elevation data available");
- Beep();
- G_sleep(3);
- Curses_clear_window(INFO_WINDOW);
-
- while (1) {
- Curses_prompt_gets
- ("Enter elevation value (hit return if not known): ", buf);
- Curses_clear_window(PROMPT_WINDOW);
- G_strip(buf);
- if (*buf == 0)
- return 0;
- if (sscanf(buf, "%lf ", &Z) == 1)
- return (1);
- Beep();
- }
- }
- else {
- return (1);
- }
- return 0;
-}
-
-static int cancel(void)
-{
- return -1;
-}
Copied: grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2target/mark.c (from rev 44501, grass/branches/develbranch_6/imagery/i.ortho.photo/i.photo.2target/mark.c)
===================================================================
--- grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2target/mark.c (rev 0)
+++ grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2target/mark.c 2010-12-22 10:05:10 UTC (rev 44654)
@@ -0,0 +1,441 @@
+#include <unistd.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <grass/raster.h>
+#include "globals.h"
+#include "local_proto.h"
+
+/* define MOUSE_YN to answer y/n by mouse click */
+#define MOUSE_YN
+
+static int get_point2(double *, double *, double *);
+static int keyboard(void);
+static int _keyboard(void);
+static int digitizer(void);
+static int screen(int, int, int);
+static int cancel(void);
+
+int mark(int x, int y, int button)
+{
+ if (button == 2) {
+ zoom_box1(x, y);
+ return 0;
+ }
+ else if (button == 3) {
+ zoom_point2(x, y, 1, 1.);
+ return 0;
+ }
+
+ if (VIEW_MAP1->cell.configured && In_view(VIEW_MAP1, x, y))
+ mark_point(VIEW_MAP1, x, y);
+ else if (VIEW_MAP1_ZOOM->cell.configured && In_view(VIEW_MAP1_ZOOM, x, y))
+ mark_point(VIEW_MAP1_ZOOM, x, y);
+
+ return 0; /* return but don't quit */
+}
+
+int mark_point(View * view, int x, int y)
+{
+ double e0, n0;
+ double e1, n1, z1;
+ double e2, n2, z2;
+ double ee1, nn1;
+ int row, col;
+ char buf[100];
+
+
+ /* convert x,y to east,north at center of cell */
+ col = view_to_col(view, x);
+ e0 = col_to_easting(&view->cell.head, col, 0.5);
+ row = view_to_row(view, y);
+ n0 = row_to_northing(&view->cell.head, row, 0.5);
+
+ /* These are image coordinates not photo coordinates */
+ ee1 = e0;
+ nn1 = n0;
+
+ /* e1, n1 now become photo coordinates */
+ I_georef(e0, n0, &e1, &n1, group.E12, group.N12);
+ z1 = -group.camera_ref.CFL;
+
+ Curses_clear_window(MENU_WINDOW);
+ sprintf(buf, "Point %d marked at IMAGE COORDINATES:",
+ group.control_points.count + 1);
+ Curses_write_window(MENU_WINDOW, 1, 1, buf);
+ sprintf(buf, "X: %10.2f", ee1);
+ Curses_write_window(MENU_WINDOW, 3, 3, buf);
+ sprintf(buf, "Y: %10.2f", nn1);
+ Curses_write_window(MENU_WINDOW, 4, 3, buf);
+ Curses_clear_window(INFO_WINDOW);
+
+ R_standard_color(ORANGE);
+ save_under_dot(x, y, tempfile_dot);
+ dot(x, y);
+
+ if (!get_point2(&e2, &n2, &z2)) {
+ Curses_clear_window(MENU_WINDOW);
+ Curses_clear_window(INFO_WINDOW);
+ restore_under_dot(tempfile_dot);
+ }
+ else {
+ Curses_write_window(MENU_WINDOW, 7, 1, "Target Point location:");
+ sprintf(buf, "East: %10.2f", e2);
+ Curses_write_window(MENU_WINDOW, 8, 3, buf);
+ sprintf(buf, "North: %10.2f", n2);
+ Curses_write_window(MENU_WINDOW, 9, 3, buf);
+ if (G_is_d_null_value(&z2))
+ sprintf(buf, "Elevation: NULL");
+ else
+ sprintf(buf, "Elevation: %10.2f", z2);
+ Curses_write_window(MENU_WINDOW, 10, 3, buf);
+
+ I_new_con_point(&group.control_points, ee1, nn1, z1, e2, n2, z2, 1);
+ I_new_con_point((struct Ortho_Control_Points *)&group.photo_points,
+ e1, n1, z1, e2, n2, z2, 1);
+
+ I_put_con_points(group.name, &group.control_points);
+
+ sprintf(buf, "Computing equations ...");
+ Curses_write_window(MENU_WINDOW, 13, 1, buf);
+ Compute_ortho_equation();
+ display_conz_points(1);
+ Curses_clear_window(MENU_WINDOW);
+ Curses_clear_window(INFO_WINDOW);
+ }
+ release_under_dot(tempfile_dot);
+
+ return 0;
+}
+
+static double N, E, Z;
+
+static int get_point2(double *east, double *north, double *elev)
+{
+ int stat;
+ static int use = 1;
+ static Objects objects[] = {
+ MENU("CANCEL", cancel, &use),
+ INFO("Mark control point on target image", &use),
+ OTHER(screen, &use),
+ {0}
+ };
+
+
+ if (from_digitizer > 0)
+ stat = Input_other(digitizer, "Digitizer") > 0;
+ else if (from_screen > 0) {
+ set_colors(&VIEW_MAP2->cell.colors);
+ stat = Input_pointer(objects) > 0;
+ set_colors(&VIEW_MAP1->cell.colors);
+ }
+ else
+ stat = Input_other(keyboard, "Keyboard");
+
+ if (stat) {
+ *east = E;
+ *north = N;
+ if (G_is_d_null_value(&Z))
+ G_set_d_null_value(elev, 1);
+ else
+ *elev = Z;
+ }
+
+ return stat;
+}
+
+static int keyboard(void)
+{
+ int ok;
+
+ ok = _keyboard();
+ return ok;
+}
+
+static int _keyboard(void)
+{
+ char buf[100];
+
+ while (1) {
+ Curses_clear_window(INFO_WINDOW);
+ Curses_prompt_gets
+ ("Enter CONTROL COORDINATES as east north elevation: ", buf);
+ G_strip(buf);
+ if (*buf == 0) {
+ return 0;
+ }
+ if (sscanf(buf, "%lf %lf %lf", &E, &N, &Z) != 3) {
+ Beep();
+ continue;
+ }
+ Curses_clear_window(INFO_WINDOW);
+ sprintf(buf, "East: %f\n", E);
+ Curses_write_window(INFO_WINDOW, 2, 2, buf);
+ sprintf(buf, "North: %f\n", N);
+ Curses_write_window(INFO_WINDOW, 3, 2, buf);
+ if (G_is_d_null_value(&Z))
+ sprintf(buf, "Elevation: NULL");
+ else
+ sprintf(buf, "Elevation: %f\n", Z);
+ Curses_write_window(INFO_WINDOW, 4, 2, buf);
+#ifdef MOUSE_YN
+ Curses_write_window(INFO_WINDOW, 6, 1,
+ "Look ok? (Left: y / Right: n) ");
+#else
+ Curses_write_window(INFO_WINDOW, 6, 1, "Look ok? (y/n) ");
+#endif
+
+ while (1) {
+#ifdef MOUSE_YN
+ int x, y, b;
+
+ R_get_location_with_pointer(&x, &y, &b);
+ if (b == 1)
+ return 1;
+ else if (b == 3)
+ break;
+#else
+ int c;
+
+ c = Curses_getch(0);
+ if (c == 'y' || c == 'Y')
+ return 1;
+ if (c == 'n' || c == 'N')
+ break;
+#endif
+ Beep();
+ }
+ }
+ /* return 0; dont get here */
+}
+
+static int digitizer(void)
+{
+ int ok;
+ char buf[100];
+
+ ok = digitizer_point(&E, &N);
+ if (ok) {
+ if (!get_z_from_cell(N, E))
+ return 0;
+
+ Curses_clear_window(INFO_WINDOW);
+ sprintf(buf, "East: %f\n", E);
+ Curses_write_window(INFO_WINDOW, 3, 2, buf);
+ sprintf(buf, "North: %f\n", N);
+ Curses_write_window(INFO_WINDOW, 4, 2, buf);
+ if (G_is_d_null_value(&Z))
+ sprintf(buf, "Elevation: NULL");
+ else
+ sprintf(buf, "Elevation: %f\n", Z);
+ Curses_write_window(INFO_WINDOW, 5, 2, buf);
+#ifdef MOUSE_YN
+ Curses_write_window(INFO_WINDOW, 7, 1,
+ "Look ok? (Left: y / Right: n) ");
+#else
+ Curses_write_window(INFO_WINDOW, 7, 1, "Look ok? (y/n) ");
+#endif
+
+ while (1) {
+#ifdef MOUSE_YN
+ int x, y, b;
+
+ R_get_location_with_pointer(&x, &y, &b);
+ if (b == 1) {
+ ok = 1;
+ break;
+ }
+ else if (b == 3) {
+ ok = -1;
+ break;
+ }
+#else
+ c = Curses_getch(0);
+ if (c == 'y' || c == 'Y') {
+ ok = 1;
+ break;
+ }
+ if (c == 'n' || c == 'N') {
+ ok = -1;
+ break;
+ }
+#endif
+ Beep();
+ }
+ Curses_clear_window(INFO_WINDOW);
+ return ok;
+ }
+ return 0;
+}
+
+static int screen(int x, int y, int button)
+{
+ int row, col, ok;
+ char buf[50];
+ View *view;
+
+ if (button == 3) /* cancel */
+ return -1;
+
+ if (In_view(VIEW_MAP2, x, y) && VIEW_MAP2->cell.configured)
+ view = VIEW_MAP2;
+ else if (In_view(VIEW_MAP2_ZOOM, x, y) && VIEW_MAP2_ZOOM->cell.configured)
+ view = VIEW_MAP2_ZOOM;
+ else
+ return 0; /* ignore mouse event */
+
+ col = view_to_col(view, x);
+ E = col_to_easting(&view->cell.head, col, 0.5);
+ row = view_to_row(view, y);
+ N = row_to_northing(&view->cell.head, row, 0.5);
+
+ if (!get_z_from_cell(N, E))
+ return 0;
+
+ Curses_clear_window(INFO_WINDOW);
+ sprintf(buf, "East: %10.2f\n", E);
+ Curses_write_window(INFO_WINDOW, 3, 2, buf);
+ sprintf(buf, "North: %10.2f\n", N);
+ Curses_write_window(INFO_WINDOW, 4, 2, buf);
+ if (G_is_d_null_value(&Z))
+ sprintf(buf, "Elevation: NULL");
+ else
+ sprintf(buf, "Elevation: %10.2f\n", Z);
+ Curses_write_window(INFO_WINDOW, 5, 2, buf);
+#ifdef MOUSE_YN
+ Curses_write_window(INFO_WINDOW, 7, 1, "Look ok? (Left: y / Right: n) ");
+#else
+ Curses_write_window(INFO_WINDOW, 7, 1, "Look ok? (y/n) ");
+#endif
+
+ R_standard_color(ORANGE);
+ save_under_dot(x, y, tempfile_dot2);
+ dot(x, y);
+ R_flush();
+
+ while (1) {
+#ifdef MOUSE_YN
+ int x, y, b;
+
+ R_get_location_with_pointer(&x, &y, &b);
+ if (b == 1) {
+ ok = 1;
+ break;
+ }
+ else if (b == 3) {
+ restore_under_dot(tempfile_dot2);
+ ok = 0;
+ break;
+ }
+#else
+ int c;
+
+ c = Curses_getch(0);
+ if (c == 'y' || c == 'Y') {
+ ok = 1;
+ break;
+ }
+ if (c == 'n' || c == 'N') {
+ ok = -1;
+ break;
+ }
+#endif
+ Beep();
+ }
+ Curses_clear_window(INFO_WINDOW);
+
+ return ok;
+}
+
+/* Get height from raster
+ * return 1 if coors are in raster or cannot open rster
+ * 0 if coors are outside raster
+ */
+int get_z_from_cell2(double north, double east, double *height)
+{
+ int row, col;
+ struct Cell_head elevhd;
+ RASTER_MAP_TYPE data_type;
+
+ G_set_d_null_value(height, 1);
+
+ /* allocate the elev buffer */
+ select_target_env();
+ G_get_cellhd(elev_layer, mapset_elev, &elevhd);
+ G_set_window(&elevhd);
+
+ elev = G_open_cell_old(elev_layer, mapset_elev);
+ if (elev < 0)
+ return 0;
+ data_type = G_get_raster_map_type(elev);
+
+ elevbuf = G_allocate_raster_buf(data_type);
+
+ /* find row, col in elevation raster map */
+ row = (int)northing_to_row(&elevhd, north);
+ col = (int)easting_to_col(&elevhd, east);
+
+ if (row < 0 || row >= elevhd.rows || col < 0 || col >= elevhd.cols) {
+ G_close_cell(elev);
+ G_free(elevbuf);
+ return 0;
+ }
+
+ if (G_get_raster_row(elev, elevbuf, row, data_type) <= 0) {
+ G_close_cell(elev);
+ G_free(elevbuf);
+ return 0;
+ }
+
+ if ((data_type == CELL_TYPE &&
+ !G_is_c_null_value((CELL *) & ((CELL *) elevbuf)[col])) ||
+ (data_type == FCELL_TYPE &&
+ !G_is_f_null_value((FCELL *) & ((FCELL *) elevbuf)[col])) ||
+ (data_type == DCELL_TYPE &&
+ !G_is_d_null_value((DCELL *) & ((DCELL *) elevbuf)[col]))) {
+ if (data_type == CELL_TYPE)
+ *height = (double)((CELL *) elevbuf)[col];
+ else if (data_type == FCELL_TYPE)
+ *height = (double)((FCELL *) elevbuf)[col];
+ else if (data_type == DCELL_TYPE)
+ *height = (double)((DCELL *) elevbuf)[col];
+ }
+
+ G_close_cell(elev);
+ G_free(elevbuf);
+ select_current_env();
+ return (1);
+}
+
+int get_z_from_cell(double north, double east)
+{
+ char buf[100];
+
+ if (!get_z_from_cell2(north, east, &Z)) {
+ Curses_write_window(INFO_WINDOW, 5, 1, "point not on elevation map");
+ Curses_write_window(INFO_WINDOW, 6, 1, "no elevation data available");
+ Beep();
+ G_sleep(3);
+ Curses_clear_window(INFO_WINDOW);
+
+ while (1) {
+ Curses_prompt_gets
+ ("Enter elevation value (hit return if not known): ", buf);
+ Curses_clear_window(PROMPT_WINDOW);
+ G_strip(buf);
+ if (*buf == 0)
+ return 0;
+ if (sscanf(buf, "%lf ", &Z) == 1)
+ return (1);
+ Beep();
+ }
+ }
+ else {
+ return (1);
+ }
+ return 0;
+}
+
+static int cancel(void)
+{
+ return -1;
+}
Deleted: grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2target/mouse.c
===================================================================
--- grass/branches/develbranch_6/imagery/i.ortho.photo/i.photo.2target/mouse.c 2010-12-01 09:34:37 UTC (rev 44501)
+++ grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2target/mouse.c 2010-12-22 10:05:10 UTC (rev 44654)
@@ -1,56 +0,0 @@
-#include <grass/raster.h>
-#include "globals.h"
-
-static int first = 1;
-static int curx, cury;
-
-int Mouse_pointer(int *x, int *y, int *button)
-{
- if (first) {
- curx = (SCREEN_LEFT + SCREEN_RIGHT) / 2;
- cury = (SCREEN_TOP + SCREEN_BOTTOM) / 2;
- first = 0;
- }
- R_get_location_with_pointer(&curx, &cury, button);
- *x = curx;
- *y = cury;
-
-#ifdef BUTTON3
- if (*button == 3)
- quit(0);
-#endif
-
- return 0;
-}
-
-int Mouse_box_anchored(int x1, int y1, int *x2, int *y2, int *button)
-{
- R_get_location_with_box(x1, y1, x2, y2, button);
- curx = *x2;
- cury = *y2;
- first = 0;
-
-#ifdef BUTTON3
- if (*button == 3)
- quit(0);
-#endif
-
- return 0;
-}
-
-int Get_mouse_xy(int *x, int *y)
-{
- *x = curx;
- *y = cury;
-
- return 0;
-}
-
-int Set_mouse_xy(int x, int y)
-{
- first = 0;
- curx = x;
- cury = y;
-
- return 0;
-}
Copied: grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2target/mouse.c (from rev 44501, grass/branches/develbranch_6/imagery/i.ortho.photo/i.photo.2target/mouse.c)
===================================================================
--- grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2target/mouse.c (rev 0)
+++ grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2target/mouse.c 2010-12-22 10:05:10 UTC (rev 44654)
@@ -0,0 +1,56 @@
+#include <grass/raster.h>
+#include "globals.h"
+
+static int first = 1;
+static int curx, cury;
+
+int Mouse_pointer(int *x, int *y, int *button)
+{
+ if (first) {
+ curx = (SCREEN_LEFT + SCREEN_RIGHT) / 2;
+ cury = (SCREEN_TOP + SCREEN_BOTTOM) / 2;
+ first = 0;
+ }
+ R_get_location_with_pointer(&curx, &cury, button);
+ *x = curx;
+ *y = cury;
+
+#ifdef BUTTON3
+ if (*button == 3)
+ quit(0);
+#endif
+
+ return 0;
+}
+
+int Mouse_box_anchored(int x1, int y1, int *x2, int *y2, int *button)
+{
+ R_get_location_with_box(x1, y1, x2, y2, button);
+ curx = *x2;
+ cury = *y2;
+ first = 0;
+
+#ifdef BUTTON3
+ if (*button == 3)
+ quit(0);
+#endif
+
+ return 0;
+}
+
+int Get_mouse_xy(int *x, int *y)
+{
+ *x = curx;
+ *y = cury;
+
+ return 0;
+}
+
+int Set_mouse_xy(int x, int y)
+{
+ first = 0;
+ curx = x;
+ cury = y;
+
+ return 0;
+}
Deleted: grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2target/points.c
===================================================================
--- grass/branches/develbranch_6/imagery/i.ortho.photo/i.photo.2target/points.c 2010-12-01 09:34:37 UTC (rev 44501)
+++ grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2target/points.c 2010-12-22 10:05:10 UTC (rev 44654)
@@ -1,86 +0,0 @@
-#include <grass/raster.h>
-#include "globals.h"
-#include "local_proto.h"
-
-int display_conz_points(int in_color)
-{
- /* double x,y;
-
- I_georef (group.control_points.e1, group.control_points.n1, &x, &y,
- group.E21, group.N21);
- *** */
-
- display_conz_points_in_view(VIEW_MAP1, in_color,
- group.control_points.e1,
- group.control_points.n1,
- group.control_points.status,
- group.control_points.count);
-
- display_conz_points_in_view(VIEW_MAP1_ZOOM, in_color,
- group.control_points.e1,
- group.control_points.n1,
- group.control_points.status,
- group.control_points.count);
-
- display_conz_points_in_view(VIEW_MAP2, in_color,
- group.control_points.e2,
- group.control_points.n2,
- group.control_points.status,
- group.control_points.count);
-
- display_conz_points_in_view(VIEW_MAP2_ZOOM, in_color,
- group.control_points.e2,
- group.control_points.n2,
- group.control_points.status,
- group.control_points.count);
-
- return 0;
-}
-
-int display_conz_points_in_view(View * view, int in_color, double *east,
- double *north, int *status, int count)
-{
- if (!view->cell.configured)
- return 1;
- while (count-- > 0) {
- if (in_color && (*status > 0))
- R_standard_color(GREEN);
- else if (in_color && (*status == 0))
- R_standard_color(RED);
- else
- R_standard_color(GREY);
- status++;
- display_one_point(view, *east++, *north++);
- }
-
- return 0;
-}
-
-int display_one_point(View * view, double east, double north)
-{
- int row, col, x, y;
- double x0, y0;
-
- row = northing_to_row(&view->cell.head, north) + .5;
- col = easting_to_col(&view->cell.head, east) + .5;
- y = row_to_view(view, row);
- x = col_to_view(view, col);
-
- if ((view == VIEW_MAP1) || (view == VIEW_MAP1_ZOOM)) {
- /*
- I_georef (east,north,&x0,&y0,group.E21,group.N21);
- */
- x0 = east;
- y0 = north;
-
- row = northing_to_row(&view->cell.head, y0) + .5;
- col = easting_to_col(&view->cell.head, x0) + .5;
- y = row_to_view(view, row);
- x = col_to_view(view, col);
- }
-
- if (In_view(view, x, y))
- dot(x, y);
-
- return 0;
-}
Copied: grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2target/points.c (from rev 44501, grass/branches/develbranch_6/imagery/i.ortho.photo/i.photo.2target/points.c)
===================================================================
--- grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2target/points.c (rev 0)
+++ grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2target/points.c 2010-12-22 10:05:10 UTC (rev 44654)
@@ -0,0 +1,86 @@
+#include <grass/raster.h>
+#include "globals.h"
+#include "local_proto.h"
+
+int display_conz_points(int in_color)
+{
+ /* double x,y;
+
+ I_georef (group.control_points.e1, group.control_points.n1, &x, &y,
+ group.E21, group.N21);
+ *** */
+
+ display_conz_points_in_view(VIEW_MAP1, in_color,
+ group.control_points.e1,
+ group.control_points.n1,
+ group.control_points.status,
+ group.control_points.count);
+
+ display_conz_points_in_view(VIEW_MAP1_ZOOM, in_color,
+ group.control_points.e1,
+ group.control_points.n1,
+ group.control_points.status,
+ group.control_points.count);
+
+ display_conz_points_in_view(VIEW_MAP2, in_color,
+ group.control_points.e2,
+ group.control_points.n2,
+ group.control_points.status,
+ group.control_points.count);
+
+ display_conz_points_in_view(VIEW_MAP2_ZOOM, in_color,
+ group.control_points.e2,
+ group.control_points.n2,
+ group.control_points.status,
+ group.control_points.count);
+
+ return 0;
+}
+
+int display_conz_points_in_view(View * view, int in_color, double *east,
+ double *north, int *status, int count)
+{
+ if (!view->cell.configured)
+ return 1;
+ while (count-- > 0) {
+ if (in_color && (*status > 0))
+ R_standard_color(GREEN);
+ else if (in_color && (*status == 0))
+ R_standard_color(RED);
+ else
+ R_standard_color(GREY);
+ status++;
+ display_one_point(view, *east++, *north++);
+ }
+
+ return 0;
+}
+
+int display_one_point(View * view, double east, double north)
+{
+ int row, col, x, y;
+ double x0, y0;
+
+ row = northing_to_row(&view->cell.head, north) + .5;
+ col = easting_to_col(&view->cell.head, east) + .5;
+ y = row_to_view(view, row);
+ x = col_to_view(view, col);
+
+ if ((view == VIEW_MAP1) || (view == VIEW_MAP1_ZOOM)) {
+ /*
+ I_georef (east,north,&x0,&y0,group.E21,group.N21);
+ */
+ x0 = east;
+ y0 = north;
+
+ row = northing_to_row(&view->cell.head, y0) + .5;
+ col = easting_to_col(&view->cell.head, x0) + .5;
+ y = row_to_view(view, row);
+ x = col_to_view(view, col);
+ }
+
+ if (In_view(view, x, y))
+ dot(x, y);
+
+ return 0;
+}
Deleted: grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2target/target.c
===================================================================
--- grass/branches/develbranch_6/imagery/i.ortho.photo/i.photo.2target/target.c 2010-12-01 09:34:37 UTC (rev 44501)
+++ grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2target/target.c 2010-12-22 10:05:10 UTC (rev 44654)
@@ -1,107 +0,0 @@
-#include <unistd.h>
-#include <string.h>
-#include <grass/imagery.h>
-#include "globals.h"
-#include "local_proto.h"
-
-/* read the target for the group and cast it into the alternate GRASS env */
-
-static int which_env;
-
-int get_target(void)
-{
- char location[40];
- char mapset[40];
- char buf[1024];
- int stat;
- char tl[100];
- char math_exp[100];
- char units[100];
- char nd[100];
-
- elev_layer = (char *)G_malloc(40 * sizeof(char));
- mapset_elev = (char *)G_malloc(40 * sizeof(char));
-
- /*fprintf (stderr,"Looking for target location\n"); */
-
- if (!I_get_target(group.name, location, mapset)) {
- sprintf(buf, "Target information missing for group [%s]\n",
- group.name);
- goto error;
- }
-
-/***
-fprintf (stderr,"target location: %s\n", location);
-fprintf (stderr,"target mapset: %s\n", mapset);
-fprintf (stderr,"Checking target access\n");
-G_sleep (3);
-****/
- sprintf(buf, "%s/%s", G_gisdbase(), location);
- if (access(buf, 0) != 0) {
- sprintf(buf, "Target location [%s] not found\n", location);
- goto error;
- }
- G__create_alt_env();
- G__setenv("LOCATION_NAME", location);
- stat = G__mapset_permissions(mapset);
- if (stat > 0) {
- G__setenv("MAPSET", mapset);
- G__create_alt_search_path();
- G__switch_env();
- G__switch_search_path();
- which_env = 0;
-
- /* get the block elevation layer raster map in target location */
-
-/***
-fprintf (stderr,"Looking for elevation file in block: %s\n", block.name);
-G_sleep (3);
-***/
- /* Return the elev name from the group file ELEVATION */
- if (!I_get_group_elev(group.name, elev_layer, mapset_elev,
- tl, math_exp, units, nd)) {
- sprintf(buf, "Elevation information missing.for group [%s] \n",
- group.name);
- goto error;
- }
-
-/**
-fprintf (stderr,"Block elevation: %s in %s\n", elev_layer, mapset_elev);
-G_sleep (3);
-**/
- return 1;
- }
- sprintf(buf, "Mapset [%s] in target location [%s] - ", mapset, location);
- strcat(buf, stat == 0 ? "permission denied\n" : "not found\n");
-
-
- error:
-
-/****
- strcat (buf, "Please run i.target for block ");
- strcat (buf, block.name);
-****/
- G_fatal_error(buf);
-}
-
-int select_current_env(void)
-{
- if (which_env != 0) {
- G__switch_env();
- G__switch_search_path();
- which_env = 0;
- }
-
- return 0;
-}
-
-int select_target_env(void)
-{
- if (which_env != 1) {
- G__switch_env();
- G__switch_search_path();
- which_env = 1;
- }
-
- return 0;
-}
Copied: grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2target/target.c (from rev 44501, grass/branches/develbranch_6/imagery/i.ortho.photo/i.photo.2target/target.c)
===================================================================
--- grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2target/target.c (rev 0)
+++ grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2target/target.c 2010-12-22 10:05:10 UTC (rev 44654)
@@ -0,0 +1,107 @@
+#include <unistd.h>
+#include <string.h>
+#include <grass/imagery.h>
+#include "globals.h"
+#include "local_proto.h"
+
+/* read the target for the group and cast it into the alternate GRASS env */
+
+static int which_env;
+
+int get_target(void)
+{
+ char location[40];
+ char mapset[40];
+ char buf[1024];
+ int stat;
+ char tl[100];
+ char math_exp[100];
+ char units[100];
+ char nd[100];
+
+ elev_layer = (char *)G_malloc(40 * sizeof(char));
+ mapset_elev = (char *)G_malloc(40 * sizeof(char));
+
+ /*fprintf (stderr,"Looking for target location\n"); */
+
+ if (!I_get_target(group.name, location, mapset)) {
+ sprintf(buf, "Target information missing for group [%s]\n",
+ group.name);
+ goto error;
+ }
+
+/***
+fprintf (stderr,"target location: %s\n", location);
+fprintf (stderr,"target mapset: %s\n", mapset);
+fprintf (stderr,"Checking target access\n");
+G_sleep (3);
+****/
+ sprintf(buf, "%s/%s", G_gisdbase(), location);
+ if (access(buf, 0) != 0) {
+ sprintf(buf, "Target location [%s] not found\n", location);
+ goto error;
+ }
+ G__create_alt_env();
+ G__setenv("LOCATION_NAME", location);
+ stat = G__mapset_permissions(mapset);
+ if (stat > 0) {
+ G__setenv("MAPSET", mapset);
+ G__create_alt_search_path();
+ G__switch_env();
+ G__switch_search_path();
+ which_env = 0;
+
+ /* get the block elevation layer raster map in target location */
+
+/***
+fprintf (stderr,"Looking for elevation file in block: %s\n", block.name);
+G_sleep (3);
+***/
+ /* Return the elev name from the group file ELEVATION */
+ if (!I_get_group_elev(group.name, elev_layer, mapset_elev,
+ tl, math_exp, units, nd)) {
+ sprintf(buf, "Elevation information missing.for group [%s] \n",
+ group.name);
+ goto error;
+ }
+
+/**
+fprintf (stderr,"Block elevation: %s in %s\n", elev_layer, mapset_elev);
+G_sleep (3);
+**/
+ return 1;
+ }
+ sprintf(buf, "Mapset [%s] in target location [%s] - ", mapset, location);
+ strcat(buf, stat == 0 ? "permission denied\n" : "not found\n");
+
+
+ error:
+
+/****
+ strcat (buf, "Please run i.target for block ");
+ strcat (buf, block.name);
+****/
+ G_fatal_error(buf);
+}
+
+int select_current_env(void)
+{
+ if (which_env != 0) {
+ G__switch_env();
+ G__switch_search_path();
+ which_env = 0;
+ }
+
+ return 0;
+}
+
+int select_target_env(void)
+{
+ if (which_env != 1) {
+ G__switch_env();
+ G__switch_search_path();
+ which_env = 1;
+ }
+
+ return 0;
+}
Deleted: grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2target/title.c
===================================================================
--- grass/branches/develbranch_6/imagery/i.ortho.photo/i.photo.2target/title.c 2010-12-01 09:34:37 UTC (rev 44501)
+++ grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2target/title.c 2010-12-22 10:05:10 UTC (rev 44654)
@@ -1,48 +0,0 @@
-#include <grass/raster.h>
-#include "globals.h"
-#include "local_proto.h"
-
-int display_title(View * view)
-{
- View *title;
- char left[100], center[100];
- int size;
-
- *left = 0;
- *center = 0;
-
- if (view->cell.configured) {
- sprintf(center, "%s (mag %.1f)",
- view->cell.name, magnification(view));
- }
-
- if (view == VIEW_MAP1) {
- sprintf(left, "%s", G_location());
- title = VIEW_TITLE1;
- }
- else if (view == VIEW_MAP1_ZOOM) {
- title = VIEW_TITLE1_ZOOM;
- }
-
- if (view == VIEW_MAP2) {
- sprintf(left, "%s", G_location());
- title = VIEW_TITLE2;
- }
- else if (view == VIEW_MAP2_ZOOM) {
- title = VIEW_TITLE2_ZOOM;
- }
-
- Erase_view(title);
- R_standard_color(WHITE);
- size = title->nrows - 4;
- R_text_size(size, size);
- Text(left, title->top, title->bottom, title->left, title->right, 2);
- if (*center) {
- R_standard_color(YELLOW);
- Text(center, title->top, title->bottom,
- (title->left + title->right - Text_width(center)) / 2,
- title->right, 2);
- }
-
- return 0;
-}
Copied: grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2target/title.c (from rev 44501, grass/branches/develbranch_6/imagery/i.ortho.photo/i.photo.2target/title.c)
===================================================================
--- grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2target/title.c (rev 0)
+++ grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2target/title.c 2010-12-22 10:05:10 UTC (rev 44654)
@@ -0,0 +1,48 @@
+#include <grass/raster.h>
+#include "globals.h"
+#include "local_proto.h"
+
+int display_title(View * view)
+{
+ View *title;
+ char left[100], center[100];
+ int size;
+
+ *left = 0;
+ *center = 0;
+
+ if (view->cell.configured) {
+ sprintf(center, "%s (mag %.1f)",
+ view->cell.name, magnification(view));
+ }
+
+ if (view == VIEW_MAP1) {
+ sprintf(left, "%s", G_location());
+ title = VIEW_TITLE1;
+ }
+ else if (view == VIEW_MAP1_ZOOM) {
+ title = VIEW_TITLE1_ZOOM;
+ }
+
+ if (view == VIEW_MAP2) {
+ sprintf(left, "%s", G_location());
+ title = VIEW_TITLE2;
+ }
+ else if (view == VIEW_MAP2_ZOOM) {
+ title = VIEW_TITLE2_ZOOM;
+ }
+
+ Erase_view(title);
+ R_standard_color(WHITE);
+ size = title->nrows - 4;
+ R_text_size(size, size);
+ Text(left, title->top, title->bottom, title->left, title->right, 2);
+ if (*center) {
+ R_standard_color(YELLOW);
+ Text(center, title->top, title->bottom,
+ (title->left + title->right - Text_width(center)) / 2,
+ title->right, 2);
+ }
+
+ return 0;
+}
Deleted: grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2target/view.c
===================================================================
--- grass/branches/develbranch_6/imagery/i.ortho.photo/i.photo.2target/view.c 2010-12-01 09:34:37 UTC (rev 44501)
+++ grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2target/view.c 2010-12-22 10:05:10 UTC (rev 44654)
@@ -1,50 +0,0 @@
-#include <string.h>
-#include <grass/raster.h>
-#include "globals.h"
-#include "local_proto.h"
-
-int Configure_view(View * view, char *name, char *mapset, double ns_res, double ew_res /* original map resolution */
- )
-{
- Erase_view(view);
- view->cell.configured = 0;
-
- /* copy the cell name into the view */
- strcpy(view->cell.name, name);
- strcpy(view->cell.mapset, mapset);
-
- /* determine the map edges */
- view->cell.left = view->left + (view->ncols - view->cell.head.cols) / 2;
- view->cell.right = view->cell.left + view->cell.head.cols - 1;
- view->cell.top = view->top + (view->nrows - view->cell.head.rows) / 2;
- view->cell.bottom = view->cell.top + view->cell.head.rows - 1;
-
- /* remember original resolutions */
- view->cell.ns_res = ns_res;
- view->cell.ew_res = ew_res;
-
- view->cell.configured = 1;
-
- return 0;
-}
-
-int In_view(View * view, int x, int y)
-{
- return (x >= view->left && x <= view->right && y >= view->top &&
- y <= view->bottom);
-}
-
-int Erase_view(View * view)
-{
- R_standard_color(BLACK);
- R_box_abs(view->left, view->top, view->right, view->bottom);
-
- return 0;
-}
-
-double magnification(View * view)
-{
- if (!view->cell.configured)
- return ((double)0.0);
- return (view->cell.ew_res / view->cell.head.ew_res);
-}
Copied: grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2target/view.c (from rev 44501, grass/branches/develbranch_6/imagery/i.ortho.photo/i.photo.2target/view.c)
===================================================================
--- grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2target/view.c (rev 0)
+++ grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2target/view.c 2010-12-22 10:05:10 UTC (rev 44654)
@@ -0,0 +1,50 @@
+#include <string.h>
+#include <grass/raster.h>
+#include "globals.h"
+#include "local_proto.h"
+
+int Configure_view(View * view, char *name, char *mapset, double ns_res, double ew_res /* original map resolution */
+ )
+{
+ Erase_view(view);
+ view->cell.configured = 0;
+
+ /* copy the cell name into the view */
+ strcpy(view->cell.name, name);
+ strcpy(view->cell.mapset, mapset);
+
+ /* determine the map edges */
+ view->cell.left = view->left + (view->ncols - view->cell.head.cols) / 2;
+ view->cell.right = view->cell.left + view->cell.head.cols - 1;
+ view->cell.top = view->top + (view->nrows - view->cell.head.rows) / 2;
+ view->cell.bottom = view->cell.top + view->cell.head.rows - 1;
+
+ /* remember original resolutions */
+ view->cell.ns_res = ns_res;
+ view->cell.ew_res = ew_res;
+
+ view->cell.configured = 1;
+
+ return 0;
+}
+
+int In_view(View * view, int x, int y)
+{
+ return (x >= view->left && x <= view->right && y >= view->top &&
+ y <= view->bottom);
+}
+
+int Erase_view(View * view)
+{
+ R_standard_color(BLACK);
+ R_box_abs(view->left, view->top, view->right, view->bottom);
+
+ return 0;
+}
+
+double magnification(View * view)
+{
+ if (!view->cell.configured)
+ return ((double)0.0);
+ return (view->cell.ew_res / view->cell.head.ew_res);
+}
Deleted: grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2target/where.c
===================================================================
--- grass/branches/develbranch_6/imagery/i.ortho.photo/i.photo.2target/where.c 2010-12-01 09:34:37 UTC (rev 44501)
+++ grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2target/where.c 2010-12-22 10:05:10 UTC (rev 44654)
@@ -1,68 +0,0 @@
-#include "globals.h"
-#include "local_proto.h"
-
-static int where_12(View *, int, int);
-static int where_21(View *, int, int);
-static int where_am_i(View *, int, int, Window *, double *, double *,
- Window *);
-
-int where(int x, int y)
-{
- if (VIEW_MAP1->cell.configured && In_view(VIEW_MAP1, x, y))
- where_12(VIEW_MAP1, x, y);
- else if (VIEW_MAP1_ZOOM->cell.configured && In_view(VIEW_MAP1_ZOOM, x, y))
- where_12(VIEW_MAP1_ZOOM, x, y);
- else if (VIEW_MAP2->cell.configured && In_view(VIEW_MAP2, x, y))
- where_21(VIEW_MAP2, x, y);
- else if (VIEW_MAP2_ZOOM->cell.configured && In_view(VIEW_MAP2_ZOOM, x, y))
- where_21(VIEW_MAP2_ZOOM, x, y);
- return 0; /* return but don't quit */
-}
-
-static int where_12(View * view, int x, int y)
-{
- where_am_i(view, x, y, MENU_WINDOW, group.E12, group.N12, INFO_WINDOW);
- return 0;
-}
-
-static int where_21(View * view, int x, int y)
-{
- where_am_i(view, x, y, INFO_WINDOW, group.E21, group.N21, MENU_WINDOW);
- return 0;
-}
-
-static int where_am_i(View * view, int x, int y, Window * w1, double *E,
- double *N, Window * w2)
-{
- double e1, n1, e2, n2;
- int row, col;
-
- char buf[100];
-
- /* convert x,y to east,north at center of cell */
- col = view_to_col(view, x);
- e1 = col_to_easting(&view->cell.head, col, 0.5);
- row = view_to_row(view, y);
- n1 = row_to_northing(&view->cell.head, row, 0.5);
-
- Curses_clear_window(w1);
- sprintf(buf, "IMAGE X: %10.2f", e1);
- Curses_write_window(w1, 3, 3, buf);
- sprintf(buf, "IMAGE Y: %10.2f", n1);
- Curses_write_window(w1, 4, 3, buf);
-
- /* if transformation equation is useable, determine point via equation */
- if (group.ref_equation_stat <= 0)
- return 1;
-
- /* I_georef (e1, n1, &e2, &n2, E, N); */
- e2 = e1;
- n2 = n1;
-
- Curses_clear_window(w2);
- sprintf(buf, "IMAGE X: %10.2f", e2);
- Curses_write_window(w2, 3, 3, buf);
- sprintf(buf, "IMAGE Y: %10.2f", n2);
- Curses_write_window(w2, 4, 3, buf);
- return 0;
-}
Copied: grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2target/where.c (from rev 44501, grass/branches/develbranch_6/imagery/i.ortho.photo/i.photo.2target/where.c)
===================================================================
--- grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2target/where.c (rev 0)
+++ grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2target/where.c 2010-12-22 10:05:10 UTC (rev 44654)
@@ -0,0 +1,68 @@
+#include "globals.h"
+#include "local_proto.h"
+
+static int where_12(View *, int, int);
+static int where_21(View *, int, int);
+static int where_am_i(View *, int, int, Window *, double *, double *,
+ Window *);
+
+int where(int x, int y)
+{
+ if (VIEW_MAP1->cell.configured && In_view(VIEW_MAP1, x, y))
+ where_12(VIEW_MAP1, x, y);
+ else if (VIEW_MAP1_ZOOM->cell.configured && In_view(VIEW_MAP1_ZOOM, x, y))
+ where_12(VIEW_MAP1_ZOOM, x, y);
+ else if (VIEW_MAP2->cell.configured && In_view(VIEW_MAP2, x, y))
+ where_21(VIEW_MAP2, x, y);
+ else if (VIEW_MAP2_ZOOM->cell.configured && In_view(VIEW_MAP2_ZOOM, x, y))
+ where_21(VIEW_MAP2_ZOOM, x, y);
+ return 0; /* return but don't quit */
+}
+
+static int where_12(View * view, int x, int y)
+{
+ where_am_i(view, x, y, MENU_WINDOW, group.E12, group.N12, INFO_WINDOW);
+ return 0;
+}
+
+static int where_21(View * view, int x, int y)
+{
+ where_am_i(view, x, y, INFO_WINDOW, group.E21, group.N21, MENU_WINDOW);
+ return 0;
+}
+
+static int where_am_i(View * view, int x, int y, Window * w1, double *E,
+ double *N, Window * w2)
+{
+ double e1, n1, e2, n2;
+ int row, col;
+
+ char buf[100];
+
+ /* convert x,y to east,north at center of cell */
+ col = view_to_col(view, x);
+ e1 = col_to_easting(&view->cell.head, col, 0.5);
+ row = view_to_row(view, y);
+ n1 = row_to_northing(&view->cell.head, row, 0.5);
+
+ Curses_clear_window(w1);
+ sprintf(buf, "IMAGE X: %10.2f", e1);
+ Curses_write_window(w1, 3, 3, buf);
+ sprintf(buf, "IMAGE Y: %10.2f", n1);
+ Curses_write_window(w1, 4, 3, buf);
+
+ /* if transformation equation is useable, determine point via equation */
+ if (group.ref_equation_stat <= 0)
+ return 1;
+
+ /* I_georef (e1, n1, &e2, &n2, E, N); */
+ e2 = e1;
+ n2 = n1;
+
+ Curses_clear_window(w2);
+ sprintf(buf, "IMAGE X: %10.2f", e2);
+ Curses_write_window(w2, 3, 3, buf);
+ sprintf(buf, "IMAGE Y: %10.2f", n2);
+ Curses_write_window(w2, 4, 3, buf);
+ return 0;
+}
Deleted: grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2target/zoom.c
===================================================================
--- grass/branches/develbranch_6/imagery/i.ortho.photo/i.photo.2target/zoom.c 2010-12-01 09:34:37 UTC (rev 44501)
+++ grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2target/zoom.c 2010-12-22 10:05:10 UTC (rev 44654)
@@ -1,102 +0,0 @@
-#include "globals.h"
-#include "local_proto.h"
-
-static int cancel(void);
-
-int zoom(void)
-{
- static int use = 1;
- static Objects objects[] = {
- MENU("CANCEL", cancel, &use),
- MENU("BOX", zoom_box, &use),
- MENU("POINT", zoom_point, &use),
- INFO("Select type of zoom", &use),
- {0}
- };
-
- Input_pointer(objects);
- return 0; /* return, but don't QUIT */
-}
-
-static int cancel(void)
-{
- return -1;
-}
-
-/* get target point for source point */
-void source_to_target(double srx, double sry, double *trx, double *try)
-{
- int i;
- double spx, spy, spz; /* source photo */
- double trz; /* target raster */
-
- G_debug(2, "source raster: %.0f %.0f", srx, sry);
-
- /* Photo coordinates of center on ZOOM1 */
- I_georef(srx, sry, &spx, &spy, group.E12, group.N12);
- G_debug(2, "source photo: %.3f %.3f", spx, spy);
-
- /* We need height but we don't know point on target ->
- * get aproximately the point on target and use that
- * height for more precise position */
- spz = 0;
- for (i = 0; i < 3; i++) {
- I_inverse_ortho_ref(spx, spy, spz, trx, try, &trz,
- &group.camera_ref,
- group.XC, group.YC, group.ZC, group.MI);
-
- G_debug(2, "target raster: %.0f %.0f", *trx, *try);
- get_z_from_cell2(*try, *trx, &spz);
- G_debug(2, "target raster height: %.0f", spz);
- }
-
- G_debug(2, "target rast center: %.0f %.0f", *trx, *try);
-}
-
-void auto_zoom(void)
-{
- double srx, sry; /* source raster */
- double trx, try; /* target raster */
- int vx, vy;
- double trl, trr;
- double width, magnific;
-
- if (autozoom_off)
- return;
-
- Compute_ortho_equation();
- if (group.con_equation_stat <= 0)
- return;
-
- /* Calc scale for target */
- sry = VIEW_MAP1_ZOOM->cell.head.north;
- srx = VIEW_MAP1_ZOOM->cell.head.west;
- source_to_target(srx, sry, &trl, &try);
- srx = VIEW_MAP1_ZOOM->cell.head.east;
- source_to_target(srx, sry, &trr, &try);
- width = trr - trl; /* ZOOM1 width in target units */
-
- /* Calc magnification - relation between resolution
- * in zoom window and cell head */
- magnific = (VIEW_MAP1_ZOOM->right - VIEW_MAP1_ZOOM->left) / width;
- G_debug(3, "width = %.0f magnific = %f", width, magnific);
-
- /* Raster coordinates of center on ZOOM1 */
- srx = (VIEW_MAP1_ZOOM->cell.head.east +
- VIEW_MAP1_ZOOM->cell.head.west) / 2;
- sry = (VIEW_MAP1_ZOOM->cell.head.north +
- VIEW_MAP1_ZOOM->cell.head.south) / 2;
-
- source_to_target(srx, sry, &trx, &try);
-
- vx = easting_to_col(&VIEW_MAP2->cell.head, trx);
- vy = northing_to_row(&VIEW_MAP2->cell.head, try);
- G_debug(2, "target rast col, row: %d %d", vx, vy);
-
- vx = col_to_view(VIEW_MAP2, vx);
- vy = row_to_view(VIEW_MAP2, vy);
-
- G_debug(2, "target view col, row: %d %d", vx, vy);
-
- zoom_point2(vx, vy, 0, magnific);
-}
Copied: grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2target/zoom.c (from rev 44501, grass/branches/develbranch_6/imagery/i.ortho.photo/i.photo.2target/zoom.c)
===================================================================
--- grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2target/zoom.c (rev 0)
+++ grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2target/zoom.c 2010-12-22 10:05:10 UTC (rev 44654)
@@ -0,0 +1,102 @@
+#include "globals.h"
+#include "local_proto.h"
+
+static int cancel(void);
+
+int zoom(void)
+{
+ static int use = 1;
+ static Objects objects[] = {
+ MENU("CANCEL", cancel, &use),
+ MENU("BOX", zoom_box, &use),
+ MENU("POINT", zoom_point, &use),
+ INFO("Select type of zoom", &use),
+ {0}
+ };
+
+ Input_pointer(objects);
+ return 0; /* return, but don't QUIT */
+}
+
+static int cancel(void)
+{
+ return -1;
+}
+
+/* get target point for source point */
+void source_to_target(double srx, double sry, double *trx, double *try)
+{
+ int i;
+ double spx, spy, spz; /* source photo */
+ double trz; /* target raster */
+
+ G_debug(2, "source raster: %.0f %.0f", srx, sry);
+
+ /* Photo coordinates of center on ZOOM1 */
+ I_georef(srx, sry, &spx, &spy, group.E12, group.N12);
+ G_debug(2, "source photo: %.3f %.3f", spx, spy);
+
+ /* We need height but we don't know point on target ->
+ * get aproximately the point on target and use that
+ * height for more precise position */
+ spz = 0;
+ for (i = 0; i < 3; i++) {
+ I_inverse_ortho_ref(spx, spy, spz, trx, try, &trz,
+ &group.camera_ref,
+ group.XC, group.YC, group.ZC, group.MI);
+
+ G_debug(2, "target raster: %.0f %.0f", *trx, *try);
+ get_z_from_cell2(*try, *trx, &spz);
+ G_debug(2, "target raster height: %.0f", spz);
+ }
+
+ G_debug(2, "target rast center: %.0f %.0f", *trx, *try);
+}
+
+void auto_zoom(void)
+{
+ double srx, sry; /* source raster */
+ double trx, try; /* target raster */
+ int vx, vy;
+ double trl, trr;
+ double width, magnific;
+
+ if (autozoom_off)
+ return;
+
+ Compute_ortho_equation();
+ if (group.con_equation_stat <= 0)
+ return;
+
+ /* Calc scale for target */
+ sry = VIEW_MAP1_ZOOM->cell.head.north;
+ srx = VIEW_MAP1_ZOOM->cell.head.west;
+ source_to_target(srx, sry, &trl, &try);
+ srx = VIEW_MAP1_ZOOM->cell.head.east;
+ source_to_target(srx, sry, &trr, &try);
+ width = trr - trl; /* ZOOM1 width in target units */
+
+ /* Calc magnification - relation between resolution
+ * in zoom window and cell head */
+ magnific = (VIEW_MAP1_ZOOM->right - VIEW_MAP1_ZOOM->left) / width;
+ G_debug(3, "width = %.0f magnific = %f", width, magnific);
+
+ /* Raster coordinates of center on ZOOM1 */
+ srx = (VIEW_MAP1_ZOOM->cell.head.east +
+ VIEW_MAP1_ZOOM->cell.head.west) / 2;
+ sry = (VIEW_MAP1_ZOOM->cell.head.north +
+ VIEW_MAP1_ZOOM->cell.head.south) / 2;
+
+ source_to_target(srx, sry, &trx, &try);
+
+ vx = easting_to_col(&VIEW_MAP2->cell.head, trx);
+ vy = northing_to_row(&VIEW_MAP2->cell.head, try);
+ G_debug(2, "target rast col, row: %d %d", vx, vy);
+
+ vx = col_to_view(VIEW_MAP2, vx);
+ vy = row_to_view(VIEW_MAP2, vy);
+
+ G_debug(2, "target view col, row: %d %d", vx, vy);
+
+ zoom_point2(vx, vy, 0, magnific);
+}
Deleted: grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2target/zoom_box.c
===================================================================
--- grass/branches/develbranch_6/imagery/i.ortho.photo/i.photo.2target/zoom_box.c 2010-12-01 09:34:37 UTC (rev 44501)
+++ grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2target/zoom_box.c 2010-12-22 10:05:10 UTC (rev 44654)
@@ -1,197 +0,0 @@
-#include <grass/raster.h>
-#include "globals.h"
-#include "local_proto.h"
-
-static int x1, y1, x2, y2;
-static View *pick_view, *zoom_view, *main_view;
-static int target_flag;
-static int zoom2(int, int);
-static int cancel(void);
-
-int zoom_box(void)
-{
- static int use = 1;
-
- static Objects objects[] = {
- MENU("CANCEL", cancel, &use),
- INFO(" Mark first corner of window ", &use),
- OTHER(zoom_box1, &use),
- {0}
- };
-
- Input_pointer(objects);
- return 1;
-}
-
-int zoom_box1(int x, int y)
-{ /* called by Input_pointer */
- static int use = 1;
- static Objects objects[] = {
- MENU("CANCEL", cancel, &use),
- INFO(" Define the window ", &use),
- OTHER(zoom2, &use),
- {0}
- };
-
- /*
- * user has marked first corner
- * this determines which view is being zoomed
- */
- x1 = x;
- y1 = y;
-
- if (In_view(pick_view = VIEW_MAP1, x1, y1)) {
- main_view = VIEW_MAP1;
- zoom_view = VIEW_MAP1_ZOOM;
- target_flag = 0;
- }
- else if (In_view(pick_view = VIEW_MAP2, x1, y1)) {
- if (!pick_view->cell.configured)
- return 0; /* ignore the mouse event */
- main_view = VIEW_MAP2;
- zoom_view = VIEW_MAP2_ZOOM;
- target_flag = 1;
- }
- else if (In_view(pick_view = VIEW_MAP1_ZOOM, x1, y1)) {
- if (!pick_view->cell.configured)
- return 0; /* ignore the mouse event */
- main_view = VIEW_MAP1;
- zoom_view = VIEW_MAP1_ZOOM;
- target_flag = 0;
- }
- else if (In_view(pick_view = VIEW_MAP2_ZOOM, x1, y1)) {
- if (!pick_view->cell.configured)
- return 0; /* ignore the mouse event */
- main_view = VIEW_MAP2;
- zoom_view = VIEW_MAP2_ZOOM;
- target_flag = 1;
- }
- else
- return 0; /* ignore the mouse event */
- if (!pick_view->cell.configured)
- return 0; /* just to be sure */
-
- return Input_box(objects, x, y);
-}
-
-static int zoom2(int x, int y)
-{
- int top, bottom, left, right;
- int row, col;
- struct Cell_head cellhd;
- char *winfile;
-
- x2 = x;
- y2 = y;
- /*
- * user has completed the zoom window.
- * must be in same view as first corner
- */
- if (x1 == x2 || y1 == y2)
- return 0; /* ignore event */
- if (!In_view(pick_view, x2, y2))
- return 0;
- /*
- * ok, erase menu messages
- */
- Menu_msg("");
-
- /*
- * assign window coordinates to top,bottom,left,right
- */
- if (x1 < x2) {
- left = x1;
- right = x2;
- }
- else {
- left = x2;
- right = x1;
- }
- if (y1 < y2) {
- top = y1;
- bottom = y2;
- }
- else {
- top = y2;
- bottom = y1;
- }
-
- /*
- * Determine the the zoom window (ie, cellhd)
- * must copy the current view cellhd first, to preserve header info
- * (such as projection, zone, and other items.)
- * compute zoom window northings,eastings, rows, cols, and resolution
- */
-
- G_copy(&cellhd, &pick_view->cell.head, sizeof(cellhd));
-
- /* convert top to northing at top edge of cell
- * left to easting at left edge
- */
- col = view_to_col(pick_view, left);
- row = view_to_row(pick_view, top);
- cellhd.north = row_to_northing(&pick_view->cell.head, row, 0.0);
- cellhd.west = col_to_easting(&pick_view->cell.head, col, 0.0);
-
- /* convert bottom to northing at bottom edge of cell
- * right to easting at right edge
- */
- col = view_to_col(pick_view, right);
- row = view_to_row(pick_view, bottom);
- cellhd.south = row_to_northing(&pick_view->cell.head, row, 1.0);
- cellhd.east = col_to_easting(&pick_view->cell.head, col, 1.0);
-
-
- cellhd.rows = bottom - top + 1;
- cellhd.cols = right - left + 1;
- cellhd.ns_res = (cellhd.north - cellhd.south) / cellhd.rows;
- cellhd.ew_res = (cellhd.east - cellhd.west) / cellhd.cols;
-
- /*
- * Outline the zoom window on the main map
- * Turn previous one to grey.
- */
- if (main_view == VIEW_MAP1)
- winfile = tempfile_win;
- else
- winfile = tempfile_win2;
-
- if (zoom_view->cell.configured) {
- R_standard_color(GREY);
- /* Outline_cellhd (main_view, &zoom_view->cell.head); */
- R_panel_restore(winfile);
- }
-
- Save_cellhd(main_view, &cellhd, winfile);
-
- R_standard_color(RED);
- Outline_cellhd(main_view, &cellhd);
-
-
- /*
- * zoom
- */
- if (target_flag)
- select_target_env();
- /* must close and reopen elev layer buffer */
- /* G_close_cell (elev); */
- G_adjust_window_to_box(&cellhd, &zoom_view->cell.head, zoom_view->nrows,
- zoom_view->ncols);
- Configure_view(zoom_view, pick_view->cell.name, pick_view->cell.mapset,
- pick_view->cell.ns_res, pick_view->cell.ew_res);
- drawcell(zoom_view);
- select_current_env();
- display_conz_points(1);
-
- /* Auto zoom VIEW_MAP2_ZOOM */
- if (main_view == VIEW_MAP1) {
- auto_zoom();
- }
-
- return 1; /* pop back */
-}
-
-static int cancel(void)
-{
- return -1;
-}
Copied: grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2target/zoom_box.c (from rev 44501, grass/branches/develbranch_6/imagery/i.ortho.photo/i.photo.2target/zoom_box.c)
===================================================================
--- grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2target/zoom_box.c (rev 0)
+++ grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2target/zoom_box.c 2010-12-22 10:05:10 UTC (rev 44654)
@@ -0,0 +1,197 @@
+#include <grass/raster.h>
+#include "globals.h"
+#include "local_proto.h"
+
+static int x1, y1, x2, y2;
+static View *pick_view, *zoom_view, *main_view;
+static int target_flag;
+static int zoom2(int, int);
+static int cancel(void);
+
+int zoom_box(void)
+{
+ static int use = 1;
+
+ static Objects objects[] = {
+ MENU("CANCEL", cancel, &use),
+ INFO(" Mark first corner of window ", &use),
+ OTHER(zoom_box1, &use),
+ {0}
+ };
+
+ Input_pointer(objects);
+ return 1;
+}
+
+int zoom_box1(int x, int y)
+{ /* called by Input_pointer */
+ static int use = 1;
+ static Objects objects[] = {
+ MENU("CANCEL", cancel, &use),
+ INFO(" Define the window ", &use),
+ OTHER(zoom2, &use),
+ {0}
+ };
+
+ /*
+ * user has marked first corner
+ * this determines which view is being zoomed
+ */
+ x1 = x;
+ y1 = y;
+
+ if (In_view(pick_view = VIEW_MAP1, x1, y1)) {
+ main_view = VIEW_MAP1;
+ zoom_view = VIEW_MAP1_ZOOM;
+ target_flag = 0;
+ }
+ else if (In_view(pick_view = VIEW_MAP2, x1, y1)) {
+ if (!pick_view->cell.configured)
+ return 0; /* ignore the mouse event */
+ main_view = VIEW_MAP2;
+ zoom_view = VIEW_MAP2_ZOOM;
+ target_flag = 1;
+ }
+ else if (In_view(pick_view = VIEW_MAP1_ZOOM, x1, y1)) {
+ if (!pick_view->cell.configured)
+ return 0; /* ignore the mouse event */
+ main_view = VIEW_MAP1;
+ zoom_view = VIEW_MAP1_ZOOM;
+ target_flag = 0;
+ }
+ else if (In_view(pick_view = VIEW_MAP2_ZOOM, x1, y1)) {
+ if (!pick_view->cell.configured)
+ return 0; /* ignore the mouse event */
+ main_view = VIEW_MAP2;
+ zoom_view = VIEW_MAP2_ZOOM;
+ target_flag = 1;
+ }
+ else
+ return 0; /* ignore the mouse event */
+ if (!pick_view->cell.configured)
+ return 0; /* just to be sure */
+
+ return Input_box(objects, x, y);
+}
+
+static int zoom2(int x, int y)
+{
+ int top, bottom, left, right;
+ int row, col;
+ struct Cell_head cellhd;
+ char *winfile;
+
+ x2 = x;
+ y2 = y;
+ /*
+ * user has completed the zoom window.
+ * must be in same view as first corner
+ */
+ if (x1 == x2 || y1 == y2)
+ return 0; /* ignore event */
+ if (!In_view(pick_view, x2, y2))
+ return 0;
+ /*
+ * ok, erase menu messages
+ */
+ Menu_msg("");
+
+ /*
+ * assign window coordinates to top,bottom,left,right
+ */
+ if (x1 < x2) {
+ left = x1;
+ right = x2;
+ }
+ else {
+ left = x2;
+ right = x1;
+ }
+ if (y1 < y2) {
+ top = y1;
+ bottom = y2;
+ }
+ else {
+ top = y2;
+ bottom = y1;
+ }
+
+ /*
+ * Determine the the zoom window (ie, cellhd)
+ * must copy the current view cellhd first, to preserve header info
+ * (such as projection, zone, and other items.)
+ * compute zoom window northings,eastings, rows, cols, and resolution
+ */
+
+ G_copy(&cellhd, &pick_view->cell.head, sizeof(cellhd));
+
+ /* convert top to northing at top edge of cell
+ * left to easting at left edge
+ */
+ col = view_to_col(pick_view, left);
+ row = view_to_row(pick_view, top);
+ cellhd.north = row_to_northing(&pick_view->cell.head, row, 0.0);
+ cellhd.west = col_to_easting(&pick_view->cell.head, col, 0.0);
+
+ /* convert bottom to northing at bottom edge of cell
+ * right to easting at right edge
+ */
+ col = view_to_col(pick_view, right);
+ row = view_to_row(pick_view, bottom);
+ cellhd.south = row_to_northing(&pick_view->cell.head, row, 1.0);
+ cellhd.east = col_to_easting(&pick_view->cell.head, col, 1.0);
+
+
+ cellhd.rows = bottom - top + 1;
+ cellhd.cols = right - left + 1;
+ cellhd.ns_res = (cellhd.north - cellhd.south) / cellhd.rows;
+ cellhd.ew_res = (cellhd.east - cellhd.west) / cellhd.cols;
+
+ /*
+ * Outline the zoom window on the main map
+ * Turn previous one to grey.
+ */
+ if (main_view == VIEW_MAP1)
+ winfile = tempfile_win;
+ else
+ winfile = tempfile_win2;
+
+ if (zoom_view->cell.configured) {
+ R_standard_color(GREY);
+ /* Outline_cellhd (main_view, &zoom_view->cell.head); */
+ R_panel_restore(winfile);
+ }
+
+ Save_cellhd(main_view, &cellhd, winfile);
+
+ R_standard_color(RED);
+ Outline_cellhd(main_view, &cellhd);
+
+
+ /*
+ * zoom
+ */
+ if (target_flag)
+ select_target_env();
+ /* must close and reopen elev layer buffer */
+ /* G_close_cell (elev); */
+ G_adjust_window_to_box(&cellhd, &zoom_view->cell.head, zoom_view->nrows,
+ zoom_view->ncols);
+ Configure_view(zoom_view, pick_view->cell.name, pick_view->cell.mapset,
+ pick_view->cell.ns_res, pick_view->cell.ew_res);
+ drawcell(zoom_view);
+ select_current_env();
+ display_conz_points(1);
+
+ /* Auto zoom VIEW_MAP2_ZOOM */
+ if (main_view == VIEW_MAP1) {
+ auto_zoom();
+ }
+
+ return 1; /* pop back */
+}
+
+static int cancel(void)
+{
+ return -1;
+}
Deleted: grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2target/zoom_pnt.c
===================================================================
--- grass/branches/develbranch_6/imagery/i.ortho.photo/i.photo.2target/zoom_pnt.c 2010-12-01 09:34:37 UTC (rev 44501)
+++ grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2target/zoom_pnt.c 2010-12-22 10:05:10 UTC (rev 44654)
@@ -1,233 +0,0 @@
-#include <math.h>
-#include <grass/raster.h>
-#include "globals.h"
-#include "local_proto.h"
-
-static View *pick_view, *zoom_view, *main_view;
-static int target_flag;
-static int zoom1(int, int);
-static int cancel(void);
-
-int zoom_point(void)
-{
- static int use = 1;
-
- static Objects objects[] = {
- MENU("CANCEL", cancel, &use),
- INFO(" Mark center of area to be zoomed ", &use),
- OTHER(zoom1, &use),
- {0}
- };
-
- Input_pointer(objects);
- return 1;
-}
-
-static int zoom1(int x, int y)
-{ /* called by Input_pointer */
- return zoom_point2(x, y, 2, 1.);
-}
-
-/* Zoom with point.
- * magnify: > 0 dont ask for magnification.
- * -1 pan
- * 0 ask for magnification
- * magnify: 0 use specified magnification
- * 1 pan
- * 2 ask for magnification
- */
-int zoom_point2(int x, int y, int magnify, double magnific)
-{
- int top, bottom, left, right;
- int n, row, col;
- int nrows, ncols;
- struct Cell_head cellhd;
- int mag;
- double north, south, east, west;
- double dmag;
- char *winfile;
-
- if (In_view(pick_view = VIEW_MAP1, x, y)) {
- main_view = VIEW_MAP1;
- zoom_view = VIEW_MAP1_ZOOM;
- target_flag = 0;
- }
- else if (In_view(pick_view = VIEW_MAP2, x, y)) {
- if (!pick_view->cell.configured)
- return 0; /* ignore the mouse event */
- main_view = VIEW_MAP2;
- zoom_view = VIEW_MAP2_ZOOM;
- target_flag = 1;
- }
- else if (In_view(pick_view = VIEW_MAP1_ZOOM, x, y)) {
- if (!pick_view->cell.configured)
- return 0; /* ignore the mouse event */
- main_view = VIEW_MAP1;
- zoom_view = VIEW_MAP1_ZOOM;
- target_flag = 0;
- }
- else if (In_view(pick_view = VIEW_MAP2_ZOOM, x, y)) {
- if (!pick_view->cell.configured)
- return 0; /* ignore the mouse event */
- main_view = VIEW_MAP2;
- zoom_view = VIEW_MAP2_ZOOM;
- target_flag = 1;
- }
- else
- return 0; /* ignore the mouse event */
- if (!pick_view->cell.configured)
- return 0; /* just to be sure */
- /*
- * make sure point is within edges of image as well
- */
- if (x <= pick_view->cell.left)
- return 0;
- if (x >= pick_view->cell.right)
- return 0;
- if (y <= pick_view->cell.top)
- return 0;
- if (y >= pick_view->cell.bottom)
- return 0;
-
-
- /*
- * ok, erase menu messages
- */
- Menu_msg("");
-
- /* determine magnification of zoom */
- if (magnify == 2) {
- if (zoom_view->cell.configured) {
- if (zoom_view == pick_view)
- mag = floor(magnification(zoom_view) + 1.0) + .1;
- else
- mag = ceil(magnification(zoom_view)) + .1;
- }
- else {
- mag = floor(magnification(main_view) + 1.0) + .1;
- }
- if (!ask_magnification(&mag))
- return 1;
-
- dmag = mag;
- }
- else if (magnify == 0) {
- dmag = magnific;
- }
- else if (magnify == 1) { /* pan */
- /* Use current magnification */
- if (zoom_view->cell.configured) {
- dmag = main_view->cell.ns_res /
- ((zoom_view->cell.head.north - zoom_view->cell.head.south)
- / zoom_view->cell.head.rows);
- }
- else {
- dmag = 1.;
- }
- }
- /*
- * Determine the the zoom window (ie, cellhd)
- */
-
- G_copy(&cellhd, &main_view->cell.head, sizeof(cellhd));
- cellhd.ns_res = main_view->cell.ns_res / dmag;
- cellhd.ew_res = main_view->cell.ew_res / dmag;
-
- cellhd.cols = (cellhd.east - cellhd.west) / cellhd.ew_res;
- cellhd.rows = (cellhd.north - cellhd.south) / cellhd.ns_res;
-
- /* convert x,y to col,row */
-
- col = view_to_col(pick_view, x);
- east = col_to_easting(&pick_view->cell.head, col, 0.5);
- col = easting_to_col(&cellhd, east);
-
- row = view_to_row(pick_view, y);
- north = row_to_northing(&pick_view->cell.head, row, 0.5);
- row = northing_to_row(&cellhd, north);
-
- ncols = zoom_view->ncols;
- nrows = zoom_view->nrows;
-
- n = cellhd.cols - col;
- if (n > col)
- n = col;
- if (n + n + 1 >= ncols) {
- n = ncols / 2;
- if (n + n + 1 >= ncols)
- n--;
- }
- left = col - n;
- right = col + n;
-
- n = cellhd.rows - row;
- if (n > row)
- n = row;
- if (n + n + 1 >= nrows) {
- n = nrows / 2;
- if (n + n + 1 >= nrows)
- n--;
- }
- top = row - n;
- bottom = row + n;
-
-
- north = row_to_northing(&cellhd, top, 0.0);
- west = col_to_easting(&cellhd, left, 0.0);
- south = row_to_northing(&cellhd, bottom, 1.0);
- east = col_to_easting(&cellhd, right, 1.0);
-
-
- cellhd.north = north;
- cellhd.south = south;
- cellhd.east = east;
- cellhd.west = west;
-
- cellhd.rows = (cellhd.north - cellhd.south) / cellhd.ns_res;
- cellhd.cols = (cellhd.east - cellhd.west) / cellhd.ew_res;
-
- /*
- * Outline the zoom window on the main map
- * Turn previous one to grey.
- */
- if (main_view == VIEW_MAP1)
- winfile = tempfile_win;
- else
- winfile = tempfile_win2;
-
- if (zoom_view->cell.configured) {
- R_standard_color(GREY);
- /* Outline_cellhd (main_view, &zoom_view->cell.head); */
- R_panel_restore(winfile);
- }
-
- Save_cellhd(main_view, &cellhd, winfile);
-
- R_standard_color(RED);
- Outline_cellhd(main_view, &cellhd);
-
-
- /*
- * zoom
- */
- if (target_flag)
- select_target_env();
- G_copy(&zoom_view->cell.head, &cellhd, sizeof(cellhd));
- Configure_view(zoom_view, pick_view->cell.name, pick_view->cell.mapset,
- pick_view->cell.ns_res, pick_view->cell.ew_res);
- drawcell(zoom_view);
- select_current_env();
- display_conz_points(1);
-
- /* Auto zoom VIEW_MAP2_ZOOM */
- if (main_view == VIEW_MAP1) {
- auto_zoom();
- }
-
- return 1; /* pop back */
-}
-
-static int cancel(void)
-{
- return -1;
-}
Copied: grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2target/zoom_pnt.c (from rev 44501, grass/branches/develbranch_6/imagery/i.ortho.photo/i.photo.2target/zoom_pnt.c)
===================================================================
--- grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2target/zoom_pnt.c (rev 0)
+++ grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.2target/zoom_pnt.c 2010-12-22 10:05:10 UTC (rev 44654)
@@ -0,0 +1,233 @@
+#include <math.h>
+#include <grass/raster.h>
+#include "globals.h"
+#include "local_proto.h"
+
+static View *pick_view, *zoom_view, *main_view;
+static int target_flag;
+static int zoom1(int, int);
+static int cancel(void);
+
+int zoom_point(void)
+{
+ static int use = 1;
+
+ static Objects objects[] = {
+ MENU("CANCEL", cancel, &use),
+ INFO(" Mark center of area to be zoomed ", &use),
+ OTHER(zoom1, &use),
+ {0}
+ };
+
+ Input_pointer(objects);
+ return 1;
+}
+
+static int zoom1(int x, int y)
+{ /* called by Input_pointer */
+ return zoom_point2(x, y, 2, 1.);
+}
+
+/* Zoom with point.
+ * magnify: > 0 dont ask for magnification.
+ * -1 pan
+ * 0 ask for magnification
+ * magnify: 0 use specified magnification
+ * 1 pan
+ * 2 ask for magnification
+ */
+int zoom_point2(int x, int y, int magnify, double magnific)
+{
+ int top, bottom, left, right;
+ int n, row, col;
+ int nrows, ncols;
+ struct Cell_head cellhd;
+ int mag;
+ double north, south, east, west;
+ double dmag;
+ char *winfile;
+
+ if (In_view(pick_view = VIEW_MAP1, x, y)) {
+ main_view = VIEW_MAP1;
+ zoom_view = VIEW_MAP1_ZOOM;
+ target_flag = 0;
+ }
+ else if (In_view(pick_view = VIEW_MAP2, x, y)) {
+ if (!pick_view->cell.configured)
+ return 0; /* ignore the mouse event */
+ main_view = VIEW_MAP2;
+ zoom_view = VIEW_MAP2_ZOOM;
+ target_flag = 1;
+ }
+ else if (In_view(pick_view = VIEW_MAP1_ZOOM, x, y)) {
+ if (!pick_view->cell.configured)
+ return 0; /* ignore the mouse event */
+ main_view = VIEW_MAP1;
+ zoom_view = VIEW_MAP1_ZOOM;
+ target_flag = 0;
+ }
+ else if (In_view(pick_view = VIEW_MAP2_ZOOM, x, y)) {
+ if (!pick_view->cell.configured)
+ return 0; /* ignore the mouse event */
+ main_view = VIEW_MAP2;
+ zoom_view = VIEW_MAP2_ZOOM;
+ target_flag = 1;
+ }
+ else
+ return 0; /* ignore the mouse event */
+ if (!pick_view->cell.configured)
+ return 0; /* just to be sure */
+ /*
+ * make sure point is within edges of image as well
+ */
+ if (x <= pick_view->cell.left)
+ return 0;
+ if (x >= pick_view->cell.right)
+ return 0;
+ if (y <= pick_view->cell.top)
+ return 0;
+ if (y >= pick_view->cell.bottom)
+ return 0;
+
+
+ /*
+ * ok, erase menu messages
+ */
+ Menu_msg("");
+
+ /* determine magnification of zoom */
+ if (magnify == 2) {
+ if (zoom_view->cell.configured) {
+ if (zoom_view == pick_view)
+ mag = floor(magnification(zoom_view) + 1.0) + .1;
+ else
+ mag = ceil(magnification(zoom_view)) + .1;
+ }
+ else {
+ mag = floor(magnification(main_view) + 1.0) + .1;
+ }
+ if (!ask_magnification(&mag))
+ return 1;
+
+ dmag = mag;
+ }
+ else if (magnify == 0) {
+ dmag = magnific;
+ }
+ else if (magnify == 1) { /* pan */
+ /* Use current magnification */
+ if (zoom_view->cell.configured) {
+ dmag = main_view->cell.ns_res /
+ ((zoom_view->cell.head.north - zoom_view->cell.head.south)
+ / zoom_view->cell.head.rows);
+ }
+ else {
+ dmag = 1.;
+ }
+ }
+ /*
+ * Determine the the zoom window (ie, cellhd)
+ */
+
+ G_copy(&cellhd, &main_view->cell.head, sizeof(cellhd));
+ cellhd.ns_res = main_view->cell.ns_res / dmag;
+ cellhd.ew_res = main_view->cell.ew_res / dmag;
+
+ cellhd.cols = (cellhd.east - cellhd.west) / cellhd.ew_res;
+ cellhd.rows = (cellhd.north - cellhd.south) / cellhd.ns_res;
+
+ /* convert x,y to col,row */
+
+ col = view_to_col(pick_view, x);
+ east = col_to_easting(&pick_view->cell.head, col, 0.5);
+ col = easting_to_col(&cellhd, east);
+
+ row = view_to_row(pick_view, y);
+ north = row_to_northing(&pick_view->cell.head, row, 0.5);
+ row = northing_to_row(&cellhd, north);
+
+ ncols = zoom_view->ncols;
+ nrows = zoom_view->nrows;
+
+ n = cellhd.cols - col;
+ if (n > col)
+ n = col;
+ if (n + n + 1 >= ncols) {
+ n = ncols / 2;
+ if (n + n + 1 >= ncols)
+ n--;
+ }
+ left = col - n;
+ right = col + n;
+
+ n = cellhd.rows - row;
+ if (n > row)
+ n = row;
+ if (n + n + 1 >= nrows) {
+ n = nrows / 2;
+ if (n + n + 1 >= nrows)
+ n--;
+ }
+ top = row - n;
+ bottom = row + n;
+
+
+ north = row_to_northing(&cellhd, top, 0.0);
+ west = col_to_easting(&cellhd, left, 0.0);
+ south = row_to_northing(&cellhd, bottom, 1.0);
+ east = col_to_easting(&cellhd, right, 1.0);
+
+
+ cellhd.north = north;
+ cellhd.south = south;
+ cellhd.east = east;
+ cellhd.west = west;
+
+ cellhd.rows = (cellhd.north - cellhd.south) / cellhd.ns_res;
+ cellhd.cols = (cellhd.east - cellhd.west) / cellhd.ew_res;
+
+ /*
+ * Outline the zoom window on the main map
+ * Turn previous one to grey.
+ */
+ if (main_view == VIEW_MAP1)
+ winfile = tempfile_win;
+ else
+ winfile = tempfile_win2;
+
+ if (zoom_view->cell.configured) {
+ R_standard_color(GREY);
+ /* Outline_cellhd (main_view, &zoom_view->cell.head); */
+ R_panel_restore(winfile);
+ }
+
+ Save_cellhd(main_view, &cellhd, winfile);
+
+ R_standard_color(RED);
+ Outline_cellhd(main_view, &cellhd);
+
+
+ /*
+ * zoom
+ */
+ if (target_flag)
+ select_target_env();
+ G_copy(&zoom_view->cell.head, &cellhd, sizeof(cellhd));
+ Configure_view(zoom_view, pick_view->cell.name, pick_view->cell.mapset,
+ pick_view->cell.ns_res, pick_view->cell.ew_res);
+ drawcell(zoom_view);
+ select_current_env();
+ display_conz_points(1);
+
+ /* Auto zoom VIEW_MAP2_ZOOM */
+ if (main_view == VIEW_MAP1) {
+ auto_zoom();
+ }
+
+ return 1; /* pop back */
+}
+
+static int cancel(void)
+{
+ return -1;
+}
Property changes on: grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.camera
___________________________________________________________________
Added: svn:ignore
+ *.tmp.html
*OBJ*
Deleted: grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.camera/Makefile
===================================================================
--- grass/branches/develbranch_6/imagery/i.ortho.photo/i.photo.camera/Makefile 2010-12-01 09:34:37 UTC (rev 44501)
+++ grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.camera/Makefile 2010-12-22 10:05:10 UTC (rev 44654)
@@ -1,16 +0,0 @@
-MODULE_TOPDIR = ../../..
-
-PGM = i.photo.camera
-
-EXTRA_CFLAGS = -I../libes
-
-LIBES = $(IORTHOLIB) $(IMAGERYLIB) $(GISLIB) $(VASKLIB) $(CURSES) $(GMATHLIB)
-DEPENDENCIES= $(IMAGERYDEP) $(IORTHODEP) $(GISDEP) $(VASKDEP) $(GMATHDEP)
-
-include $(MODULE_TOPDIR)/include/Make/Module.make
-
-default: etc
-
-$(PGM).tmp.html: description.html
- $(INSTALL_DATA) $< $@
- $(INSTALL_DATA) *.png $(GISBASE)/docs/html/
Copied: grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.camera/Makefile (from rev 44501, grass/branches/develbranch_6/imagery/i.ortho.photo/i.photo.camera/Makefile)
===================================================================
--- grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.camera/Makefile (rev 0)
+++ grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.camera/Makefile 2010-12-22 10:05:10 UTC (rev 44654)
@@ -0,0 +1,16 @@
+MODULE_TOPDIR = ../../..
+
+PGM = i.photo.camera
+
+EXTRA_CFLAGS = -I../libes
+
+LIBES = $(IORTHOLIB) $(IMAGERYLIB) $(GISLIB) $(VASKLIB) $(CURSES) $(GMATHLIB)
+DEPENDENCIES= $(IMAGERYDEP) $(IORTHODEP) $(GISDEP) $(VASKDEP) $(GMATHDEP)
+
+include $(MODULE_TOPDIR)/include/Make/Module.make
+
+default: etc
+
+$(PGM).tmp.html: description.html
+ $(INSTALL_DATA) $< $@
+ $(INSTALL_DATA) *.png $(GISBASE)/docs/html/
Deleted: grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.camera/camera.h
===================================================================
--- grass/branches/develbranch_6/imagery/i.ortho.photo/i.photo.camera/camera.h 2010-12-01 09:34:37 UTC (rev 44501)
+++ grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.camera/camera.h 2010-12-22 10:05:10 UTC (rev 44654)
@@ -1 +0,0 @@
-#include "globals.h" /* external variables */
Copied: grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.camera/camera.h (from rev 44501, grass/branches/develbranch_6/imagery/i.ortho.photo/i.photo.camera/camera.h)
===================================================================
--- grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.camera/camera.h (rev 0)
+++ grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.camera/camera.h 2010-12-22 10:05:10 UTC (rev 44654)
@@ -0,0 +1 @@
+#include "globals.h" /* external variables */
Deleted: grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.camera/description.html
===================================================================
--- grass/branches/develbranch_6/imagery/i.ortho.photo/i.photo.camera/description.html 2010-12-01 09:34:37 UTC (rev 44501)
+++ grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.camera/description.html 2010-12-22 10:05:10 UTC (rev 44654)
@@ -1,114 +0,0 @@
-<H2>DESCRIPTION</H2>
-
-<EM>i.photo.camera</EM> creates or modifies entries in a camera reference
-file. For ortho-photo rectification, a camera reference file is required for
-computation of scanned image to photo-coordinate transformation parameters.
-There are two coordinate systems: The image coordinate system (in pixels)
-and the photo coordinate system (in milli-meters). The inner orientation
-establishes a relation between the pixels and the image coordinates with
-help of fiducial marks.
-
-<P>
-
-The first prompt in the program will ask you for the name of
-the camera reference file to be created or modified. You may
-create a new camera reference file by entering a new name, or modify an
-existing camera reference file by entering the name of an existing camera file.
-
-<P>
-After entering the camera file name, following menu is displayed:
-<P>
-Please provide the following information
-
-
-<P>
-<PRE>
-
- CAMERA NAME: <EM>camera name</EM>______
- CAMERA IDENTIFICATION: <EM>identification</EM>___
- CALIBRATED FOCAL LENGTH mm.:_________________
- POINT OF SYMMETRY (X) mm.:_________________
- POINT OF SYMMETRY (Y) mm.:_________________
- MAXIMUM NUMBER OF FIDUCIALS:_________________
-
- AFTER COMPLETING ALL ANSWERS, HIT <ESC> TO CONTINUE
- (OR <Ctrl-C> TO CANCEL)
-</PRE>
-
-The camera name and identification describe the camera reference file.
-The calibrated focal length and the point of symmetry are used in computing
-the photo-to-target transformation parameters. These values should be entered
-from the camera calibration report (usually available from the photograph
-supplier).
-
-<p>
-<img src="photo.camera.png" alt="Sketch of aerial photo"><br>
-<i>This example is the camera Zeiss LMK9 265-002A belonging to the Hellenic
-Military Geographical Survey (HMGS) and calibrated in December 1985</i>
-<p>
-
-The photo coordinate system origin is the so-called calibrated principal
-point (PP, Principal Point of Symmetry) which is in the center of the image.
-The origin of the axes is at the intersection of the radii traced from the
-fiducial marks. In the ideal case of no deviations in the camera (see camera
-calibration certificate) the center is the origin and the values are 0 for
-both X and Y of Point of Symmetry. But usually the principal point does not
-fall on the intersection of the radii at the center of the picture. This
-excentricity is usually of the order of a few micrometers. <P>
-
-You are then asked to enter the X and Y photo coordinates of each fiducial
-as follows.
-These fiducials (or reseau) marks are index marks imaged on film which serve
-as reference photo coordinate system. The maximum number of fiducials will
-determine the number of fiducial or reseau coordinate pairs to be entered
-below. The origin is the center of the image (or the point of symmetry) and
-X and Y are left-right and up-down. The order is up to the user, but must be
-kept consistent throughout the rectification process.
-<P>
-
-On this screen you should enter the fiducial or
-reseau photo-coordinates as given in the camera calibration report. The X,
-and Y coordinates are in milli-meters from the principle point.
-
-<P>
-Please provide the following information
-<PRE>
- Fid# FID ID X Y
-
- 1__ _____ 0.0___ 0.0___
- 2__ _____ 0.0___ 0.0___
- 3__ _____ 0.0___ 0.0___
- 4__ _____ 0.0___ 0.0___
- 5__ _____ 0.0___ 0.0___
- 6__ _____ 0.0___ 0.0___
- 7__ _____ 0.0___ 0.0___
- 8__ _____ 0.0___ 0.0___
- 9__ _____ 0.0___ 0.0___
- 10_ _____ 0.0___ 0.0___
-
- next: end__
-
- AFTER COMPLETING ALL ANSWERS, HIT <ESC> TO CONTINUE
- (OR <Ctrl-C> TO CANCEL)
-</PRE>
-The input display is repeated until the number of MAXIMUM FIDUCIALS
-is reached.
-
-
-<H2>SEE ALSO</H2>
-
-<EM>
-<A HREF="i.ortho.photo.html">i.ortho.photo</A>,
-<A HREF="i.photo.2image.html">i.photo.2image</A>,
-<A HREF="i.photo.2target.html">i.photo.2target</A>,
-<A HREF="i.photo.init.html">i.photo.init</A>
-</EM>
-
-
-<H2>AUTHOR</H2>
-
-Mike Baba, DBA Systems, Inc.
-
-<p>
-<i>Last changed: $Date$</i>
-
Copied: grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.camera/description.html (from rev 44501, grass/branches/develbranch_6/imagery/i.ortho.photo/i.photo.camera/description.html)
===================================================================
--- grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.camera/description.html (rev 0)
+++ grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.camera/description.html 2010-12-22 10:05:10 UTC (rev 44654)
@@ -0,0 +1,114 @@
+<H2>DESCRIPTION</H2>
+
+<EM>i.photo.camera</EM> creates or modifies entries in a camera reference
+file. For ortho-photo rectification, a camera reference file is required for
+computation of scanned image to photo-coordinate transformation parameters.
+There are two coordinate systems: The image coordinate system (in pixels)
+and the photo coordinate system (in milli-meters). The inner orientation
+establishes a relation between the pixels and the image coordinates with
+help of fiducial marks.
+
+<P>
+
+The first prompt in the program will ask you for the name of
+the camera reference file to be created or modified. You may
+create a new camera reference file by entering a new name, or modify an
+existing camera reference file by entering the name of an existing camera file.
+
+<P>
+After entering the camera file name, following menu is displayed:
+<P>
+Please provide the following information
+
+
+<P>
+<PRE>
+
+ CAMERA NAME: <EM>camera name</EM>______
+ CAMERA IDENTIFICATION: <EM>identification</EM>___
+ CALIBRATED FOCAL LENGTH mm.:_________________
+ POINT OF SYMMETRY (X) mm.:_________________
+ POINT OF SYMMETRY (Y) mm.:_________________
+ MAXIMUM NUMBER OF FIDUCIALS:_________________
+
+ AFTER COMPLETING ALL ANSWERS, HIT <ESC> TO CONTINUE
+ (OR <Ctrl-C> TO CANCEL)
+</PRE>
+
+The camera name and identification describe the camera reference file.
+The calibrated focal length and the point of symmetry are used in computing
+the photo-to-target transformation parameters. These values should be entered
+from the camera calibration report (usually available from the photograph
+supplier).
+
+<p>
+<img src="photo.camera.png" alt="Sketch of aerial photo"><br>
+<i>This example is the camera Zeiss LMK9 265-002A belonging to the Hellenic
+Military Geographical Survey (HMGS) and calibrated in December 1985</i>
+<p>
+
+The photo coordinate system origin is the so-called calibrated principal
+point (PP, Principal Point of Symmetry) which is in the center of the image.
+The origin of the axes is at the intersection of the radii traced from the
+fiducial marks. In the ideal case of no deviations in the camera (see camera
+calibration certificate) the center is the origin and the values are 0 for
+both X and Y of Point of Symmetry. But usually the principal point does not
+fall on the intersection of the radii at the center of the picture. This
+excentricity is usually of the order of a few micrometers. <P>
+
+You are then asked to enter the X and Y photo coordinates of each fiducial
+as follows.
+These fiducials (or reseau) marks are index marks imaged on film which serve
+as reference photo coordinate system. The maximum number of fiducials will
+determine the number of fiducial or reseau coordinate pairs to be entered
+below. The origin is the center of the image (or the point of symmetry) and
+X and Y are left-right and up-down. The order is up to the user, but must be
+kept consistent throughout the rectification process.
+<P>
+
+On this screen you should enter the fiducial or
+reseau photo-coordinates as given in the camera calibration report. The X,
+and Y coordinates are in milli-meters from the principle point.
+
+<P>
+Please provide the following information
+<PRE>
+ Fid# FID ID X Y
+
+ 1__ _____ 0.0___ 0.0___
+ 2__ _____ 0.0___ 0.0___
+ 3__ _____ 0.0___ 0.0___
+ 4__ _____ 0.0___ 0.0___
+ 5__ _____ 0.0___ 0.0___
+ 6__ _____ 0.0___ 0.0___
+ 7__ _____ 0.0___ 0.0___
+ 8__ _____ 0.0___ 0.0___
+ 9__ _____ 0.0___ 0.0___
+ 10_ _____ 0.0___ 0.0___
+
+ next: end__
+
+ AFTER COMPLETING ALL ANSWERS, HIT <ESC> TO CONTINUE
+ (OR <Ctrl-C> TO CANCEL)
+</PRE>
+The input display is repeated until the number of MAXIMUM FIDUCIALS
+is reached.
+
+
+<H2>SEE ALSO</H2>
+
+<EM>
+<A HREF="i.ortho.photo.html">i.ortho.photo</A>,
+<A HREF="i.photo.2image.html">i.photo.2image</A>,
+<A HREF="i.photo.2target.html">i.photo.2target</A>,
+<A HREF="i.photo.init.html">i.photo.init</A>
+</EM>
+
+
+<H2>AUTHOR</H2>
+
+Mike Baba, DBA Systems, Inc.
+
+<p>
+<i>Last changed: $Date$</i>
+
Deleted: grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.camera/globals.h
===================================================================
--- grass/branches/develbranch_6/imagery/i.ortho.photo/i.photo.camera/globals.h 2010-12-01 09:34:37 UTC (rev 44501)
+++ grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.camera/globals.h 2010-12-22 10:05:10 UTC (rev 44654)
@@ -1,22 +0,0 @@
-#ifdef MAIN
-#define GLOBAL
-#else
-#define GLOBAL extern
-#endif
-/* State flags Most are Toggles */
-GLOBAL char Data_Loaded; /* is there data in memory */
-
- /* used for abnormal exit logic */
-GLOBAL char Files_Open; /* is there data in memory */
-
-GLOBAL struct Ortho_Camera_File_Ref cam_info;
-
-GLOBAL char *camera;
-
-/* hold the names of files etc. mostly used by main.c */
-GLOBAL char *N_path;
-GLOBAL char *N_name;
-GLOBAL char *N_camera;
-
-/* mod_cam_info.c */
-int mod_cam_info(int, struct Ortho_Camera_File_Ref *);
Copied: grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.camera/globals.h (from rev 44501, grass/branches/develbranch_6/imagery/i.ortho.photo/i.photo.camera/globals.h)
===================================================================
--- grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.camera/globals.h (rev 0)
+++ grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.camera/globals.h 2010-12-22 10:05:10 UTC (rev 44654)
@@ -0,0 +1,22 @@
+#ifdef MAIN
+#define GLOBAL
+#else
+#define GLOBAL extern
+#endif
+/* State flags Most are Toggles */
+GLOBAL char Data_Loaded; /* is there data in memory */
+
+ /* used for abnormal exit logic */
+GLOBAL char Files_Open; /* is there data in memory */
+
+GLOBAL struct Ortho_Camera_File_Ref cam_info;
+
+GLOBAL char *camera;
+
+/* hold the names of files etc. mostly used by main.c */
+GLOBAL char *N_path;
+GLOBAL char *N_name;
+GLOBAL char *N_camera;
+
+/* mod_cam_info.c */
+int mod_cam_info(int, struct Ortho_Camera_File_Ref *);
Deleted: grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.camera/main.c
===================================================================
--- grass/branches/develbranch_6/imagery/i.ortho.photo/i.photo.camera/main.c 2010-12-01 09:34:37 UTC (rev 44501)
+++ grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.camera/main.c 2010-12-22 10:05:10 UTC (rev 44654)
@@ -1,117 +0,0 @@
-
-/****************************************************************************
- *
- * MODULE: i.photo.camera
- * AUTHOR(S): Mike Baba, DBA Systems, Inc. (original contributor)
- * Markus Neteler <neteler itc.it>,
- * Roberto Flor <flor itc.it>,
- * Bernhard Reiter <bernhard intevation.de>,
- * Glynn Clements <glynn gclements.plus.com>
- * Hamish Bowman
- *
- * PURPOSE: Creates or modifies entries in a camera reference file
- * COPYRIGHT: (C) 1999-2008 by the GRASS Development Team
- *
- * This program is free software under the GNU General Public
- * License (>=v2). Read the file COPYING that comes with GRASS
- * for details.
- *
- *****************************************************************************/
-/* select_camera */
-/* select a camera reference file for a given imagery group */
-
-#define MAIN 1
-#include <stdlib.h>
-#include <string.h>
-
-#ifdef DEBUG
-#include <unistd.h> /* for sleep() */
-#endif
-
-#include <grass/gis.h>
-#include <grass/glocale.h>
-#include "orthophoto.h"
-#include "globals.h"
-
-int main(int argc, char *argv[])
-{
- struct GModule *module;
- struct Option *group_opt, *camera_opt;
-
- char *location;
- char *mapset;
- char group[GNAME_MAX];
-
- static int have_old;
- char *camera;
-
-
- /* must run in a term window */
- G_putenv("GRASS_UI_TERM", "1");
-
- G_gisinit(argv[0]);
-
- module = G_define_module();
- module->keywords = _("imagery, orthorectify");
- module->description =
- _("Interactively select and modify the imagery group camera reference file.");
-
- group_opt = G_define_standard_option(G_OPT_I_GROUP);
- group_opt->description =
- _("Name of imagery group for ortho-rectification");
-
- camera_opt = G_define_standard_option(G_OPT_F_INPUT);
- camera_opt->key = "camera";
- camera_opt->required = NO;
- camera_opt->gisprompt = "old_file,camera,camera";
- camera_opt->description =
- _("Name of camera reference file to use");
-
- if (G_parser(argc, argv))
- exit(EXIT_FAILURE);
-
-
- camera = (char *)G_malloc(GNAME_MAX * sizeof(char));
-
- location = G_location();
- mapset = G_mapset();
-
- strcpy(group, group_opt->answer);
-
- if (!camera_opt->answer) {
- /* select the camera to use */
- if (!I_ask_camera_any(
- _("Enter a camera reference file to be used with this imagery group"),
- camera)) {
- exit(EXIT_SUCCESS);
- }
- }
- else {
- if (G_legal_filename (camera_opt->answer) < 0)
- G_fatal_error(_("<%s> is an illegal file name"),
- camera_opt->answer);
- else
- strcpy(camera, camera_opt->answer);
- }
-
- /* I_put_camera (camera); */
- I_put_group_camera(group, camera);
-
- G_message(
- _("Group [%s] in location [%s] mapset [%s] now has camera file [%s]"),
- group, location, mapset, camera);
-#ifdef DEBUG
- /* slight pause before the screen is cleared */
- sleep(3);
-#endif
-
- /* show the camera info for modification */
- if (I_find_camera(camera)) {
- have_old = 1;
- I_get_cam_info(camera, &cam_info);
- }
- mod_cam_info(have_old, &cam_info);
- I_put_cam_info(camera, &cam_info);
-
- exit(EXIT_SUCCESS);
-}
Copied: grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.camera/main.c (from rev 44501, grass/branches/develbranch_6/imagery/i.ortho.photo/i.photo.camera/main.c)
===================================================================
--- grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.camera/main.c (rev 0)
+++ grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.camera/main.c 2010-12-22 10:05:10 UTC (rev 44654)
@@ -0,0 +1,117 @@
+
+/****************************************************************************
+ *
+ * MODULE: i.photo.camera
+ * AUTHOR(S): Mike Baba, DBA Systems, Inc. (original contributor)
+ * Markus Neteler <neteler itc.it>,
+ * Roberto Flor <flor itc.it>,
+ * Bernhard Reiter <bernhard intevation.de>,
+ * Glynn Clements <glynn gclements.plus.com>
+ * Hamish Bowman
+ *
+ * PURPOSE: Creates or modifies entries in a camera reference file
+ * COPYRIGHT: (C) 1999-2008 by the GRASS Development Team
+ *
+ * This program is free software under the GNU General Public
+ * License (>=v2). Read the file COPYING that comes with GRASS
+ * for details.
+ *
+ *****************************************************************************/
+/* select_camera */
+/* select a camera reference file for a given imagery group */
+
+#define MAIN 1
+#include <stdlib.h>
+#include <string.h>
+
+#ifdef DEBUG
+#include <unistd.h> /* for sleep() */
+#endif
+
+#include <grass/gis.h>
+#include <grass/glocale.h>
+#include "orthophoto.h"
+#include "globals.h"
+
+int main(int argc, char *argv[])
+{
+ struct GModule *module;
+ struct Option *group_opt, *camera_opt;
+
+ char *location;
+ char *mapset;
+ char group[GNAME_MAX];
+
+ static int have_old;
+ char *camera;
+
+
+ /* must run in a term window */
+ G_putenv("GRASS_UI_TERM", "1");
+
+ G_gisinit(argv[0]);
+
+ module = G_define_module();
+ module->keywords = _("imagery, orthorectify");
+ module->description =
+ _("Interactively select and modify the imagery group camera reference file.");
+
+ group_opt = G_define_standard_option(G_OPT_I_GROUP);
+ group_opt->description =
+ _("Name of imagery group for ortho-rectification");
+
+ camera_opt = G_define_standard_option(G_OPT_F_INPUT);
+ camera_opt->key = "camera";
+ camera_opt->required = NO;
+ camera_opt->gisprompt = "old_file,camera,camera";
+ camera_opt->description =
+ _("Name of camera reference file to use");
+
+ if (G_parser(argc, argv))
+ exit(EXIT_FAILURE);
+
+
+ camera = (char *)G_malloc(GNAME_MAX * sizeof(char));
+
+ location = G_location();
+ mapset = G_mapset();
+
+ strcpy(group, group_opt->answer);
+
+ if (!camera_opt->answer) {
+ /* select the camera to use */
+ if (!I_ask_camera_any(
+ _("Enter a camera reference file to be used with this imagery group"),
+ camera)) {
+ exit(EXIT_SUCCESS);
+ }
+ }
+ else {
+ if (G_legal_filename (camera_opt->answer) < 0)
+ G_fatal_error(_("<%s> is an illegal file name"),
+ camera_opt->answer);
+ else
+ strcpy(camera, camera_opt->answer);
+ }
+
+ /* I_put_camera (camera); */
+ I_put_group_camera(group, camera);
+
+ G_message(
+ _("Group [%s] in location [%s] mapset [%s] now has camera file [%s]"),
+ group, location, mapset, camera);
+#ifdef DEBUG
+ /* slight pause before the screen is cleared */
+ sleep(3);
+#endif
+
+ /* show the camera info for modification */
+ if (I_find_camera(camera)) {
+ have_old = 1;
+ I_get_cam_info(camera, &cam_info);
+ }
+ mod_cam_info(have_old, &cam_info);
+ I_put_cam_info(camera, &cam_info);
+
+ exit(EXIT_SUCCESS);
+}
Deleted: grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.camera/mod_cam_info.c
===================================================================
--- grass/branches/develbranch_6/imagery/i.ortho.photo/i.photo.camera/mod_cam_info.c 2010-12-01 09:34:37 UTC (rev 44501)
+++ grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.camera/mod_cam_info.c 2010-12-22 10:05:10 UTC (rev 44654)
@@ -1,111 +0,0 @@
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#include <grass/vask.h>
-#include "orthophoto.h"
-#include "globals.h"
-
-#define NLINES 10
-
-int mod_cam_info(int have_old, struct Ortho_Camera_File_Ref *cam_info)
-{
- long fidnum[NLINES];
- char next[20];
- char next_line[20];
- int i;
- int atnum;
- int line;
- int startfid;
- int endfid;
-
- if (!have_old)
- strcpy(cam_info->cam_name, "DBA SYSTEMS CAMERA");
-
- V_clear();
- V_line(1, " Please provide the following information:");
- V_line(2,
- "+------------------------------------------------------------------------------+");
- V_line(4, " Camera Name");
- V_line(5, " Camera Identification");
- V_line(6, " Calibrated Focal Length mm.");
- V_line(7, " Point of Symmetry: X-coordinate mm.");
- V_line(8, " Point of Symmetry: Y-coordinate mm.");
- V_line(9, " Maximum number of fiducial or reseau marks");
- V_line(11,
- "+-----------------------------------------------------------------------------+");
- V_ques(cam_info->cam_name, 's', 4, 55, 20 - 1);
- V_ques(cam_info->cam_id, 's', 5, 55, 20 - 1);
- V_ques(&(cam_info->CFL), 'd', 6, 55, 20 - 1);
- V_ques(&(cam_info->Xp), 'd', 7, 55, 20 - 1);
- V_ques(&(cam_info->Yp), 'd', 8, 55, 20 - 1);
- V_ques(&(cam_info->num_fid), 'i', 9, 55, 20 - 1);
- V_intrpt_ok();
- if (!V_call())
- exit(0);
-
- /* get fiducail or reseau info NUMLINES at a time */
- startfid = 0;
- while (startfid >= 0 && startfid < cam_info->num_fid) {
- V_clear();
- {
- V_line(1,
- " Please provide the following information:");
- V_line(2,
- "+--------------------------------------------------------------------------+");
- V_line(4,
- " Fid# Fid Id Xf Yf");
- }
- endfid =
- startfid + NLINES <=
- cam_info->num_fid + 1 ? startfid + NLINES : cam_info->num_fid;
-
- atnum = 0;
- line = 6;
- for (i = startfid; i < endfid; i++) {
-
- fidnum[atnum] = i + 1;
-
- V_const(&fidnum[atnum], 'i', line, 13, 5);
- V_ques(cam_info->fiducials[i].fid_id, 's', line, 21, 6);
- V_ques(&(cam_info->fiducials[i].Xf), 'd', line, 33, 10);
- V_ques(&(cam_info->fiducials[i].Yf), 'd', line, 49, 10);
-
- atnum++;
- line++;
- }
-
- line += 2;
- *next = 0;
-
- if (endfid >= cam_info->num_fid)
- strcpy(next, "end");
- else
- sprintf(next, "%d", endfid);
- sprintf(next_line, next);
- V_line(line, " Next:");
- V_ques(next, 's', line, 34, 5);
- V_line(line + 2,
- "+--------------------------------------------------------------------------+");
- V_intrpt_ok();
- if (!V_call())
- exit(0);
-
- if (*next == 0)
- break;
- if (strcmp(next, "end") == 0)
- break;
- if (sscanf(next, "%d", &endfid) != 1)
- continue;
- if (endfid < 0)
- endfid = 0;
- if (endfid > cam_info->num_fid) {
- endfid = cam_info->num_fid - NLINES + 1;
- if (endfid < 0)
- endfid = 0;
- }
-
- startfid = endfid;
- }
-
- return 0;
-}
Copied: grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.camera/mod_cam_info.c (from rev 44501, grass/branches/develbranch_6/imagery/i.ortho.photo/i.photo.camera/mod_cam_info.c)
===================================================================
--- grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.camera/mod_cam_info.c (rev 0)
+++ grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.camera/mod_cam_info.c 2010-12-22 10:05:10 UTC (rev 44654)
@@ -0,0 +1,111 @@
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <grass/vask.h>
+#include "orthophoto.h"
+#include "globals.h"
+
+#define NLINES 10
+
+int mod_cam_info(int have_old, struct Ortho_Camera_File_Ref *cam_info)
+{
+ long fidnum[NLINES];
+ char next[20];
+ char next_line[20];
+ int i;
+ int atnum;
+ int line;
+ int startfid;
+ int endfid;
+
+ if (!have_old)
+ strcpy(cam_info->cam_name, "DBA SYSTEMS CAMERA");
+
+ V_clear();
+ V_line(1, " Please provide the following information:");
+ V_line(2,
+ "+------------------------------------------------------------------------------+");
+ V_line(4, " Camera Name");
+ V_line(5, " Camera Identification");
+ V_line(6, " Calibrated Focal Length mm.");
+ V_line(7, " Point of Symmetry: X-coordinate mm.");
+ V_line(8, " Point of Symmetry: Y-coordinate mm.");
+ V_line(9, " Maximum number of fiducial or reseau marks");
+ V_line(11,
+ "+-----------------------------------------------------------------------------+");
+ V_ques(cam_info->cam_name, 's', 4, 55, 20 - 1);
+ V_ques(cam_info->cam_id, 's', 5, 55, 20 - 1);
+ V_ques(&(cam_info->CFL), 'd', 6, 55, 20 - 1);
+ V_ques(&(cam_info->Xp), 'd', 7, 55, 20 - 1);
+ V_ques(&(cam_info->Yp), 'd', 8, 55, 20 - 1);
+ V_ques(&(cam_info->num_fid), 'i', 9, 55, 20 - 1);
+ V_intrpt_ok();
+ if (!V_call())
+ exit(0);
+
+ /* get fiducail or reseau info NUMLINES at a time */
+ startfid = 0;
+ while (startfid >= 0 && startfid < cam_info->num_fid) {
+ V_clear();
+ {
+ V_line(1,
+ " Please provide the following information:");
+ V_line(2,
+ "+--------------------------------------------------------------------------+");
+ V_line(4,
+ " Fid# Fid Id Xf Yf");
+ }
+ endfid =
+ startfid + NLINES <=
+ cam_info->num_fid + 1 ? startfid + NLINES : cam_info->num_fid;
+
+ atnum = 0;
+ line = 6;
+ for (i = startfid; i < endfid; i++) {
+
+ fidnum[atnum] = i + 1;
+
+ V_const(&fidnum[atnum], 'i', line, 13, 5);
+ V_ques(cam_info->fiducials[i].fid_id, 's', line, 21, 6);
+ V_ques(&(cam_info->fiducials[i].Xf), 'd', line, 33, 10);
+ V_ques(&(cam_info->fiducials[i].Yf), 'd', line, 49, 10);
+
+ atnum++;
+ line++;
+ }
+
+ line += 2;
+ *next = 0;
+
+ if (endfid >= cam_info->num_fid)
+ strcpy(next, "end");
+ else
+ sprintf(next, "%d", endfid);
+ sprintf(next_line, next);
+ V_line(line, " Next:");
+ V_ques(next, 's', line, 34, 5);
+ V_line(line + 2,
+ "+--------------------------------------------------------------------------+");
+ V_intrpt_ok();
+ if (!V_call())
+ exit(0);
+
+ if (*next == 0)
+ break;
+ if (strcmp(next, "end") == 0)
+ break;
+ if (sscanf(next, "%d", &endfid) != 1)
+ continue;
+ if (endfid < 0)
+ endfid = 0;
+ if (endfid > cam_info->num_fid) {
+ endfid = cam_info->num_fid - NLINES + 1;
+ if (endfid < 0)
+ endfid = 0;
+ }
+
+ startfid = endfid;
+ }
+
+ return 0;
+}
Deleted: grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.camera/photo.camera.png
===================================================================
(Binary files differ)
Copied: grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.camera/photo.camera.png (from rev 44501, grass/branches/develbranch_6/imagery/i.ortho.photo/i.photo.camera/photo.camera.png)
===================================================================
(Binary files differ)
Property changes on: grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.elev
___________________________________________________________________
Added: svn:ignore
+ *.tmp.html
*OBJ*
Deleted: grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.elev/Makefile
===================================================================
--- grass/branches/develbranch_6/imagery/i.ortho.photo/i.photo.elev/Makefile 2010-12-01 09:34:37 UTC (rev 44501)
+++ grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.elev/Makefile 2010-12-22 10:05:10 UTC (rev 44654)
@@ -1,15 +0,0 @@
-MODULE_TOPDIR = ../../..
-
-PGM = i.photo.elev
-
-EXTRA_CFLAGS = -I../libes
-
-LIBES = $(IMAGERYLIB) $(GISLIB) $(IORTHOLIB) $(VASKLIB) $(CURSES) $(GMATHLIB)
-DEPENDENCIES= $(IMAGERYDEP) $(IORTHODEP) $(GISDEP) $(VASKDEP) $(GMATHDEP)
-
-include $(MODULE_TOPDIR)/include/Make/Module.make
-
-default: etc
-
-htmletc:
- @echo no docs needed for $(PGM)
Copied: grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.elev/Makefile (from rev 44501, grass/branches/develbranch_6/imagery/i.ortho.photo/i.photo.elev/Makefile)
===================================================================
--- grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.elev/Makefile (rev 0)
+++ grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.elev/Makefile 2010-12-22 10:05:10 UTC (rev 44654)
@@ -0,0 +1,15 @@
+MODULE_TOPDIR = ../../..
+
+PGM = i.photo.elev
+
+EXTRA_CFLAGS = -I../libes
+
+LIBES = $(IMAGERYLIB) $(GISLIB) $(IORTHOLIB) $(VASKLIB) $(CURSES) $(GMATHLIB)
+DEPENDENCIES= $(IMAGERYDEP) $(IORTHODEP) $(GISDEP) $(VASKDEP) $(GMATHDEP)
+
+include $(MODULE_TOPDIR)/include/Make/Module.make
+
+default: etc
+
+htmletc:
+ @echo no docs needed for $(PGM)
Deleted: grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.elev/ask_elev.c
===================================================================
--- grass/branches/develbranch_6/imagery/i.ortho.photo/i.photo.elev/ask_elev.c 2010-12-01 09:34:37 UTC (rev 44501)
+++ grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.elev/ask_elev.c 2010-12-22 10:05:10 UTC (rev 44654)
@@ -1,50 +0,0 @@
-/* ask_elev .c */
-
-#include <stdlib.h>
-#include <string.h>
-#include <grass/gis.h>
-#include <grass/vask.h>
-#include "elev.h"
-
-int ask_elev(char *group, char *location, char *mapset)
-{
- char buf[100];
- char t1[80];
- char t2[80];
-
- sprintf(t1, "Please select the elevation raster map for group <%s>",
- group);
- sprintf(t2, "Elevation raster map: ");
-
- V_clear();
- V_line(1, t1);
- V_line(4, t2);
- V_line(6, "(enter list for a list of existing raster maps)");
- V_ques(elev_layer, 's', 4, 28, 20);
-
- for (;;) {
- V_intrpt_ok();
- if (!V_call())
- exit(0);
- if (*elev_layer == 0)
- exit(0);
-
- if (strcmp(elev_layer, "list") == 0) {
- G_set_list_hit_return(1);
- G_list_element("cell", "raster", "", 0);
- }
-
- else if ((mapset_elev = G_find_cell(elev_layer, "")) == NULL) {
- sprintf(buf,
- "\n\nraster-file %s not found - select another file\n",
- elev_layer);
- G_warning(buf);
- *elev_layer = 0;
- continue;
- }
- else
- break;
- }
- /* mod_elev_data(); */
- return 0;
-}
Copied: grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.elev/ask_elev.c (from rev 44501, grass/branches/develbranch_6/imagery/i.ortho.photo/i.photo.elev/ask_elev.c)
===================================================================
--- grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.elev/ask_elev.c (rev 0)
+++ grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.elev/ask_elev.c 2010-12-22 10:05:10 UTC (rev 44654)
@@ -0,0 +1,50 @@
+/* ask_elev .c */
+
+#include <stdlib.h>
+#include <string.h>
+#include <grass/gis.h>
+#include <grass/vask.h>
+#include "elev.h"
+
+int ask_elev(char *group, char *location, char *mapset)
+{
+ char buf[100];
+ char t1[80];
+ char t2[80];
+
+ sprintf(t1, "Please select the elevation raster map for group <%s>",
+ group);
+ sprintf(t2, "Elevation raster map: ");
+
+ V_clear();
+ V_line(1, t1);
+ V_line(4, t2);
+ V_line(6, "(enter list for a list of existing raster maps)");
+ V_ques(elev_layer, 's', 4, 28, 20);
+
+ for (;;) {
+ V_intrpt_ok();
+ if (!V_call())
+ exit(0);
+ if (*elev_layer == 0)
+ exit(0);
+
+ if (strcmp(elev_layer, "list") == 0) {
+ G_set_list_hit_return(1);
+ G_list_element("cell", "raster", "", 0);
+ }
+
+ else if ((mapset_elev = G_find_cell(elev_layer, "")) == NULL) {
+ sprintf(buf,
+ "\n\nraster-file %s not found - select another file\n",
+ elev_layer);
+ G_warning(buf);
+ *elev_layer = 0;
+ continue;
+ }
+ else
+ break;
+ }
+ /* mod_elev_data(); */
+ return 0;
+}
Deleted: grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.elev/elev.h
===================================================================
--- grass/branches/develbranch_6/imagery/i.ortho.photo/i.photo.elev/elev.h 2010-12-01 09:34:37 UTC (rev 44501)
+++ grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.elev/elev.h 2010-12-22 10:05:10 UTC (rev 44654)
@@ -1,16 +0,0 @@
-extern char *elev_layer;
-extern char *mapset_elev;
-extern char *tl;
-extern char *math_exp;
-extern char *units;
-extern char *nd;
-
-/* ask_elev.c */
-int ask_elev(char *, char *, char *);
-
-/* main.c */
-int select_current_env(void);
-int select_target_env(void);
-
-/* mod_elev.c */
-int mod_elev_data(void);
Copied: grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.elev/elev.h (from rev 44501, grass/branches/develbranch_6/imagery/i.ortho.photo/i.photo.elev/elev.h)
===================================================================
--- grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.elev/elev.h (rev 0)
+++ grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.elev/elev.h 2010-12-22 10:05:10 UTC (rev 44654)
@@ -0,0 +1,16 @@
+extern char *elev_layer;
+extern char *mapset_elev;
+extern char *tl;
+extern char *math_exp;
+extern char *units;
+extern char *nd;
+
+/* ask_elev.c */
+int ask_elev(char *, char *, char *);
+
+/* main.c */
+int select_current_env(void);
+int select_target_env(void);
+
+/* mod_elev.c */
+int mod_elev_data(void);
Deleted: grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.elev/local_proto.h
===================================================================
--- grass/branches/develbranch_6/imagery/i.ortho.photo/i.photo.elev/local_proto.h 2010-12-01 09:34:37 UTC (rev 44501)
+++ grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.elev/local_proto.h 2010-12-22 10:05:10 UTC (rev 44654)
@@ -1,9 +0,0 @@
-/* ask_elev.c */
-int ask_elev(char *, char *, char *);
-
-/* main.c */
-int select_current_env(void);
-int select_target_env(void);
-
-/* mod_elev.c */
-int mod_elev_data(void);
Copied: grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.elev/local_proto.h (from rev 44501, grass/branches/develbranch_6/imagery/i.ortho.photo/i.photo.elev/local_proto.h)
===================================================================
--- grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.elev/local_proto.h (rev 0)
+++ grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.elev/local_proto.h 2010-12-22 10:05:10 UTC (rev 44654)
@@ -0,0 +1,9 @@
+/* ask_elev.c */
+int ask_elev(char *, char *, char *);
+
+/* main.c */
+int select_current_env(void);
+int select_target_env(void);
+
+/* mod_elev.c */
+int mod_elev_data(void);
Deleted: grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.elev/main.c
===================================================================
--- grass/branches/develbranch_6/imagery/i.ortho.photo/i.photo.elev/main.c 2010-12-01 09:34:37 UTC (rev 44501)
+++ grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.elev/main.c 2010-12-22 10:05:10 UTC (rev 44654)
@@ -1,158 +0,0 @@
-
-/****************************************************************************
- *
- * MODULE: i.photo.elev
- * AUTHOR(S): Mike Baba (original contributor)
- * Markus Neteler <neteler itc.it>,
- * Roberto Flor <flor itc.it>,
- * Bernhard Reiter <bernhard intevation.de>,
- * Glynn Clements <glynn gclements.plus.com>
- * Hamish Bowman
- *
- * PURPOSE: Select the elevation model
- * COPYRIGHT: (C) 1999-2008 by the GRASS Development Team
- *
- * This program is free software under the GNU General Public
- * License (>=v2). Read the file COPYING that comes with GRASS
- * for details.
- *
- *****************************************************************************/
-
-/* read the target for the block and cast it into the alternate GRASS env */
-#define MAIN
-#include <stdlib.h>
-#include <stdio.h>
-#include <unistd.h>
-#include <string.h>
-#include <grass/gis.h>
-#include <grass/imagery.h>
-#include <grass/glocale.h>
-#include "orthophoto.h"
-#include "elev.h"
-
-static int which_env;
-
-char *elev_layer;
-char *mapset_elev;
-char *tl;
-char *math_exp;
-char *units;
-char *nd;
-
-int main(int argc, char *argv[])
-{
-
- struct GModule *module;
- struct Option *group_opt;
-
- char location[GMAPSET_MAX];
- char mapset[GMAPSET_MAX];
- char group[GNAME_MAX];
-
- char buf[100];
- int stat;
-
-
- /* must run in a term window */
- G_putenv("GRASS_UI_TERM", "1");
-
- G_gisinit(argv[0]);
-
- module = G_define_module();
- module->keywords = _("imagery, orthorectify");
- module->description =
- _("Interactively select or modify the target elevation model.");
-
- group_opt = G_define_standard_option(G_OPT_I_GROUP);
- group_opt->description =
- _("Name of imagery group for ortho-rectification");
-
- if (G_parser(argc, argv))
- exit(EXIT_FAILURE);
-
- elev_layer = (char *)G_malloc(GNAME_MAX * sizeof(char));
- mapset_elev = (char *)G_malloc(GMAPSET_MAX * sizeof(char));
- tl = (char *)G_malloc(80 * sizeof(char));
- math_exp = (char *)G_malloc(80 * sizeof(char));
- units = (char *)G_malloc(80 * sizeof(char));
- nd = (char *)G_malloc(80 * sizeof(char));
-
- *elev_layer = 0;
- *mapset_elev = 0;
- *tl = 0;
- *math_exp = 0;
- *units = 0;
- *nd = 0;
-
- strcpy(group, group_opt->answer);
-
- G_suppress_warnings(1);
- if (!I_get_target(group, location, mapset)) {
- sprintf(buf, _("Target information for group [%s] missing\n"), group);
- goto error;
- }
-
- G_suppress_warnings(0);
- sprintf(buf, "%s/%s", G_gisdbase(), location);
- if (access(buf, 0) != 0) {
- sprintf(buf, _("Target location [%s] not found\n"), location);
- goto error;
- }
-
- I_get_group_elev(group, elev_layer, mapset_elev, tl, math_exp, units, nd);
- G__create_alt_env();
- G__setenv("LOCATION_NAME", location);
-
- stat = G__mapset_permissions(mapset);
- if (stat > 0) {
- G__setenv("MAPSET", mapset);
- G__create_alt_search_path();
- G__switch_env();
- G__switch_search_path();
- which_env = 0;
-
- /* get elevation layer raster map in target location */
- select_target_env();
- ask_elev(group, location, mapset);
-
- /* select current location */
- select_current_env();
-
- I_put_group_elev(group, elev_layer, mapset_elev, tl,
- math_exp, units, nd);
-
- exit(EXIT_SUCCESS);
- }
-
- sprintf(buf, _("Mapset [%s] in target location [%s] - "), mapset, location);
- strcat(buf, stat == 0 ? _("permission denied\n") : _("not found\n"));
-
- error:
- strcat(buf, _("Please select a target for group"));
- strcat(buf, group);
- G_suppress_warnings(0);
- G_fatal_error(buf);
-}
-
-
-int select_current_env(void)
-{
- if (which_env != 0) {
- G__switch_env();
- G__switch_search_path();
- which_env = 0;
- }
-
- return 0;
-}
-
-int select_target_env(void)
-{
- if (which_env != 1) {
- G__switch_env();
- G__switch_search_path();
- which_env = 1;
- }
-
- return 0;
-}
Copied: grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.elev/main.c (from rev 44501, grass/branches/develbranch_6/imagery/i.ortho.photo/i.photo.elev/main.c)
===================================================================
--- grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.elev/main.c (rev 0)
+++ grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.elev/main.c 2010-12-22 10:05:10 UTC (rev 44654)
@@ -0,0 +1,158 @@
+
+/****************************************************************************
+ *
+ * MODULE: i.photo.elev
+ * AUTHOR(S): Mike Baba (original contributor)
+ * Markus Neteler <neteler itc.it>,
+ * Roberto Flor <flor itc.it>,
+ * Bernhard Reiter <bernhard intevation.de>,
+ * Glynn Clements <glynn gclements.plus.com>
+ * Hamish Bowman
+ *
+ * PURPOSE: Select the elevation model
+ * COPYRIGHT: (C) 1999-2008 by the GRASS Development Team
+ *
+ * This program is free software under the GNU General Public
+ * License (>=v2). Read the file COPYING that comes with GRASS
+ * for details.
+ *
+ *****************************************************************************/
+
+/* read the target for the block and cast it into the alternate GRASS env */
+#define MAIN
+#include <stdlib.h>
+#include <stdio.h>
+#include <unistd.h>
+#include <string.h>
+#include <grass/gis.h>
+#include <grass/imagery.h>
+#include <grass/glocale.h>
+#include "orthophoto.h"
+#include "elev.h"
+
+static int which_env;
+
+char *elev_layer;
+char *mapset_elev;
+char *tl;
+char *math_exp;
+char *units;
+char *nd;
+
+int main(int argc, char *argv[])
+{
+
+ struct GModule *module;
+ struct Option *group_opt;
+
+ char location[GMAPSET_MAX];
+ char mapset[GMAPSET_MAX];
+ char group[GNAME_MAX];
+
+ char buf[100];
+ int stat;
+
+
+ /* must run in a term window */
+ G_putenv("GRASS_UI_TERM", "1");
+
+ G_gisinit(argv[0]);
+
+ module = G_define_module();
+ module->keywords = _("imagery, orthorectify");
+ module->description =
+ _("Interactively select or modify the target elevation model.");
+
+ group_opt = G_define_standard_option(G_OPT_I_GROUP);
+ group_opt->description =
+ _("Name of imagery group for ortho-rectification");
+
+ if (G_parser(argc, argv))
+ exit(EXIT_FAILURE);
+
+ elev_layer = (char *)G_malloc(GNAME_MAX * sizeof(char));
+ mapset_elev = (char *)G_malloc(GMAPSET_MAX * sizeof(char));
+ tl = (char *)G_malloc(80 * sizeof(char));
+ math_exp = (char *)G_malloc(80 * sizeof(char));
+ units = (char *)G_malloc(80 * sizeof(char));
+ nd = (char *)G_malloc(80 * sizeof(char));
+
+ *elev_layer = 0;
+ *mapset_elev = 0;
+ *tl = 0;
+ *math_exp = 0;
+ *units = 0;
+ *nd = 0;
+
+ strcpy(group, group_opt->answer);
+
+ G_suppress_warnings(1);
+ if (!I_get_target(group, location, mapset)) {
+ sprintf(buf, _("Target information for group [%s] missing\n"), group);
+ goto error;
+ }
+
+ G_suppress_warnings(0);
+ sprintf(buf, "%s/%s", G_gisdbase(), location);
+ if (access(buf, 0) != 0) {
+ sprintf(buf, _("Target location [%s] not found\n"), location);
+ goto error;
+ }
+
+ I_get_group_elev(group, elev_layer, mapset_elev, tl, math_exp, units, nd);
+ G__create_alt_env();
+ G__setenv("LOCATION_NAME", location);
+
+ stat = G__mapset_permissions(mapset);
+ if (stat > 0) {
+ G__setenv("MAPSET", mapset);
+ G__create_alt_search_path();
+ G__switch_env();
+ G__switch_search_path();
+ which_env = 0;
+
+ /* get elevation layer raster map in target location */
+ select_target_env();
+ ask_elev(group, location, mapset);
+
+ /* select current location */
+ select_current_env();
+
+ I_put_group_elev(group, elev_layer, mapset_elev, tl,
+ math_exp, units, nd);
+
+ exit(EXIT_SUCCESS);
+ }
+
+ sprintf(buf, _("Mapset [%s] in target location [%s] - "), mapset, location);
+ strcat(buf, stat == 0 ? _("permission denied\n") : _("not found\n"));
+
+ error:
+ strcat(buf, _("Please select a target for group"));
+ strcat(buf, group);
+ G_suppress_warnings(0);
+ G_fatal_error(buf);
+}
+
+
+int select_current_env(void)
+{
+ if (which_env != 0) {
+ G__switch_env();
+ G__switch_search_path();
+ which_env = 0;
+ }
+
+ return 0;
+}
+
+int select_target_env(void)
+{
+ if (which_env != 1) {
+ G__switch_env();
+ G__switch_search_path();
+ which_env = 1;
+ }
+
+ return 0;
+}
Deleted: grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.elev/mod_elev.c
===================================================================
--- grass/branches/develbranch_6/imagery/i.ortho.photo/i.photo.elev/mod_elev.c 2010-12-01 09:34:37 UTC (rev 44501)
+++ grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.elev/mod_elev.c 2010-12-22 10:05:10 UTC (rev 44654)
@@ -1,47 +0,0 @@
-/* mod_elev.c */
-
-#include <stdlib.h>
-#include <grass/gis.h>
-#include <grass/vask.h>
-#include "elev.h"
-
-#define ZERO_DATA 0
-
-int mod_elev_data(void)
-{
- short ok;
-
- tl = G_location();
- sprintf(units, "METERS");
-
- ok = 0;
- while (!ok) {
- /* List options on the screen for the user to answer */
- ok = 1;
- V_clear();
- V_line(1, "Please check the elevation data convention:");
- V_line(3,
- "ELEV_DATA = CELL FILE [MAPSET in LOCATION] [MATH EXPERSION][UNITS]");
-
- V_line(6, "CELL FILE : ");
- V_line(7, "MAPSET : ");
- V_line(8, "LOCATION : ");
- V_line(9, "MATH EXPRESSION : ");
- V_line(10, "UNITS : ");
- V_line(12, "NO DATA VALUES : ");
-
- V_const(elev_layer, 's', 6, 20, 40);
- V_const(mapset_elev, 's', 7, 20, 40);
- V_const(tl, 's', 8, 20, 40);
- V_ques(math_exp, 's', 9, 20, 40);
- V_const(units, 's', 10, 20, 10);
- V_ques(nd, 's', 12, 20, 10);
-
- V_intrpt_ok();
- if (!V_call())
- exit(1);
-
- }
-
- return 0;
-}
Copied: grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.elev/mod_elev.c (from rev 44501, grass/branches/develbranch_6/imagery/i.ortho.photo/i.photo.elev/mod_elev.c)
===================================================================
--- grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.elev/mod_elev.c (rev 0)
+++ grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.elev/mod_elev.c 2010-12-22 10:05:10 UTC (rev 44654)
@@ -0,0 +1,47 @@
+/* mod_elev.c */
+
+#include <stdlib.h>
+#include <grass/gis.h>
+#include <grass/vask.h>
+#include "elev.h"
+
+#define ZERO_DATA 0
+
+int mod_elev_data(void)
+{
+ short ok;
+
+ tl = G_location();
+ sprintf(units, "METERS");
+
+ ok = 0;
+ while (!ok) {
+ /* List options on the screen for the user to answer */
+ ok = 1;
+ V_clear();
+ V_line(1, "Please check the elevation data convention:");
+ V_line(3,
+ "ELEV_DATA = CELL FILE [MAPSET in LOCATION] [MATH EXPERSION][UNITS]");
+
+ V_line(6, "CELL FILE : ");
+ V_line(7, "MAPSET : ");
+ V_line(8, "LOCATION : ");
+ V_line(9, "MATH EXPRESSION : ");
+ V_line(10, "UNITS : ");
+ V_line(12, "NO DATA VALUES : ");
+
+ V_const(elev_layer, 's', 6, 20, 40);
+ V_const(mapset_elev, 's', 7, 20, 40);
+ V_const(tl, 's', 8, 20, 40);
+ V_ques(math_exp, 's', 9, 20, 40);
+ V_const(units, 's', 10, 20, 10);
+ V_ques(nd, 's', 12, 20, 10);
+
+ V_intrpt_ok();
+ if (!V_call())
+ exit(1);
+
+ }
+
+ return 0;
+}
Property changes on: grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.init
___________________________________________________________________
Added: svn:ignore
+ *.tmp.html
*OBJ*
Deleted: grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.init/Makefile
===================================================================
--- grass/branches/develbranch_6/imagery/i.ortho.photo/i.photo.init/Makefile 2010-12-01 09:34:37 UTC (rev 44501)
+++ grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.init/Makefile 2010-12-22 10:05:10 UTC (rev 44654)
@@ -1,16 +0,0 @@
-MODULE_TOPDIR = ../../..
-
-PGM = i.photo.init
-
-EXTRA_CFLAGS = -I../libes
-
-LIBES = $(IORTHOLIB) $(IMAGERYLIB) $(DISPLAYLIB) $(RASTERLIB) $(GISLIB) $(VASKLIB) $(CURSES) $(GMATHLIB)
-DEPENDENCIES= $(IMAGERYDEP) $(DISPLAYDEP) $(RASTERDEP) $(IORTHODEP) $(GISDEP) $(VASKDEP) $(GMATHDEP)
-
-include $(MODULE_TOPDIR)/include/Make/Module.make
-
-default: etc
-
-$(PGM).tmp.html: description.html
- $(INSTALL_DATA) $< $@
-
Copied: grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.init/Makefile (from rev 44501, grass/branches/develbranch_6/imagery/i.ortho.photo/i.photo.init/Makefile)
===================================================================
--- grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.init/Makefile (rev 0)
+++ grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.init/Makefile 2010-12-22 10:05:10 UTC (rev 44654)
@@ -0,0 +1,16 @@
+MODULE_TOPDIR = ../../..
+
+PGM = i.photo.init
+
+EXTRA_CFLAGS = -I../libes
+
+LIBES = $(IORTHOLIB) $(IMAGERYLIB) $(DISPLAYLIB) $(RASTERLIB) $(GISLIB) $(VASKLIB) $(CURSES) $(GMATHLIB)
+DEPENDENCIES= $(IMAGERYDEP) $(DISPLAYDEP) $(RASTERDEP) $(IORTHODEP) $(GISDEP) $(VASKDEP) $(GMATHDEP)
+
+include $(MODULE_TOPDIR)/include/Make/Module.make
+
+default: etc
+
+$(PGM).tmp.html: description.html
+ $(INSTALL_DATA) $< $@
+
Deleted: grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.init/description.html
===================================================================
--- grass/branches/develbranch_6/imagery/i.ortho.photo/i.photo.init/description.html 2010-12-01 09:34:37 UTC (rev 44501)
+++ grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.init/description.html 2010-12-22 10:05:10 UTC (rev 44654)
@@ -1,109 +0,0 @@
-<H2>DESCRIPTION</H2>
-
-Aerial photographs may be either vertical or oblique. Vertical photographs
-can be truly vertical (nadir), or slightly tilted (less than 3 degree
-from the vertical). Usually aerial photos are tilted to some degree. We
-refer to the term <i>vertical photograph</i> up to a tilt of 3 degree.
-<br>
-Oblique aerial photographs are purposely taken with an
-angle between 3 and 90 degree from the nadir direction.
-<P>
-<b>The use of <EM>i.photo.init</EM> (menu 6) is only required when rectifying a
-tilted or oblique aerial photo.</b>
-<P>
-<EM>i.photo.init</EM> creates or modifies entries in a camera initial exposure
-station file for imagery group referenced by a sub-block. These entries
-include: the (XC,YC,ZC) standard (e.g. UTM) approximate coordinates of the camera exposure
-station; initial roll, pitch, and yaw angles (in degrees) of the cameras
-attitude; and the <EM>a priori</EM> standard deviations for these
-parameters. During the imagery program, <EM>i.photo.rectify</EM>, the initial camera
-exposure station file is used for computation of the ortho-rectification
-parameters. If no initial camera exposure station file exist, the default
-values are computed from the control points file created in <EM><A
-HREF="i.photo.2target.html">i.photo.2target</A></EM>.
-
-
-<P>
-
-The following menu is displayed:
-<PRE>
- Please provide the following information
-
- INITIAL XC: Meters __________
- INITIAL YC: Meters __________
- INITIAL ZC: Meters __________
- INITIAL omega (roll) degrees: __________
- INITIAL phi (pitch) degrees: __________
- INITIAL kappa (yaw) degrees: __________
-
- Standard Deviation XC: Meters __________
- Standard Deviation YC: Meters __________
- Standard Deviation ZC: Meters __________
- Std. Dev. omega (roll) degrees: __________
- Std. Dev. phi (pitch) degrees: __________
- Std. Dev. kappa (yaw) degrees: __________
-
- Use these values at run time? (1=yes, 0=no)
-
- AFTER COMPLETING ALL ANSWERS, HIT <ESC> TO CONTINUE
- (OR <Ctrl-C> TO CANCEL)
-</PRE>
-
-<P>
-The INITIAL values for (XC,YC,ZC) are expressed in standard (e.g. UTM) coordinates, and
-represent an approximation for the location of the camera at the time of
-exposure.
-
-<ul>
-<li> X: East aircraft position;
-<li> Y: North aircraft position;
-<li> Z: Flight altitude above sea level
-</ul>
-
-<P>
-
-The INITIAL values for (omega,phi,kappa) are expressed in degrees, and
-represent an approximation for the cameras attitude at the time of
-exposure.
-
-<ul>
-<li> Omega (roll): Raising or lowering of the wings (turning around the
- aircraft's axis);
-<li> Phi (pitch): Raising or lowering of the aircraft's front (turning
- around the wings' axis);
-<li> Kappa (yaw): Rotation needed to align the aerial photo to true north:
- needs to be denoted as +90 degree for clockwise turn and -90 degree for
- a counterclockwise turn.
-</ul>
-<P>
-
-The standard deviations for (XC,YC,ZC) are expressed in meters, and
-are used as <EM>a priori</EM> values for the standard deviations used in
-computation of the ortho rectification parameters.
-<P>
-
-The standard deviations for (omega,phi,kappa) are expressed in degrees, and
-are used as <EM>a priori</EM> values for the standard deviations used in
-computation of the ortho rectification parameters.
-
-<P>
-If <i>Use these values at run time? (1=yes, 0=no)</i> is set to 0, the
-values in this menu are not used.
-
-<H2>SEE ALSO</H2>
-
-<EM>
-<A HREF="i.ortho.photo.html">i.ortho.photo</A>,
-<A HREF="i.photo.camera.html">i.photo.camera</A>,
-<A HREF="i.photo.2image.html">i.photo.2image</A>,
-<A HREF="i.photo.2target.html">i.photo.2target</A>,
-<A HREF="i.photo.rectify.html">i.photo.rectify</A>
-</EM>
-
-
-
-<H2>AUTHOR</H2>
-
-Mike Baba, DBA Systems, Inc.
-<p>
-<i>Last changed: $Date$</i>
Copied: grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.init/description.html (from rev 44501, grass/branches/develbranch_6/imagery/i.ortho.photo/i.photo.init/description.html)
===================================================================
--- grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.init/description.html (rev 0)
+++ grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.init/description.html 2010-12-22 10:05:10 UTC (rev 44654)
@@ -0,0 +1,109 @@
+<H2>DESCRIPTION</H2>
+
+Aerial photographs may be either vertical or oblique. Vertical photographs
+can be truly vertical (nadir), or slightly tilted (less than 3 degree
+from the vertical). Usually aerial photos are tilted to some degree. We
+refer to the term <i>vertical photograph</i> up to a tilt of 3 degree.
+<br>
+Oblique aerial photographs are purposely taken with an
+angle between 3 and 90 degree from the nadir direction.
+<P>
+<b>The use of <EM>i.photo.init</EM> (menu 6) is only required when rectifying a
+tilted or oblique aerial photo.</b>
+<P>
+<EM>i.photo.init</EM> creates or modifies entries in a camera initial exposure
+station file for imagery group referenced by a sub-block. These entries
+include: the (XC,YC,ZC) standard (e.g. UTM) approximate coordinates of the camera exposure
+station; initial roll, pitch, and yaw angles (in degrees) of the cameras
+attitude; and the <EM>a priori</EM> standard deviations for these
+parameters. During the imagery program, <EM>i.photo.rectify</EM>, the initial camera
+exposure station file is used for computation of the ortho-rectification
+parameters. If no initial camera exposure station file exist, the default
+values are computed from the control points file created in <EM><A
+HREF="i.photo.2target.html">i.photo.2target</A></EM>.
+
+
+<P>
+
+The following menu is displayed:
+<PRE>
+ Please provide the following information
+
+ INITIAL XC: Meters __________
+ INITIAL YC: Meters __________
+ INITIAL ZC: Meters __________
+ INITIAL omega (roll) degrees: __________
+ INITIAL phi (pitch) degrees: __________
+ INITIAL kappa (yaw) degrees: __________
+
+ Standard Deviation XC: Meters __________
+ Standard Deviation YC: Meters __________
+ Standard Deviation ZC: Meters __________
+ Std. Dev. omega (roll) degrees: __________
+ Std. Dev. phi (pitch) degrees: __________
+ Std. Dev. kappa (yaw) degrees: __________
+
+ Use these values at run time? (1=yes, 0=no)
+
+ AFTER COMPLETING ALL ANSWERS, HIT <ESC> TO CONTINUE
+ (OR <Ctrl-C> TO CANCEL)
+</PRE>
+
+<P>
+The INITIAL values for (XC,YC,ZC) are expressed in standard (e.g. UTM) coordinates, and
+represent an approximation for the location of the camera at the time of
+exposure.
+
+<ul>
+<li> X: East aircraft position;
+<li> Y: North aircraft position;
+<li> Z: Flight altitude above sea level
+</ul>
+
+<P>
+
+The INITIAL values for (omega,phi,kappa) are expressed in degrees, and
+represent an approximation for the cameras attitude at the time of
+exposure.
+
+<ul>
+<li> Omega (roll): Raising or lowering of the wings (turning around the
+ aircraft's axis);
+<li> Phi (pitch): Raising or lowering of the aircraft's front (turning
+ around the wings' axis);
+<li> Kappa (yaw): Rotation needed to align the aerial photo to true north:
+ needs to be denoted as +90 degree for clockwise turn and -90 degree for
+ a counterclockwise turn.
+</ul>
+<P>
+
+The standard deviations for (XC,YC,ZC) are expressed in meters, and
+are used as <EM>a priori</EM> values for the standard deviations used in
+computation of the ortho rectification parameters.
+<P>
+
+The standard deviations for (omega,phi,kappa) are expressed in degrees, and
+are used as <EM>a priori</EM> values for the standard deviations used in
+computation of the ortho rectification parameters.
+
+<P>
+If <i>Use these values at run time? (1=yes, 0=no)</i> is set to 0, the
+values in this menu are not used.
+
+<H2>SEE ALSO</H2>
+
+<EM>
+<A HREF="i.ortho.photo.html">i.ortho.photo</A>,
+<A HREF="i.photo.camera.html">i.photo.camera</A>,
+<A HREF="i.photo.2image.html">i.photo.2image</A>,
+<A HREF="i.photo.2target.html">i.photo.2target</A>,
+<A HREF="i.photo.rectify.html">i.photo.rectify</A>
+</EM>
+
+
+
+<H2>AUTHOR</H2>
+
+Mike Baba, DBA Systems, Inc.
+<p>
+<i>Last changed: $Date$</i>
Deleted: grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.init/globals.h
===================================================================
--- grass/branches/develbranch_6/imagery/i.ortho.photo/i.photo.init/globals.h 2010-12-01 09:34:37 UTC (rev 44501)
+++ grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.init/globals.h 2010-12-22 10:05:10 UTC (rev 44654)
@@ -1,26 +0,0 @@
-#ifdef MAIN
-#define GLOBAL
-#else
-#define GLOBAL extern
-#endif
-
-#include "orthophoto.h"
-
-/* State flags Most are Toggles */
-GLOBAL char Data_Loaded; /* is there data in memory */
-
- /* used for abnormal exit logic */
-GLOBAL char Files_Open; /* is there data in memory */
-
-GLOBAL struct Ortho_Image_Group group;
-
-/* hold the names of files etc. mostly used by main.c */
-GLOBAL char *N_path;
-GLOBAL char *N_name;
-GLOBAL char *N_camera;
-
-#define DEG_TO_RADS 0.01745329
-#define RAD_TO_DEGS 57.29578
-
-/* mod_info.c */
-int mod_init_info(int, struct Ortho_Camera_Exp_Init *);
Copied: grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.init/globals.h (from rev 44501, grass/branches/develbranch_6/imagery/i.ortho.photo/i.photo.init/globals.h)
===================================================================
--- grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.init/globals.h (rev 0)
+++ grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.init/globals.h 2010-12-22 10:05:10 UTC (rev 44654)
@@ -0,0 +1,26 @@
+#ifdef MAIN
+#define GLOBAL
+#else
+#define GLOBAL extern
+#endif
+
+#include "orthophoto.h"
+
+/* State flags Most are Toggles */
+GLOBAL char Data_Loaded; /* is there data in memory */
+
+ /* used for abnormal exit logic */
+GLOBAL char Files_Open; /* is there data in memory */
+
+GLOBAL struct Ortho_Image_Group group;
+
+/* hold the names of files etc. mostly used by main.c */
+GLOBAL char *N_path;
+GLOBAL char *N_name;
+GLOBAL char *N_camera;
+
+#define DEG_TO_RADS 0.01745329
+#define RAD_TO_DEGS 57.29578
+
+/* mod_info.c */
+int mod_init_info(int, struct Ortho_Camera_Exp_Init *);
Deleted: grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.init/main.c
===================================================================
--- grass/branches/develbranch_6/imagery/i.ortho.photo/i.photo.init/main.c 2010-12-01 09:34:37 UTC (rev 44501)
+++ grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.init/main.c 2010-12-22 10:05:10 UTC (rev 44654)
@@ -1,89 +0,0 @@
-
-/****************************************************************************
- *
- * MODULE: i.photo.init
- * AUTHOR(S): Mike Baba, DBA Systems, Inc. (original contributor)
- * Markus Neteler <neteler itc.it>,
- * Roberto Flor <flor itc.it>,
- * Bernhard Reiter <bernhard intevation.de>,
- * Glynn Clements <glynn gclements.plus.com>
- * Hamish Bowman
- *
- * PURPOSE: Creates or modifies entries in a camera initial exposure
- * station file for imagery group referenced by a sub-block
- * COPYRIGHT: (C) 1999-2008 by the GRASS Development Team
- *
- * This program is free software under the GNU General Public
- * License (>=v2). Read the file COPYING that comes with GRASS
- * for details.
- *
- *****************************************************************************/
-
-#define MAIN 1
-#include <stdlib.h>
-#include <string.h>
-#include <grass/gis.h>
-#include <grass/glocale.h>
-#include "globals.h"
-
-
-int main(int argc, char *argv[])
-{
- struct GModule *module;
- struct Option *group_opt;
-
- char name[GNAME_MAX];
- int have_old;
-
- /* must run in a term window */
- G_putenv("GRASS_UI_TERM", "1");
-
- G_gisinit(argv[0]);
-
- module = G_define_module();
- module->keywords = _("imagery, orthorectify");
- module->description =
- _("Interactively creates or modifies entries in a camera "
- "initial exposure station file for imagery group referenced "
- "by a sub-block.");
-
- group_opt = G_define_standard_option(G_OPT_I_GROUP);
- group_opt->description =
- _("Name of imagery group for ortho-rectification");
-
- if (G_parser(argc, argv))
- exit(EXIT_FAILURE);
-
-
- strcpy(name, group_opt->answer);
-
- /* get group ref */
- strcpy(group.name, name);
-
- if (!I_find_group(group.name)) {
- G_fatal_error(_("Group [%s] not found"), name);
- }
- G_debug(1, "Found group %s", group.name);
-
-
-/*******************
- I_get_Ortho_Image_Group_Ref(group.name, &group.group_ref);
- nfiles = block.block_ref.nfiles;
- G_debug(1, "Got group ref");
-*******************/
-
-
- /* get initial camera exposure infor */
- if (I_find_initial(group.name)) {
- have_old = 1;
- I_get_init_info(group.name, &group.camera_exp);
- }
-
- /* modifiy infor */
- mod_init_info(have_old, &group.camera_exp);
-
- /* save info */
- I_put_init_info(group.name, &group.camera_exp);
-
- exit(EXIT_SUCCESS);
-}
Copied: grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.init/main.c (from rev 44501, grass/branches/develbranch_6/imagery/i.ortho.photo/i.photo.init/main.c)
===================================================================
--- grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.init/main.c (rev 0)
+++ grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.init/main.c 2010-12-22 10:05:10 UTC (rev 44654)
@@ -0,0 +1,89 @@
+
+/****************************************************************************
+ *
+ * MODULE: i.photo.init
+ * AUTHOR(S): Mike Baba, DBA Systems, Inc. (original contributor)
+ * Markus Neteler <neteler itc.it>,
+ * Roberto Flor <flor itc.it>,
+ * Bernhard Reiter <bernhard intevation.de>,
+ * Glynn Clements <glynn gclements.plus.com>
+ * Hamish Bowman
+ *
+ * PURPOSE: Creates or modifies entries in a camera initial exposure
+ * station file for imagery group referenced by a sub-block
+ * COPYRIGHT: (C) 1999-2008 by the GRASS Development Team
+ *
+ * This program is free software under the GNU General Public
+ * License (>=v2). Read the file COPYING that comes with GRASS
+ * for details.
+ *
+ *****************************************************************************/
+
+#define MAIN 1
+#include <stdlib.h>
+#include <string.h>
+#include <grass/gis.h>
+#include <grass/glocale.h>
+#include "globals.h"
+
+
+int main(int argc, char *argv[])
+{
+ struct GModule *module;
+ struct Option *group_opt;
+
+ char name[GNAME_MAX];
+ int have_old;
+
+ /* must run in a term window */
+ G_putenv("GRASS_UI_TERM", "1");
+
+ G_gisinit(argv[0]);
+
+ module = G_define_module();
+ module->keywords = _("imagery, orthorectify");
+ module->description =
+ _("Interactively creates or modifies entries in a camera "
+ "initial exposure station file for imagery group referenced "
+ "by a sub-block.");
+
+ group_opt = G_define_standard_option(G_OPT_I_GROUP);
+ group_opt->description =
+ _("Name of imagery group for ortho-rectification");
+
+ if (G_parser(argc, argv))
+ exit(EXIT_FAILURE);
+
+
+ strcpy(name, group_opt->answer);
+
+ /* get group ref */
+ strcpy(group.name, name);
+
+ if (!I_find_group(group.name)) {
+ G_fatal_error(_("Group [%s] not found"), name);
+ }
+ G_debug(1, "Found group %s", group.name);
+
+
+/*******************
+ I_get_Ortho_Image_Group_Ref(group.name, &group.group_ref);
+ nfiles = block.block_ref.nfiles;
+ G_debug(1, "Got group ref");
+*******************/
+
+
+ /* get initial camera exposure infor */
+ if (I_find_initial(group.name)) {
+ have_old = 1;
+ I_get_init_info(group.name, &group.camera_exp);
+ }
+
+ /* modifiy infor */
+ mod_init_info(have_old, &group.camera_exp);
+
+ /* save info */
+ I_put_init_info(group.name, &group.camera_exp);
+
+ exit(EXIT_SUCCESS);
+}
Deleted: grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.init/mod_info.c
===================================================================
--- grass/branches/develbranch_6/imagery/i.ortho.photo/i.photo.init/mod_info.c 2010-12-01 09:34:37 UTC (rev 44501)
+++ grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.init/mod_info.c 2010-12-22 10:05:10 UTC (rev 44654)
@@ -1,80 +0,0 @@
-#include <stdlib.h>
-#include <stdio.h>
-#include <curses.h>
-#include <grass/vask.h>
-#include "globals.h"
-
-int mod_init_info(int have_old, struct Ortho_Camera_Exp_Init *init_info)
-{
- double omega_deg, phi_deg, kappa_deg;
- double omega_var, phi_var, kappa_var;
-
- if (!have_old) {
- /* make zero */
- }
-
- /* convert from radians to degrees */
- omega_deg = init_info->omega_init * RAD_TO_DEGS;
- phi_deg = init_info->phi_init * RAD_TO_DEGS;
- kappa_deg = init_info->kappa_init * RAD_TO_DEGS;
-
- omega_var = init_info->omega_var * RAD_TO_DEGS;
- phi_var = init_info->phi_var * RAD_TO_DEGS;
- kappa_var = init_info->kappa_var * RAD_TO_DEGS;
-
-
- V_clear();
- V_line(1, " Please provide the following information:");
- V_line(2,
- "+------------------------------------------------------------------------------+");
- V_line(4, " Initial Camera Exposure X-coordinate Meters:");
- V_line(5, " Initial Camera Exposure Y-coordinate Meters:");
- V_line(6, " Initial Camera Exposure Z-coordinate Meters:");
- V_line(7, " Initial Camera Omega (roll) degrees:");
- V_line(8, " Initial Camera Phi (pitch) degrees:");
- V_line(9, " Initial Camera Kappa (yaw) degrees:");
-
- V_line(11, " Apriori standard deviation X-coordinate Meters:");
- V_line(12, " Apriori standard deviation Y-coordinate Meters:");
- V_line(13, " Apriori standard deviation Z-coordinate Meters:");
- V_line(14, " Apriori standard deviation Omega (roll) degrees:");
- V_line(15, " Apriori standard deviation Phi (pitch) degrees:");
- V_line(16, " Apriori standard deviation Kappa (yaw) degrees:");
-
- V_line(18, " Use these values at run time? (1=yes, 0=no)");
- V_line(19,
- "+------------------------------------------------------------------------------+");
-
- V_ques(&(init_info->XC_init), 'd', 4, 60, 15 - 1);
- V_ques(&(init_info->YC_init), 'd', 5, 60, 15 - 1);
- V_ques(&(init_info->ZC_init), 'd', 6, 60, 15 - 1);
-
- V_ques(&omega_deg, 'd', 7, 60, 15 - 1);
- V_ques(&phi_deg, 'd', 8, 60, 15 - 1);
- V_ques(&kappa_deg, 'd', 9, 60, 15 - 1);
-
- V_ques(&(init_info->XC_var), 'd', 11, 60, 15 - 1);
- V_ques(&(init_info->YC_var), 'd', 12, 60, 15 - 1);
- V_ques(&(init_info->ZC_var), 'd', 13, 60, 15 - 1);
-
- V_ques(&omega_var, 'd', 14, 60, 15 - 1);
- V_ques(&phi_var, 'd', 15, 60, 15 - 1);
- V_ques(&kappa_var, 'd', 16, 60, 15 - 1);
- V_ques(&(init_info->status), 'i', 18, 60, 2);
-
- V_intrpt_ok();
- if (!V_call()) {
- exit(0);
- }
-
- /* convert back to radians */
- init_info->omega_init = omega_deg * DEG_TO_RADS;
- init_info->phi_init = phi_deg * DEG_TO_RADS;
- init_info->kappa_init = kappa_deg * DEG_TO_RADS;
-
- init_info->omega_var = omega_var * DEG_TO_RADS;
- init_info->phi_var = phi_var * DEG_TO_RADS;
- init_info->kappa_var = kappa_var * DEG_TO_RADS;
-
- return 0;
-}
Copied: grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.init/mod_info.c (from rev 44501, grass/branches/develbranch_6/imagery/i.ortho.photo/i.photo.init/mod_info.c)
===================================================================
--- grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.init/mod_info.c (rev 0)
+++ grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.init/mod_info.c 2010-12-22 10:05:10 UTC (rev 44654)
@@ -0,0 +1,80 @@
+#include <stdlib.h>
+#include <stdio.h>
+#include <curses.h>
+#include <grass/vask.h>
+#include "globals.h"
+
+int mod_init_info(int have_old, struct Ortho_Camera_Exp_Init *init_info)
+{
+ double omega_deg, phi_deg, kappa_deg;
+ double omega_var, phi_var, kappa_var;
+
+ if (!have_old) {
+ /* make zero */
+ }
+
+ /* convert from radians to degrees */
+ omega_deg = init_info->omega_init * RAD_TO_DEGS;
+ phi_deg = init_info->phi_init * RAD_TO_DEGS;
+ kappa_deg = init_info->kappa_init * RAD_TO_DEGS;
+
+ omega_var = init_info->omega_var * RAD_TO_DEGS;
+ phi_var = init_info->phi_var * RAD_TO_DEGS;
+ kappa_var = init_info->kappa_var * RAD_TO_DEGS;
+
+
+ V_clear();
+ V_line(1, " Please provide the following information:");
+ V_line(2,
+ "+------------------------------------------------------------------------------+");
+ V_line(4, " Initial Camera Exposure X-coordinate Meters:");
+ V_line(5, " Initial Camera Exposure Y-coordinate Meters:");
+ V_line(6, " Initial Camera Exposure Z-coordinate Meters:");
+ V_line(7, " Initial Camera Omega (roll) degrees:");
+ V_line(8, " Initial Camera Phi (pitch) degrees:");
+ V_line(9, " Initial Camera Kappa (yaw) degrees:");
+
+ V_line(11, " Apriori standard deviation X-coordinate Meters:");
+ V_line(12, " Apriori standard deviation Y-coordinate Meters:");
+ V_line(13, " Apriori standard deviation Z-coordinate Meters:");
+ V_line(14, " Apriori standard deviation Omega (roll) degrees:");
+ V_line(15, " Apriori standard deviation Phi (pitch) degrees:");
+ V_line(16, " Apriori standard deviation Kappa (yaw) degrees:");
+
+ V_line(18, " Use these values at run time? (1=yes, 0=no)");
+ V_line(19,
+ "+------------------------------------------------------------------------------+");
+
+ V_ques(&(init_info->XC_init), 'd', 4, 60, 15 - 1);
+ V_ques(&(init_info->YC_init), 'd', 5, 60, 15 - 1);
+ V_ques(&(init_info->ZC_init), 'd', 6, 60, 15 - 1);
+
+ V_ques(&omega_deg, 'd', 7, 60, 15 - 1);
+ V_ques(&phi_deg, 'd', 8, 60, 15 - 1);
+ V_ques(&kappa_deg, 'd', 9, 60, 15 - 1);
+
+ V_ques(&(init_info->XC_var), 'd', 11, 60, 15 - 1);
+ V_ques(&(init_info->YC_var), 'd', 12, 60, 15 - 1);
+ V_ques(&(init_info->ZC_var), 'd', 13, 60, 15 - 1);
+
+ V_ques(&omega_var, 'd', 14, 60, 15 - 1);
+ V_ques(&phi_var, 'd', 15, 60, 15 - 1);
+ V_ques(&kappa_var, 'd', 16, 60, 15 - 1);
+ V_ques(&(init_info->status), 'i', 18, 60, 2);
+
+ V_intrpt_ok();
+ if (!V_call()) {
+ exit(0);
+ }
+
+ /* convert back to radians */
+ init_info->omega_init = omega_deg * DEG_TO_RADS;
+ init_info->phi_init = phi_deg * DEG_TO_RADS;
+ init_info->kappa_init = kappa_deg * DEG_TO_RADS;
+
+ init_info->omega_var = omega_var * DEG_TO_RADS;
+ init_info->phi_var = phi_var * DEG_TO_RADS;
+ init_info->kappa_var = kappa_var * DEG_TO_RADS;
+
+ return 0;
+}
Property changes on: grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.rectify
___________________________________________________________________
Added: svn:ignore
+ *.tmp.html
*OBJ*
Deleted: grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.rectify/Makefile
===================================================================
--- grass/branches/develbranch_6/imagery/i.ortho.photo/i.photo.rectify/Makefile 2010-12-01 09:34:37 UTC (rev 44501)
+++ grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.rectify/Makefile 2010-12-22 10:05:10 UTC (rev 44654)
@@ -1,18 +0,0 @@
-MODULE_TOPDIR = ../../..
-
-PGM = i.photo.rectify
-
-# for DEBUG3 see README!
-#EXTRA_CFLAGS = -I../libes -DDEBUG3
-EXTRA_CFLAGS = -I../libes
-
-LIBES = $(IMAGERYLIB) $(GISLIB) $(IORTHOLIB) $(VASKLIB) $(CURSES) $(GMATHLIB)
-DEPENDENCIES= $(IMAGERYDEP) $(IORTHODEP) $(GISDEP) $(VASKDEP) $(GMATHDEP)
-
-include $(MODULE_TOPDIR)/include/Make/Module.make
-
-default: etc
-
-$(PGM).tmp.html: description.html
- $(INSTALL_DATA) $< $@
-
Copied: grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.rectify/Makefile (from rev 44501, grass/branches/develbranch_6/imagery/i.ortho.photo/i.photo.rectify/Makefile)
===================================================================
--- grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.rectify/Makefile (rev 0)
+++ grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.rectify/Makefile 2010-12-22 10:05:10 UTC (rev 44654)
@@ -0,0 +1,18 @@
+MODULE_TOPDIR = ../../..
+
+PGM = i.photo.rectify
+
+# for DEBUG3 see README!
+#EXTRA_CFLAGS = -I../libes -DDEBUG3
+EXTRA_CFLAGS = -I../libes
+
+LIBES = $(IMAGERYLIB) $(GISLIB) $(IORTHOLIB) $(VASKLIB) $(CURSES) $(GMATHLIB)
+DEPENDENCIES= $(IMAGERYDEP) $(IORTHODEP) $(GISDEP) $(VASKDEP) $(GMATHDEP)
+
+include $(MODULE_TOPDIR)/include/Make/Module.make
+
+default: etc
+
+$(PGM).tmp.html: description.html
+ $(INSTALL_DATA) $< $@
+
Deleted: grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.rectify/README
===================================================================
--- grass/branches/develbranch_6/imagery/i.ortho.photo/i.photo.rectify/README 2010-12-01 09:34:37 UTC (rev 44501)
+++ grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.rectify/README 2010-12-22 10:05:10 UTC (rev 44654)
@@ -1,17 +0,0 @@
-1/2002: Markus Neteler
-
- - have updated write routines to GRASS 5 functions (taken from i.rectify2)
- - have changed elev reading from CELL to raster_type to support
- also FP elevations
-
-
-Bugs:
- - somewhere the map_type is undefined in an underlying function (can't
- identify), so I added G_suppress_warnings(1) at top of rectify.c
- -> the module works well
-
- - when DEBUG3 is activated, the module silently stops in exec.c at
- select_current_env() (line 87). Why???
- However, not a real bug. Seems to be a problem of exit status or
- whatever.
-
Copied: grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.rectify/README (from rev 44501, grass/branches/develbranch_6/imagery/i.ortho.photo/i.photo.rectify/README)
===================================================================
--- grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.rectify/README (rev 0)
+++ grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.rectify/README 2010-12-22 10:05:10 UTC (rev 44654)
@@ -0,0 +1,17 @@
+1/2002: Markus Neteler
+
+ - have updated write routines to GRASS 5 functions (taken from i.rectify2)
+ - have changed elev reading from CELL to raster_type to support
+ also FP elevations
+
+
+Bugs:
+ - somewhere the map_type is undefined in an underlying function (can't
+ identify), so I added G_suppress_warnings(1) at top of rectify.c
+ -> the module works well
+
+ - when DEBUG3 is activated, the module silently stops in exec.c at
+ select_current_env() (line 87). Why???
+ However, not a real bug. Seems to be a problem of exit status or
+ whatever.
+
Deleted: grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.rectify/ask_files.c
===================================================================
--- grass/branches/develbranch_6/imagery/i.ortho.photo/i.photo.rectify/ask_files.c 2010-12-01 09:34:37 UTC (rev 44501)
+++ grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.rectify/ask_files.c 2010-12-22 10:05:10 UTC (rev 44654)
@@ -1,109 +0,0 @@
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-#include <grass/glocale.h>
-#include "global.h"
-#include <grass/vask.h>
-
-#define NFILES 15
-
-int ask_files(char *groupname)
-{
- char result[NFILES][15];
- int repeat;
- int do_all;
- int i, k, f1;
- int *r;
- char **nm;
-
- r = ref_list;
- nm = new_name;
-
- repeat = 0;
-
- /* name extension for rectified maps */
- extension = (char *)G_malloc(GNAME_MAX * sizeof(char));
- sprintf(extension, ".ortho");
-
- repeat = 1;
- while (repeat) {
- repeat = 0;
- V_clear();
- V_line(1, _("Enter an extension to be appended to rectified maps:"));
- V_ques(extension, 's', 3, 0, 20);
- V_intrpt_ok();
- if (!V_call())
- exit(0);
-
- /* test for legal file name */
- sprintf(result[0], "%s%s", group.group_ref.file[0].name, extension);
- if (G_legal_filename(result[0]) < 0) {
- G_clear_screen();
- fprintf(stderr, _("Extension <%s> is illegal"), extension);
- repeat = G_yes(_("\nChoose another extension? "), 1);
- if (!repeat) {
- fprintf(stderr,_("Orthorectification cancelled."));
- exit(0);
- }
- }
- }
-
- G_debug(1, "Extension: %s", extension);
-
- /* rectify all files ? */
- do_all = 1;
- G_clear_screen();
- do_all = G_yes(_("\nRectify all files in the group? "), do_all);
-
- /* create list of files to be rectified */
- f1 = 0;
- for (i = 0; i < group.group_ref.nfiles && i < NFILES; i++) {
- int ok = 1;
- char buf[100];
-
- if (!do_all) {
- sprintf(buf, _("\nRectify image <%s>? "), group.group_ref.file[i].name);
- ok = G_yes(buf, ok);
- }
- if (ok) {
- sprintf(result[i], "%s%s", group.group_ref.file[i].name, extension);
- *r++ = f1++;
- *nm++ = G_store(result[i]);
- }
- }
- for (i = f1; i < NFILES; i++) {
- result[i][0] = 0;
- }
-
- /* check if raster exists in target location/mapset */
- select_target_env();
- repeat = 0;
- G_clear_screen();
- for (i = 0; i < NFILES; i++) {
- if (result[i][0] && G_find_cell(result[i], G_mapset())) {
- if (!repeat++) {
- repeat = 1;
- fprintf(stderr, "\n");
- fprintf(stderr,
- "** The following raster maps already exist in\n");
- fprintf(stderr, "** LOCATION %s, MAPSET %s:\n\n",
- G_location(), G_mapset());
- }
- fprintf(stderr, "%-18s\n", result[i]);
- }
- }
- select_current_env();
- if (repeat) {
- if (!G_yes("\n\nOk to overwrite? ", 0)) {
- fprintf(stderr,_("Orthorectification cancelled."));
- exit(0);
- }
- }
-
- for (k = 0; k < group.group_ref.nfiles; k++)
- if (ref_list[k] >= 0)
- return 1;
- fprintf(stderr, "No files selected! Bye\n");
- G_sleep(3);
- exit(0);
-}
Copied: grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.rectify/ask_files.c (from rev 44501, grass/branches/develbranch_6/imagery/i.ortho.photo/i.photo.rectify/ask_files.c)
===================================================================
--- grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.rectify/ask_files.c (rev 0)
+++ grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.rectify/ask_files.c 2010-12-22 10:05:10 UTC (rev 44654)
@@ -0,0 +1,109 @@
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+#include <grass/glocale.h>
+#include "global.h"
+#include <grass/vask.h>
+
+#define NFILES 15
+
+int ask_files(char *groupname)
+{
+ char result[NFILES][15];
+ int repeat;
+ int do_all;
+ int i, k, f1;
+ int *r;
+ char **nm;
+
+ r = ref_list;
+ nm = new_name;
+
+ repeat = 0;
+
+ /* name extension for rectified maps */
+ extension = (char *)G_malloc(GNAME_MAX * sizeof(char));
+ sprintf(extension, ".ortho");
+
+ repeat = 1;
+ while (repeat) {
+ repeat = 0;
+ V_clear();
+ V_line(1, _("Enter an extension to be appended to rectified maps:"));
+ V_ques(extension, 's', 3, 0, 20);
+ V_intrpt_ok();
+ if (!V_call())
+ exit(0);
+
+ /* test for legal file name */
+ sprintf(result[0], "%s%s", group.group_ref.file[0].name, extension);
+ if (G_legal_filename(result[0]) < 0) {
+ G_clear_screen();
+ fprintf(stderr, _("Extension <%s> is illegal"), extension);
+ repeat = G_yes(_("\nChoose another extension? "), 1);
+ if (!repeat) {
+ fprintf(stderr,_("Orthorectification cancelled."));
+ exit(0);
+ }
+ }
+ }
+
+ G_debug(1, "Extension: %s", extension);
+
+ /* rectify all files ? */
+ do_all = 1;
+ G_clear_screen();
+ do_all = G_yes(_("\nRectify all files in the group? "), do_all);
+
+ /* create list of files to be rectified */
+ f1 = 0;
+ for (i = 0; i < group.group_ref.nfiles && i < NFILES; i++) {
+ int ok = 1;
+ char buf[100];
+
+ if (!do_all) {
+ sprintf(buf, _("\nRectify image <%s>? "), group.group_ref.file[i].name);
+ ok = G_yes(buf, ok);
+ }
+ if (ok) {
+ sprintf(result[i], "%s%s", group.group_ref.file[i].name, extension);
+ *r++ = f1++;
+ *nm++ = G_store(result[i]);
+ }
+ }
+ for (i = f1; i < NFILES; i++) {
+ result[i][0] = 0;
+ }
+
+ /* check if raster exists in target location/mapset */
+ select_target_env();
+ repeat = 0;
+ G_clear_screen();
+ for (i = 0; i < NFILES; i++) {
+ if (result[i][0] && G_find_cell(result[i], G_mapset())) {
+ if (!repeat++) {
+ repeat = 1;
+ fprintf(stderr, "\n");
+ fprintf(stderr,
+ "** The following raster maps already exist in\n");
+ fprintf(stderr, "** LOCATION %s, MAPSET %s:\n\n",
+ G_location(), G_mapset());
+ }
+ fprintf(stderr, "%-18s\n", result[i]);
+ }
+ }
+ select_current_env();
+ if (repeat) {
+ if (!G_yes("\n\nOk to overwrite? ", 0)) {
+ fprintf(stderr,_("Orthorectification cancelled."));
+ exit(0);
+ }
+ }
+
+ for (k = 0; k < group.group_ref.nfiles; k++)
+ if (ref_list[k] >= 0)
+ return 1;
+ fprintf(stderr, "No files selected! Bye\n");
+ G_sleep(3);
+ exit(0);
+}
Deleted: grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.rectify/ask_method.c
===================================================================
--- grass/branches/develbranch_6/imagery/i.ortho.photo/i.photo.rectify/ask_method.c 2010-12-01 09:34:37 UTC (rev 44501)
+++ grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.rectify/ask_method.c 2010-12-22 10:05:10 UTC (rev 44654)
@@ -1,109 +0,0 @@
-#include <stdlib.h>
-#include <string.h>
-#include "global.h"
-
-int ask_method(void)
-{
- int f1, f2, count, max_rows, max_cols;
- int nx, ny;
- struct Cell_head win;
- double max_mb_img, max_mb_elev, max_mb;
-
- fprintf(stderr, "\n\n");
- while (1) {
- char buf[100];
-
- G_clear_screen();
- fprintf(stderr, _("Please select one of the following interpolation methods\n"));
- fprintf(stderr, _(" 1. nearest neighbor\n"));
- fprintf(stderr, _(" 2. bilinear\n"));
- fprintf(stderr, _(" 3. bicubic\n"));
- fprintf(stderr, _(" 4. bilinear with fallback\n"));
- fprintf(stderr, _(" 5. bicubic with fallback\n"));
- fprintf(stderr, "> ");
- if (!G_gets(buf))
- continue;
- G_strip(buf);
-
- if (strcmp(buf, "1") == 0) {
- interpolate = p_nearest;
- method = "nearest";
- break;
- }
- if (strcmp(buf, "2") == 0) {
- interpolate = p_bilinear;
- method = "bilinear";
- break;
- }
- if (strcmp(buf, "3") == 0) {
- interpolate = p_cubic;
- method = "bicubic";
- break;
- }
- if (strcmp(buf, "4") == 0) {
- interpolate = p_bilinear_f;
- method = "bilinear_f";
- break;
- }
- if (strcmp(buf, "5") == 0) {
- interpolate = p_cubic_f;
- method = "bicubic_f";
- break;
- }
- }
-
- count = max_rows = max_cols = 0;
- for (f1 = 0; f1 < group.group_ref.nfiles; f1++) {
- if (ref_list[f1] >= 0) {
- f2 = ref_list[f1];
- G_get_cellhd(group.group_ref.file[f2].name,
- group.group_ref.file[f2].mapset, &win);
- if (max_rows < win.rows)
- max_rows = win.rows;
- if (max_cols < win.cols)
- max_cols = win.cols;
- }
- }
-
- ny = (max_rows + BDIM - 1) / BDIM;
- nx = (max_cols + BDIM - 1) / BDIM;
-
- max_mb_img = ((double)nx * ny * sizeof(block)) / (1<<20);
-
- ny = (target_window.rows + BDIM - 1) / BDIM;
- nx = (target_window.cols + BDIM - 1) / BDIM;
-
- max_mb_elev = ((double)nx * ny * sizeof(block)) / (1<<20);
- max_mb = max_mb_img + max_mb_elev + 0.5; /* + 0.5 for rounding */
- if (max_mb < 1)
- max_mb = 1;
-
- fprintf(stderr, "\n\n");
- while (1) {
- char buf[100];
- int seg_mb;
-
- fprintf(stderr, _("Amount of memory to use in MB\n"));
- fprintf(stderr, _("RETURN use %d MB to keep all data in RAM\n"), (int)(max_mb));
- fprintf(stderr, "> ");
- if (!G_gets(buf))
- continue;
-
- if (*buf == 0) { /* all in memory */
- seg_mb_elev = max_mb_elev;
- seg_mb_img = max_mb_img;
- break;
- }
-
- G_strip(buf);
- if ((seg_mb = atoi(buf)) > 0) {
- seg_mb_elev = seg_mb * max_mb_elev / (max_mb_img + max_mb_elev);
- seg_mb_img = seg_mb * max_mb_img / (max_mb_img + max_mb_elev);
- break;
- }
- }
-
- fprintf(stderr, "\n\n");
-
- return 0;
-}
Copied: grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.rectify/ask_method.c (from rev 44501, grass/branches/develbranch_6/imagery/i.ortho.photo/i.photo.rectify/ask_method.c)
===================================================================
--- grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.rectify/ask_method.c (rev 0)
+++ grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.rectify/ask_method.c 2010-12-22 10:05:10 UTC (rev 44654)
@@ -0,0 +1,109 @@
+#include <stdlib.h>
+#include <string.h>
+#include "global.h"
+
+int ask_method(void)
+{
+ int f1, f2, count, max_rows, max_cols;
+ int nx, ny;
+ struct Cell_head win;
+ double max_mb_img, max_mb_elev, max_mb;
+
+ fprintf(stderr, "\n\n");
+ while (1) {
+ char buf[100];
+
+ G_clear_screen();
+ fprintf(stderr, _("Please select one of the following interpolation methods\n"));
+ fprintf(stderr, _(" 1. nearest neighbor\n"));
+ fprintf(stderr, _(" 2. bilinear\n"));
+ fprintf(stderr, _(" 3. bicubic\n"));
+ fprintf(stderr, _(" 4. bilinear with fallback\n"));
+ fprintf(stderr, _(" 5. bicubic with fallback\n"));
+ fprintf(stderr, "> ");
+ if (!G_gets(buf))
+ continue;
+ G_strip(buf);
+
+ if (strcmp(buf, "1") == 0) {
+ interpolate = p_nearest;
+ method = "nearest";
+ break;
+ }
+ if (strcmp(buf, "2") == 0) {
+ interpolate = p_bilinear;
+ method = "bilinear";
+ break;
+ }
+ if (strcmp(buf, "3") == 0) {
+ interpolate = p_cubic;
+ method = "bicubic";
+ break;
+ }
+ if (strcmp(buf, "4") == 0) {
+ interpolate = p_bilinear_f;
+ method = "bilinear_f";
+ break;
+ }
+ if (strcmp(buf, "5") == 0) {
+ interpolate = p_cubic_f;
+ method = "bicubic_f";
+ break;
+ }
+ }
+
+ count = max_rows = max_cols = 0;
+ for (f1 = 0; f1 < group.group_ref.nfiles; f1++) {
+ if (ref_list[f1] >= 0) {
+ f2 = ref_list[f1];
+ G_get_cellhd(group.group_ref.file[f2].name,
+ group.group_ref.file[f2].mapset, &win);
+ if (max_rows < win.rows)
+ max_rows = win.rows;
+ if (max_cols < win.cols)
+ max_cols = win.cols;
+ }
+ }
+
+ ny = (max_rows + BDIM - 1) / BDIM;
+ nx = (max_cols + BDIM - 1) / BDIM;
+
+ max_mb_img = ((double)nx * ny * sizeof(block)) / (1<<20);
+
+ ny = (target_window.rows + BDIM - 1) / BDIM;
+ nx = (target_window.cols + BDIM - 1) / BDIM;
+
+ max_mb_elev = ((double)nx * ny * sizeof(block)) / (1<<20);
+ max_mb = max_mb_img + max_mb_elev + 0.5; /* + 0.5 for rounding */
+ if (max_mb < 1)
+ max_mb = 1;
+
+ fprintf(stderr, "\n\n");
+ while (1) {
+ char buf[100];
+ int seg_mb;
+
+ fprintf(stderr, _("Amount of memory to use in MB\n"));
+ fprintf(stderr, _("RETURN use %d MB to keep all data in RAM\n"), (int)(max_mb));
+ fprintf(stderr, "> ");
+ if (!G_gets(buf))
+ continue;
+
+ if (*buf == 0) { /* all in memory */
+ seg_mb_elev = max_mb_elev;
+ seg_mb_img = max_mb_img;
+ break;
+ }
+
+ G_strip(buf);
+ if ((seg_mb = atoi(buf)) > 0) {
+ seg_mb_elev = seg_mb * max_mb_elev / (max_mb_img + max_mb_elev);
+ seg_mb_img = seg_mb * max_mb_img / (max_mb_img + max_mb_elev);
+ break;
+ }
+ }
+
+ fprintf(stderr, "\n\n");
+
+ return 0;
+}
Deleted: grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.rectify/aver_z.c
===================================================================
--- grass/branches/develbranch_6/imagery/i.ortho.photo/i.photo.rectify/aver_z.c 2010-12-01 09:34:37 UTC (rev 44501)
+++ grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.rectify/aver_z.c 2010-12-22 10:05:10 UTC (rev 44654)
@@ -1,31 +0,0 @@
-#include "global.h"
-
-int get_aver_elev(struct Ortho_Control_Points *cpz, double *aver_z)
-{
- double meanz;
- double *cp = cpz->z2;
- int i, n;
-
- /* Need 1 control points */
- if (cpz->count <= 0) {
- return (-1);
- }
-
- /* set average elevation from mean values of CONZ points */
- meanz = 0;
- n = 0;
- for (i = 0; i < cpz->count; i++) {
- if (cpz->status[i] <= 0)
- continue;
-
- n++;
- meanz += *(cp++);
- G_debug(3, "In ortho meanz = %f", meanz);
- }
-
- *aver_z = meanz / n;
-
- G_debug(1, "In ortho aver_z = %f", *aver_z);
-
- return 0;
-}
Copied: grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.rectify/aver_z.c (from rev 44501, grass/branches/develbranch_6/imagery/i.ortho.photo/i.photo.rectify/aver_z.c)
===================================================================
--- grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.rectify/aver_z.c (rev 0)
+++ grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.rectify/aver_z.c 2010-12-22 10:05:10 UTC (rev 44654)
@@ -0,0 +1,31 @@
+#include "global.h"
+
+int get_aver_elev(struct Ortho_Control_Points *cpz, double *aver_z)
+{
+ double meanz;
+ double *cp = cpz->z2;
+ int i, n;
+
+ /* Need 1 control points */
+ if (cpz->count <= 0) {
+ return (-1);
+ }
+
+ /* set average elevation from mean values of CONZ points */
+ meanz = 0;
+ n = 0;
+ for (i = 0; i < cpz->count; i++) {
+ if (cpz->status[i] <= 0)
+ continue;
+
+ n++;
+ meanz += *(cp++);
+ G_debug(3, "In ortho meanz = %f", meanz);
+ }
+
+ *aver_z = meanz / n;
+
+ G_debug(1, "In ortho aver_z = %f", *aver_z);
+
+ return 0;
+}
Deleted: grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.rectify/bilinear.c
===================================================================
--- grass/branches/develbranch_6/imagery/i.ortho.photo/i.photo.rectify/bilinear.c 2010-12-01 09:34:37 UTC (rev 44501)
+++ grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.rectify/bilinear.c 2010-12-22 10:05:10 UTC (rev 44654)
@@ -1,59 +0,0 @@
-/*
- * Name
- * bilinear.c -- use bilinear interpolation for given row, col
- *
- * Description
- * bilinear interpolation for the given row, column indices.
- * If the given row or column is outside the bounds of the input map,
- * the point in the output map is set to NULL.
- * If any of the 4 surrounding points to be used in the interpolation
- * is NULL it is filled with is neighbor value
- */
-
-#include <math.h>
-#include <grass/gis.h>
-#include "global.h"
-
-void p_bilinear(struct cache *ibuffer, /* input buffer */
- void *obufptr, /* ptr in output buffer */
- int cell_type, /* raster map type of obufptr */
- double *row_idx, /* row index */
- double *col_idx, /* column index */
- struct Cell_head *cellhd /* information of output map */
- )
-{
- int row; /* row indices for interp */
- int col; /* column indices for interp */
- int i, j;
- DCELL t, u; /* intermediate slope */
- DCELL result; /* result of interpolation */
- DCELL c[2][2];
-
- /* cut indices to integer */
- row = (int)floor(*row_idx - 0.5);
- col = (int)floor(*col_idx - 0.5);
-
- /* check for out of bounds - if out of bounds set NULL value and return */
- if (row < 0 || row + 1 >= cellhd->rows || col < 0 || col + 1 >= cellhd->cols) {
- G_set_null_value(obufptr, 1, cell_type);
- return;
- }
-
- for (i = 0; i < 2; i++)
- for (j = 0; j < 2; j++) {
- const DCELL *cellp = CPTR(ibuffer, row + i, col + j);
- if (G_is_d_null_value(cellp)) {
- G_set_null_value(obufptr, 1, cell_type);
- return;
- }
- c[i][j] = *cellp;
- }
-
- /* do the interpolation */
- t = *col_idx - 0.5 - col;
- u = *row_idx - 0.5 - row;
-
- result = G_interp_bilinear(t, u, c[0][0], c[0][1], c[1][0], c[1][1]);
-
- G_set_raster_value_d(obufptr, result, cell_type);
-}
Copied: grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.rectify/bilinear.c (from rev 44501, grass/branches/develbranch_6/imagery/i.ortho.photo/i.photo.rectify/bilinear.c)
===================================================================
--- grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.rectify/bilinear.c (rev 0)
+++ grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.rectify/bilinear.c 2010-12-22 10:05:10 UTC (rev 44654)
@@ -0,0 +1,59 @@
+/*
+ * Name
+ * bilinear.c -- use bilinear interpolation for given row, col
+ *
+ * Description
+ * bilinear interpolation for the given row, column indices.
+ * If the given row or column is outside the bounds of the input map,
+ * the point in the output map is set to NULL.
+ * If any of the 4 surrounding points to be used in the interpolation
+ * is NULL it is filled with is neighbor value
+ */
+
+#include <math.h>
+#include <grass/gis.h>
+#include "global.h"
+
+void p_bilinear(struct cache *ibuffer, /* input buffer */
+ void *obufptr, /* ptr in output buffer */
+ int cell_type, /* raster map type of obufptr */
+ double *row_idx, /* row index */
+ double *col_idx, /* column index */
+ struct Cell_head *cellhd /* information of output map */
+ )
+{
+ int row; /* row indices for interp */
+ int col; /* column indices for interp */
+ int i, j;
+ DCELL t, u; /* intermediate slope */
+ DCELL result; /* result of interpolation */
+ DCELL c[2][2];
+
+ /* cut indices to integer */
+ row = (int)floor(*row_idx - 0.5);
+ col = (int)floor(*col_idx - 0.5);
+
+ /* check for out of bounds - if out of bounds set NULL value and return */
+ if (row < 0 || row + 1 >= cellhd->rows || col < 0 || col + 1 >= cellhd->cols) {
+ G_set_null_value(obufptr, 1, cell_type);
+ return;
+ }
+
+ for (i = 0; i < 2; i++)
+ for (j = 0; j < 2; j++) {
+ const DCELL *cellp = CPTR(ibuffer, row + i, col + j);
+ if (G_is_d_null_value(cellp)) {
+ G_set_null_value(obufptr, 1, cell_type);
+ return;
+ }
+ c[i][j] = *cellp;
+ }
+
+ /* do the interpolation */
+ t = *col_idx - 0.5 - col;
+ u = *row_idx - 0.5 - row;
+
+ result = G_interp_bilinear(t, u, c[0][0], c[0][1], c[1][0], c[1][1]);
+
+ G_set_raster_value_d(obufptr, result, cell_type);
+}
Deleted: grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.rectify/bilinear_f.c
===================================================================
--- grass/branches/develbranch_6/imagery/i.ortho.photo/i.photo.rectify/bilinear_f.c 2010-12-01 09:34:37 UTC (rev 44501)
+++ grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.rectify/bilinear_f.c 2010-12-22 10:05:10 UTC (rev 44654)
@@ -1,49 +0,0 @@
-/*
- * Name
- * bilinear_f.c -- use bilinear interpolation with fallback for given row, col
- *
- * Description
- * bilinear interpolation for the given row, column indices.
- * If the interpolated value (but not the nearest) is null,
- * it falls back to nearest neighbor.
- */
-
-#include <grass/gis.h>
-#include <math.h>
-#include "global.h"
-
-void p_bilinear_f(struct cache *ibuffer, /* input buffer */
- void *obufptr, /* ptr in output buffer */
- int cell_type, /* raster map type of obufptr */
- double *row_idx, /* row index */
- double *col_idx, /* column index */
- struct Cell_head *cellhd /* cell header of input layer */
- )
-{
- /* start nearest neighbor to do some basic tests */
- int row, col; /* row/col of nearest neighbor */
- DCELL *cellp, cell;
-
- /* cut indices to integer */
- row = (int)floor(*row_idx);
- col = (int)floor(*col_idx);
-
- /* check for out of bounds - if out of bounds set NULL value */
- if (row < 0 || row >= cellhd->rows || col < 0 || col >= cellhd->cols) {
- G_set_null_value(obufptr, 1, cell_type);
- return;
- }
-
- cellp = CPTR(ibuffer, row, col);
- /* if nearest is null, all the other interps will be null */
- if (G_is_d_null_value(cellp)) {
- G_set_null_value(obufptr, 1, cell_type);
- return;
- }
- cell = *cellp;
-
- p_bilinear(ibuffer, obufptr, cell_type, row_idx, col_idx, cellhd);
- /* fallback to nearest if bilinear is null */
- if (G_is_d_null_value(obufptr))
- G_set_raster_value_d(obufptr, cell, cell_type);
-}
Copied: grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.rectify/bilinear_f.c (from rev 44501, grass/branches/develbranch_6/imagery/i.ortho.photo/i.photo.rectify/bilinear_f.c)
===================================================================
--- grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.rectify/bilinear_f.c (rev 0)
+++ grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.rectify/bilinear_f.c 2010-12-22 10:05:10 UTC (rev 44654)
@@ -0,0 +1,49 @@
+/*
+ * Name
+ * bilinear_f.c -- use bilinear interpolation with fallback for given row, col
+ *
+ * Description
+ * bilinear interpolation for the given row, column indices.
+ * If the interpolated value (but not the nearest) is null,
+ * it falls back to nearest neighbor.
+ */
+
+#include <grass/gis.h>
+#include <math.h>
+#include "global.h"
+
+void p_bilinear_f(struct cache *ibuffer, /* input buffer */
+ void *obufptr, /* ptr in output buffer */
+ int cell_type, /* raster map type of obufptr */
+ double *row_idx, /* row index */
+ double *col_idx, /* column index */
+ struct Cell_head *cellhd /* cell header of input layer */
+ )
+{
+ /* start nearest neighbor to do some basic tests */
+ int row, col; /* row/col of nearest neighbor */
+ DCELL *cellp, cell;
+
+ /* cut indices to integer */
+ row = (int)floor(*row_idx);
+ col = (int)floor(*col_idx);
+
+ /* check for out of bounds - if out of bounds set NULL value */
+ if (row < 0 || row >= cellhd->rows || col < 0 || col >= cellhd->cols) {
+ G_set_null_value(obufptr, 1, cell_type);
+ return;
+ }
+
+ cellp = CPTR(ibuffer, row, col);
+ /* if nearest is null, all the other interps will be null */
+ if (G_is_d_null_value(cellp)) {
+ G_set_null_value(obufptr, 1, cell_type);
+ return;
+ }
+ cell = *cellp;
+
+ p_bilinear(ibuffer, obufptr, cell_type, row_idx, col_idx, cellhd);
+ /* fallback to nearest if bilinear is null */
+ if (G_is_d_null_value(obufptr))
+ G_set_raster_value_d(obufptr, cell, cell_type);
+}
Deleted: grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.rectify/compress.c
===================================================================
--- grass/branches/develbranch_6/imagery/i.ortho.photo/i.photo.rectify/compress.c 2010-12-01 09:34:37 UTC (rev 44501)
+++ grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.rectify/compress.c 2010-12-22 10:05:10 UTC (rev 44654)
@@ -1,9 +0,0 @@
-#include "global.h"
-
-int compress(char *name)
-{
- return 0;
- /*
- return 1;
- */
-}
Copied: grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.rectify/compress.c (from rev 44501, grass/branches/develbranch_6/imagery/i.ortho.photo/i.photo.rectify/compress.c)
===================================================================
--- grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.rectify/compress.c (rev 0)
+++ grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.rectify/compress.c 2010-12-22 10:05:10 UTC (rev 44654)
@@ -0,0 +1,9 @@
+#include "global.h"
+
+int compress(char *name)
+{
+ return 0;
+ /*
+ return 1;
+ */
+}
Deleted: grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.rectify/cp.c
===================================================================
--- grass/branches/develbranch_6/imagery/i.ortho.photo/i.photo.rectify/cp.c 2010-12-01 09:34:37 UTC (rev 44501)
+++ grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.rectify/cp.c 2010-12-22 10:05:10 UTC (rev 44654)
@@ -1,81 +0,0 @@
-#include <stdlib.h>
-#include <string.h>
-#include "global.h"
-
-int get_conz_points(void)
-{
- char msg[200];
-
- if (!I_get_con_points(group.name, &group.control_points))
- exit(0);
-
- /* compute photo coordinates of image control points */
- /* I_convert_con_points (group.name, &group.control_points, &group.photo_points, group.E12, group.N12); */
-
- sprintf(msg, _("Control Z Point file for group [%s] in [%s] \n \n"),
- group.name, G_mapset());
-
- G_verbose_message(_("Computing equations..."));
-
- Compute_ortho_equation();
-
- switch (group.con_equation_stat) {
- case -1:
- strcat(msg, _("Poorly placed Control Points!\n"));
- strcat(msg, _("Can not generate the transformation equation.\n"));
- strcat(msg, _("Run OPTION 7 again!\n"));
- break;
- case 0:
- strcat(msg, _("No active Control Points!\n"));
- strcat(msg, _("Can not generate the transformation equation.\n"));
- strcat(msg, _("Run OPTION 7 !\n"));
- break;
- default:
- return 1;
- }
- G_fatal_error(msg);
-}
-
-int get_ref_points(void)
-{
- char msg[200];
-
- /* struct Ref_Points cp; */
-
- if (!I_get_ref_points(group.name, &group.photo_points))
- exit(0);
-
- sprintf(msg, _("Reference Point file for group [%s] in [%s] \n \n"),
- group.name, G_mapset());
-
- Compute_ref_equation();
- switch (group.ref_equation_stat) {
- case -1:
- strcat(msg, _("Poorly placed Reference Points!\n"));
- strcat(msg, _("Can not generate the transformation equation.\n"));
- strcat(msg, _("Run OPTION 5 again!\n"));
- break;
-
- case 0:
- strcat(msg, _("No active Reference Points!\n"));
- strcat(msg, _("Can not generate the transformation equation.\n"));
- strcat(msg, _("Run OPTION 5!\n"));
- break;
- default:
- E12a = E12[0];
- E12b = E12[1];
- E12c = E12[2];
- N12a = N12[0];
- N12b = N12[1];
- N12c = N12[2];
- E21a = E21[0];
- E21b = E21[1];
- E21c = E21[2];
- N21a = N21[0];
- N21b = N21[1];
- N21c = N21[2];
- return 1;
- }
- G_fatal_error(msg);
- /* exit(1); shouldn't get here */
-}
Copied: grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.rectify/cp.c (from rev 44501, grass/branches/develbranch_6/imagery/i.ortho.photo/i.photo.rectify/cp.c)
===================================================================
--- grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.rectify/cp.c (rev 0)
+++ grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.rectify/cp.c 2010-12-22 10:05:10 UTC (rev 44654)
@@ -0,0 +1,81 @@
+#include <stdlib.h>
+#include <string.h>
+#include "global.h"
+
+int get_conz_points(void)
+{
+ char msg[200];
+
+ if (!I_get_con_points(group.name, &group.control_points))
+ exit(0);
+
+ /* compute photo coordinates of image control points */
+ /* I_convert_con_points (group.name, &group.control_points, &group.photo_points, group.E12, group.N12); */
+
+ sprintf(msg, _("Control Z Point file for group [%s] in [%s] \n \n"),
+ group.name, G_mapset());
+
+ G_verbose_message(_("Computing equations..."));
+
+ Compute_ortho_equation();
+
+ switch (group.con_equation_stat) {
+ case -1:
+ strcat(msg, _("Poorly placed Control Points!\n"));
+ strcat(msg, _("Can not generate the transformation equation.\n"));
+ strcat(msg, _("Run OPTION 7 again!\n"));
+ break;
+ case 0:
+ strcat(msg, _("No active Control Points!\n"));
+ strcat(msg, _("Can not generate the transformation equation.\n"));
+ strcat(msg, _("Run OPTION 7 !\n"));
+ break;
+ default:
+ return 1;
+ }
+ G_fatal_error(msg);
+}
+
+int get_ref_points(void)
+{
+ char msg[200];
+
+ /* struct Ref_Points cp; */
+
+ if (!I_get_ref_points(group.name, &group.photo_points))
+ exit(0);
+
+ sprintf(msg, _("Reference Point file for group [%s] in [%s] \n \n"),
+ group.name, G_mapset());
+
+ Compute_ref_equation();
+ switch (group.ref_equation_stat) {
+ case -1:
+ strcat(msg, _("Poorly placed Reference Points!\n"));
+ strcat(msg, _("Can not generate the transformation equation.\n"));
+ strcat(msg, _("Run OPTION 5 again!\n"));
+ break;
+
+ case 0:
+ strcat(msg, _("No active Reference Points!\n"));
+ strcat(msg, _("Can not generate the transformation equation.\n"));
+ strcat(msg, _("Run OPTION 5!\n"));
+ break;
+ default:
+ E12a = E12[0];
+ E12b = E12[1];
+ E12c = E12[2];
+ N12a = N12[0];
+ N12b = N12[1];
+ N12c = N12[2];
+ E21a = E21[0];
+ E21b = E21[1];
+ E21c = E21[2];
+ N21a = N21[0];
+ N21b = N21[1];
+ N21c = N21[2];
+ return 1;
+ }
+ G_fatal_error(msg);
+ /* exit(1); shouldn't get here */
+}
Deleted: grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.rectify/cubic.c
===================================================================
--- grass/branches/develbranch_6/imagery/i.ortho.photo/i.photo.rectify/cubic.c 2010-12-01 09:34:37 UTC (rev 44501)
+++ grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.rectify/cubic.c 2010-12-22 10:05:10 UTC (rev 44654)
@@ -1,67 +0,0 @@
-/*
- * Name
- * cubic.c -- use cubic convolution interpolation for given row, col
- *
- * Description
- * cubic returns the value in the buffer that is the result of cubic
- * convolution interpolation for the given row, column indices.
- * If the given row or column is outside the bounds of the input map,
- * the corresponding point in the output map is set to NULL.
- *
- * If single surrounding points in the interpolation matrix are
- * NULL they where filled with their neighbor
- */
-
-#include <grass/gis.h>
-#include <math.h>
-#include "global.h"
-
-void p_cubic(struct cache *ibuffer, /* input buffer */
- void *obufptr, /* ptr in output buffer */
- int cell_type, /* raster map type of obufptr */
- double *row_idx, /* row index (decimal) */
- double *col_idx, /* column index (decimal) */
- struct Cell_head *cellhd /* information of output map */
- )
-{
- int row; /* row indices for interp */
- int col; /* column indices for interp */
- int i, j;
- DCELL t, u; /* intermediate slope */
- DCELL result; /* result of interpolation */
- DCELL val[4]; /* buffer for temporary values */
- DCELL cell[4][4];
-
- /* cut indices to integer */
- row = (int)floor(*row_idx - 0.5);
- col = (int)floor(*col_idx - 0.5);
-
- /* check for out of bounds of map - if out of bounds set NULL value */
- if (row - 1 < 0 || row + 2 >= cellhd->rows ||
- col - 1 < 0 || col + 2 >= cellhd->cols) {
- G_set_null_value(obufptr, 1, cell_type);
- return;
- }
-
- for (i = 0; i < 4; i++)
- for (j = 0; j < 4; j++) {
- const DCELL *cellp = CPTR(ibuffer, row - 1 + i, col - 1 + j);
- if (G_is_d_null_value(cellp)) {
- G_set_null_value(obufptr, 1, cell_type);
- return;
- }
- cell[i][j] = *cellp;
- }
-
- /* do the interpolation */
- t = *col_idx - 0.5 - col;
- u = *row_idx - 0.5 - row;
-
- for (i = 0; i < 4; i++) {
- val[i] = G_interp_cubic(t, cell[i][0], cell[i][1], cell[i][2], cell[i][3]);
- }
-
- result = G_interp_cubic(u, val[0], val[1], val[2], val[3]);
-
- G_set_raster_value_d(obufptr, result, cell_type);
-}
Copied: grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.rectify/cubic.c (from rev 44501, grass/branches/develbranch_6/imagery/i.ortho.photo/i.photo.rectify/cubic.c)
===================================================================
--- grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.rectify/cubic.c (rev 0)
+++ grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.rectify/cubic.c 2010-12-22 10:05:10 UTC (rev 44654)
@@ -0,0 +1,67 @@
+/*
+ * Name
+ * cubic.c -- use cubic convolution interpolation for given row, col
+ *
+ * Description
+ * cubic returns the value in the buffer that is the result of cubic
+ * convolution interpolation for the given row, column indices.
+ * If the given row or column is outside the bounds of the input map,
+ * the corresponding point in the output map is set to NULL.
+ *
+ * If single surrounding points in the interpolation matrix are
+ * NULL they where filled with their neighbor
+ */
+
+#include <grass/gis.h>
+#include <math.h>
+#include "global.h"
+
+void p_cubic(struct cache *ibuffer, /* input buffer */
+ void *obufptr, /* ptr in output buffer */
+ int cell_type, /* raster map type of obufptr */
+ double *row_idx, /* row index (decimal) */
+ double *col_idx, /* column index (decimal) */
+ struct Cell_head *cellhd /* information of output map */
+ )
+{
+ int row; /* row indices for interp */
+ int col; /* column indices for interp */
+ int i, j;
+ DCELL t, u; /* intermediate slope */
+ DCELL result; /* result of interpolation */
+ DCELL val[4]; /* buffer for temporary values */
+ DCELL cell[4][4];
+
+ /* cut indices to integer */
+ row = (int)floor(*row_idx - 0.5);
+ col = (int)floor(*col_idx - 0.5);
+
+ /* check for out of bounds of map - if out of bounds set NULL value */
+ if (row - 1 < 0 || row + 2 >= cellhd->rows ||
+ col - 1 < 0 || col + 2 >= cellhd->cols) {
+ G_set_null_value(obufptr, 1, cell_type);
+ return;
+ }
+
+ for (i = 0; i < 4; i++)
+ for (j = 0; j < 4; j++) {
+ const DCELL *cellp = CPTR(ibuffer, row - 1 + i, col - 1 + j);
+ if (G_is_d_null_value(cellp)) {
+ G_set_null_value(obufptr, 1, cell_type);
+ return;
+ }
+ cell[i][j] = *cellp;
+ }
+
+ /* do the interpolation */
+ t = *col_idx - 0.5 - col;
+ u = *row_idx - 0.5 - row;
+
+ for (i = 0; i < 4; i++) {
+ val[i] = G_interp_cubic(t, cell[i][0], cell[i][1], cell[i][2], cell[i][3]);
+ }
+
+ result = G_interp_cubic(u, val[0], val[1], val[2], val[3]);
+
+ G_set_raster_value_d(obufptr, result, cell_type);
+}
Deleted: grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.rectify/cubic_f.c
===================================================================
--- grass/branches/develbranch_6/imagery/i.ortho.photo/i.photo.rectify/cubic_f.c 2010-12-01 09:34:37 UTC (rev 44501)
+++ grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.rectify/cubic_f.c 2010-12-22 10:05:10 UTC (rev 44654)
@@ -1,54 +0,0 @@
-/*
- * Name
- * cubic_f.c -- use cubic interpolation with fallback for given row, col
- *
- * Description
- * cubic interpolation for the given row, column indices.
- * If the interpolated value (but not the nearest) is null,
- * it falls back to bilinear. If that interp value is null,
- * it falls back to nearest neighbor.
- */
-
-#include <grass/gis.h>
-#include <math.h>
-#include "global.h"
-
-void p_cubic_f(struct cache *ibuffer, /* input buffer */
- void *obufptr, /* ptr in output buffer */
- int cell_type, /* raster map type of obufptr */
- double *row_idx, /* row index */
- double *col_idx, /* column index */
- struct Cell_head *cellhd /* cell header of input layer */
- )
-{
- /* start nearest neighbor to do some basic tests */
- int row, col; /* row/col of nearest neighbor */
- DCELL *cellp, cell;
-
- /* cut indices to integer */
- row = (int)floor(*row_idx);
- col = (int)floor(*col_idx);
-
- /* check for out of bounds - if out of bounds set NULL value */
- if (row < 0 || row >= cellhd->rows || col < 0 || col >= cellhd->cols) {
- G_set_null_value(obufptr, 1, cell_type);
- return;
- }
-
- cellp = CPTR(ibuffer, row, col);
- /* if nearest is null, all the other interps will be null */
- if (G_is_d_null_value(cellp)) {
- G_set_null_value(obufptr, 1, cell_type);
- return;
- }
- cell = *cellp;
-
- p_cubic(ibuffer, obufptr, cell_type, row_idx, col_idx, cellhd);
- /* fallback to bilinear if cubic is null */
- if (G_is_d_null_value(obufptr)) {
- p_bilinear(ibuffer, obufptr, cell_type, row_idx, col_idx, cellhd);
- /* fallback to nearest if bilinear is null */
- if (G_is_d_null_value(obufptr))
- G_set_raster_value_d(obufptr, cell, cell_type);
- }
-}
Copied: grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.rectify/cubic_f.c (from rev 44501, grass/branches/develbranch_6/imagery/i.ortho.photo/i.photo.rectify/cubic_f.c)
===================================================================
--- grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.rectify/cubic_f.c (rev 0)
+++ grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.rectify/cubic_f.c 2010-12-22 10:05:10 UTC (rev 44654)
@@ -0,0 +1,54 @@
+/*
+ * Name
+ * cubic_f.c -- use cubic interpolation with fallback for given row, col
+ *
+ * Description
+ * cubic interpolation for the given row, column indices.
+ * If the interpolated value (but not the nearest) is null,
+ * it falls back to bilinear. If that interp value is null,
+ * it falls back to nearest neighbor.
+ */
+
+#include <grass/gis.h>
+#include <math.h>
+#include "global.h"
+
+void p_cubic_f(struct cache *ibuffer, /* input buffer */
+ void *obufptr, /* ptr in output buffer */
+ int cell_type, /* raster map type of obufptr */
+ double *row_idx, /* row index */
+ double *col_idx, /* column index */
+ struct Cell_head *cellhd /* cell header of input layer */
+ )
+{
+ /* start nearest neighbor to do some basic tests */
+ int row, col; /* row/col of nearest neighbor */
+ DCELL *cellp, cell;
+
+ /* cut indices to integer */
+ row = (int)floor(*row_idx);
+ col = (int)floor(*col_idx);
+
+ /* check for out of bounds - if out of bounds set NULL value */
+ if (row < 0 || row >= cellhd->rows || col < 0 || col >= cellhd->cols) {
+ G_set_null_value(obufptr, 1, cell_type);
+ return;
+ }
+
+ cellp = CPTR(ibuffer, row, col);
+ /* if nearest is null, all the other interps will be null */
+ if (G_is_d_null_value(cellp)) {
+ G_set_null_value(obufptr, 1, cell_type);
+ return;
+ }
+ cell = *cellp;
+
+ p_cubic(ibuffer, obufptr, cell_type, row_idx, col_idx, cellhd);
+ /* fallback to bilinear if cubic is null */
+ if (G_is_d_null_value(obufptr)) {
+ p_bilinear(ibuffer, obufptr, cell_type, row_idx, col_idx, cellhd);
+ /* fallback to nearest if bilinear is null */
+ if (G_is_d_null_value(obufptr))
+ G_set_raster_value_d(obufptr, cell, cell_type);
+ }
+}
Deleted: grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.rectify/defs.h
===================================================================
--- grass/branches/develbranch_6/imagery/i.ortho.photo/i.photo.rectify/defs.h 2010-12-01 09:34:37 UTC (rev 44501)
+++ grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.rectify/defs.h 2010-12-22 10:05:10 UTC (rev 44654)
@@ -1,28 +0,0 @@
-/* cache for raster data, code taken from r.proj */
-
-#define L2BDIM 6
-#define BDIM (1<<(L2BDIM))
-#define L2BSIZE (2*(L2BDIM))
-#define BSIZE (1<<(L2BSIZE))
-#define HI(i) ((i)>>(L2BDIM))
-#define LO(i) ((i)&((BDIM)-1))
-
-typedef DCELL block[BDIM][BDIM]; /* FCELL sufficient ? */
-
-struct cache
-{
- int fd;
- int stride;
- int nblocks;
- block **grid;
- block *blocks;
- int *refs;
-};
-
-typedef void (*func) (struct cache *, void *, int, double *, double *, struct Cell_head *);
-
-#define BKIDX(c,y,x) ((y) * (c)->stride + (x))
-#define BKPTR(c,y,x) ((c)->grid[BKIDX((c),(y),(x))])
-#define BLOCK(c,y,x) (BKPTR((c),(y),(x)) ? BKPTR((c),(y),(x)) : get_block((c),BKIDX((c),(y),(x))))
-#define CPTR(c,y,x) (&(*BLOCK((c),HI((y)),HI((x))))[LO((y))][LO((x))])
-
Copied: grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.rectify/defs.h (from rev 44501, grass/branches/develbranch_6/imagery/i.ortho.photo/i.photo.rectify/defs.h)
===================================================================
--- grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.rectify/defs.h (rev 0)
+++ grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.rectify/defs.h 2010-12-22 10:05:10 UTC (rev 44654)
@@ -0,0 +1,28 @@
+/* cache for raster data, code taken from r.proj */
+
+#define L2BDIM 6
+#define BDIM (1<<(L2BDIM))
+#define L2BSIZE (2*(L2BDIM))
+#define BSIZE (1<<(L2BSIZE))
+#define HI(i) ((i)>>(L2BDIM))
+#define LO(i) ((i)&((BDIM)-1))
+
+typedef DCELL block[BDIM][BDIM]; /* FCELL sufficient ? */
+
+struct cache
+{
+ int fd;
+ int stride;
+ int nblocks;
+ block **grid;
+ block *blocks;
+ int *refs;
+};
+
+typedef void (*func) (struct cache *, void *, int, double *, double *, struct Cell_head *);
+
+#define BKIDX(c,y,x) ((y) * (c)->stride + (x))
+#define BKPTR(c,y,x) ((c)->grid[BKIDX((c),(y),(x))])
+#define BLOCK(c,y,x) (BKPTR((c),(y),(x)) ? BKPTR((c),(y),(x)) : get_block((c),BKIDX((c),(y),(x))))
+#define CPTR(c,y,x) (&(*BLOCK((c),HI((y)),HI((x))))[LO((y))][LO((x))])
+
Deleted: grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.rectify/description.html
===================================================================
--- grass/branches/develbranch_6/imagery/i.ortho.photo/i.photo.rectify/description.html 2010-12-01 09:34:37 UTC (rev 44501)
+++ grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.rectify/description.html 2010-12-22 10:05:10 UTC (rev 44654)
@@ -1,72 +0,0 @@
-<H2>DESCRIPTION</H2>
-
-<EM>i.photo.rectify</EM> rectifies an image by using the image to photo
-coordinate transformation matrix created by <A HREF="i.photo.2image.html">i.photo.2image</A>
-and the rectification parameters created by <A HREF="i.photo.2target.html">i.photo.2target</A>.
-Rectification is the process by which the geometry of an image is made
-planimetric. This is accomplished by mapping an image from one coordinate
-system to another. In <EM>i.photo.rectify</EM> the parameters computed by
-<A HREF="i.photo.2image.html">i.photo.2image</A> and
-<A HREF="i.photo.2target.html">i.photo.2target</A> are used in equations to
-convert x,y image coordinates to standard map coordinates for each pixel in
-the image. The result is an image with a standard map coordinate system,
-compensated for relief distortions and photographic tilt. Upon completion of
-the program the rectified image is deposited in a previously targeted GRASS
-LOCATION.
-<P> You are asked to select the file(s) within the imagery group
-to be rectified:
-<P> Please select the file(s) to rectify by naming an
-output file <P> <PRE>
-
- gs13.1 in PERMANENT gs13.orect...
- gs14.1 in PERMANENT .............
-
- (enter list by any name to get a list of existing raster maps)
-
- AFTER COMPLETING ALL ANSWERS, HIT <ESC> TO CONTINUE
- (OR <Ctrl-C> TO CANCEL)
-</PRE>
-<P>
-<P>
-More than one file may be rectified at a time. Each file
-should have a unique output file name.
-<P>
-The next prompt asks you to select one of two windows:
-<P>
-<PRE>
- Please select one of the following options
- 1. Use the current window in the target location
- 2. Determine the smallest window which covers the image
- >
-</PRE>
-<P>
-<EM>i.photo.rectify</EM> will only rectify that portion of the
-image that occurs within the chosen window. Only that portion will be
-relocated in the target database. It is therefore important to check the
-current window in the target LOCATION if choice number one is selected.
-<P>
-The process may take an hour or more depending on the size of the image,
-the speed of the computer, the number files, and the size and resolution
-of the selected window.
-<P>
-The rectified image will be located in the target LOCATION when the program
-is completed. The original unrectified files are not modified or removed.
-
-<H2>SEE ALSO</H2>
-
-<EM>
-<A HREF="i.ortho.photo.html">i.ortho.photo</A><br>
-<A HREF="i.photo.camera.html">i.photo.camera</A><br>
-<A HREF="i.photo.2image.html">i.photo.2image</A><br>
-<A HREF="i.photo.2target.html">i.photo.2target</A><br>
-<A HREF="i.photo.init.html">i.photo.init</A>
-</EM>
-
-
-
-<H2>AUTHOR</H2>
-Mike Baba, DBA Systems, Inc.<br>
-Updated rectification and elevation map to FP 1/2002 Markus Neteler
-
-<p>
-<i>Last changed: $Date$</i>
Copied: grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.rectify/description.html (from rev 44501, grass/branches/develbranch_6/imagery/i.ortho.photo/i.photo.rectify/description.html)
===================================================================
--- grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.rectify/description.html (rev 0)
+++ grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.rectify/description.html 2010-12-22 10:05:10 UTC (rev 44654)
@@ -0,0 +1,72 @@
+<H2>DESCRIPTION</H2>
+
+<EM>i.photo.rectify</EM> rectifies an image by using the image to photo
+coordinate transformation matrix created by <A HREF="i.photo.2image.html">i.photo.2image</A>
+and the rectification parameters created by <A HREF="i.photo.2target.html">i.photo.2target</A>.
+Rectification is the process by which the geometry of an image is made
+planimetric. This is accomplished by mapping an image from one coordinate
+system to another. In <EM>i.photo.rectify</EM> the parameters computed by
+<A HREF="i.photo.2image.html">i.photo.2image</A> and
+<A HREF="i.photo.2target.html">i.photo.2target</A> are used in equations to
+convert x,y image coordinates to standard map coordinates for each pixel in
+the image. The result is an image with a standard map coordinate system,
+compensated for relief distortions and photographic tilt. Upon completion of
+the program the rectified image is deposited in a previously targeted GRASS
+LOCATION.
+<P> You are asked to select the file(s) within the imagery group
+to be rectified:
+<P> Please select the file(s) to rectify by naming an
+output file <P> <PRE>
+
+ gs13.1 in PERMANENT gs13.orect...
+ gs14.1 in PERMANENT .............
+
+ (enter list by any name to get a list of existing raster maps)
+
+ AFTER COMPLETING ALL ANSWERS, HIT <ESC> TO CONTINUE
+ (OR <Ctrl-C> TO CANCEL)
+</PRE>
+<P>
+<P>
+More than one file may be rectified at a time. Each file
+should have a unique output file name.
+<P>
+The next prompt asks you to select one of two windows:
+<P>
+<PRE>
+ Please select one of the following options
+ 1. Use the current window in the target location
+ 2. Determine the smallest window which covers the image
+ >
+</PRE>
+<P>
+<EM>i.photo.rectify</EM> will only rectify that portion of the
+image that occurs within the chosen window. Only that portion will be
+relocated in the target database. It is therefore important to check the
+current window in the target LOCATION if choice number one is selected.
+<P>
+The process may take an hour or more depending on the size of the image,
+the speed of the computer, the number files, and the size and resolution
+of the selected window.
+<P>
+The rectified image will be located in the target LOCATION when the program
+is completed. The original unrectified files are not modified or removed.
+
+<H2>SEE ALSO</H2>
+
+<EM>
+<A HREF="i.ortho.photo.html">i.ortho.photo</A><br>
+<A HREF="i.photo.camera.html">i.photo.camera</A><br>
+<A HREF="i.photo.2image.html">i.photo.2image</A><br>
+<A HREF="i.photo.2target.html">i.photo.2target</A><br>
+<A HREF="i.photo.init.html">i.photo.init</A>
+</EM>
+
+
+
+<H2>AUTHOR</H2>
+Mike Baba, DBA Systems, Inc.<br>
+Updated rectification and elevation map to FP 1/2002 Markus Neteler
+
+<p>
+<i>Last changed: $Date$</i>
Deleted: grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.rectify/env.c
===================================================================
--- grass/branches/develbranch_6/imagery/i.ortho.photo/i.photo.rectify/env.c 2010-12-01 09:34:37 UTC (rev 44501)
+++ grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.rectify/env.c 2010-12-22 10:05:10 UTC (rev 44654)
@@ -1,42 +0,0 @@
-#include <unistd.h>
-#include "global.h"
-static int which_env = -1; /* 0 = cur, 1 = target */
-
-int select_current_env(void)
-{
- if (which_env < 0) {
- G__create_alt_env();
- which_env = 0;
- }
- if (which_env != 0) {
- G__switch_env();
- which_env = 0;
- }
-
- return 0;
-}
-
-int select_target_env(void)
-{
- if (which_env < 0) {
- G__create_alt_env();
- which_env = 1;
- }
- if (which_env != 1) {
- G__switch_env();
- which_env = 1;
- }
-
- return 0;
-}
-
-int show_env(void)
-{
- fprintf(stderr, "env(%d) switch to LOCATION %s, MAPSET %s\n", which_env,
- G__getenv("LOCATION_NAME") ==
- NULL ? "?" : G__getenv("LOCATION_NAME"),
- G__getenv("MAPSET") == NULL ? "?" : G__getenv("MAPSET"));
- G_sleep(2);
-
- return 0;
-}
Copied: grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.rectify/env.c (from rev 44501, grass/branches/develbranch_6/imagery/i.ortho.photo/i.photo.rectify/env.c)
===================================================================
--- grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.rectify/env.c (rev 0)
+++ grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.rectify/env.c 2010-12-22 10:05:10 UTC (rev 44654)
@@ -0,0 +1,42 @@
+#include <unistd.h>
+#include "global.h"
+static int which_env = -1; /* 0 = cur, 1 = target */
+
+int select_current_env(void)
+{
+ if (which_env < 0) {
+ G__create_alt_env();
+ which_env = 0;
+ }
+ if (which_env != 0) {
+ G__switch_env();
+ which_env = 0;
+ }
+
+ return 0;
+}
+
+int select_target_env(void)
+{
+ if (which_env < 0) {
+ G__create_alt_env();
+ which_env = 1;
+ }
+ if (which_env != 1) {
+ G__switch_env();
+ which_env = 1;
+ }
+
+ return 0;
+}
+
+int show_env(void)
+{
+ fprintf(stderr, "env(%d) switch to LOCATION %s, MAPSET %s\n", which_env,
+ G__getenv("LOCATION_NAME") ==
+ NULL ? "?" : G__getenv("LOCATION_NAME"),
+ G__getenv("MAPSET") == NULL ? "?" : G__getenv("MAPSET"));
+ G_sleep(2);
+
+ return 0;
+}
Deleted: grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.rectify/equ.c
===================================================================
--- grass/branches/develbranch_6/imagery/i.ortho.photo/i.photo.rectify/equ.c 2010-12-01 09:34:37 UTC (rev 44501)
+++ grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.rectify/equ.c 2010-12-22 10:05:10 UTC (rev 44654)
@@ -1,56 +0,0 @@
-#include "global.h"
-
-int Compute_ortho_equation(void)
-{
-
- /* struct Ortho_Control_Points temp_points; */
- double e0, e1, e2, n0, n1, n2, z1, z2;
- int status, i;
-
- /* alloc and fill temp control points */
- temp_points.count = 0;
- temp_points.status = NULL;
- temp_points.e1 = NULL;
- temp_points.n1 = NULL;
- temp_points.z1 = NULL;
- temp_points.e2 = NULL;
- temp_points.n2 = NULL;
- temp_points.z2 = NULL;
-
- /* e0, n0, equal photo coordinates not image coords */
- for (i = 0; i < group.control_points.count; i++) {
- status = group.control_points.status[i];
- e1 = group.control_points.e1[i];
- n1 = group.control_points.n1[i];
- z1 = group.control_points.z1[i];
- e2 = group.control_points.e2[i];
- n2 = group.control_points.n2[i];
- z2 = group.control_points.z2[i];
-
- I_georef(e1, n1, &e0, &n0, group.E12, group.N12);
- I_new_con_point(&temp_points, e0, n0, z1, e2, n2, z2, status);
- }
-
-
- group.con_equation_stat = I_compute_ortho_equations(&temp_points,
- &group.camera_ref,
- &group.camera_exp,
- &group.XC, &group.YC,
- &group.ZC,
- &group.omega,
- &group.phi,
- &group.kappa,
- &group.M,
- &group.MI);
-
- return 0;
-}
-
-int Compute_ref_equation(void)
-{
- group.ref_equation_stat = I_compute_ref_equations(&group.photo_points,
- group.E12, group.N12,
- group.E21, group.N21);
-
- return 0;
-}
Copied: grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.rectify/equ.c (from rev 44501, grass/branches/develbranch_6/imagery/i.ortho.photo/i.photo.rectify/equ.c)
===================================================================
--- grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.rectify/equ.c (rev 0)
+++ grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.rectify/equ.c 2010-12-22 10:05:10 UTC (rev 44654)
@@ -0,0 +1,56 @@
+#include "global.h"
+
+int Compute_ortho_equation(void)
+{
+
+ /* struct Ortho_Control_Points temp_points; */
+ double e0, e1, e2, n0, n1, n2, z1, z2;
+ int status, i;
+
+ /* alloc and fill temp control points */
+ temp_points.count = 0;
+ temp_points.status = NULL;
+ temp_points.e1 = NULL;
+ temp_points.n1 = NULL;
+ temp_points.z1 = NULL;
+ temp_points.e2 = NULL;
+ temp_points.n2 = NULL;
+ temp_points.z2 = NULL;
+
+ /* e0, n0, equal photo coordinates not image coords */
+ for (i = 0; i < group.control_points.count; i++) {
+ status = group.control_points.status[i];
+ e1 = group.control_points.e1[i];
+ n1 = group.control_points.n1[i];
+ z1 = group.control_points.z1[i];
+ e2 = group.control_points.e2[i];
+ n2 = group.control_points.n2[i];
+ z2 = group.control_points.z2[i];
+
+ I_georef(e1, n1, &e0, &n0, group.E12, group.N12);
+ I_new_con_point(&temp_points, e0, n0, z1, e2, n2, z2, status);
+ }
+
+
+ group.con_equation_stat = I_compute_ortho_equations(&temp_points,
+ &group.camera_ref,
+ &group.camera_exp,
+ &group.XC, &group.YC,
+ &group.ZC,
+ &group.omega,
+ &group.phi,
+ &group.kappa,
+ &group.M,
+ &group.MI);
+
+ return 0;
+}
+
+int Compute_ref_equation(void)
+{
+ group.ref_equation_stat = I_compute_ref_equations(&group.photo_points,
+ group.E12, group.N12,
+ group.E21, group.N21);
+
+ return 0;
+}
Deleted: grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.rectify/exec.c
===================================================================
--- grass/branches/develbranch_6/imagery/i.ortho.photo/i.photo.rectify/exec.c 2010-12-01 09:34:37 UTC (rev 44501)
+++ grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.rectify/exec.c 2010-12-22 10:05:10 UTC (rev 44654)
@@ -1,109 +0,0 @@
-/*
- exec.c --
-
- Loop through all files to be rectified and do the retification.
- Handles things like support files.
- */
-
-#include <unistd.h>
-#include <time.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include "global.h"
-
-int exec_rectify(void)
-{
- char *name;
- char *mapset;
- char *result;
- int i, n;
- struct Colors colr;
- struct Categories cats;
- struct History hist;
- int colr_ok, hist_ok, cats_ok;
- long start_time, rectify_time, compress_time;
- double aver_z;
- int elevfd;
- struct cache *ebuffer;
-
- G_debug(1, "Open elevation raster: ");
-
- /* open elevation raster */
- select_target_env();
- G_set_window(&target_window);
- G_debug(1, "target window: rs=%d cs=%d n=%f s=%f w=%f e=%f\n",
- target_window.rows, target_window.cols, target_window.north,
- target_window.south, target_window.west, target_window.east);
-
- elevfd = G_open_cell_old(elev_layer, mapset_elev);
- if (elevfd < 0) {
- G_fatal_error(_("Could not open elevation raster"));
- return 1;
- }
- G_debug(1, "elev layer = %s mapset elev = %s elevfd = %d",
- elev_layer, mapset_elev, elevfd);
- ebuffer = readcell(elevfd, seg_mb_elev, 1);
- G_close_cell(elevfd);
-
- /* get an average elevation of the control points */
- /* this is used only if target cells have no elevation */
- get_aver_elev(&group.control_points, &aver_z);
-
- /* rectify each file */
- for (n = 0; n < group.group_ref.nfiles; n++) {
- G_debug(2, "I look for files to ortho rectify");
-
- if ((i = ref_list[n]) < 0)
- continue;
- name = group.group_ref.file[i].name;
- mapset = group.group_ref.file[i].mapset;
- result = new_name[n];
-
- G_debug(2, "ORTHO RECTIFYING:");
- G_debug(2, "NAME %s", name);
- G_debug(2, "MAPSET %s", mapset);
- G_debug(2, "RESULT %s", result);
- G_debug(2, "select_current_env...");
-
- select_current_env();
-
- cats_ok = G_read_cats(name, mapset, &cats) >= 0;
- colr_ok = G_read_colors(name, mapset, &colr) > 0;
- hist_ok = G_read_history(name, mapset, &hist) >= 0;
- G_debug(2, "reading was fine...");
-
- time(&start_time);
-
- G_debug(2, "Starting the rectification...");
-
- if (rectify(name, mapset, ebuffer, aver_z, result)) {
- G_debug(2, "Done. Writing results...");
- select_target_env();
- if (cats_ok) {
- G_write_cats(result, &cats);
- G_free_cats(&cats);
- }
- if (colr_ok) {
- G_write_colors(result, G_mapset(), &colr);
- G_free_colors(&colr);
- }
- if (hist_ok)
- G_write_history(result, &hist);
- select_current_env();
- time(&rectify_time);
- compress_time = rectify_time;
- report(name, mapset, result, rectify_time - start_time,
- compress_time - rectify_time, 1);
- }
- else {
- G_debug(2, "Could not rectify. Mhhh.");
- report(name, mapset, result, (long)0, (long)0, 0);
- }
- }
- close(ebuffer->fd);
- G_free(ebuffer);
-
- G_done_msg(" ");
- return 0;
-}
Copied: grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.rectify/exec.c (from rev 44501, grass/branches/develbranch_6/imagery/i.ortho.photo/i.photo.rectify/exec.c)
===================================================================
--- grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.rectify/exec.c (rev 0)
+++ grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.rectify/exec.c 2010-12-22 10:05:10 UTC (rev 44654)
@@ -0,0 +1,109 @@
+/*
+ exec.c --
+
+ Loop through all files to be rectified and do the retification.
+ Handles things like support files.
+ */
+
+#include <unistd.h>
+#include <time.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include "global.h"
+
+int exec_rectify(void)
+{
+ char *name;
+ char *mapset;
+ char *result;
+ int i, n;
+ struct Colors colr;
+ struct Categories cats;
+ struct History hist;
+ int colr_ok, hist_ok, cats_ok;
+ long start_time, rectify_time, compress_time;
+ double aver_z;
+ int elevfd;
+ struct cache *ebuffer;
+
+ G_debug(1, "Open elevation raster: ");
+
+ /* open elevation raster */
+ select_target_env();
+ G_set_window(&target_window);
+ G_debug(1, "target window: rs=%d cs=%d n=%f s=%f w=%f e=%f\n",
+ target_window.rows, target_window.cols, target_window.north,
+ target_window.south, target_window.west, target_window.east);
+
+ elevfd = G_open_cell_old(elev_layer, mapset_elev);
+ if (elevfd < 0) {
+ G_fatal_error(_("Could not open elevation raster"));
+ return 1;
+ }
+ G_debug(1, "elev layer = %s mapset elev = %s elevfd = %d",
+ elev_layer, mapset_elev, elevfd);
+ ebuffer = readcell(elevfd, seg_mb_elev, 1);
+ G_close_cell(elevfd);
+
+ /* get an average elevation of the control points */
+ /* this is used only if target cells have no elevation */
+ get_aver_elev(&group.control_points, &aver_z);
+
+ /* rectify each file */
+ for (n = 0; n < group.group_ref.nfiles; n++) {
+ G_debug(2, "I look for files to ortho rectify");
+
+ if ((i = ref_list[n]) < 0)
+ continue;
+ name = group.group_ref.file[i].name;
+ mapset = group.group_ref.file[i].mapset;
+ result = new_name[n];
+
+ G_debug(2, "ORTHO RECTIFYING:");
+ G_debug(2, "NAME %s", name);
+ G_debug(2, "MAPSET %s", mapset);
+ G_debug(2, "RESULT %s", result);
+ G_debug(2, "select_current_env...");
+
+ select_current_env();
+
+ cats_ok = G_read_cats(name, mapset, &cats) >= 0;
+ colr_ok = G_read_colors(name, mapset, &colr) > 0;
+ hist_ok = G_read_history(name, mapset, &hist) >= 0;
+ G_debug(2, "reading was fine...");
+
+ time(&start_time);
+
+ G_debug(2, "Starting the rectification...");
+
+ if (rectify(name, mapset, ebuffer, aver_z, result)) {
+ G_debug(2, "Done. Writing results...");
+ select_target_env();
+ if (cats_ok) {
+ G_write_cats(result, &cats);
+ G_free_cats(&cats);
+ }
+ if (colr_ok) {
+ G_write_colors(result, G_mapset(), &colr);
+ G_free_colors(&colr);
+ }
+ if (hist_ok)
+ G_write_history(result, &hist);
+ select_current_env();
+ time(&rectify_time);
+ compress_time = rectify_time;
+ report(name, mapset, result, rectify_time - start_time,
+ compress_time - rectify_time, 1);
+ }
+ else {
+ G_debug(2, "Could not rectify. Mhhh.");
+ report(name, mapset, result, (long)0, (long)0, 0);
+ }
+ }
+ close(ebuffer->fd);
+ G_free(ebuffer);
+
+ G_done_msg(" ");
+ return 0;
+}
Deleted: grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.rectify/get_wind.c
===================================================================
--- grass/branches/develbranch_6/imagery/i.ortho.photo/i.photo.rectify/get_wind.c 2010-12-01 09:34:37 UTC (rev 44501)
+++ grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.rectify/get_wind.c 2010-12-22 10:05:10 UTC (rev 44654)
@@ -1,284 +0,0 @@
-#include <stdlib.h>
-#include <string.h>
-#include <math.h>
-#include "global.h"
-
-int get_ref_window(struct Cell_head *cellhd)
-{
- int k, f1, f2;
- int count;
- struct Cell_head win;
-
- /* from all the files in the group, get max extends and min resolutions */
- count = 0;
- for (f1 = 0; f1 < group.group_ref.nfiles; f1++) {
- if (ref_list[f1] >= 0) {
- if (count++ == 0) {
- f2 = ref_list[f1];
- G_get_cellhd(group.group_ref.file[f2].name,
- group.group_ref.file[f2].mapset, cellhd);
- }
- else {
- k = ref_list[f1];
- G_get_cellhd(group.group_ref.file[k].name,
- group.group_ref.file[k].mapset, &win);
- /* extends */
- if (cellhd->north < win.north)
- cellhd->north = win.north;
- if (cellhd->south > win.south)
- cellhd->south = win.south;
- if (cellhd->west > win.west)
- cellhd->west = win.west;
- if (cellhd->east < win.east)
- cellhd->east = win.east;
- /* resolution */
- if (cellhd->ns_res > win.ns_res)
- cellhd->ns_res = win.ns_res;
- if (cellhd->ew_res > win.ew_res)
- cellhd->ew_res = win.ew_res;
- }
- }
- }
-
- /* if the north-south is not multiple of the resolution,
- * round the south downward
- */
- cellhd->rows = (cellhd->north - cellhd->south) /cellhd->ns_res + 0.5;
- cellhd->south = cellhd->north - cellhd->rows * cellhd->ns_res;
-
- /* do the same for the west */
- cellhd->cols = (cellhd->east - cellhd->west) / cellhd->ew_res + 0.5;
- cellhd->west = cellhd->east - cellhd->cols * cellhd->ew_res;
-
- return 1;
-}
-
-int get_target_window(void)
-{
- struct Cell_head cellhd;
- double res;
-
- fprintf(stderr, "\n\n");
- while (1) {
- char buf[100];
-
- fprintf(stderr, "Please select one of the following options\n");
- fprintf(stderr,
- " 1. Use the current window in the target location\n");
- fprintf(stderr,
- " 2. Determine the smallest window which covers the image\n");
- fprintf(stderr, "> ");
- if (!G_gets(buf))
- continue;
- G_strip(buf);
-
- if (strcmp(buf, "1") == 0) {
- return 1;
- }
- if (strcmp(buf, "2") == 0)
- break;
- }
-
- /* ask for target resolution */
- while (1) {
- char buf[100];
-
- fprintf(stderr, "Desired target resolution\n");
- fprintf(stderr,
- " RETURN determine automatically\n");
- fprintf(stderr, "> ");
- if (!G_gets(buf))
- continue;
-
- if (*buf == 0) { /* determine automatically */
- res = -1;
- break;
- }
-
- G_strip(buf);
-
- if ((res = atof(buf)) <= 0) {
- fprintf(stderr, "Resolution must be larger than zero!");
- G_clear_screen();
- }
- else
- break;
- }
-
- /* get reference window: max extend, min resolution */
- get_ref_window(&cellhd);
-
- G_debug(1, "current window: n s = %f %f,", cellhd.north,
- cellhd.south);
- G_debug(1, "current window: w e = %f %f,", cellhd.west,
- cellhd.east);
-
- georef_window(&cellhd, &target_window, res);
-
- select_target_env();
- if (G_put_window(&target_window) >= 0)
- fprintf(stderr, "Window Saved!\n");
- select_current_env();
- return 0;
-}
-
-int georef_window(struct Cell_head *w1, struct Cell_head *w2, double res)
-{
- double n, e, z1, ad;
- double n0, e0;
- double aver_z;
- struct _corner {
- double n, e;
- } nw, ne, se, sw;
-
- /* get an average elevation from the active control points */
- get_aver_elev(&group.control_points, &aver_z);
- G_debug(1, "Aver elev = %f", aver_z);
-
- /* compute ortho ref of all corners */
-
- I_georef(w1->west, w1->north, &e0, &n0, group.E12, group.N12);
- I_inverse_ortho_ref(e0, n0, aver_z, &e, &n, &z1, &group.camera_ref,
- group.XC, group.YC, group.ZC, group.MI);
-
- G_debug(1, "NORTH WEST CORNER");
- G_debug(1, "group.E12 = %f %f %f,", group.E12[0], group.E12[1],
- group.E12[2]);
- G_debug(1, "group.N12 = %f %f %f,", group.N12[0], group.N12[1],
- group.N12[2]);
- G_debug(1, "image x = %f y = %f, photo x = %f y = %f", w1->west,
- w1->north, e0, n0);
- G_debug(1, "target x = %f y = %f", e, n);
-
- w2->north = w2->south = n;
- w2->west = w2->east = e;
- nw.n = n;
- nw.e = e;
-
- I_georef(w1->east, w1->north, &e0, &n0, group.E12, group.N12);
- I_inverse_ortho_ref(e0, n0, aver_z, &e, &n, &z1, &group.camera_ref,
- group.XC, group.YC, group.ZC, group.MI);
-
- G_debug(1, "NORTH EAST CORNER");
- G_debug(1, "image x = %f y = %f, photo x = %f y = %f", w1->east,
- w1->north, e0, n0);
- G_debug(1, "target x = %f y = %f", e, n);
-
-
- ne.n = n;
- ne.e = e;
- if (n > w2->north)
- w2->north = n;
- if (n < w2->south)
- w2->south = n;
- if (e > w2->east)
- w2->east = e;
- if (e < w2->west)
- w2->west = e;
-
- I_georef(w1->west, w1->south, &e0, &n0, group.E12, group.N12);
- I_inverse_ortho_ref(e0, n0, aver_z, &e, &n, &z1, &group.camera_ref,
- group.XC, group.YC, group.ZC, group.MI);
-
- G_debug(1, "SOUTH WEST CORNER");
- G_debug(1, "image x = %f y = %f, photo x = %f y = %f", w1->west,
- w1->south, e0, n0);
- G_debug(1, "target x = %f y = %f", e, n);
-
- sw.n = n;
- sw.e = e;
- if (n > w2->north)
- w2->north = n;
- if (n < w2->south)
- w2->south = n;
- if (e > w2->east)
- w2->east = e;
- if (e < w2->west)
- w2->west = e;
-
- I_georef(w1->east, w1->south, &e0, &n0, group.E12, N12);
- I_inverse_ortho_ref(e0, n0, aver_z, &e, &n, &z1, &group.camera_ref,
- group.XC, group.YC, group.ZC, group.MI);
-
- G_debug(1, "SOUTH EAST CORNER");
- G_debug(1, "image x = %f y = %f, photo x = %f y = %f", w1->east,
- w1->south, e0, n0);
- G_debug(1, "target x = %f y = %f", e, n);
-
- se.n = n;
- se.e = e;
- if (n > w2->north)
- w2->north = n;
- if (n < w2->south)
- w2->south = n;
- if (e > w2->east)
- w2->east = e;
- if (e < w2->west)
- w2->west = e;
-
- /* resolution */
- if (res > 0)
- w2->ew_res = w2->ns_res = res;
- else {
- /* this results in ugly res values, and ns_res != ew_res */
- /* and is no good for rotation */
- /*
- w2->ns_res = (w2->north - w2->south) / w1->rows;
- w2->ew_res = (w2->east - w2->west) / w1->cols;
- */
-
- /* alternative: account for rotation and order > 1 */
-
- /* N-S extends along western and eastern edge */
- w2->ns_res = (sqrt((nw.n - sw.n) * (nw.n - sw.n) +
- (nw.e - sw.e) * (nw.e - sw.e)) +
- sqrt((ne.n - se.n) * (ne.n - se.n) +
- (ne.e - se.e) * (ne.e - se.e))) / (2.0 * w1->rows);
-
- /* E-W extends along northern and southern edge */
- w2->ew_res = (sqrt((nw.n - ne.n) * (nw.n - ne.n) +
- (nw.e - ne.e) * (nw.e - ne.e)) +
- sqrt((sw.n - se.n) * (sw.n - se.n) +
- (sw.e - se.e) * (sw.e - se.e))) / (2.0 * w1->cols);
-
- /* make ew_res = ns_res */
- w2->ns_res = (w2->ns_res + w2->ew_res) / 2.0;
- w2->ew_res = w2->ns_res;
-
- /* nice round values */
- if (w2->ns_res > 1) {
- if (w2->ns_res < 10) {
- /* round to first decimal */
- w2->ns_res = (int)(w2->ns_res * 10 + 0.5) / 10.0;
- w2->ew_res = w2->ns_res;
- }
- else {
- /* round to integer */
- w2->ns_res = (int)(w2->ns_res + 0.5);
- w2->ew_res = w2->ns_res;
- }
- }
- }
-
- /* adjust extends */
- ad = w2->north > 0 ? 0.5 : -0.5;
- w2->north = (int) (ceil(w2->north / w2->ns_res) + ad) * w2->ns_res;
- ad = w2->south > 0 ? 0.5 : -0.5;
- w2->south = (int) (floor(w2->south / w2->ns_res) + ad) * w2->ns_res;
- ad = w2->east > 0 ? 0.5 : -0.5;
- w2->east = (int) (ceil(w2->east / w2->ew_res) + ad) * w2->ew_res;
- ad = w2->west > 0 ? 0.5 : -0.5;
- w2->west = (int) (floor(w2->west / w2->ew_res) + ad) * w2->ew_res;
-
- w2->rows = (w2->north - w2->south + w2->ns_res / 2.0) / w2->ns_res;
- w2->cols = (w2->east - w2->west + w2->ew_res / 2.0) / w2->ew_res;
-
- G_debug(1, "FINAL");
- G_debug(1, "east = %f \n west = %f \n north = %f \n south = %f",
- w2->east, w2->west, w2->north, w2->south);
- G_debug(1, "RESOLUTION");
- G_debug(1, "EW = %f", w2->ew_res);
- G_debug(1, "NS = %f", w2->ns_res);
-
- return 0;
-}
Copied: grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.rectify/get_wind.c (from rev 44501, grass/branches/develbranch_6/imagery/i.ortho.photo/i.photo.rectify/get_wind.c)
===================================================================
--- grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.rectify/get_wind.c (rev 0)
+++ grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.rectify/get_wind.c 2010-12-22 10:05:10 UTC (rev 44654)
@@ -0,0 +1,284 @@
+#include <stdlib.h>
+#include <string.h>
+#include <math.h>
+#include "global.h"
+
+int get_ref_window(struct Cell_head *cellhd)
+{
+ int k, f1, f2;
+ int count;
+ struct Cell_head win;
+
+ /* from all the files in the group, get max extends and min resolutions */
+ count = 0;
+ for (f1 = 0; f1 < group.group_ref.nfiles; f1++) {
+ if (ref_list[f1] >= 0) {
+ if (count++ == 0) {
+ f2 = ref_list[f1];
+ G_get_cellhd(group.group_ref.file[f2].name,
+ group.group_ref.file[f2].mapset, cellhd);
+ }
+ else {
+ k = ref_list[f1];
+ G_get_cellhd(group.group_ref.file[k].name,
+ group.group_ref.file[k].mapset, &win);
+ /* extends */
+ if (cellhd->north < win.north)
+ cellhd->north = win.north;
+ if (cellhd->south > win.south)
+ cellhd->south = win.south;
+ if (cellhd->west > win.west)
+ cellhd->west = win.west;
+ if (cellhd->east < win.east)
+ cellhd->east = win.east;
+ /* resolution */
+ if (cellhd->ns_res > win.ns_res)
+ cellhd->ns_res = win.ns_res;
+ if (cellhd->ew_res > win.ew_res)
+ cellhd->ew_res = win.ew_res;
+ }
+ }
+ }
+
+ /* if the north-south is not multiple of the resolution,
+ * round the south downward
+ */
+ cellhd->rows = (cellhd->north - cellhd->south) /cellhd->ns_res + 0.5;
+ cellhd->south = cellhd->north - cellhd->rows * cellhd->ns_res;
+
+ /* do the same for the west */
+ cellhd->cols = (cellhd->east - cellhd->west) / cellhd->ew_res + 0.5;
+ cellhd->west = cellhd->east - cellhd->cols * cellhd->ew_res;
+
+ return 1;
+}
+
+int get_target_window(void)
+{
+ struct Cell_head cellhd;
+ double res;
+
+ fprintf(stderr, "\n\n");
+ while (1) {
+ char buf[100];
+
+ fprintf(stderr, "Please select one of the following options\n");
+ fprintf(stderr,
+ " 1. Use the current window in the target location\n");
+ fprintf(stderr,
+ " 2. Determine the smallest window which covers the image\n");
+ fprintf(stderr, "> ");
+ if (!G_gets(buf))
+ continue;
+ G_strip(buf);
+
+ if (strcmp(buf, "1") == 0) {
+ return 1;
+ }
+ if (strcmp(buf, "2") == 0)
+ break;
+ }
+
+ /* ask for target resolution */
+ while (1) {
+ char buf[100];
+
+ fprintf(stderr, "Desired target resolution\n");
+ fprintf(stderr,
+ " RETURN determine automatically\n");
+ fprintf(stderr, "> ");
+ if (!G_gets(buf))
+ continue;
+
+ if (*buf == 0) { /* determine automatically */
+ res = -1;
+ break;
+ }
+
+ G_strip(buf);
+
+ if ((res = atof(buf)) <= 0) {
+ fprintf(stderr, "Resolution must be larger than zero!");
+ G_clear_screen();
+ }
+ else
+ break;
+ }
+
+ /* get reference window: max extend, min resolution */
+ get_ref_window(&cellhd);
+
+ G_debug(1, "current window: n s = %f %f,", cellhd.north,
+ cellhd.south);
+ G_debug(1, "current window: w e = %f %f,", cellhd.west,
+ cellhd.east);
+
+ georef_window(&cellhd, &target_window, res);
+
+ select_target_env();
+ if (G_put_window(&target_window) >= 0)
+ fprintf(stderr, "Window Saved!\n");
+ select_current_env();
+ return 0;
+}
+
+int georef_window(struct Cell_head *w1, struct Cell_head *w2, double res)
+{
+ double n, e, z1, ad;
+ double n0, e0;
+ double aver_z;
+ struct _corner {
+ double n, e;
+ } nw, ne, se, sw;
+
+ /* get an average elevation from the active control points */
+ get_aver_elev(&group.control_points, &aver_z);
+ G_debug(1, "Aver elev = %f", aver_z);
+
+ /* compute ortho ref of all corners */
+
+ I_georef(w1->west, w1->north, &e0, &n0, group.E12, group.N12);
+ I_inverse_ortho_ref(e0, n0, aver_z, &e, &n, &z1, &group.camera_ref,
+ group.XC, group.YC, group.ZC, group.MI);
+
+ G_debug(1, "NORTH WEST CORNER");
+ G_debug(1, "group.E12 = %f %f %f,", group.E12[0], group.E12[1],
+ group.E12[2]);
+ G_debug(1, "group.N12 = %f %f %f,", group.N12[0], group.N12[1],
+ group.N12[2]);
+ G_debug(1, "image x = %f y = %f, photo x = %f y = %f", w1->west,
+ w1->north, e0, n0);
+ G_debug(1, "target x = %f y = %f", e, n);
+
+ w2->north = w2->south = n;
+ w2->west = w2->east = e;
+ nw.n = n;
+ nw.e = e;
+
+ I_georef(w1->east, w1->north, &e0, &n0, group.E12, group.N12);
+ I_inverse_ortho_ref(e0, n0, aver_z, &e, &n, &z1, &group.camera_ref,
+ group.XC, group.YC, group.ZC, group.MI);
+
+ G_debug(1, "NORTH EAST CORNER");
+ G_debug(1, "image x = %f y = %f, photo x = %f y = %f", w1->east,
+ w1->north, e0, n0);
+ G_debug(1, "target x = %f y = %f", e, n);
+
+
+ ne.n = n;
+ ne.e = e;
+ if (n > w2->north)
+ w2->north = n;
+ if (n < w2->south)
+ w2->south = n;
+ if (e > w2->east)
+ w2->east = e;
+ if (e < w2->west)
+ w2->west = e;
+
+ I_georef(w1->west, w1->south, &e0, &n0, group.E12, group.N12);
+ I_inverse_ortho_ref(e0, n0, aver_z, &e, &n, &z1, &group.camera_ref,
+ group.XC, group.YC, group.ZC, group.MI);
+
+ G_debug(1, "SOUTH WEST CORNER");
+ G_debug(1, "image x = %f y = %f, photo x = %f y = %f", w1->west,
+ w1->south, e0, n0);
+ G_debug(1, "target x = %f y = %f", e, n);
+
+ sw.n = n;
+ sw.e = e;
+ if (n > w2->north)
+ w2->north = n;
+ if (n < w2->south)
+ w2->south = n;
+ if (e > w2->east)
+ w2->east = e;
+ if (e < w2->west)
+ w2->west = e;
+
+ I_georef(w1->east, w1->south, &e0, &n0, group.E12, N12);
+ I_inverse_ortho_ref(e0, n0, aver_z, &e, &n, &z1, &group.camera_ref,
+ group.XC, group.YC, group.ZC, group.MI);
+
+ G_debug(1, "SOUTH EAST CORNER");
+ G_debug(1, "image x = %f y = %f, photo x = %f y = %f", w1->east,
+ w1->south, e0, n0);
+ G_debug(1, "target x = %f y = %f", e, n);
+
+ se.n = n;
+ se.e = e;
+ if (n > w2->north)
+ w2->north = n;
+ if (n < w2->south)
+ w2->south = n;
+ if (e > w2->east)
+ w2->east = e;
+ if (e < w2->west)
+ w2->west = e;
+
+ /* resolution */
+ if (res > 0)
+ w2->ew_res = w2->ns_res = res;
+ else {
+ /* this results in ugly res values, and ns_res != ew_res */
+ /* and is no good for rotation */
+ /*
+ w2->ns_res = (w2->north - w2->south) / w1->rows;
+ w2->ew_res = (w2->east - w2->west) / w1->cols;
+ */
+
+ /* alternative: account for rotation and order > 1 */
+
+ /* N-S extends along western and eastern edge */
+ w2->ns_res = (sqrt((nw.n - sw.n) * (nw.n - sw.n) +
+ (nw.e - sw.e) * (nw.e - sw.e)) +
+ sqrt((ne.n - se.n) * (ne.n - se.n) +
+ (ne.e - se.e) * (ne.e - se.e))) / (2.0 * w1->rows);
+
+ /* E-W extends along northern and southern edge */
+ w2->ew_res = (sqrt((nw.n - ne.n) * (nw.n - ne.n) +
+ (nw.e - ne.e) * (nw.e - ne.e)) +
+ sqrt((sw.n - se.n) * (sw.n - se.n) +
+ (sw.e - se.e) * (sw.e - se.e))) / (2.0 * w1->cols);
+
+ /* make ew_res = ns_res */
+ w2->ns_res = (w2->ns_res + w2->ew_res) / 2.0;
+ w2->ew_res = w2->ns_res;
+
+ /* nice round values */
+ if (w2->ns_res > 1) {
+ if (w2->ns_res < 10) {
+ /* round to first decimal */
+ w2->ns_res = (int)(w2->ns_res * 10 + 0.5) / 10.0;
+ w2->ew_res = w2->ns_res;
+ }
+ else {
+ /* round to integer */
+ w2->ns_res = (int)(w2->ns_res + 0.5);
+ w2->ew_res = w2->ns_res;
+ }
+ }
+ }
+
+ /* adjust extends */
+ ad = w2->north > 0 ? 0.5 : -0.5;
+ w2->north = (int) (ceil(w2->north / w2->ns_res) + ad) * w2->ns_res;
+ ad = w2->south > 0 ? 0.5 : -0.5;
+ w2->south = (int) (floor(w2->south / w2->ns_res) + ad) * w2->ns_res;
+ ad = w2->east > 0 ? 0.5 : -0.5;
+ w2->east = (int) (ceil(w2->east / w2->ew_res) + ad) * w2->ew_res;
+ ad = w2->west > 0 ? 0.5 : -0.5;
+ w2->west = (int) (floor(w2->west / w2->ew_res) + ad) * w2->ew_res;
+
+ w2->rows = (w2->north - w2->south + w2->ns_res / 2.0) / w2->ns_res;
+ w2->cols = (w2->east - w2->west + w2->ew_res / 2.0) / w2->ew_res;
+
+ G_debug(1, "FINAL");
+ G_debug(1, "east = %f \n west = %f \n north = %f \n south = %f",
+ w2->east, w2->west, w2->north, w2->south);
+ G_debug(1, "RESOLUTION");
+ G_debug(1, "EW = %f", w2->ew_res);
+ G_debug(1, "NS = %f", w2->ns_res);
+
+ return 0;
+}
Deleted: grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.rectify/global.h
===================================================================
--- grass/branches/develbranch_6/imagery/i.ortho.photo/i.photo.rectify/global.h 2010-12-01 09:34:37 UTC (rev 44501)
+++ grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.rectify/global.h 2010-12-22 10:05:10 UTC (rev 44654)
@@ -1,50 +0,0 @@
-#include <grass/imagery.h>
-#include <grass/ortholib.h>
-#include <grass/glocale.h>
-#include "orthophoto.h"
-#include "defs.h"
-
-#ifndef GLOBAL
-#define GLOBAL extern
-#endif
-
-/* activate debug in Gmakefile */
-#ifdef DEBUG3
-GLOBAL FILE *Bugsr;
-#endif
-
-GLOBAL func interpolate; /* interpolation routine */
-
-GLOBAL int seg_mb_img, seg_mb_elev;
-GLOBAL char *method;
-GLOBAL int temp_fd;
-GLOBAL CELL **cell_buf;
-GLOBAL char *temp_name;
-
-GLOBAL char *extension;
-GLOBAL double target_res;
-
-GLOBAL int *ref_list;
-GLOBAL char **new_name;
-
-
-GLOBAL struct Ortho_Image_Group group;
-GLOBAL struct Ortho_Photo_Points cp;
-GLOBAL struct Ortho_Control_Points cpz;
-GLOBAL struct Ortho_Control_Points temp_points;
-GLOBAL struct Ortho_Camera_File_Ref cam_info;
-
-GLOBAL struct Cell_head elevhd;
-GLOBAL char *elev_layer;
-GLOBAL char *mapset_elev;
-
-
-/* georef coefficients */
-GLOBAL double E12[3], N12[3], Z12[3];
-GLOBAL double E21[3], N21[3], Z21[3];
-GLOBAL double E12a, E12b, E12c, N12a, N12b, N12c;
-GLOBAL double E21a, E21b, E21c, N21a, N21b, N21c;
-
-GLOBAL struct Cell_head target_window;
-
-#include "local_proto.h"
Copied: grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.rectify/global.h (from rev 44501, grass/branches/develbranch_6/imagery/i.ortho.photo/i.photo.rectify/global.h)
===================================================================
--- grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.rectify/global.h (rev 0)
+++ grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.rectify/global.h 2010-12-22 10:05:10 UTC (rev 44654)
@@ -0,0 +1,50 @@
+#include <grass/imagery.h>
+#include <grass/ortholib.h>
+#include <grass/glocale.h>
+#include "orthophoto.h"
+#include "defs.h"
+
+#ifndef GLOBAL
+#define GLOBAL extern
+#endif
+
+/* activate debug in Gmakefile */
+#ifdef DEBUG3
+GLOBAL FILE *Bugsr;
+#endif
+
+GLOBAL func interpolate; /* interpolation routine */
+
+GLOBAL int seg_mb_img, seg_mb_elev;
+GLOBAL char *method;
+GLOBAL int temp_fd;
+GLOBAL CELL **cell_buf;
+GLOBAL char *temp_name;
+
+GLOBAL char *extension;
+GLOBAL double target_res;
+
+GLOBAL int *ref_list;
+GLOBAL char **new_name;
+
+
+GLOBAL struct Ortho_Image_Group group;
+GLOBAL struct Ortho_Photo_Points cp;
+GLOBAL struct Ortho_Control_Points cpz;
+GLOBAL struct Ortho_Control_Points temp_points;
+GLOBAL struct Ortho_Camera_File_Ref cam_info;
+
+GLOBAL struct Cell_head elevhd;
+GLOBAL char *elev_layer;
+GLOBAL char *mapset_elev;
+
+
+/* georef coefficients */
+GLOBAL double E12[3], N12[3], Z12[3];
+GLOBAL double E21[3], N21[3], Z21[3];
+GLOBAL double E12a, E12b, E12c, N12a, N12b, N12c;
+GLOBAL double E21a, E21b, E21c, N21a, N21b, N21c;
+
+GLOBAL struct Cell_head target_window;
+
+#include "local_proto.h"
Deleted: grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.rectify/local_proto.h
===================================================================
--- grass/branches/develbranch_6/imagery/i.ortho.photo/i.photo.rectify/local_proto.h 2010-12-01 09:34:37 UTC (rev 44501)
+++ grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.rectify/local_proto.h 2010-12-22 10:05:10 UTC (rev 44654)
@@ -1,61 +0,0 @@
-/* ask_files.c */
-int ask_files(char *);
-
-/* ask_method.c */
-int ask_method(void);
-
-/* aver_z.c */
-int get_aver_elev(struct Ortho_Control_Points *, double *);
-
-/* cp.c */
-int get_conz_points(void);
-int get_ref_points(void);
-
-/* elev_data.c */
-int elev_data(char *, int);
-
-/* env.c */
-int select_current_env(void);
-int select_target_env(void);
-int show_env(void);
-
-/* equ.c */
-int Compute_ortho_equation(void);
-int Compute_ref_equation(void);
-
-/* exec.c */
-int exec_rectify(void);
-
-/* get_wind.c */
-int get_target_window(void);
-int georef_window(struct Cell_head *, struct Cell_head *, double);
-
-/* rectify.c */
-int rectify(char *, char *, struct cache *, double, char *);
-
-/* readcell.c */
-struct cache *readcell(int, int, int);
-block *get_block(struct cache *, int);
-
-/* report.c */
-int report(char *, char *, char *, long, long, int);
-
-/* target.c */
-int get_target(char *);
-
-/* declare resampling methods */
-/* bilinear.c */
-extern void p_bilinear(struct cache *, void *, int, double *, double *,
- struct Cell_head *);
-/* cubic.c */
-extern void p_cubic(struct cache *, void *, int, double *, double *,
- struct Cell_head *);
-/* nearest.c */
-extern void p_nearest(struct cache *, void *, int, double *, double *,
- struct Cell_head *);
-/* bilinear_f.c */
-extern void p_bilinear_f(struct cache *, void *, int, double *, double *,
- struct Cell_head *);
-/* cubic_f.c */
-extern void p_cubic_f(struct cache *, void *, int, double *, double *,
- struct Cell_head *);
Copied: grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.rectify/local_proto.h (from rev 44501, grass/branches/develbranch_6/imagery/i.ortho.photo/i.photo.rectify/local_proto.h)
===================================================================
--- grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.rectify/local_proto.h (rev 0)
+++ grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.rectify/local_proto.h 2010-12-22 10:05:10 UTC (rev 44654)
@@ -0,0 +1,61 @@
+/* ask_files.c */
+int ask_files(char *);
+
+/* ask_method.c */
+int ask_method(void);
+
+/* aver_z.c */
+int get_aver_elev(struct Ortho_Control_Points *, double *);
+
+/* cp.c */
+int get_conz_points(void);
+int get_ref_points(void);
+
+/* elev_data.c */
+int elev_data(char *, int);
+
+/* env.c */
+int select_current_env(void);
+int select_target_env(void);
+int show_env(void);
+
+/* equ.c */
+int Compute_ortho_equation(void);
+int Compute_ref_equation(void);
+
+/* exec.c */
+int exec_rectify(void);
+
+/* get_wind.c */
+int get_target_window(void);
+int georef_window(struct Cell_head *, struct Cell_head *, double);
+
+/* rectify.c */
+int rectify(char *, char *, struct cache *, double, char *);
+
+/* readcell.c */
+struct cache *readcell(int, int, int);
+block *get_block(struct cache *, int);
+
+/* report.c */
+int report(char *, char *, char *, long, long, int);
+
+/* target.c */
+int get_target(char *);
+
+/* declare resampling methods */
+/* bilinear.c */
+extern void p_bilinear(struct cache *, void *, int, double *, double *,
+ struct Cell_head *);
+/* cubic.c */
+extern void p_cubic(struct cache *, void *, int, double *, double *,
+ struct Cell_head *);
+/* nearest.c */
+extern void p_nearest(struct cache *, void *, int, double *, double *,
+ struct Cell_head *);
+/* bilinear_f.c */
+extern void p_bilinear_f(struct cache *, void *, int, double *, double *,
+ struct Cell_head *);
+/* cubic_f.c */
+extern void p_cubic_f(struct cache *, void *, int, double *, double *,
+ struct Cell_head *);
Deleted: grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.rectify/main.c
===================================================================
--- grass/branches/develbranch_6/imagery/i.ortho.photo/i.photo.rectify/main.c 2010-12-01 09:34:37 UTC (rev 44501)
+++ grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.rectify/main.c 2010-12-22 10:05:10 UTC (rev 44654)
@@ -1,140 +0,0 @@
-
-/****************************************************************************
- *
- * MODULE: i.photo.rectify
- * AUTHOR(S): Mike Baba, DBA Systems, Inc. (original contributor)
- * Markus Neteler <neteler itc.it>,
- * Bernhard Reiter <bernhard intevation.de>,
- * Glynn Clements <glynn gclements.plus.com>,
- * Hamish Bowman <hamish_b yahoo.com>,
- * Markus Metz
- *
- * PURPOSE: Rectifies an image by using the image to photo coordinate
- * transformation matrix
- * COPYRIGHT: (C) 1999-2010 by the GRASS Development Team
- *
- * This program is free software under the GNU General Public
- * License (>=v2). Read the file COPYING that comes with GRASS
- * for details.
- *
- *****************************************************************************/
-#define GLOBAL
-#include <stdlib.h>
-#include <string.h>
-#include <grass/gis.h>
-#include <grass/imagery.h>
-#include <grass/glocale.h>
-#include "global.h"
-
-int main(int argc, char *argv[])
-{
-
- char name[GNAME_MAX];
- char *camera;
- int n, nfiles;
- char tl[100];
- char math_exp[100];
- char units[100];
- char nd[100];
-
- struct GModule *module;
- struct Option *group_opt;
-
- /* must run in a term window */
- G_putenv("GRASS_UI_TERM", "1");
-
- G_gisinit(argv[0]);
-
- module = G_define_module();
- module->keywords = _("imagery, orthorectify");
- module->description =
- _("Interactively select or modify the imagery group target.");
-
- group_opt = G_define_standard_option(G_OPT_I_GROUP);
- group_opt->description =
- _("Name of imagery group for ortho-rectification");
-
- if (G_parser(argc, argv))
- exit(EXIT_FAILURE);
-
-
- G_suppress_masking(); /* need to do this for target location */
-
- strcpy(name, group_opt->answer);
-
- camera = (char *)G_malloc(GNAME_MAX * sizeof(char));
- elev_layer = (char *)G_malloc(GNAME_MAX * sizeof(char));
- mapset_elev = (char *)G_malloc(GMAPSET_MAX * sizeof(char));
-
- /* find group */
- strcpy(group.name, name);
- if (!I_find_group(group.name))
- G_fatal_error(_("Group [%s] not found"), group.name);
-
- /* get the group ref */
- if (!I_get_group_ref(group.name, (struct Ref *)&group.group_ref))
- G_fatal_error(_("Could not read REF file for group [%s]"), group.name);
- nfiles = group.group_ref.nfiles;
- if (nfiles <= 0)
- G_fatal_error(_("No files in this group!"));
-
- ref_list = (int *)G_malloc(nfiles * sizeof(int));
- new_name = (char **)G_malloc(nfiles * sizeof(char *));
- for (n = 0; n < nfiles; n++)
- ref_list[n] = -1;
-
- /* get the target */
- get_target(group.name);
-
- /* ask for files to be rectified */
- ask_files(group.name);
-
- G_debug(1, "Looking for elevation file in group: <%s>", group.name);
-
- /* get the block elevation layer raster map in target location */
- if (!I_get_group_elev(group.name, elev_layer, mapset_elev, tl,
- math_exp, units, nd))
- G_fatal_error(_("No target elevation model selected for group <%s>"),
- group.name);
-
- G_debug(1, "Block elevation: <%s> in <%s>", elev_layer, mapset_elev);
-
- /* get the elevation layer header in target location */
- select_target_env();
- G_get_cellhd(elev_layer, mapset_elev, &elevhd);
- select_current_env();
-
- /** look for camera info for this block **/
- if (!I_get_group_camera(group.name, camera))
- G_fatal_error(_("No camera reference file selected for group <%s>"),
- group.name);
-
- if (!I_get_cam_info(camera, &group.camera_ref))
- G_fatal_error(_("Bad format in camera file for group <%s>"),
- group.name);
-
- /* get initial camera exposure station, if any */
- if (I_find_initial(group.name)) {
- if (!I_get_init_info(group.name, &group.camera_exp))
- G_warning(_("Bad format in initial exposure station file for group <%s>"),
- group.name);
- }
-
- /* read the reference points for the group, compute image-to-photo trans. */
- get_ref_points();
-
- /* read the control points for the group, convert to photo coords. */
- get_conz_points();
-
- /* ask for window to be used in target location */
- select_current_env();
- get_target_window();
-
- /* ask for interpolation method and amount of memory to be used */
- ask_method();
-
- /* go do it */
- exec_rectify();
-
- exit(EXIT_SUCCESS);
-}
Copied: grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.rectify/main.c (from rev 44501, grass/branches/develbranch_6/imagery/i.ortho.photo/i.photo.rectify/main.c)
===================================================================
--- grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.rectify/main.c (rev 0)
+++ grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.rectify/main.c 2010-12-22 10:05:10 UTC (rev 44654)
@@ -0,0 +1,140 @@
+
+/****************************************************************************
+ *
+ * MODULE: i.photo.rectify
+ * AUTHOR(S): Mike Baba, DBA Systems, Inc. (original contributor)
+ * Markus Neteler <neteler itc.it>,
+ * Bernhard Reiter <bernhard intevation.de>,
+ * Glynn Clements <glynn gclements.plus.com>,
+ * Hamish Bowman <hamish_b yahoo.com>,
+ * Markus Metz
+ *
+ * PURPOSE: Rectifies an image by using the image to photo coordinate
+ * transformation matrix
+ * COPYRIGHT: (C) 1999-2010 by the GRASS Development Team
+ *
+ * This program is free software under the GNU General Public
+ * License (>=v2). Read the file COPYING that comes with GRASS
+ * for details.
+ *
+ *****************************************************************************/
+#define GLOBAL
+#include <stdlib.h>
+#include <string.h>
+#include <grass/gis.h>
+#include <grass/imagery.h>
+#include <grass/glocale.h>
+#include "global.h"
+
+int main(int argc, char *argv[])
+{
+
+ char name[GNAME_MAX];
+ char *camera;
+ int n, nfiles;
+ char tl[100];
+ char math_exp[100];
+ char units[100];
+ char nd[100];
+
+ struct GModule *module;
+ struct Option *group_opt;
+
+ /* must run in a term window */
+ G_putenv("GRASS_UI_TERM", "1");
+
+ G_gisinit(argv[0]);
+
+ module = G_define_module();
+ module->keywords = _("imagery, orthorectify");
+ module->description =
+ _("Interactively select or modify the imagery group target.");
+
+ group_opt = G_define_standard_option(G_OPT_I_GROUP);
+ group_opt->description =
+ _("Name of imagery group for ortho-rectification");
+
+ if (G_parser(argc, argv))
+ exit(EXIT_FAILURE);
+
+
+ G_suppress_masking(); /* need to do this for target location */
+
+ strcpy(name, group_opt->answer);
+
+ camera = (char *)G_malloc(GNAME_MAX * sizeof(char));
+ elev_layer = (char *)G_malloc(GNAME_MAX * sizeof(char));
+ mapset_elev = (char *)G_malloc(GMAPSET_MAX * sizeof(char));
+
+ /* find group */
+ strcpy(group.name, name);
+ if (!I_find_group(group.name))
+ G_fatal_error(_("Group [%s] not found"), group.name);
+
+ /* get the group ref */
+ if (!I_get_group_ref(group.name, (struct Ref *)&group.group_ref))
+ G_fatal_error(_("Could not read REF file for group [%s]"), group.name);
+ nfiles = group.group_ref.nfiles;
+ if (nfiles <= 0)
+ G_fatal_error(_("No files in this group!"));
+
+ ref_list = (int *)G_malloc(nfiles * sizeof(int));
+ new_name = (char **)G_malloc(nfiles * sizeof(char *));
+ for (n = 0; n < nfiles; n++)
+ ref_list[n] = -1;
+
+ /* get the target */
+ get_target(group.name);
+
+ /* ask for files to be rectified */
+ ask_files(group.name);
+
+ G_debug(1, "Looking for elevation file in group: <%s>", group.name);
+
+ /* get the block elevation layer raster map in target location */
+ if (!I_get_group_elev(group.name, elev_layer, mapset_elev, tl,
+ math_exp, units, nd))
+ G_fatal_error(_("No target elevation model selected for group <%s>"),
+ group.name);
+
+ G_debug(1, "Block elevation: <%s> in <%s>", elev_layer, mapset_elev);
+
+ /* get the elevation layer header in target location */
+ select_target_env();
+ G_get_cellhd(elev_layer, mapset_elev, &elevhd);
+ select_current_env();
+
+ /** look for camera info for this block **/
+ if (!I_get_group_camera(group.name, camera))
+ G_fatal_error(_("No camera reference file selected for group <%s>"),
+ group.name);
+
+ if (!I_get_cam_info(camera, &group.camera_ref))
+ G_fatal_error(_("Bad format in camera file for group <%s>"),
+ group.name);
+
+ /* get initial camera exposure station, if any */
+ if (I_find_initial(group.name)) {
+ if (!I_get_init_info(group.name, &group.camera_exp))
+ G_warning(_("Bad format in initial exposure station file for group <%s>"),
+ group.name);
+ }
+
+ /* read the reference points for the group, compute image-to-photo trans. */
+ get_ref_points();
+
+ /* read the control points for the group, convert to photo coords. */
+ get_conz_points();
+
+ /* ask for window to be used in target location */
+ select_current_env();
+ get_target_window();
+
+ /* ask for interpolation method and amount of memory to be used */
+ ask_method();
+
+ /* go do it */
+ exec_rectify();
+
+ exit(EXIT_SUCCESS);
+}
Deleted: grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.rectify/nearest.c
===================================================================
--- grass/branches/develbranch_6/imagery/i.ortho.photo/i.photo.rectify/nearest.c 2010-12-01 09:34:37 UTC (rev 44501)
+++ grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.rectify/nearest.c 2010-12-22 10:05:10 UTC (rev 44654)
@@ -1,40 +0,0 @@
-/*
- * nearest.c - returns the nearest neighbor to a given
- * x,y position
- */
-
-#include <math.h>
-#include <grass/gis.h>
-#include "global.h"
-
-void p_nearest(struct cache *ibuffer, /* input buffer */
- void *obufptr, /* ptr in output buffer */
- int cell_type, /* raster map type of obufptr */
- double *row_idx, /* row index in input matrix */
- double *col_idx, /* column index in input matrix */
- struct Cell_head *cellhd /* cell header of input layer */
- )
-{
- int row, col; /* row/col of nearest neighbor */
- DCELL *cellp;
-
- /* cut indices to integer and get nearest cell */
- /* the row_idx, col_idx correction for bilinear/bicubic does not apply here */
- row = (int)floor(*row_idx);
- col = (int)floor(*col_idx);
-
- /* check for out of bounds - if out of bounds set NULL value */
- if (row < 0 || row >= cellhd->rows || col < 0 || col >= cellhd->cols) {
- G_set_null_value(obufptr, 1, cell_type);
- return;
- }
-
- cellp = CPTR(ibuffer, row, col);
-
- if (G_is_d_null_value(cellp)) {
- G_set_null_value(obufptr, 1, cell_type);
- return;
- }
-
- G_set_raster_value_d(obufptr, *cellp, cell_type);
-}
Copied: grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.rectify/nearest.c (from rev 44501, grass/branches/develbranch_6/imagery/i.ortho.photo/i.photo.rectify/nearest.c)
===================================================================
--- grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.rectify/nearest.c (rev 0)
+++ grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.rectify/nearest.c 2010-12-22 10:05:10 UTC (rev 44654)
@@ -0,0 +1,40 @@
+/*
+ * nearest.c - returns the nearest neighbor to a given
+ * x,y position
+ */
+
+#include <math.h>
+#include <grass/gis.h>
+#include "global.h"
+
+void p_nearest(struct cache *ibuffer, /* input buffer */
+ void *obufptr, /* ptr in output buffer */
+ int cell_type, /* raster map type of obufptr */
+ double *row_idx, /* row index in input matrix */
+ double *col_idx, /* column index in input matrix */
+ struct Cell_head *cellhd /* cell header of input layer */
+ )
+{
+ int row, col; /* row/col of nearest neighbor */
+ DCELL *cellp;
+
+ /* cut indices to integer and get nearest cell */
+ /* the row_idx, col_idx correction for bilinear/bicubic does not apply here */
+ row = (int)floor(*row_idx);
+ col = (int)floor(*col_idx);
+
+ /* check for out of bounds - if out of bounds set NULL value */
+ if (row < 0 || row >= cellhd->rows || col < 0 || col >= cellhd->cols) {
+ G_set_null_value(obufptr, 1, cell_type);
+ return;
+ }
+
+ cellp = CPTR(ibuffer, row, col);
+
+ if (G_is_d_null_value(cellp)) {
+ G_set_null_value(obufptr, 1, cell_type);
+ return;
+ }
+
+ G_set_raster_value_d(obufptr, *cellp, cell_type);
+}
Deleted: grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.rectify/readcell.c
===================================================================
--- grass/branches/develbranch_6/imagery/i.ortho.photo/i.photo.rectify/readcell.c 2010-12-01 09:34:37 UTC (rev 44501)
+++ grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.rectify/readcell.c 2010-12-22 10:05:10 UTC (rev 44654)
@@ -1,132 +0,0 @@
-/*
- * readcell.c - reads an entire cell layer into a buffer
- *
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <unistd.h>
-#include <grass/gis.h>
-#include <grass/glocale.h>
-#include "global.h"
-
-struct cache *readcell(int fdi, int size, int target_env)
-{
- DCELL *tmpbuf;
- struct cache *c;
- int nrows;
- int ncols;
- int row;
- char *filename;
- int nx, ny;
- int nblocks;
- int i;
-
- nrows = G_window_rows();
- ncols = G_window_cols();
-
- ny = (nrows + BDIM - 1) / BDIM;
- nx = (ncols + BDIM - 1) / BDIM;
-
- if (size > 0)
- nblocks = size * ((1 << 20) / sizeof(block));
- else
- nblocks = (nx + ny) * 2; /* guess */
-
- if (nblocks > nx * ny)
- nblocks = nx * ny;
-
- c = G_malloc(sizeof(struct cache));
- c->stride = nx;
- c->nblocks = nblocks;
- c->grid = (block **) G_calloc(nx * ny, sizeof(block *));
- c->blocks = (block *) G_malloc(nblocks * sizeof(block));
- c->refs = (int *)G_malloc(nblocks * sizeof(int));
-
- if (nblocks < nx * ny) {
- /* Temporary file must be created in output location */
- select_target_env();
- filename = G_tempfile();
- if (!target_env)
- select_current_env();
- c->fd = open(filename, O_RDWR | O_CREAT | O_EXCL, 0600);
- if (c->fd < 0)
- G_fatal_error(_("Unable to open temporary file"));
- remove(filename);
- }
- else
- c->fd = -1;
-
- G_important_message(_("Allocating memory and reading input map..."));
- G_percent(0, nrows, 5);
-
- for (i = 0; i < c->nblocks; i++)
- c->refs[i] = -1;
-
- tmpbuf = (DCELL *) G_malloc(nx * sizeof(block));
-
- for (row = 0; row < nrows; row += BDIM) {
- int x, y;
-
- for (y = 0; y < BDIM; y++) {
- G_percent(row + y, nrows, 5);
-
- if (row + y >= nrows)
- break;
-
- G_get_d_raster_row(fdi, &tmpbuf[y * nx * BDIM], row + y);
- }
-
- for (x = 0; x < nx; x++)
- for (y = 0; y < BDIM; y++)
- if (c->fd >= 0) {
- if (write
- (c->fd, &tmpbuf[(y * nx + x) * BDIM],
- BDIM * sizeof(DCELL)) < 0)
- G_fatal_error(_("Error writing segment file"));
- }
- else
- memcpy(&c->blocks[BKIDX(c, HI(row), x)][LO(y)][0],
- &tmpbuf[(y * nx + x) * BDIM],
- BDIM * sizeof(DCELL));
- }
-
- G_free(tmpbuf);
-
- if (c->fd < 0)
- for (i = 0; i < c->nblocks; i++) {
- c->grid[i] = &c->blocks[i];
- c->refs[i] = i;
- }
-
- return c;
-}
-
-block *get_block(struct cache * c, int idx)
-{
- int replace = rand() % c->nblocks;
- block *p = &c->blocks[replace];
- int ref = c->refs[replace];
- off_t offset = (off_t) idx * sizeof(DCELL) << L2BSIZE;
-
- if (c->fd < 0)
- G_fatal_error(_("Internal error: cache miss on fully-cached map"));
-
- if (ref >= 0)
- c->grid[ref] = NULL;
-
- c->grid[idx] = p;
- c->refs[replace] = idx;
-
- if (lseek(c->fd, offset, SEEK_SET) < 0)
- G_fatal_error(_("Error seeking on segment file"));
-
- if (read(c->fd, p, sizeof(block)) < 0)
- G_fatal_error(_("Error writing segment file"));
-
- return p;
-}
Copied: grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.rectify/readcell.c (from rev 44501, grass/branches/develbranch_6/imagery/i.ortho.photo/i.photo.rectify/readcell.c)
===================================================================
--- grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.rectify/readcell.c (rev 0)
+++ grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.rectify/readcell.c 2010-12-22 10:05:10 UTC (rev 44654)
@@ -0,0 +1,132 @@
+/*
+ * readcell.c - reads an entire cell layer into a buffer
+ *
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <unistd.h>
+#include <grass/gis.h>
+#include <grass/glocale.h>
+#include "global.h"
+
+struct cache *readcell(int fdi, int size, int target_env)
+{
+ DCELL *tmpbuf;
+ struct cache *c;
+ int nrows;
+ int ncols;
+ int row;
+ char *filename;
+ int nx, ny;
+ int nblocks;
+ int i;
+
+ nrows = G_window_rows();
+ ncols = G_window_cols();
+
+ ny = (nrows + BDIM - 1) / BDIM;
+ nx = (ncols + BDIM - 1) / BDIM;
+
+ if (size > 0)
+ nblocks = size * ((1 << 20) / sizeof(block));
+ else
+ nblocks = (nx + ny) * 2; /* guess */
+
+ if (nblocks > nx * ny)
+ nblocks = nx * ny;
+
+ c = G_malloc(sizeof(struct cache));
+ c->stride = nx;
+ c->nblocks = nblocks;
+ c->grid = (block **) G_calloc(nx * ny, sizeof(block *));
+ c->blocks = (block *) G_malloc(nblocks * sizeof(block));
+ c->refs = (int *)G_malloc(nblocks * sizeof(int));
+
+ if (nblocks < nx * ny) {
+ /* Temporary file must be created in output location */
+ select_target_env();
+ filename = G_tempfile();
+ if (!target_env)
+ select_current_env();
+ c->fd = open(filename, O_RDWR | O_CREAT | O_EXCL, 0600);
+ if (c->fd < 0)
+ G_fatal_error(_("Unable to open temporary file"));
+ remove(filename);
+ }
+ else
+ c->fd = -1;
+
+ G_important_message(_("Allocating memory and reading input map..."));
+ G_percent(0, nrows, 5);
+
+ for (i = 0; i < c->nblocks; i++)
+ c->refs[i] = -1;
+
+ tmpbuf = (DCELL *) G_malloc(nx * sizeof(block));
+
+ for (row = 0; row < nrows; row += BDIM) {
+ int x, y;
+
+ for (y = 0; y < BDIM; y++) {
+ G_percent(row + y, nrows, 5);
+
+ if (row + y >= nrows)
+ break;
+
+ G_get_d_raster_row(fdi, &tmpbuf[y * nx * BDIM], row + y);
+ }
+
+ for (x = 0; x < nx; x++)
+ for (y = 0; y < BDIM; y++)
+ if (c->fd >= 0) {
+ if (write
+ (c->fd, &tmpbuf[(y * nx + x) * BDIM],
+ BDIM * sizeof(DCELL)) < 0)
+ G_fatal_error(_("Error writing segment file"));
+ }
+ else
+ memcpy(&c->blocks[BKIDX(c, HI(row), x)][LO(y)][0],
+ &tmpbuf[(y * nx + x) * BDIM],
+ BDIM * sizeof(DCELL));
+ }
+
+ G_free(tmpbuf);
+
+ if (c->fd < 0)
+ for (i = 0; i < c->nblocks; i++) {
+ c->grid[i] = &c->blocks[i];
+ c->refs[i] = i;
+ }
+
+ return c;
+}
+
+block *get_block(struct cache * c, int idx)
+{
+ int replace = rand() % c->nblocks;
+ block *p = &c->blocks[replace];
+ int ref = c->refs[replace];
+ off_t offset = (off_t) idx * sizeof(DCELL) << L2BSIZE;
+
+ if (c->fd < 0)
+ G_fatal_error(_("Internal error: cache miss on fully-cached map"));
+
+ if (ref >= 0)
+ c->grid[ref] = NULL;
+
+ c->grid[idx] = p;
+ c->refs[replace] = idx;
+
+ if (lseek(c->fd, offset, SEEK_SET) < 0)
+ G_fatal_error(_("Error seeking on segment file"));
+
+ if (read(c->fd, p, sizeof(block)) < 0)
+ G_fatal_error(_("Error writing segment file"));
+
+ return p;
+}
Deleted: grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.rectify/rectify.c
===================================================================
--- grass/branches/develbranch_6/imagery/i.ortho.photo/i.photo.rectify/rectify.c 2010-12-01 09:34:37 UTC (rev 44501)
+++ grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.rectify/rectify.c 2010-12-22 10:05:10 UTC (rev 44654)
@@ -1,143 +0,0 @@
-/* rectification code */
-
-/* 1/2002: updated to GRASS 5 write routines and
- CELL/FP elevation - Markus Neteler
- */
-
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-#include <grass/glocale.h>
-#include "global.h"
-#include "local_proto.h"
-
-int rectify(char *name, char *mapset, struct cache *ebuffer,
- double aver_z, char *result)
-{
- struct Cell_head cellhd;
- int ncols, nrows;
- int row, col;
- int infd, outfd;
- RASTER_MAP_TYPE map_type;
- int cell_size;
- void *trast, *tptr;
- double n1, e1, z1;
- double nx, ex, nx1, ex1, zx1;
- double row_idx, col_idx;
- struct cache *ibuffer;
-
- select_current_env();
- if (G_get_cellhd(name, mapset, &cellhd) < 0)
- return 0;
-
- /* open the file to be rectified
- * set window to cellhd first to be able to read file exactly
- */
- G_set_window(&cellhd);
- G_debug(2, "cellhd: rs=%d cs=%d n=%f s=%f w=%f e=%f\n",
- cellhd.rows, cellhd.cols, cellhd.north,
- cellhd.south, cellhd.west, cellhd.east);
-
- infd = G_open_cell_old(name, mapset);
- if (infd < 0) {
- return 0;
- }
- map_type = G_get_raster_map_type(infd);
- cell_size = G_raster_size(map_type);
- if (strcmp(method, "nearest") != 0) {
- map_type = DCELL_TYPE;
- cell_size = G_raster_size(map_type);
- }
-
- ibuffer = readcell(infd, seg_mb_img, 0);
-
- G_close_cell(infd); /* (pmx) 17 april 2000 */
-
- G_message(_("Rectify <%s@%s> (location <%s>)"),
- name, mapset, G_location());
- select_target_env();
- G_message(_("into <%s@%s> (location <%s>) ..."),
- result, G_mapset(), G_location());
-
- G_set_window(&target_window);
- nrows = target_window.rows;
- ncols = target_window.cols;
-
- outfd = G_open_raster_new(result, map_type);
- trast = G_allocate_raster_buf(map_type);
-
- for (row = 0; row < nrows; row++) {
- n1 = target_window.north - (row + 0.5) * target_window.ns_res;
-
- G_percent(row, nrows, 2);
-
- G_set_null_value(trast, ncols, map_type);
- tptr = trast;
- for (col = 0; col < ncols; col++) {
- DCELL *zp = CPTR(ebuffer, row, col);
-
- e1 = target_window.west + (col + 0.5) * target_window.ew_res;
-
- /* if target cell has no elevation, set to aver_z */
- if (G_is_d_null_value(zp)) {
- G_warning(_("No elevation available at row = %d, col = %d"), row, col);
- z1 = aver_z;
- }
- else
- z1 = *zp;
-
- /* target coordinates e1, n1 to photo coordinates ex1, nx1 */
- I_ortho_ref(e1, n1, z1, &ex1, &nx1, &zx1, &group.camera_ref,
- group.XC, group.YC, group.ZC, group.M);
-
- G_debug(5, "\t\tAfter ortho ref (photo cords): ex = %f \t nx = %f",
- ex1, nx1);
-
- /* photo coordinates ex1, nx1 to image coordinates ex, nx */
- I_georef(ex1, nx1, &ex, &nx, group.E21, group.N21);
-
- G_debug(5, "\t\tAfter geo ref: ex = %f \t nx = %f", ex, nx);
-
- /* convert to row/column indices of source raster */
- row_idx = (cellhd.north - nx) / cellhd.ns_res;
- col_idx = (ex - cellhd.west) / cellhd.ew_res;
-
- /* resample data point */
- interpolate(ibuffer, tptr, map_type, &row_idx, &col_idx, &cellhd);
-
- tptr = G_incr_void_ptr(tptr, cell_size);
- }
- G_put_raster_row(outfd, trast, map_type);
- }
- G_percent(1, 1, 1);
-
- G_free(trast);
-
- G_close_cell(outfd);
- close(ibuffer->fd);
- G_free(ibuffer);
-
- if (G_get_cellhd(result, G_mapset(), &cellhd) < 0)
- return 0;
-
- if (cellhd.proj == 0) { /* x,y imagery */
- cellhd.proj = target_window.proj;
- cellhd.zone = target_window.zone;
- }
-
- if (target_window.proj != cellhd.proj) {
- cellhd.proj = target_window.proj;
- G_warning(_("%s@%s: projection doesn't match current settings"),
- name, mapset);
- }
-
- if (target_window.zone != cellhd.zone) {
- cellhd.zone = target_window.zone;
- G_warning(_("%s@%s: zone doesn't match current settings"),
- name, mapset);
- }
-
- select_current_env();
-
- return 1;
-}
Copied: grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.rectify/rectify.c (from rev 44501, grass/branches/develbranch_6/imagery/i.ortho.photo/i.photo.rectify/rectify.c)
===================================================================
--- grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.rectify/rectify.c (rev 0)
+++ grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.rectify/rectify.c 2010-12-22 10:05:10 UTC (rev 44654)
@@ -0,0 +1,143 @@
+/* rectification code */
+
+/* 1/2002: updated to GRASS 5 write routines and
+ CELL/FP elevation - Markus Neteler
+ */
+
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+#include <grass/glocale.h>
+#include "global.h"
+#include "local_proto.h"
+
+int rectify(char *name, char *mapset, struct cache *ebuffer,
+ double aver_z, char *result)
+{
+ struct Cell_head cellhd;
+ int ncols, nrows;
+ int row, col;
+ int infd, outfd;
+ RASTER_MAP_TYPE map_type;
+ int cell_size;
+ void *trast, *tptr;
+ double n1, e1, z1;
+ double nx, ex, nx1, ex1, zx1;
+ double row_idx, col_idx;
+ struct cache *ibuffer;
+
+ select_current_env();
+ if (G_get_cellhd(name, mapset, &cellhd) < 0)
+ return 0;
+
+ /* open the file to be rectified
+ * set window to cellhd first to be able to read file exactly
+ */
+ G_set_window(&cellhd);
+ G_debug(2, "cellhd: rs=%d cs=%d n=%f s=%f w=%f e=%f\n",
+ cellhd.rows, cellhd.cols, cellhd.north,
+ cellhd.south, cellhd.west, cellhd.east);
+
+ infd = G_open_cell_old(name, mapset);
+ if (infd < 0) {
+ return 0;
+ }
+ map_type = G_get_raster_map_type(infd);
+ cell_size = G_raster_size(map_type);
+ if (strcmp(method, "nearest") != 0) {
+ map_type = DCELL_TYPE;
+ cell_size = G_raster_size(map_type);
+ }
+
+ ibuffer = readcell(infd, seg_mb_img, 0);
+
+ G_close_cell(infd); /* (pmx) 17 april 2000 */
+
+ G_message(_("Rectify <%s@%s> (location <%s>)"),
+ name, mapset, G_location());
+ select_target_env();
+ G_message(_("into <%s@%s> (location <%s>) ..."),
+ result, G_mapset(), G_location());
+
+ G_set_window(&target_window);
+ nrows = target_window.rows;
+ ncols = target_window.cols;
+
+ outfd = G_open_raster_new(result, map_type);
+ trast = G_allocate_raster_buf(map_type);
+
+ for (row = 0; row < nrows; row++) {
+ n1 = target_window.north - (row + 0.5) * target_window.ns_res;
+
+ G_percent(row, nrows, 2);
+
+ G_set_null_value(trast, ncols, map_type);
+ tptr = trast;
+ for (col = 0; col < ncols; col++) {
+ DCELL *zp = CPTR(ebuffer, row, col);
+
+ e1 = target_window.west + (col + 0.5) * target_window.ew_res;
+
+ /* if target cell has no elevation, set to aver_z */
+ if (G_is_d_null_value(zp)) {
+ G_warning(_("No elevation available at row = %d, col = %d"), row, col);
+ z1 = aver_z;
+ }
+ else
+ z1 = *zp;
+
+ /* target coordinates e1, n1 to photo coordinates ex1, nx1 */
+ I_ortho_ref(e1, n1, z1, &ex1, &nx1, &zx1, &group.camera_ref,
+ group.XC, group.YC, group.ZC, group.M);
+
+ G_debug(5, "\t\tAfter ortho ref (photo cords): ex = %f \t nx = %f",
+ ex1, nx1);
+
+ /* photo coordinates ex1, nx1 to image coordinates ex, nx */
+ I_georef(ex1, nx1, &ex, &nx, group.E21, group.N21);
+
+ G_debug(5, "\t\tAfter geo ref: ex = %f \t nx = %f", ex, nx);
+
+ /* convert to row/column indices of source raster */
+ row_idx = (cellhd.north - nx) / cellhd.ns_res;
+ col_idx = (ex - cellhd.west) / cellhd.ew_res;
+
+ /* resample data point */
+ interpolate(ibuffer, tptr, map_type, &row_idx, &col_idx, &cellhd);
+
+ tptr = G_incr_void_ptr(tptr, cell_size);
+ }
+ G_put_raster_row(outfd, trast, map_type);
+ }
+ G_percent(1, 1, 1);
+
+ G_free(trast);
+
+ G_close_cell(outfd);
+ close(ibuffer->fd);
+ G_free(ibuffer);
+
+ if (G_get_cellhd(result, G_mapset(), &cellhd) < 0)
+ return 0;
+
+ if (cellhd.proj == 0) { /* x,y imagery */
+ cellhd.proj = target_window.proj;
+ cellhd.zone = target_window.zone;
+ }
+
+ if (target_window.proj != cellhd.proj) {
+ cellhd.proj = target_window.proj;
+ G_warning(_("%s@%s: projection doesn't match current settings"),
+ name, mapset);
+ }
+
+ if (target_window.zone != cellhd.zone) {
+ cellhd.zone = target_window.zone;
+ G_warning(_("%s@%s: zone doesn't match current settings"),
+ name, mapset);
+ }
+
+ select_current_env();
+
+ return 1;
+}
Deleted: grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.rectify/report.c
===================================================================
--- grass/branches/develbranch_6/imagery/i.ortho.photo/i.photo.rectify/report.c 2010-12-01 09:34:37 UTC (rev 44501)
+++ grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.rectify/report.c 2010-12-22 10:05:10 UTC (rev 44654)
@@ -1,56 +0,0 @@
-#include "global.h"
-int
-report(char *name, char *mapset, char *result, long rectify, long compress,
- int ok)
-{
- int minutes, hours;
- long seconds;
- long ncells;
-
- select_current_env();
- fprintf(stderr, "***********************************************\n");
- fprintf(stderr, "Rectify [%s in %s] (LOCATION %s)\n",
- name, mapset, G_location());
- fprintf(stderr, " into [%s in ", result);
- select_target_env();
- fprintf(stderr, "%s] (LOCATION %s)\n", G_mapset(), G_location());
- fprintf(stderr, "%s\n", ok ? "complete" : "failed");
- fprintf(stderr, "-----------------------------------------------\n");
- select_current_env();
-
- if (!ok)
- return 1;
-
- seconds = rectify;
- minutes = seconds / 60;
- hours = minutes / 60;
- minutes -= hours * 60;
- ncells = target_window.rows * target_window.cols;
- fprintf(stderr, " %d rows, %d cols (%ld cells) completed in ",
- target_window.rows, target_window.cols, ncells);
- if (hours)
- fprintf(stderr, "%d:%02d:%02ld\n", hours, minutes, seconds % 60);
- else
- fprintf(stderr, "%d:%02ld\n", minutes, seconds % 60);
- if (seconds)
- fprintf(stderr, " %.1f cells per minute\n",
- (60.0 * ncells) / ((double)seconds));
-
- fprintf(stderr, "\n");
-
- seconds = compress;
-
- if (seconds <= 0)
- return 1;
-
- minutes = seconds / 60;
- hours = minutes / 60;
- minutes -= hours * 60;
- fprintf(stderr, " data compression required an additional ");
- if (hours)
- fprintf(stderr, "%d:%02d:%02ld\n", hours, minutes, seconds % 60);
- else
- fprintf(stderr, "%d:%02ld\n", minutes, seconds % 60);
-
- return 0;
-}
Copied: grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.rectify/report.c (from rev 44501, grass/branches/develbranch_6/imagery/i.ortho.photo/i.photo.rectify/report.c)
===================================================================
--- grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.rectify/report.c (rev 0)
+++ grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.rectify/report.c 2010-12-22 10:05:10 UTC (rev 44654)
@@ -0,0 +1,56 @@
+#include "global.h"
+int
+report(char *name, char *mapset, char *result, long rectify, long compress,
+ int ok)
+{
+ int minutes, hours;
+ long seconds;
+ long ncells;
+
+ select_current_env();
+ fprintf(stderr, "***********************************************\n");
+ fprintf(stderr, "Rectify [%s in %s] (LOCATION %s)\n",
+ name, mapset, G_location());
+ fprintf(stderr, " into [%s in ", result);
+ select_target_env();
+ fprintf(stderr, "%s] (LOCATION %s)\n", G_mapset(), G_location());
+ fprintf(stderr, "%s\n", ok ? "complete" : "failed");
+ fprintf(stderr, "-----------------------------------------------\n");
+ select_current_env();
+
+ if (!ok)
+ return 1;
+
+ seconds = rectify;
+ minutes = seconds / 60;
+ hours = minutes / 60;
+ minutes -= hours * 60;
+ ncells = target_window.rows * target_window.cols;
+ fprintf(stderr, " %d rows, %d cols (%ld cells) completed in ",
+ target_window.rows, target_window.cols, ncells);
+ if (hours)
+ fprintf(stderr, "%d:%02d:%02ld\n", hours, minutes, seconds % 60);
+ else
+ fprintf(stderr, "%d:%02ld\n", minutes, seconds % 60);
+ if (seconds)
+ fprintf(stderr, " %.1f cells per minute\n",
+ (60.0 * ncells) / ((double)seconds));
+
+ fprintf(stderr, "\n");
+
+ seconds = compress;
+
+ if (seconds <= 0)
+ return 1;
+
+ minutes = seconds / 60;
+ hours = minutes / 60;
+ minutes -= hours * 60;
+ fprintf(stderr, " data compression required an additional ");
+ if (hours)
+ fprintf(stderr, "%d:%02d:%02ld\n", hours, minutes, seconds % 60);
+ else
+ fprintf(stderr, "%d:%02ld\n", minutes, seconds % 60);
+
+ return 0;
+}
Deleted: grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.rectify/target.c
===================================================================
--- grass/branches/develbranch_6/imagery/i.ortho.photo/i.photo.rectify/target.c 2010-12-01 09:34:37 UTC (rev 44501)
+++ grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.rectify/target.c 2010-12-22 10:05:10 UTC (rev 44654)
@@ -1,35 +0,0 @@
-#include <unistd.h>
-#include <string.h>
-#include "global.h"
-
-int get_target(char *name)
-{
- char location[40];
- char mapset[40];
- char buf[1024];
- int stat;
-
- if (!I_get_target(name, location, mapset)) {
- sprintf(buf, "Target information for group [%s] missing.\n", name);
- goto error;
- }
-
- sprintf(buf, "%s/%s", G_gisdbase(), location);
- if (access(buf, 0) != 0) {
- sprintf(buf, "Target location [%s] not found\n", location);
- goto error;
- }
- select_target_env();
- G__setenv("LOCATION_NAME", location);
- stat = G__mapset_permissions(mapset);
- if (stat > 0) {
- G__setenv("MAPSET", mapset);
- G_get_window(&target_window);
- select_current_env();
- return 1;
- }
- sprintf(buf, "Mapset [%s] in target location [%s] - ", mapset, location);
- strcat(buf, stat == 0 ? "permission denied\n" : "not found\n");
- error:
- G_fatal_error(buf);
-}
Copied: grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.rectify/target.c (from rev 44501, grass/branches/develbranch_6/imagery/i.ortho.photo/i.photo.rectify/target.c)
===================================================================
--- grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.rectify/target.c (rev 0)
+++ grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.rectify/target.c 2010-12-22 10:05:10 UTC (rev 44654)
@@ -0,0 +1,35 @@
+#include <unistd.h>
+#include <string.h>
+#include "global.h"
+
+int get_target(char *name)
+{
+ char location[40];
+ char mapset[40];
+ char buf[1024];
+ int stat;
+
+ if (!I_get_target(name, location, mapset)) {
+ sprintf(buf, "Target information for group [%s] missing.\n", name);
+ goto error;
+ }
+
+ sprintf(buf, "%s/%s", G_gisdbase(), location);
+ if (access(buf, 0) != 0) {
+ sprintf(buf, "Target location [%s] not found\n", location);
+ goto error;
+ }
+ select_target_env();
+ G__setenv("LOCATION_NAME", location);
+ stat = G__mapset_permissions(mapset);
+ if (stat > 0) {
+ G__setenv("MAPSET", mapset);
+ G_get_window(&target_window);
+ select_current_env();
+ return 1;
+ }
+ sprintf(buf, "Mapset [%s] in target location [%s] - ", mapset, location);
+ strcat(buf, stat == 0 ? "permission denied\n" : "not found\n");
+ error:
+ G_fatal_error(buf);
+}
Property changes on: grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.target
___________________________________________________________________
Added: svn:ignore
+ *.tmp.html
*OBJ*
Deleted: grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.target/Makefile
===================================================================
--- grass/branches/develbranch_6/imagery/i.ortho.photo/i.photo.target/Makefile 2010-12-01 09:34:37 UTC (rev 44501)
+++ grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.target/Makefile 2010-12-22 10:05:10 UTC (rev 44654)
@@ -1,15 +0,0 @@
-MODULE_TOPDIR = ../../..
-
-PGM = i.photo.target
-
-EXTRA_CFLAGS = -I../libes
-
-LIBES = $(IMAGERYLIB) $(GISLIB) $(IORTHOLIB) $(VASKLIB) $(CURSES) $(GMATHLIB)
-DEPENDENCIES= $(IMAGERYDEP) $(IORTHODEP) $(GISDEP) $(VASKDEP) $(GMATHDEP)
-
-include $(MODULE_TOPDIR)/include/Make/Module.make
-
-default: etc
-
-htmletc:
- @echo No docs needed for $(PGM)
Copied: grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.target/Makefile (from rev 44501, grass/branches/develbranch_6/imagery/i.ortho.photo/i.photo.target/Makefile)
===================================================================
--- grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.target/Makefile (rev 0)
+++ grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.target/Makefile 2010-12-22 10:05:10 UTC (rev 44654)
@@ -0,0 +1,15 @@
+MODULE_TOPDIR = ../../..
+
+PGM = i.photo.target
+
+EXTRA_CFLAGS = -I../libes
+
+LIBES = $(IMAGERYLIB) $(GISLIB) $(IORTHOLIB) $(VASKLIB) $(CURSES) $(GMATHLIB)
+DEPENDENCIES= $(IMAGERYDEP) $(IORTHODEP) $(GISDEP) $(VASKDEP) $(GMATHDEP)
+
+include $(MODULE_TOPDIR)/include/Make/Module.make
+
+default: etc
+
+htmletc:
+ @echo No docs needed for $(PGM)
Deleted: grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.target/ask_target.c
===================================================================
--- grass/branches/develbranch_6/imagery/i.ortho.photo/i.photo.target/ask_target.c 2010-12-01 09:34:37 UTC (rev 44501)
+++ grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.target/ask_target.c 2010-12-22 10:05:10 UTC (rev 44654)
@@ -1,144 +0,0 @@
-/* ask_target.c */
-
-#include <stdlib.h>
-#include <unistd.h>
-#include <string.h>
-#include <grass/gis.h>
-#include <grass/vask.h>
-#include "local_proto.h"
-
-int ask_target(char *group, char *location, char *mapset)
-{
- char buf[100];
- char t1[80], t2[80], t3[80];
- char cur_location[30], cur_mapset[30];
-
- strcpy(cur_location, location);
- strcpy(cur_mapset, mapset);
-
- sprintf(t1, "Please select the target LOCATION and MAPSET for group<%s>",
- group);
- sprintf(t2, "CURRENT LOCATION: %s", G_location());
- sprintf(t3, "CURRENT MAPSET: %s", G_mapset());
-
- V_clear();
- V_line(1, t1);
- V_line(4, t2);
- V_line(5, t3);
- V_line(9, "TARGET LOCATION:");
- V_line(10, "TARGET MAPSET:");
- V_line(12,
- "(enter list for a list of locations or mapsets within a location)");
- V_ques(location, 's', 9, 18, 20);
- V_ques(mapset, 's', 10, 18, 20);
-
- for (;;) {
- if (strcmp(location, "list") == 0)
- strcpy(location, cur_location);
- if (strcmp(mapset, "list") == 0)
- strcpy(mapset, cur_mapset);
-
- V_intrpt_ok();
- if (!V_call())
- exit(0);
- if (*location == 0 && *mapset == 0)
- exit(0);
-
- if (*location == 0 || strcmp(location, "list") == 0)
- list_locations();
- else if (no_location(location)) {
- fprintf(stderr, "\n** <%s> - unknown location\n", location);
- list_locations();
- }
- else {
- G__setenv("LOCATION_NAME", location);
- if (*mapset == 0 || strcmp(mapset, "list") == 0)
- list_mapsets();
- else if (mapset_ok(mapset))
- break;
- else
- list_mapsets();
- }
- fprintf(stderr, "Hit RETURN -->");
- G_gets(buf);
- }
-
- return 0;
-}
-
-int list_locations(void)
-{
- char buf[1024];
-
- sprintf(buf, "ls -C %s\n", G_gisdbase());
- fprintf(stderr, "\nKnown locations:\n");
- system(buf);
-
- return 0;
-}
-
-int no_location(char *location)
-{
- char buf[1024];
-
- sprintf(buf, "%s/%s", G_gisdbase(), location);
- return access(buf, 0) != 0;
-}
-
-int list_mapsets(void)
-{
- char buf[1024];
- FILE *fd;
- int any, ok, any_ok;
- int len, tot_len;
-
- sprintf(buf, "ls %s/%s", G_gisdbase(), G_location());
- fprintf(stderr, "LOCATION %s\n", G_location());
- fprintf(stderr, "\nAvailable mapsets:\n");
- fd = popen(buf, "r");
- any = 0;
- any_ok = 0;
- tot_len = 0;
- if (fd) {
- while (fscanf(fd, "%s", buf) == 1) {
- any = 1;
- len = strlen(buf) + 1;
- len /= 20;
- len = (len + 1) * 20;
- tot_len += len;
- if (tot_len > 75) {
- fprintf(stderr, "\n");
- tot_len = len;
- }
- if ((ok = (G__mapset_permissions(buf)) == 1))
- any_ok = 1;
- fprintf(stderr, "%s%-*s", ok ? "(+)" : " ", len, buf);
- }
- pclose(fd);
- if (tot_len)
- fprintf(stderr, "\n");
- if (any_ok)
- fprintf(stderr,
- "\nnote: you only have access to mapsets marked with (+)\n");
- else if (any)
- fprintf(stderr,
- "\nnote: you do not have access to any of these mapsets\n");
- }
-
- return 0;
-}
-
-int mapset_ok(char *mapset)
-{
- switch (G__mapset_permissions(mapset)) {
- case 1:
- return 1;
- case 0:
- fprintf(stderr, "\n** <%s> - permission to mapset denied **\n",
- mapset);
- return 0;
- default:
- fprintf(stderr, "\n** <%s> - mapset not found **\n", mapset);
- return 0;
- }
-}
Copied: grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.target/ask_target.c (from rev 44501, grass/branches/develbranch_6/imagery/i.ortho.photo/i.photo.target/ask_target.c)
===================================================================
--- grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.target/ask_target.c (rev 0)
+++ grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.target/ask_target.c 2010-12-22 10:05:10 UTC (rev 44654)
@@ -0,0 +1,144 @@
+/* ask_target.c */
+
+#include <stdlib.h>
+#include <unistd.h>
+#include <string.h>
+#include <grass/gis.h>
+#include <grass/vask.h>
+#include "local_proto.h"
+
+int ask_target(char *group, char *location, char *mapset)
+{
+ char buf[100];
+ char t1[80], t2[80], t3[80];
+ char cur_location[30], cur_mapset[30];
+
+ strcpy(cur_location, location);
+ strcpy(cur_mapset, mapset);
+
+ sprintf(t1, "Please select the target LOCATION and MAPSET for group<%s>",
+ group);
+ sprintf(t2, "CURRENT LOCATION: %s", G_location());
+ sprintf(t3, "CURRENT MAPSET: %s", G_mapset());
+
+ V_clear();
+ V_line(1, t1);
+ V_line(4, t2);
+ V_line(5, t3);
+ V_line(9, "TARGET LOCATION:");
+ V_line(10, "TARGET MAPSET:");
+ V_line(12,
+ "(enter list for a list of locations or mapsets within a location)");
+ V_ques(location, 's', 9, 18, 20);
+ V_ques(mapset, 's', 10, 18, 20);
+
+ for (;;) {
+ if (strcmp(location, "list") == 0)
+ strcpy(location, cur_location);
+ if (strcmp(mapset, "list") == 0)
+ strcpy(mapset, cur_mapset);
+
+ V_intrpt_ok();
+ if (!V_call())
+ exit(0);
+ if (*location == 0 && *mapset == 0)
+ exit(0);
+
+ if (*location == 0 || strcmp(location, "list") == 0)
+ list_locations();
+ else if (no_location(location)) {
+ fprintf(stderr, "\n** <%s> - unknown location\n", location);
+ list_locations();
+ }
+ else {
+ G__setenv("LOCATION_NAME", location);
+ if (*mapset == 0 || strcmp(mapset, "list") == 0)
+ list_mapsets();
+ else if (mapset_ok(mapset))
+ break;
+ else
+ list_mapsets();
+ }
+ fprintf(stderr, "Hit RETURN -->");
+ G_gets(buf);
+ }
+
+ return 0;
+}
+
+int list_locations(void)
+{
+ char buf[1024];
+
+ sprintf(buf, "ls -C %s\n", G_gisdbase());
+ fprintf(stderr, "\nKnown locations:\n");
+ system(buf);
+
+ return 0;
+}
+
+int no_location(char *location)
+{
+ char buf[1024];
+
+ sprintf(buf, "%s/%s", G_gisdbase(), location);
+ return access(buf, 0) != 0;
+}
+
+int list_mapsets(void)
+{
+ char buf[1024];
+ FILE *fd;
+ int any, ok, any_ok;
+ int len, tot_len;
+
+ sprintf(buf, "ls %s/%s", G_gisdbase(), G_location());
+ fprintf(stderr, "LOCATION %s\n", G_location());
+ fprintf(stderr, "\nAvailable mapsets:\n");
+ fd = popen(buf, "r");
+ any = 0;
+ any_ok = 0;
+ tot_len = 0;
+ if (fd) {
+ while (fscanf(fd, "%s", buf) == 1) {
+ any = 1;
+ len = strlen(buf) + 1;
+ len /= 20;
+ len = (len + 1) * 20;
+ tot_len += len;
+ if (tot_len > 75) {
+ fprintf(stderr, "\n");
+ tot_len = len;
+ }
+ if ((ok = (G__mapset_permissions(buf)) == 1))
+ any_ok = 1;
+ fprintf(stderr, "%s%-*s", ok ? "(+)" : " ", len, buf);
+ }
+ pclose(fd);
+ if (tot_len)
+ fprintf(stderr, "\n");
+ if (any_ok)
+ fprintf(stderr,
+ "\nnote: you only have access to mapsets marked with (+)\n");
+ else if (any)
+ fprintf(stderr,
+ "\nnote: you do not have access to any of these mapsets\n");
+ }
+
+ return 0;
+}
+
+int mapset_ok(char *mapset)
+{
+ switch (G__mapset_permissions(mapset)) {
+ case 1:
+ return 1;
+ case 0:
+ fprintf(stderr, "\n** <%s> - permission to mapset denied **\n",
+ mapset);
+ return 0;
+ default:
+ fprintf(stderr, "\n** <%s> - mapset not found **\n", mapset);
+ return 0;
+ }
+}
Deleted: grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.target/local_proto.h
===================================================================
--- grass/branches/develbranch_6/imagery/i.ortho.photo/i.photo.target/local_proto.h 2010-12-01 09:34:37 UTC (rev 44501)
+++ grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.target/local_proto.h 2010-12-22 10:05:10 UTC (rev 44654)
@@ -1,6 +0,0 @@
-/* ask_target.c */
-int ask_target(char *, char *, char *);
-int list_locations(void);
-int no_location(char *);
-int list_mapsets(void);
-int mapset_ok(char *);
Copied: grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.target/local_proto.h (from rev 44501, grass/branches/develbranch_6/imagery/i.ortho.photo/i.photo.target/local_proto.h)
===================================================================
--- grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.target/local_proto.h (rev 0)
+++ grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.target/local_proto.h 2010-12-22 10:05:10 UTC (rev 44654)
@@ -0,0 +1,6 @@
+/* ask_target.c */
+int ask_target(char *, char *, char *);
+int list_locations(void);
+int no_location(char *);
+int list_mapsets(void);
+int mapset_ok(char *);
Deleted: grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.target/main.c
===================================================================
--- grass/branches/develbranch_6/imagery/i.ortho.photo/i.photo.target/main.c 2010-12-01 09:34:37 UTC (rev 44501)
+++ grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.target/main.c 2010-12-22 10:05:10 UTC (rev 44654)
@@ -1,70 +0,0 @@
-
-/****************************************************************************
- *
- * MODULE: i.photo.target
- * AUTHOR(S): Mike Baba, DBA Systems, Inc. (original contributor)
- * Markus Neteler <neteler itc.it>,
- * Roberto Flor <flor itc.it>,
- * Bernhard Reiter <bernhard intevation.de>,
- * Glynn Clements <glynn gclements.plus.com>
- * Hamish Bowman
- *
- * PURPOSE: Select target location and mapset
- * COPYRIGHT: (C) 1999-2008 by the GRASS Development Team
- *
- * This program is free software under the GNU General Public
- * License (>=v2). Read the file COPYING that comes with GRASS
- * for details.
- *
- *****************************************************************************/
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#include <grass/gis.h>
-#include <grass/imagery.h>
-#include <grass/glocale.h>
-#include "orthophoto.h"
-#include "local_proto.h"
-
-int main(int argc, char *argv[])
-{
- struct GModule *module;
- struct Option *group_opt;
-
- char location[GMAPSET_MAX];
- char mapset[GMAPSET_MAX];
- char group[GNAME_MAX];
-
-
- /* must run in a term window */
- G_putenv("GRASS_UI_TERM", "1");
-
- G_gisinit(argv[0]);
-
- module = G_define_module();
- module->keywords = _("imagery, orthorectify");
- module->description =
- _("Interactively select or modify the imagery group target.");
-
- group_opt = G_define_standard_option(G_OPT_I_GROUP);
- group_opt->description =
- _("Name of imagery group for ortho-rectification");
-
- if (G_parser(argc, argv))
- exit(EXIT_FAILURE);
-
-
- strcpy(group, group_opt->answer);
-
- I_get_target(group, location, mapset);
- G__create_alt_env();
- ask_target(group, location, mapset);
- G__switch_env();
- I_put_target(group, location, mapset);
-
- G_message(_("Group [%s] targeted for location [%s], mapset [%s]"),
- group, location, mapset);
-
- exit(EXIT_SUCCESS);
-}
Copied: grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.target/main.c (from rev 44501, grass/branches/develbranch_6/imagery/i.ortho.photo/i.photo.target/main.c)
===================================================================
--- grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.target/main.c (rev 0)
+++ grass/branches/releasebranch_6_4/imagery/i.ortho.photo/i.photo.target/main.c 2010-12-22 10:05:10 UTC (rev 44654)
@@ -0,0 +1,70 @@
+
+/****************************************************************************
+ *
+ * MODULE: i.photo.target
+ * AUTHOR(S): Mike Baba, DBA Systems, Inc. (original contributor)
+ * Markus Neteler <neteler itc.it>,
+ * Roberto Flor <flor itc.it>,
+ * Bernhard Reiter <bernhard intevation.de>,
+ * Glynn Clements <glynn gclements.plus.com>
+ * Hamish Bowman
+ *
+ * PURPOSE: Select target location and mapset
+ * COPYRIGHT: (C) 1999-2008 by the GRASS Development Team
+ *
+ * This program is free software under the GNU General Public
+ * License (>=v2). Read the file COPYING that comes with GRASS
+ * for details.
+ *
+ *****************************************************************************/
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <grass/gis.h>
+#include <grass/imagery.h>
+#include <grass/glocale.h>
+#include "orthophoto.h"
+#include "local_proto.h"
+
+int main(int argc, char *argv[])
+{
+ struct GModule *module;
+ struct Option *group_opt;
+
+ char location[GMAPSET_MAX];
+ char mapset[GMAPSET_MAX];
+ char group[GNAME_MAX];
+
+
+ /* must run in a term window */
+ G_putenv("GRASS_UI_TERM", "1");
+
+ G_gisinit(argv[0]);
+
+ module = G_define_module();
+ module->keywords = _("imagery, orthorectify");
+ module->description =
+ _("Interactively select or modify the imagery group target.");
+
+ group_opt = G_define_standard_option(G_OPT_I_GROUP);
+ group_opt->description =
+ _("Name of imagery group for ortho-rectification");
+
+ if (G_parser(argc, argv))
+ exit(EXIT_FAILURE);
+
+
+ strcpy(group, group_opt->answer);
+
+ I_get_target(group, location, mapset);
+ G__create_alt_env();
+ ask_target(group, location, mapset);
+ G__switch_env();
+ I_put_target(group, location, mapset);
+
+ G_message(_("Group [%s] targeted for location [%s], mapset [%s]"),
+ group, location, mapset);
+
+ exit(EXIT_SUCCESS);
+}
Modified: grass/branches/releasebranch_6_4/imagery/i.ortho.photo/menu/description.html
===================================================================
--- grass/branches/releasebranch_6_4/imagery/i.ortho.photo/menu/description.html 2010-12-22 09:44:29 UTC (rev 44653)
+++ grass/branches/releasebranch_6_4/imagery/i.ortho.photo/menu/description.html 2010-12-22 10:05:10 UTC (rev 44654)
@@ -126,7 +126,7 @@
description of option (4) please see the GRASS manual page
for
-<EM><A HREF="photo.camera.html">photo.camera</A></EM>.
+<EM><A HREF="i.photo.camera.html">i.photo.camera</A></EM>.
<DT><EM>5. Compute image-to-photo transformation parameters</EM>
@@ -139,7 +139,7 @@
documentation for this option is available under the manual
entry
-<EM><A HREF="photo.2image.html">photo.2image</A></EM>.
+<EM><A HREF="i.photo.2image.html">i.photo.2image</A></EM>.
<DT><EM>6. Initialize exposure station parameters</EM>
@@ -147,7 +147,7 @@
station parameters and initial variances may be selected or
modified. Complete documentation for this option is
available under the manual entry
-<EM><A HREF="photo.init.html">photo.init</A></EM>.
+<EM><A HREF="i.photo.init.html">i.photo.init</A></EM>.
<DT><EM>7. Compute photo-to-target transformation parameters</EM>
@@ -157,7 +157,7 @@
known standard (e.g. UTM) and elevation coordinates. Complete
documentation for this option is available under the manual
entry
-<EM><A HREF="photo.2target.html">photo.2target</A></EM>.
+<EM><A HREF="i.photo.2target.html">i.photo.2target</A></EM>.
@@ -173,7 +173,7 @@
documentation for this option is available under the manual
entry
-<EM><A HREF="photo.rectify.html">photo.rectify</A></EM>.
+<EM><A HREF="i.photo.rectify.html">i.photo.rectify</A></EM>.
</DL>
@@ -185,11 +185,11 @@
<H2>SEE ALSO</H2>
-<EM><A HREF="photo.camera.html">photo.camera</A></EM>,
-<EM><A HREF="photo.2image.html">photo.2image</A></EM>,
-<EM><A HREF="photo.2target.html">photo.2target</A></EM>,
-<EM><A HREF="photo.init.html">photo.init</A></EM>,
-<EM><A HREF="photo.rectify.html">photo.rectify</A></EM>
+<EM><A HREF="i.photo.camera.html">i.photo.camera</A></EM>,
+<EM><A HREF="i.photo.2image.html">i.photo.2image</A></EM>,
+<EM><A HREF="i.photo.2target.html">i.photo.2target</A></EM>,
+<EM><A HREF="i.photo.init.html">i.photo.init</A></EM>,
+<EM><A HREF="i.photo.rectify.html">i.photo.rectify</A></EM>
<H2>AUTHOR</H2>
Modified: grass/branches/releasebranch_6_4/imagery/i.ortho.photo/menu/menu.c
===================================================================
--- grass/branches/releasebranch_6_4/imagery/i.ortho.photo/menu/menu.c 2010-12-22 09:44:29 UTC (rev 44653)
+++ grass/branches/releasebranch_6_4/imagery/i.ortho.photo/menu/menu.c 2010-12-22 10:05:10 UTC (rev 44654)
@@ -117,18 +117,18 @@
if (strcmp(buf, "1") == 0)
run_system("i.group");
if (strcmp(buf, "2") == 0)
- run_etc_imagery("photo.target", group.name);
+ run_etc_imagery("i.photo.target", group.name);
if (strcmp(buf, "3") == 0)
- run_etc_imagery("photo.elev", group.name);
+ run_etc_imagery("i.photo.elev", group.name);
if (strcmp(buf, "4") == 0)
- run_etc_imagery("photo.camera", group.name);
+ run_etc_imagery("i.photo.camera", group.name);
if (strcmp(buf, "5") == 0)
- run_etc_imagery("photo.2image", group.name);
+ run_etc_imagery("i.photo.2image", group.name);
if (strcmp(buf, "6") == 0)
- run_etc_imagery("photo.init", group.name);
+ run_etc_imagery("i.photo.init", group.name);
if (strcmp(buf, "7") == 0)
- run_etc_imagery("photo.2target", group.name);
+ run_etc_imagery("i.photo.2target", group.name);
if (strcmp(buf, "8") == 0)
- run_etc_imagery("photo.rectify", group.name);
+ run_etc_imagery("i.photo.rectify", group.name);
}
}
More information about the grass-commit
mailing list