From 82c04a347deaba195b1b396d6605f132d7eeb2dd Mon Sep 17 00:00:00 2001 From: gerber Date: Fri, 27 Jun 2003 13:47:26 +0000 Subject: [PATCH] display ruler, line/point evaluation --- src/Makefile.am | 1 + src/Makefile.in | 72 ++- src/console.c | 43 +- src/console_interface.c | 15 +- src/console_menus.h | 17 +- src/display.c | 1172 ++++++++++++++++++++++++++--------------------- src/display.h | 14 +- src/display_interface.c | 183 +++++--- src/display_interface.h | 17 +- src/gpiv_gtk.h | 15 +- src/main.c | 30 +- src/piveval.c | 542 ++++++++-------------- src/pivpost.c | 17 +- src/preferences.c | 17 +- src/utils.c | 271 ++++++++++- src/utils.h | 23 +- 16 files changed, 1403 insertions(+), 1046 deletions(-) diff --git a/src/Makefile.am b/src/Makefile.am index 8213d43..90306b8 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -25,6 +25,7 @@ gpiv_SOURCES = \ utils.c utils.h \ main.c gpiv_gtk.h + AM_CFLAGS = @OVERRIDE_IMAGE_WIDTH_MAX@ \ @OVERRIDE_IMAGE_HEIGHT_MAX@ \ @DEBUG@ \ diff --git a/src/Makefile.in b/src/Makefile.in index 2ae8ff8..6ffdc55 100644 --- a/src/Makefile.in +++ b/src/Makefile.in @@ -153,6 +153,11 @@ DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST) TAR = tar GZIP_ENV = --best +DEP_FILES = .deps/console.P .deps/console_interface.P .deps/display.P \ +.deps/display_interface.P .deps/imgh.P .deps/imgh_interface.P \ +.deps/main.P .deps/piveval.P .deps/piveval_interface.P .deps/pivpost.P \ +.deps/pivpost_interface.P .deps/pivvalid.P .deps/pivvalid_interface.P \ +.deps/preferences.P .deps/support.P .deps/utils.P SOURCES = $(gpiv_SOURCES) OBJECTS = $(gpiv_OBJECTS) @@ -160,9 +165,9 @@ all: all-redirect .SUFFIXES: .SUFFIXES: .S .c .o .s $(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) - cd $(top_srcdir) && $(AUTOMAKE) --gnu --include-deps src/Makefile + cd $(top_srcdir) && $(AUTOMAKE) --gnu src/Makefile -Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status $(BUILT_SOURCES) cd $(top_builddir) \ && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status @@ -192,9 +197,6 @@ uninstall-binPROGRAMS: rm -f $(DESTDIR)$(bindir)/`echo $$p|sed 's/$(EXEEXT)$$//'|sed '$(transform)'|sed 's/$$/$(EXEEXT)/'`; \ done -.c.o: - $(COMPILE) -c $< - .s.o: $(COMPILE) -c $< @@ -249,6 +251,11 @@ distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir) subdir = src distdir: $(DISTFILES) + here=`cd $(top_builddir) && pwd`; \ + top_distdir=`cd $(top_distdir) && pwd`; \ + distdir=`cd $(distdir) && pwd`; \ + cd $(top_srcdir) \ + && $(AUTOMAKE) --include-deps --build-dir=$$here --srcdir-name=$(top_srcdir) --output-dir=$$top_distdir --gnu src/Makefile @for file in $(DISTFILES); do \ d=$(srcdir); \ if test -d $$d/$$file; then \ @@ -260,6 +267,37 @@ distdir: $(DISTFILES) fi; \ done +DEPS_MAGIC := $(shell mkdir .deps > /dev/null 2>&1 || :) + +-include $(DEP_FILES) + +mostlyclean-depend: + +clean-depend: + +distclean-depend: + -rm -rf .deps + +maintainer-clean-depend: + +%.o: %.c + @echo '$(COMPILE) -c $<'; \ + $(COMPILE) -Wp,-MD,.deps/$(*F).pp -c $< + @-cp .deps/$(*F).pp .deps/$(*F).P; \ + tr ' ' '\012' < .deps/$(*F).pp \ + | sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \ + >> .deps/$(*F).P; \ + rm .deps/$(*F).pp + +%.lo: %.c + @echo '$(LTCOMPILE) -c $<'; \ + $(LTCOMPILE) -Wp,-MD,.deps/$(*F).pp -c $< + @-sed -e 's/^\([^:]*\)\.o[ ]*:/\1.lo \1.o :/' \ + < .deps/$(*F).pp > .deps/$(*F).P; \ + tr ' ' '\012' < .deps/$(*F).pp \ + | sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \ + >> .deps/$(*F).P; \ + rm -f .deps/$(*F).pp info-am: info: info-am dvi-am: @@ -297,23 +335,24 @@ distclean-generic: maintainer-clean-generic: mostlyclean-am: mostlyclean-binPROGRAMS mostlyclean-compile \ - mostlyclean-tags mostlyclean-generic + mostlyclean-tags mostlyclean-depend mostlyclean-generic mostlyclean: mostlyclean-am -clean-am: clean-binPROGRAMS clean-compile clean-tags clean-generic \ - mostlyclean-am +clean-am: clean-binPROGRAMS clean-compile clean-tags clean-depend \ + clean-generic mostlyclean-am clean: clean-am distclean-am: distclean-binPROGRAMS distclean-compile distclean-tags \ - distclean-generic clean-am + distclean-depend distclean-generic clean-am distclean: distclean-am maintainer-clean-am: maintainer-clean-binPROGRAMS \ maintainer-clean-compile maintainer-clean-tags \ - maintainer-clean-generic distclean-am + maintainer-clean-depend maintainer-clean-generic \ + distclean-am @echo "This command is intended for maintainers to use;" @echo "it deletes files that may require special tools to rebuild." @@ -323,12 +362,13 @@ maintainer-clean: maintainer-clean-am maintainer-clean-binPROGRAMS uninstall-binPROGRAMS install-binPROGRAMS \ mostlyclean-compile distclean-compile clean-compile \ maintainer-clean-compile tags mostlyclean-tags distclean-tags \ -clean-tags maintainer-clean-tags distdir info-am info dvi-am dvi check \ -check-am installcheck-am installcheck install-exec-am install-exec \ -install-data-am install-data install-am install uninstall-am uninstall \ -all-redirect all-am all installdirs mostlyclean-generic \ -distclean-generic clean-generic maintainer-clean-generic clean \ -mostlyclean distclean maintainer-clean +clean-tags maintainer-clean-tags distdir mostlyclean-depend \ +distclean-depend clean-depend maintainer-clean-depend info-am info \ +dvi-am dvi check check-am installcheck-am installcheck install-exec-am \ +install-exec install-data-am install-data install-am install \ +uninstall-am uninstall all-redirect all-am all installdirs \ +mostlyclean-generic distclean-generic clean-generic \ +maintainer-clean-generic clean mostlyclean distclean maintainer-clean # Tell versions [3.59,3.63) of GNU make to not export all variables. diff --git a/src/console.c b/src/console.c index 52df3d5..3134aa9 100644 --- a/src/console.c +++ b/src/console.c @@ -28,8 +28,11 @@ /* * (Callback) functions for console * $Log: console.c,v $ - * Revision 1.1 2003-06-17 17:10:52 gerber - * Initial revision + * Revision 1.2 2003-06-27 13:47:26 gerber + * display ruler, line/point evaluation + * + * Revision 1.1.1.1 2003/06/17 17:10:52 gerber + * Imported gpiv * */ @@ -843,7 +846,7 @@ on_close_activate(GtkMenuItem * menuitem, g_snprintf(message, 2 * MAX_CHARS, "%s%d%s", _("There are unsaved data that will be lost.\n\ -Are you sure you want to close buffer #"), +Are you sure you want to close buffer # %d"), display_act->count, _("?")); answer = close_buffer_yes_no (gpiv, message); switch (answer){ @@ -1175,7 +1178,7 @@ on_button_exit_enter(GtkContainer * container, GtkDirectionType direction, gpointer user_data) { GpivConsole *gpiv = gtk_object_get_data(GTK_OBJECT(container), "gpiv"); - gchar *msg = _("Exits gpiv"); + gchar *msg = _("Exits GPIV"); gnome_appbar_set_status(GNOME_APPBAR(gpiv->appbar), msg); } @@ -1289,10 +1292,10 @@ void on_toolbar_checkbutton_vorstra(GtkWidget * widget, gpointer data) /* GpivData * gpd_active = &display_act->gpd; */ -/*-------------------------------------------------------------------- - exit, message dialog callbacks */ void on_button_quit_no_clicked(GtkButton * button, gpointer user_data) { +/*-------------------------------------------------------------------- + exit, message dialog callbacks */ g_warning("on_button_quit_no_clicked::"); gnome_dialog_close(GNOME_DIALOG(gpiv_exit)); } @@ -1371,8 +1374,6 @@ select_action_from_fname(GpivConsole *gpiv, ext = g_strdup(strrchr(fname_in, '.')); - g_warning("---------select_action_from_fname:: extension = %s", ext); - fname_last = g_strdup(fname_in); gnome_config_set_string("fname_last", fname_last); gnome_config_sync(); @@ -1392,9 +1393,6 @@ select_action_from_fname(GpivConsole *gpiv, strtok(fname_base, "."); fname_ext = g_strdup(g_strconcat(dirname, G_DIR_SEPARATOR_S, fname_base, NULL)); - g_warning("select_action_from_fname:: fname_in=%s fname_last=%s" - "fname_base=%s fname_ext=%s", - fname_in, fname_last, fname_base, fname_ext); /* * reading image data from raw data format or hdf format @@ -1415,8 +1413,6 @@ select_action_from_fname(GpivConsole *gpiv, * Check if file basename (and buffer/display) already exists * or if there is a gap in the numbering of th buffers */ - g_warning("--- file_ok_sel:: Checking for existing bufs, nbufs = %d", - nbufs); for (ibuf = 0; ibuf < nbufs; ibuf++) { if (display[ibuf] != NULL && strcmp(fname_ext, display[ibuf]->fname_base) == 0 ) { @@ -1435,7 +1431,6 @@ select_action_from_fname(GpivConsole *gpiv, exist_buf = TRUE; break; } else if (display[ibuf] == NULL) { - g_warning("---------------- file_ok_sel:: buffer[%d] is null;loaded", ibuf); load_buffer(gpiv, fname_in, fname_base, fname_ext, read_hdf, ibuf, INSERT); exist_buf = TRUE; @@ -1452,7 +1447,6 @@ select_action_from_fname(GpivConsole *gpiv, if (!exist_buf) { nbufs++; ibuf = nbufs - 1; - gpiv_warning("file_ok_sel:: 0; ibuf = %d", ibuf); load_buffer(gpiv, fname_in, fname_base, fname_ext, read_hdf, ibuf, APPEND); @@ -1460,6 +1454,7 @@ select_action_from_fname(GpivConsole *gpiv, /* * reading piv data + * NOT MAINTAINED */ } else if (strcmp(ext, ".piv") == 0) { exist_buf = FALSE; @@ -1570,10 +1565,12 @@ load_buffer(GpivConsole *gpiv, "button_press_event", GTK_SIGNAL_FUNC (on_my_popup_handler), GTK_OBJECT(display_act->display_menu)); + zoom_display(display_act, display_act->zoom_index); + + /* * Load image data */ - gpiv_warning("load_buffer:: 1"); g_snprintf(display_act->fname_base, MAX_CHARS, "%s", fname_ext); if((return_val = open_img(fname_in, &display_act->img, read_hdf)) != 0) { @@ -1589,7 +1586,6 @@ load_buffer(GpivConsole *gpiv, return; } - gpiv_warning("load_buffer:: 2"); display_background(display_act); @@ -1608,7 +1604,6 @@ load_buffer(GpivConsole *gpiv, /* * Add buffer to list */ - gpiv_warning("load_buffer:: 3"); g_snprintf(cl_int, 2, "%d", ibuf); clist_buf_txt[ibuf][0] = (gchar *) cl_int; clist_buf_txt[ibuf][1] = fname_base; @@ -1667,19 +1662,19 @@ open_img(char *fname_in, gpiv_img_fread_hdf5_parameters(fname_in, &img->image_par); if (img->image_par.nrows != gpiv_par.img_height || img->image_par.ncolumns != gpiv_par.img_width) { - gtk_error(_("Image dimensions (%dx%d) differ from \n\ + gtk_warning(_("Image dimensions (%dx%d) differ from \n\ parameter settings (%dx%d"), img->image_par.ncolumns, img->image_par.nrows, gpiv_par.img_width, gpiv_par.img_height); return -1; } - copy_img_par(image_par, &img->image_par, print_par); + copy_img_par(image_par, &img->image_par, FALSE, print_par); gpiv_img_check_header_read(img->image_par); img->img1 = gpiv_ucmatrix(0, img->image_par.nrows - 1, 0, img->image_par.ncolumns - 1); if (img->image_par.x_corr != image_par.x_corr) { gtk_warning(_("cross correlation parameter from image \n\ -not in agreement with gpiv setting")); +not in agreement with GPIV setting")); return -1; } if (img->image_par.x_corr) @@ -1716,7 +1711,7 @@ parameter settings (%dx%d)"), gpiv_par.img_width, gpiv_par.img_height); return -1; } - copy_img_par (image_par, &img->image_par, print_par); + copy_img_par (image_par, &img->image_par, FALSE, print_par); gpiv_img_check_header_read(img->image_par); /* * memory allocation of matrices and vectors @@ -1726,7 +1721,7 @@ parameter settings (%dx%d)"), img->image_par.ncolumns - 1); if (img->image_par.x_corr != image_par.x_corr) { gtk_warning(_("cross correlation parameter from image \n\ -not in agreement with gpiv setting")); +not in agreement with GPIV setting")); return -1; } if (image_par.x_corr) @@ -1773,6 +1768,8 @@ open_piv(char *fname, gpiv_alloc_pivdata(&gpd->piv_data); + gpd->exist_piv = TRUE; + if ((return_val = gpiv_fread_pivdata(fname, &gpd->piv_data, c_line, &nc_lines)) != 0) { gpiv_error(_("%s: Failure calling fread_pivdata\n"), PROGNAME); diff --git a/src/console_interface.c b/src/console_interface.c index 53c61c2..f763edd 100644 --- a/src/console_interface.c +++ b/src/console_interface.c @@ -28,8 +28,11 @@ /* * $Log: console_interface.c,v $ - * Revision 1.1 2003-06-17 17:10:52 gerber - * Initial revision + * Revision 1.2 2003-06-27 13:47:26 gerber + * display ruler, line/point evaluation + * + * Revision 1.1.1.1 2003/06/17 17:10:52 gerber + * Imported gpiv * */ #ifdef HAVE_CONFIG_H @@ -215,7 +218,7 @@ create_gpiv(void) gpiv->console = gnome_app_new("Gpiv-gui-gtk", - _("gpiv")); + "gpiv"); gtk_window_set_policy(GTK_WINDOW(gpiv->console), FALSE, TRUE, @@ -1526,7 +1529,7 @@ GtkWidget *create_about(void) /* VersioN: */ VERSION, /* Copyright */ _("Copyright G. Van der Graaf"), /* Author(s): */ authors, - /* Comments: */ _("gpiv is a program for " + /* Comments: */ _("GPIV is a program for " "(Digital) Particle Image Velocimetry. It evaluates images (pairs), " "resulting into a velocity field of a fluid flow. The program includes " "validation of the velocities and allows to post-proces the data resulting " @@ -1680,7 +1683,7 @@ GtkWidget "messagebox", messagebox); gtk_window_set_title(GTK_WINDOW(messagebox), - _("gpiv message")); + _("GPIV message")); gtk_window_set_position(GTK_WINDOW(messagebox), GTK_WIN_POS_MOUSE); gtk_window_set_policy(GTK_WINDOW(messagebox), @@ -1754,7 +1757,7 @@ GtkWidget *create_errorbox(gchar * message) "errorbox", errorbox); gtk_window_set_title(GTK_WINDOW(errorbox), - _("gpiv error")); + _("GPIV error")); gtk_window_set_policy(GTK_WINDOW(errorbox), FALSE, FALSE, diff --git a/src/console_menus.h b/src/console_menus.h index a9de3c2..b9f6cea 100644 --- a/src/console_menus.h +++ b/src/console_menus.h @@ -28,8 +28,11 @@ /* * menu definitions * $Log: console_menus.h,v $ - * Revision 1.1 2003-06-17 17:10:52 gerber - * Initial revision + * Revision 1.2 2003-06-27 13:47:26 gerber + * display ruler, line/point evaluation + * + * Revision 1.1.1.1 2003/06/17 17:10:52 gerber + * Imported gpiv * */ @@ -59,8 +62,8 @@ static GnomeUIInfo file_menu_gpiv[] = static GnomeUIInfo settings_menu_gpiv[] = { { - GNOME_APP_UI_TOGGLEITEM, N_("gpiv buttons"), - N_("show gpiv check-buttons"), + GNOME_APP_UI_TOGGLEITEM, N_("GPIV buttons"), + N_("show GPIV check-buttons"), (gpointer) on_gpivbuttons_activate, NULL, NULL, GNOME_APP_PIXMAP_NONE, NULL, 0, (GdkModifierType) 0, NULL @@ -161,7 +164,7 @@ static GnomeUIInfo toolbar_gpiv[] = GNOMEUIINFO_SEPARATOR, { - GNOME_APP_UI_ITEM, N_("Exit"), N_("Exit gpiv. \nA warning message will be issued for unsaved data"), + GNOME_APP_UI_ITEM, N_("Exit"), N_("Exit GPIV. \nA warning message will be issued for unsaved data"), (gpointer) on_exit_activate, NULL, NULL, GNOME_APP_PIXMAP_STOCK, GNOME_STOCK_PIXMAP_EXIT, 0, 0, NULL }, @@ -309,8 +312,8 @@ static GnomeUIInfo settings_menu_gpiv_popup[] = /* 0, (GdkModifierType) 0, NULL */ /* }, */ { - GNOME_APP_UI_TOGGLEITEM, N_("gpiv buttons"), - N_("show gpiv check-buttons"), + GNOME_APP_UI_TOGGLEITEM, N_("GPIV buttons"), + N_("show GPIV check-buttons"), (gpointer) on_gpivbuttons_activate, NULL, NULL, GNOME_APP_PIXMAP_NONE, NULL, 0, (GdkModifierType) 0, NULL diff --git a/src/display.c b/src/display.c index c352c87..7a5e436 100644 --- a/src/display.c +++ b/src/display.c @@ -28,8 +28,11 @@ /* * (callback) functions for the display * $Log: display.c,v $ - * Revision 1.1 2003-06-17 17:10:52 gerber - * Initial revision + * Revision 1.2 2003-06-27 13:47:26 gerber + * display ruler, line/point evaluation + * + * Revision 1.1.1.1 2003/06/17 17:10:52 gerber + * Imported gpiv * */ @@ -46,11 +49,11 @@ callback function */ /* static gint col_start_old, row_start_old; */ static void -search_nearest_index(gint x, +search_nearest_index(Display * disp, + gint x, gint y, - gint * index_y, gint * index_x, - Display * disp) + gint * index_y) { gint i, j, x_min = 10e4, y_min = 10e4, dif; @@ -80,32 +83,20 @@ highlight_intreg(gint index_y, gint index_x, Display * disp) { - gint index_x_old = disp->index_x_old; - gint index_y_old = disp->index_y_old; - if (disp->intreg.exist && disp->display_intregs && index_y <= disp->intreg.data.ny && index_x <= disp->intreg.data.nx) { -/* index_y <= index_y_old && index_x <= index_x_old */ - if (disp->intreg.gci_intreg2[index_y_old][index_x_old] != NULL) + if (disp->intreg.gci_intreg2[disp->index_y_old][disp->index_x_old] + != NULL) gnome_canvas_item_set(disp->intreg. - gci_intreg2[index_y_old][index_x_old], + gci_intreg2[disp->index_y_old][disp->index_x_old], "outline_color", "yellow", NULL); -/* fprintf(stderr,"B:: lowering int2 _to_bottom\n"); */ -/* for (i = index_y-3; i < index_y+4; i++) { */ -/* for (j = index_x-3; j < index_x+4; j++) { */ -/* gnome_canvas_item_raise */ -/* (display_act->gpd.gci_intreg1[i][j], 1); */ -/* gnome_canvas_item_lower_to_bottom */ -/* (display_act->gpd.gci_intreg2[index_y][index_x]); */ -/* } */ -/* } */ - - if (disp->intreg.gci_intreg1[index_y_old][index_x_old] != NULL) + + if (disp->intreg.gci_intreg1[disp->index_y_old][disp->index_x_old] != NULL) gnome_canvas_item_set(disp->intreg. - gci_intreg1[index_y_old][index_x_old], + gci_intreg1[disp->index_y_old][disp->index_x_old], "outline_color", "blue", NULL); @@ -115,7 +106,6 @@ highlight_intreg(gint index_y, /* (disp->intreg.gci_intreg2[index_y][index_x]), */ /* disp->intreg.data.ny * */ /* disp->intreg.data.nx); */ -/* g_warning("highlight_intreg:: 3B"); */ gnome_canvas_item_set(disp->intreg.gci_intreg2[index_y][index_x], "outline_color", "red", NULL); @@ -130,7 +120,6 @@ highlight_intreg(gint index_y, /* (disp->intreg.gci_intreg1[index_y][index_x]), */ /* disp->intreg.data.ny * */ /* disp->intreg.data.nx); */ -/* g_warning("highlight_intreg:: 4B"); */ gnome_canvas_item_set(disp->intreg.gci_intreg1[index_y][index_x], "outline_color", "green", NULL); @@ -248,24 +237,136 @@ void on_scrolledwindow_display_adj_changed (GtkAdjustment *adj, gpointer data) { + Display * disp = gtk_object_get_data(GTK_OBJECT(adj), "disp"); + gfloat x_start = 0, x_end = 0, y_start = 0, y_end = 0; enum variable_type { X_ADJ = 0, Y_ADJ = 1 } var_type; var_type = atoi(gtk_object_get_data(GTK_OBJECT(adj), "var_type")); - if (var_type == X_ADJ) { - x_offset = (gint) adj->value /* * (int) display_act->gpd.zoom_factor */ ; - x_lower = (gint) adj->lower /* * (int) display_act->gpd.zoom_factor */ ; - x_upper = (gint) adj->upper /* * (int) display_act->gpd.zoom_factor */ ; - } - if (var_type == Y_ADJ) { - y_offset = (gint) adj->value/* * (int) display_act->gpd.zoom_factor */; - y_lower = (gint) adj->lower/* * (int) display_act->gpd.zoom_factor */; - y_upper = (gint) adj->upper/* * (int) display_act->gpd.zoom_factor */; + if (disp->stretch_window_tmp) { + if (var_type == X_ADJ) { + x_offset = (gint) adj->value; + x_lower = (gint) adj->lower; + x_upper = (gint) adj->upper; + + +/* + * Scaling + * See also pivpost; exec_scale + * TODO + */ +/* if (disp->gpd.exist_piv && display_act->gpd.scaled_piv) { + x_start = (gfloat) (x_offset * image_par.s_scale + + image_par.z_off_x); + x_end = (gfloat) (gpiv_par.img_width * image_par.s_scale - 1); + } else { +*/ + x_start = 0.0; + x_end = (gfloat) (gpiv_par.img_width - 1); +/* } */ + + gtk_ruler_set_range(GTK_RULER(disp->hruler), + x_start, + x_end, + x_start, + x_end); + + gtk_widget_set_usize (disp->hruler, + (gint) (disp->zoom_factor * + gpiv_par.img_width), + RULER_WIDTH); + gtk_widget_set_uposition (disp->hruler, RULER_WIDTH, 0); + } + + if (var_type == Y_ADJ) { + y_offset = (gint) adj->value; + y_lower = (gint) adj->lower; + y_upper = (gint) adj->upper; + + if (disp->gpd.exist_piv && display_act->gpd.scaled_piv) + y_offset = y_offset * image_par.s_scale + image_par.z_off_y; + + gtk_ruler_set_range(GTK_RULER(disp->vruler), + 0.0, + (gfloat) (gpiv_par.img_height - 1), + 0.0, + (gfloat) (gpiv_par.img_height - 1)); + gtk_widget_set_usize (disp->vruler, + RULER_WIDTH, + (gint) (disp->zoom_factor * + gpiv_par.img_height)); + gtk_widget_set_uposition (disp->vruler, 0, RULER_WIDTH); + } + + } else { + if (var_type == X_ADJ) { + x_offset = (gint) adj->value; + x_lower = (gint) adj->lower; + x_upper = (gint) adj->upper; + +/* + * Scaling + * See also pivpost; exec_scale + * TODO + */ +/* if (disp->gpd.exist_piv && display_act->gpd.scaled_piv) { + x_start = (gfloat) (x_offset * image_par.s_scale + + image_par.z_off_x) + / (gfloat) disp->zoom_factor; + x_end = (gfloat) (x_offset * image_par.s_scale + image_par.z_off_x) + / (gfloat) disp->zoom_factor + + (gfloat) (gpiv_par.img_width * image_par.s_scale - 1) + * (gfloat) disp->zoom_factor_old + / (gfloat) disp->zoom_factor; + } else { +*/ + x_start = (gfloat) (x_offset) / (gfloat) disp->zoom_factor; + x_end = (gfloat) x_offset + / (gfloat) disp->zoom_factor + + (gfloat) (gpiv_par.img_width - 1) + * (gfloat) disp->zoom_factor_old + / (gfloat) disp->zoom_factor; +/* } */ + + gtk_ruler_set_range(GTK_RULER(disp->hruler), + x_start, + x_end, + x_start, + x_end); + + } + + if (var_type == Y_ADJ) { + y_offset = (gint) adj->value; + y_lower = (gint) adj->lower; + y_upper = (gint) adj->upper; + + if (disp->gpd.exist_piv && display_act->gpd.scaled_piv) + y_offset = y_offset * image_par.s_scale + image_par.z_off_y; + + gtk_ruler_set_range(GTK_RULER(disp->vruler), + (gfloat) y_offset + / (gfloat) disp->zoom_factor, + (gfloat) y_offset + / (gfloat) disp->zoom_factor + + (gfloat) (gpiv_par.img_height - 1) + * (gfloat) disp->zoom_factor_old + / (gfloat) disp->zoom_factor, + (gfloat) y_offset + / (gfloat) disp->zoom_factor, + (gfloat) y_offset + / (gfloat) disp->zoom_factor + + (gfloat) (gpiv_par.img_height - 1) + * (gfloat) disp->zoom_factor_old + / (gfloat) disp->zoom_factor + ); + + } } -/* adjust rulers here ?! */ + } @@ -306,29 +407,40 @@ on_displaypopup_handler(GtkWidget *widget, GdkEvent *event) +/* void */ +/* select_zoomscale(GtkMenuItem * menuitem, */ +/* gpointer data, */ +/* guint action */ +/* ) */ void select_zoomscale(gpointer data, guint action, GtkWidget * widget) -{ - gint screen_width = 0, screen_height = 0; - gint width = 0, height = 0; - gint new_width = 0, new_height = 0; - gint zoom_index; + { +/* Display *disp = gtk_object_get_data(GTK_OBJECT(widget), "disp"); */ Display *disp = display_act; + gint zoom_index = action; +/* gtk_object_get_data(GTK_OBJECT(menuitem), "zoom_index"); */ + zoom_display(disp, zoom_index); +} + +void +zoom_display(Display *disp, gint zoom_index) +{ + gint screen_width = gdk_screen_width(); + gint screen_height = gdk_screen_height(); + gint width = 0, height = 0; + gint new_width = 0; + gint new_height = 0; + if (disp != NULL) { -/* - *test - */ -/* disp = gtk_get_data(display_act); */ + disp->zoom_factor = zfactor[zoom_index]; + new_width = (gint) (disp->zoom_factor * gpiv_par.img_width + VIEW_HMARGE); + new_height = (gint) (disp->zoom_factor * gpiv_par.img_height + VIEW_VMARGE); - zoom_index = action; - disp->zoom_factor = zfactor[zoom_index]; - screen_width = gdk_screen_width(); - screen_height = gdk_screen_height(); - gdk_window_get_size(disp->mwin->window, &width, &height); -/* gdk_window_get_size(disp->mwin->window, &width, &height); */ + gdk_window_get_size(disp->mwin->window, &width, &height); +/* gdk_win_hints_get_expanded_size(disp->mwin->window, &width, &height); */ /* gnome_win_hints_get_expanded_size(display_act, */ /* &x, */ @@ -336,8 +448,7 @@ select_zoomscale(gpointer data, /* &width, */ /* &height); */ - new_width = (gint) (disp->zoom_factor * gpiv_par.img_width + VIEW_HMARGE); - new_height = (gint) (disp->zoom_factor * gpiv_par.img_height + VIEW_VMARGE); + if ((new_width < width || new_height < height) || (gpiv_par.stretch_window ) ) { @@ -346,20 +457,26 @@ select_zoomscale(gpointer data, gnome_win_hints_set_state(disp->mwin, 0); gdk_window_resize(disp->mwin->window, new_width, new_height); + } else if (new_width > screen_width && new_height < screen_height) { gnome_win_hints_set_state(disp->mwin, WIN_STATE_MAXIMIZED_HORIZ); + } else if (new_width < screen_width && new_height > screen_height) { gnome_win_hints_set_state(disp->mwin, WIN_STATE_MAXIMIZED_VERT); + } else if (new_width > screen_width && new_height > screen_height) { gnome_win_hints_set_state(disp->mwin, WIN_STATE_MAXIMIZED_HORIZ + WIN_STATE_MAXIMIZED_VERT); - } else { + + } else { g_warning("select_zoomscale:: should not arrive here"); - } + } + } else { + disp->stretch_window_tmp = FALSE; } /* gnome_win_hints_set_expanded_size(disp->mwin, x, y, width, */ @@ -369,6 +486,17 @@ select_zoomscale(gpointer data, gnome_canvas_set_pixels_per_unit(GNOME_CANVAS(disp->canvas), disp->zoom_factor); + + if (new_width < width && new_height < height) { +/* g_warning("select_zoomscale:: set_usize stretch_window fact=%f fact_old=%f", */ +/* disp->zoom_factor, zoom_factor_tmp); */ + gtk_widget_set_usize (disp->canvas, + (gint) (disp->zoom_factor * gpiv_par.img_width), + (gint) (disp->zoom_factor * gpiv_par.img_height)); + disp->stretch_window_tmp = TRUE; + disp->zoom_factor_old = disp->zoom_factor; + } + } } @@ -390,17 +518,27 @@ canvas_display_enter_notify(GtkWidget * widget, disp->index_x_old = 0; disp->index_y_old = 0; + disp->index_old = FALSE; /* g_warning("canvas_display_enter_notify:: viewer count = %d", disp->count); */ if (m_select == NO_MS) { cursor = gdk_cursor_new(GDK_DOTBOX); /* g_warning("canvas_display_enter_notify:: NO_MS"); */ + + } else if (m_select == SINGLE_AREA_MS || m_select == ENABLE_POINT_MS || m_select == DISABLE_POINT_MS) { cursor = gdk_cursor_new(GDK_CROSSHAIR); + + + } else if ( m_select == DRAG_MS ) { + cursor = gdk_cursor_new(GDK_CROSS); + + + } else if (m_select == SINGLE_POINT_MS || m_select == VLINE_MS || m_select == HLINE_MS) { @@ -415,21 +553,19 @@ canvas_display_enter_notify(GtkWidget * widget, disp->display_intregs = FALSE; } + + } else if (m_select == AOI_MS || m_select == ENABLE_AREA_MS || m_select == DISABLE_AREA_MS) { cursor = gdk_cursor_new(GDK_FLEUR); if (m_select == AOI_MS) { -/* g_warning(" canvas_display_enter_notify:: hide_all_intregs count=%d", */ -/* disp->count); */ - hide_all_intregs(disp); disp->display_intregs = FALSE; } } gdk_window_set_cursor(disp->mwin->window, cursor); -/* g_warning("canvas_display_enter_notify:: END"); */ return TRUE; } @@ -446,7 +582,6 @@ canvas_display_motion_notify(GtkWidget * widget, gint x, y /*, i, j , x_min = 10e4, y_min = 10e4, dif */; gint index_y = 0, index_x = 0; - gint index_x_old = disp->index_x_old, index_y_old = disp->index_y_old; GdkModifierType state; PivData piv_data = disp->gpd.piv_data; @@ -457,7 +592,6 @@ canvas_display_motion_notify(GtkWidget * widget, GnomeCanvasPoints *points; points = gnome_canvas_points_new(2); -/* g_warning("canvas_motion_enter_notify:: START"); */ /* gdk_window_get_pointer (widget->mwin, &x, &y, NULL); */ /* x = event->x; */ @@ -480,62 +614,79 @@ canvas_display_motion_notify(GtkWidget * widget, || m_select == ENABLE_POINT_MS || m_select == DISABLE_POINT_MS) { /* - * display particle displacements / velocities and its attributes, * search index nearest to pointer + * display particle displacements / velocities and its attributes, */ - if (disp->gpd.exist_piv && disp->display_piv) { - search_nearest_index(x, y, &index_y, &index_x, disp); - - if (display_act->gpd.exist_vor && display_act->display_vor) { - if (display_act->gpd.scaled_piv) { - create_msg_display_with_pivscdata(piv_data_scaled, - vor_data_scaled, - index_y, - index_x, - display_act->gpd.scaled_piv); - } else { - create_msg_display_with_pivscdata(piv_data, - vor_data, - index_y, - index_x, - display_act->gpd.scaled_piv); - } - } else { - if (display_act->gpd.scaled_piv) { - create_msg_display_with_pivdata(piv_data_scaled, - index_y, - index_x, - display_act->gpd.scaled_piv); - - } else { - create_msg_display_with_pivdata(piv_data, - index_y, - index_x, - display_act->gpd.scaled_piv); - } - } - + if (disp->display_intregs) + { + search_nearest_index(disp, x, y, &index_x, &index_y); + highlight_intreg(index_y, index_x, disp); /* - * highlight intreg + * display locations of interrogation area's and estimators, + * only display locations of interrogation area's, + * or nothing */ - - if (/* disp->intreg != NULL && */disp->display_intregs + if (disp->gpd.exist_piv && disp->display_piv && piv_data.ny == disp->intreg.data.ny - && piv_data.nx == disp->intreg.data.nx - && piv_data.point_y[0][0] == disp->intreg.data.point_y[0][0] - && piv_data.point_x[0][0] == disp->intreg.data.point_x[0][0] -/* index_y <= intreg.data.ny && index_x <= intreg.data.nx */ - ) { + && piv_data.nx == disp->intreg.data.nx + && piv_data.point_y[0][0] == disp->intreg.data.point_y[0][0] + && piv_data.point_x[0][0] == disp->intreg.data.point_x[0][0] + ) { + highlight_intreg(index_y, index_x, disp); + + if (display_act->gpd.exist_vor && display_act->display_vor) { + if (display_act->gpd.scaled_piv) { + create_msg_display_with_pivscdata(piv_data_scaled, + vor_data_scaled, + index_y, + index_x, + display_act-> + gpd.scaled_piv); + } else { + create_msg_display_with_pivscdata(piv_data, + vor_data, + index_y, + index_x, + display_act-> + gpd.scaled_piv); + } + } else { + if (display_act->gpd.scaled_piv) { + create_msg_display_with_pivdata(piv_data_scaled, + index_y, + index_x, + display_act-> + gpd.scaled_piv); + + } else { + create_msg_display_with_pivdata(piv_data, + index_y, + index_x, + display_act-> + gpd.scaled_piv); + } + } + + } else if (disp->display_intregs) { + highlight_intreg(index_y, index_x, disp); + g_snprintf(msg_display, MAX_CHARS, "x=%3.2f y=%3.2f i=%d j=%d ", + disp->intreg.data.point_x[index_y][index_x], + disp->intreg.data.point_y[index_y][index_x], + index_y, index_x); + + } else { + g_snprintf(msg_display, MAX_CHARS, " "); + } - highlight_intreg(index_y, index_x, disp); /* * display correlation function + * DISABLED */ - if (piv_eval_par.print_cov == 1 - && display_act->gpd.exist_cov) { + if (piv_eval_par.print_cov == 1 + && display_act->gpd.exist_cov) { /* memset(graybuf_int1, 215, */ /* (sizeof(guchar)) * (MAX_INTERR_SIZE * */ /* MAX_INTERR_SIZE)); */ @@ -559,15 +710,23 @@ canvas_display_motion_notify(GtkWidget * widget, /* display_img_cov(&display_act->gpd.cov[index_y][index_x], */ /* piv_eval_par.int_size_2, */ /* gpiv->piveval); */ - } - } + } + } /* * displaces interrogation area nearest to pointer */ if ( m_select == DRAG_MS ) { - if (index_x == index_x_old && index_y == index_y_old) { + if (!disp->index_old) { + disp->index_x_old = index_x; + disp->index_y_old = index_y; + disp->index_old = TRUE; + } + + if (index_x == disp->index_x_old + && index_y == disp->index_y_old) { + gnome_canvas_item_set (GNOME_CANVAS_ITEM(disp->intreg. gci_intreg1[index_y][index_x]), @@ -580,45 +739,28 @@ canvas_display_motion_notify(GtkWidget * widget, gnome_canvas_item_set (GNOME_CANVAS_ITEM(disp->intreg. gci_intreg2[index_y][index_x]), - "x1", (double) x - piv_eval_par.int_size_1 / + "x1", (double) x - piv_eval_par.int_size_2 / 2 + piv_eval_par.pre_shift_col, - "y1", (double) y - piv_eval_par.int_size_1 / + "y1", (double) y - piv_eval_par.int_size_2 / 2 + piv_eval_par.pre_shift_row, - "x2", (double) x + piv_eval_par.int_size_1 / + "x2", (double) x + piv_eval_par.int_size_2 / 2 + piv_eval_par.pre_shift_col, - "y2", (double) y + piv_eval_par.int_size_1 / + "y2", (double) y + piv_eval_par.int_size_2 / 2 + piv_eval_par.pre_shift_row, NULL); /* * put the interrogation area back to its original location */ } else { - update_intreg1(index_y_old, index_x_old, disp); - update_intreg2(index_y_old, index_x_old, disp); + update_intreg1(disp->index_y_old, disp->index_x_old, disp); + update_intreg2(disp->index_y_old, disp->index_x_old, disp); } } - -/* - * only display locations of interrogation area's - * search index neares to pointer - */ - } else if (/* disp->intreg != NULL */ - /* && */disp->display_intregs) { - - search_nearest_index(x, y, &index_y, &index_x, disp); - highlight_intreg(index_y, index_x, disp); - g_snprintf(msg_display, MAX_CHARS, "x=%3.2f y=%3.2f i=%d j=%d ", - disp->intreg.data.point_x[index_y][index_x], - disp->intreg.data.point_y[index_y][index_x], - index_y, index_x); - + disp->index_x_old = index_x; + disp->index_y_old = index_y; - } else { - g_snprintf(msg_display, MAX_CHARS, " "); - } - } else if (m_select == AOI_MS || m_select == ENABLE_AREA_MS @@ -667,39 +809,13 @@ canvas_display_motion_notify(GtkWidget * widget, create_intreg2(0, 0, display_act); } -/* } else { */ - -/* - * Putting back the first interrogation area to its orignal location - */ - -/* gnome_canvas_item_set (GNOME_CANVAS_ITEM(display_act->gpd.gci_intreg1[0][0]), */ -/* "x1", (double) display_act->gpd.intregs.point_x[0][0] - piv_eval_par.int_size_1 / 2, */ -/* "y1", (double) display_act->gpd.intregs.point_y[0][0] - piv_eval_par.int_size_1 / 2, */ -/* "x2", (double) display_act->gpd.intregs.point_x[0][0] + piv_eval_par.int_size_1 / 2, */ -/* "y2", (double) display_act->gpd.intregs.point_y[0][0] + piv_eval_par.int_size_1 / 2, */ -/* NULL); */ - -/* gnome_canvas_item_set (GNOME_CANVAS_ITEM(display_act->gpd.gci_intreg2[0][0]), */ -/* "x1", (double) display_act->gpd.intregs.point_x[0][0] - piv_eval_par.int_size_1 / 2 + piv_eval_par.pre_shift_col, */ -/* "y1", (double) display_act->gpd.intregs.point_y[0][0] - piv_eval_par.int_size_1 / 2 + piv_eval_par.pre_shift_row, */ -/* "x2", (double) display_act->gpd.intregs.point_x[0][0] + piv_eval_par.int_size_1 / 2 + piv_eval_par.pre_shift_col, */ -/* "y2", (double) display_act->gpd.intregs.point_y[0][0] + piv_eval_par.int_size_1 / 2 + piv_eval_par.pre_shift_row, */ -/* NULL); */ - -/* hide_all_intregs1(display_act); */ -/* hide_all_intregs2(display_act); */ -/* display_act->gpd.d_intregs = 0; */ -/* g_snprintf(msg_display, MAX_CHARS, "Inactive; outside aoi:: " */ -/* "x=%d y=%d", x, y); */ -/* } */ - } else if (m_select == VLINE_MS) { g_snprintf(msg_display, MAX_CHARS, "x=%d y=%d", x, y); if (state & GDK_BUTTON1_MASK && gci_line != NULL ) { + points->coords[0] = piv_eval_par.int_line_col; points->coords[1] = piv_eval_par.int_line_row_start; points->coords[2] = piv_eval_par.int_line_col; @@ -716,6 +832,7 @@ canvas_display_motion_notify(GtkWidget * widget, g_snprintf(msg_display, MAX_CHARS, "x=%d y=%d", x, y); if (state & GDK_BUTTON1_MASK && gci_line != NULL ) { + points->coords[0] = piv_eval_par.int_line_col_start; points->coords[1] = piv_eval_par.int_line_row; points->coords[2] = x; @@ -745,21 +862,20 @@ canvas_display_motion_notify(GtkWidget * widget, } - disp->index_x_old = index_x; - disp->index_y_old = index_y; gnome_canvas_points_free(points); - + return TRUE; } + gint canvas_display_button_press(GtkWidget * widget, GdkEventButton * event) { Display * disp = gtk_object_get_data(GTK_OBJECT(widget), "disp"); GpivConsole *gpiv = gtk_object_get_data(GTK_OBJECT(widget), "gpiv"); - gint x, y, i, j, x_min = 10e4, y_min = 10e4, dif; + gint x, y; gint index_x = 0, index_y = 0; /* Intreg *intreg = disp->intreg; */ GdkModifierType state; @@ -771,279 +887,247 @@ canvas_display_button_press(GtkWidget * widget, y = (y + y_offset) / disp->zoom_factor; if (event->button == 1) { - if (m_select == NO_MS) { + if (m_select == NO_MS) { /* * select Area Of Interest */ - } else if (m_select == AOI_MS) { + } else if (m_select == AOI_MS) { /* * storige of original AOI */ - disp->intreg.col_start_old = piv_eval_par.col_start; - disp->intreg.row_start_old = piv_eval_par.row_start; - - disp->xgrab_first = x; - disp->ygrab_first = y; - assert( gci_aoi == NULL); - gci_aoi = - gnome_canvas_item_new(gnome_canvas_root(GNOME_CANVAS(disp->canvas)), - gnome_canvas_rect_get_type(), - "x1", (double) x, - "y1", (double) y, - "x2", (double) x, - "y2", (double) y, - "outline_color", "yellow", - "width_units", (double) THICKNESS, - NULL); - -g_warning(" canvas_display_button_press:: destroy_all_intregs count=%d", - disp->count); - destroy_all_intregs(disp); + disp->intreg.col_start_old = piv_eval_par.col_start; + disp->intreg.row_start_old = piv_eval_par.row_start; + + disp->xgrab_first = x; + disp->ygrab_first = y; + assert( gci_aoi == NULL); + gci_aoi = + gnome_canvas_item_new(gnome_canvas_root + (GNOME_CANVAS(disp->canvas)), + gnome_canvas_rect_get_type(), + "x1", (double) x, + "y1", (double) y, + "x2", (double) x, + "y2", (double) y, + "outline_color", "yellow", + "width_units", (double) THICKNESS, + NULL); + /* * analyse at single interrogation area */ - } else if ((m_select == SINGLE_AREA_MS || m_select == DRAG_MS) && - display_act->img.exist_img) { - if (disp->intreg.exist && display_act->gpd.exist_piv) { -/* - * search index nearest to pointer - */ - for (i = 0; i < disp->intreg.data.ny; i++) { - for (j = 0; j < disp->intreg.data.nx; j++) { - dif = abs(y - (int) disp->intreg.data.point_y[i][j]); - if (dif < y_min) { - y_min = dif; - index_y = i; - } - dif = abs(x - (int) disp->intreg.data.point_x[i][j]); - if (dif < x_min) { - x_min = dif; - index_x = j; - } - } - } - m_select_index_x = index_x; - m_select_index_y = index_y; - - if (m_select == DRAG_MS) { - display_act->gpd.piv_data.point_x[m_select_index_y][m_select_index_x] = (float) x; - display_act->gpd.piv_data.point_y[m_select_index_y][m_select_index_x] = (float) y; - disp->intreg.data.point_x[m_select_index_y][m_select_index_x] = (float) x; - disp->intreg.data.point_y[m_select_index_y][m_select_index_x] = (float) y; - } - -/* g_warning("\nCANVAS_DISPLAY_BUTTON_PRESS::interr analysis at x=%3.2f y=%3.2f i=%d j=%d", */ -/* intregs.point_x[m_select_index_y][m_select_index_x], */ -/* intregs.point_y[m_select_index_y][m_select_index_x], */ -/* m_select_index_y, */ -/* m_select_index_x); */ - interrogate(&display_act->gpd.piv_data, display_act->img.img1, - display_act->img.img2, gpiv); - if (display_act->gpd.gci_vector[m_select_index_y][m_select_index_x] != NULL) { - update_vector(m_select_index_y, m_select_index_x, &display_act->gpd); -/* fprintf(stderr,"CANVAS_DISPLAY_BUTTON_PRESS:: gci_vector != NULL\n"); */ - } else { -/* fprintf(stderr,"PRESS:: gci_vector == NULL\n"); */ - display_vector(m_select_index_y, m_select_index_x, - &display_act->gpd); - } - display_act->gpd.exist_piv = TRUE; - disp->display_piv = TRUE; - if (m_select == DRAG_MS) { - if (disp->intreg. - gci_intreg1[m_select_index_y][m_select_index_x] - != NULL) - update_intreg1 - (m_select_index_y, m_select_index_x, - disp); - if (disp->intreg. - gci_intreg2[m_select_index_y][m_select_index_x] - != NULL) - update_intreg2(m_select_index_y, m_select_index_x, - disp); - } + } else if ((m_select == SINGLE_AREA_MS || m_select == DRAG_MS) && + display_act->img.exist_img) { + if (disp->intreg.exist && display_act->gpd.exist_piv) { + search_nearest_index(disp, x, y, &index_x, &index_y); + m_select_index_x = index_x; + m_select_index_y = index_y; + + if (m_select == DRAG_MS) { + disp->gpd.piv_data.point_x[m_select_index_y] + [m_select_index_x] = (float) x; + disp->gpd.piv_data.point_y[m_select_index_y + ][m_select_index_x] = (float) y; + disp->intreg.data.point_x[m_select_index_y] + [m_select_index_x] = (float) x; + disp->intreg.data.point_y[m_select_index_y] + [m_select_index_x] = (float) y; + } - } else { - msg_error = "Interrogation area's and piv data must already exist!"; - gtk_warning(msg_error); - } + + interrogate(&display_act->gpd.piv_data, display_act->img.img1, + display_act->img.img2, gpiv); + + if (display_act->gpd.gci_vector[m_select_index_y] + [m_select_index_x] != NULL) { + update_vector(m_select_index_y, m_select_index_x, + &display_act->gpd); + } else { + display_vector(m_select_index_y, m_select_index_x, + &display_act->gpd); + } + +/* display_act->gpd.exist_piv = TRUE; */ + disp->display_piv = TRUE; + if (m_select == DRAG_MS) { + if (disp->intreg. + gci_intreg1[m_select_index_y][m_select_index_x] + != NULL) + update_intreg1 + (m_select_index_y, m_select_index_x, + disp); + if (disp->intreg. + gci_intreg2[m_select_index_y][m_select_index_x] + != NULL) + update_intreg2(m_select_index_y, m_select_index_x, + disp); + } + + } else { + msg_error = "Interrogation area's and piv data must already exist!"; + gtk_warning(msg_error); + } /* * Reset mouse selection to inactive + * DISABELED */ -/* if (m_select == DRAG_MS) */ -/* gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON */ -/* (radiobutton_piv_mouse_1), */ -/* TRUE); */ +/* gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON */ +/* (gpiv->piveval->radiobutton_mouse_1), */ +/* TRUE); */ +/* cursor = gdk_cursor_new(GDK_DOTBOX); */ +/* gdk_window_set_cursor(disp->mwin->window, cursor); */ -/* -------------------------------------------------------------------- - analyse at single point */ - } else if (m_select == SINGLE_POINT_MS - && display_act->img.exist_img -/* && */ -/* x >= piv_eval_par.col_start + piv_eval_par.int_size_2 / 2 && */ -/* x <= piv_eval_par.col_end - piv_eval_par.int_size_2 / 2 && */ -/* y >= piv_eval_par.row_start + piv_eval_par.int_size_2 / 2 && */ -/* y <= piv_eval_par.row_end - piv_eval_par.int_size_2 / 2 && */ - -/* x >= piv_eval_par.col_start + piv_eval_par.int_size_2 / 2 - piv_eval_par.pre_shift_col && */ -/* x <= piv_eval_par.col_end - piv_eval_par.int_size_2 / 2 - piv_eval_par.pre_shift_col && */ -/* y >= piv_eval_par.row_start + piv_eval_par.int_size_2 / 2 - piv_eval_par.pre_shift_row && */ -/* y <= piv_eval_par.row_end - piv_eval_par.int_size_2 / 2 - piv_eval_par.pre_shift_row */ - ) { - - if (display_act->gpd.exist_piv) { - destroy_all_vectors(&display_act->gpd); - display_act->gpd.exist_piv = FALSE; - disp->display_piv = FALSE; - } +/* + * analyse at single point + */ + } else if (m_select == SINGLE_POINT_MS && disp->img.exist_img) { + if (disp->gpd.exist_piv) { + destroy_all_vectors(&disp->gpd); + gpiv_free_pivdata (&disp->gpd.piv_data); + disp->gpd.exist_piv = FALSE; + if (disp->gpd.scaled_piv) { + gpiv_free_pivdata(&disp->gpd.piv_data_scaled); + disp->gpd.scaled_piv = FALSE; + } + } - destroy_all_intregs(disp); + free_post_bufmems(disp); + destroy_all_intregs(disp); - m_select_index_x = 0; - m_select_index_y = 0; - piv_eval_par.int_point_col = x; - piv_eval_par.int_point_row = y; - interrogate(&display_act->gpd.piv_data, display_act->img.img1, display_act->img.img2, - gpiv); - - display_all_vectors(&display_act->gpd); - display_act->gpd.exist_piv = TRUE; - disp->display_piv = TRUE; - -/* disp->intreg.data.nx = display_act->gpd.piv_data.nx; */ -/* disp->intreg.data.ny = display_act->gpd.piv_data.ny; */ -/* disp->intreg.data.point_x[0][0] = display_act->gpd.piv_data.point_x[0][0]; */ -/* disp->intreg.data.point_y[0][0] = display_act->gpd.piv_data.point_y[0][0]; */ + m_select_index_x = 0; + m_select_index_y = 0; + piv_eval_par.int_point_col = (float) x; + piv_eval_par.int_point_row = (float) y; + gpiv_alloc_pivdata(&disp->gpd.piv_data); + display_act->gpd.exist_piv = TRUE; + + disp->gpd.piv_data.point_x[0][0] = (float) x; + disp->gpd.piv_data.point_y[0][0] = (float) y; + + disp->intreg.data.nx = 1; + disp->intreg.data.ny = 1; + create_all_intregs(disp); + disp->intreg.exist = 1; + + disp->intreg.data.point_x[0][0] = (float) x; + disp->intreg.data.point_y[0][0] = (float) y; + show_all_intregs(disp); + disp->display_intregs = TRUE; + + interrogate(&disp->gpd.piv_data, + disp->img.img1, + disp->img.img2, + gpiv); + disp->display_piv = TRUE; + + display_all_vectors(&display_act->gpd); + gnome_canvas_update_now(GNOME_CANVAS(disp->canvas)); + /* - * NOT TESTED + * Reset mouse selection to inactive */ - disp->intreg.data.nx = 1; - disp->intreg.data.ny = 1; - disp->intreg.data.point_x[0][0] = display_act->gpd.piv_data.point_x[0][0]; - disp->intreg.data.point_y[0][0] = display_act->gpd.piv_data.point_y[0][0]; - disp->intreg.exist = 1; - gnome_canvas_update_now(GNOME_CANVAS(disp->canvas)); - - - } else if (m_select == VLINE_MS && display_act->img.exist_img) { - piv_eval_par.int_line_col = x; - piv_eval_par.int_line_row_start = y; - - points->coords[0] = piv_eval_par.int_line_col; - points->coords[1] = piv_eval_par.int_line_row_start; - points->coords[2] = piv_eval_par.int_line_col; - points->coords[3] = piv_eval_par.int_line_row_start; - if (gci_line != NULL) - gtk_object_destroy(GTK_OBJECT(gci_line)); - gci_line = - gnome_canvas_item_new(gnome_canvas_root(GNOME_CANVAS(disp->canvas) - ), - gnome_canvas_line_get_type(), - "points", points, - "fill_color", "yellow", - "width_units", (double) THICKNESS, - NULL); - - + gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON + (gpiv->piveval->radiobutton_mouse_1), + TRUE); + cursor = gdk_cursor_new(GDK_DOTBOX); + gdk_window_set_cursor(disp->mwin->window, cursor); + - } else if (m_select == HLINE_MS && display_act->img.exist_img) { - piv_eval_par.int_line_col = x; - piv_eval_par.int_line_row_start = y; - points->coords[0] = piv_eval_par.int_line_col_start; - points->coords[1] = piv_eval_par.int_line_row; - points->coords[2] = piv_eval_par.int_line_col_start; - points->coords[3] = piv_eval_par.int_line_row; - if (gci_line != NULL) - gtk_object_destroy(GTK_OBJECT(gci_line)); - gci_line = - gnome_canvas_item_new(gnome_canvas_root(GNOME_CANVAS(disp->canvas) - ), - gnome_canvas_line_get_type(), - "points", points, - "fill_color", "yellow", - "width_units", (double) THICKNESS, - NULL); + } else if (m_select == VLINE_MS && display_act->img.exist_img) { + piv_eval_par.int_line_col = x; + piv_eval_par.int_line_row_start = y; + + points->coords[0] = piv_eval_par.int_line_col; + points->coords[1] = piv_eval_par.int_line_row_start; + points->coords[2] = piv_eval_par.int_line_col; + points->coords[3] = piv_eval_par.int_line_row_start; + if (gci_line != NULL) + gtk_object_destroy(GTK_OBJECT(gci_line)); + gci_line = + gnome_canvas_item_new(gnome_canvas_root(GNOME_CANVAS(disp->canvas) + ), + gnome_canvas_line_get_type(), + "points", points, + "fill_color", "yellow", + "width_units", (double) THICKNESS, + NULL); - } else if ( m_select == ENABLE_POINT_MS ) { -/* -------------------------------------------------------------------- - Only active with piv data */ - if (display_act->gpd.exist_piv && disp->display_piv && - disp->intreg.exist && disp->display_intregs) { -/* -------------------------------------------------------------------- - search index nearest to pointer */ - for (i = 0; i < display_act->gpd.piv_data.ny; i++) { - for (j = 0; j < display_act->gpd.piv_data.nx; j++) { - dif = abs(y - (int) display_act->gpd.piv_data.point_y[i][j]); - if (dif < y_min) { - y_min = dif; - index_y = i; - } - dif = abs(x - (int) display_act->gpd.piv_data.point_x[i][j]); - if (dif < x_min) { - x_min = dif; - index_x = j; - } - } - } - display_act->gpd.piv_data.peak_no[index_y][index_x] = 1; - update_vector(index_y, index_x, &display_act->gpd); - } - + } else if (m_select == HLINE_MS && display_act->img.exist_img) { + piv_eval_par.int_line_col_start = x; + piv_eval_par.int_line_row = y; + points->coords[0] = piv_eval_par.int_line_col_start; + points->coords[1] = piv_eval_par.int_line_row; + points->coords[2] = piv_eval_par.int_line_col_start; + points->coords[3] = piv_eval_par.int_line_row; + if (gci_line != NULL) + gtk_object_destroy(GTK_OBJECT(gci_line)); + gci_line = + gnome_canvas_item_new(gnome_canvas_root(GNOME_CANVAS(disp->canvas) + ), + gnome_canvas_line_get_type(), + "points", points, + "fill_color", "yellow", + "width_units", (double) THICKNESS, + NULL); + + + + } else if ( m_select == ENABLE_POINT_MS ) { /* - * Enabling and disabling only active with piv data + * Only active with piv data */ - } else if (display_act->gpd.exist_piv && disp->display_piv) { - if ( m_select == DISABLE_POINT_MS ) { - -/* -------------------------------------------------------------------- - search index nearest to pointer */ - for (i = 0; i < display_act->gpd.piv_data.ny; i++) { - for (j = 0; j < display_act->gpd.piv_data.nx; j++) { - dif = abs(y - (int) display_act->gpd.piv_data.point_y[i][j]); - if (dif < y_min) { - y_min = dif; - index_y = i; - } - dif = abs(x - (int) display_act->gpd.piv_data.point_x[i][j]); - if (dif < x_min) { - x_min = dif; - index_x = j; - } - } - } - display_act->gpd.piv_data.peak_no[index_y][index_x] = -1; - update_vector(index_y, index_x, &display_act->gpd); - - - } else if ( m_select == ENABLE_AREA_MS ) { - enable_col_start = x; - enable_row_start = y; - assert( gci_aoi == NULL); - gci_aoi = gnome_canvas_item_new(gnome_canvas_root(GNOME_CANVAS(disp->canvas) - ), - gnome_canvas_rect_get_type(), - "x1", (double) x, - "y1", (double) y, - "x2", (double) x, - "y2", (double) y, - "outline_color", "yellow", - "width_units", (double) THICKNESS, - NULL); + if (display_act->gpd.exist_piv && disp->display_piv && + disp->intreg.exist && disp->display_intregs) { + search_nearest_index(disp, x, y, &index_x, &index_y); + display_act->gpd.piv_data.peak_no[index_y][index_x] = 1; + update_vector(index_y, index_x, &display_act->gpd); + } - } else if ( m_select == DISABLE_AREA_MS) { - enable_col_start = x; - enable_row_start = y; - assert( gci_aoi == NULL); - gci_aoi = gnome_canvas_item_new(gnome_canvas_root(GNOME_CANVAS(disp->canvas) - ), +/* + * Enabling and disabling only active with piv data + */ + } else if ((m_select == DISABLE_POINT_MS + || m_select == ENABLE_AREA_MS + || m_select == DISABLE_AREA_MS) + && display_act->gpd.exist_piv && disp->display_piv) { + if ( m_select == DISABLE_POINT_MS ) { + search_nearest_index(disp, x, y, &index_x, &index_y); + display_act->gpd.piv_data.peak_no[index_y][index_x] = -1; + update_vector(index_y, index_x, &display_act->gpd); + + + } else if ( m_select == ENABLE_AREA_MS ) { + enable_col_start = x; + enable_row_start = y; + assert( gci_aoi == NULL); + gci_aoi = + gnome_canvas_item_new(gnome_canvas_root(GNOME_CANVAS(disp->canvas) + ), + gnome_canvas_rect_get_type(), + "x1", (double) x, + "y1", (double) y, + "x2", (double) x, + "y2", (double) y, + "outline_color", "yellow", + "width_units", (double) THICKNESS, + NULL); + + + } else if ( m_select == DISABLE_AREA_MS) { + enable_col_start = x; + enable_row_start = y; + assert( gci_aoi == NULL); + gci_aoi = + gnome_canvas_item_new(gnome_canvas_root(GNOME_CANVAS(disp->canvas) + ), gnome_canvas_rect_get_type(), "x1", (double) x, "y1", (double) y, @@ -1052,13 +1136,13 @@ g_warning(" canvas_display_button_press:: destroy_all_intregs count=%d", "outline_color", "yellow", "width_units", (double) THICKNESS, NULL); - } else { - g_warning("should not arrive here"); - } - } else { - msg_error = _("no image or piv data"); - gtk_warning(msg_error); - } + } else { + g_warning("should not arrive here"); + } + } else { + msg_error = _("no image or piv data"); + gtk_warning(msg_error); + } } @@ -1072,6 +1156,7 @@ g_warning(" canvas_display_button_press:: destroy_all_intregs count=%d", } + gint canvas_display_button_release(GtkWidget * widget, GdkEventButton * event) { @@ -1087,7 +1172,7 @@ canvas_display_button_release(GtkWidget * widget, GdkEventButton * event) gdk_window_get_pointer(event->window, &x, &y, &state); x = (x + x_offset)/ disp->zoom_factor; y = (y + y_offset) / disp->zoom_factor; - + g_warning("button_release:: x=%d y=%d", x, y); if (event->button == 1) { /* printf("CANVAS_DISPLAY_BUTTON_RELEASE:: button=%d\n", */ /* event->button); */ @@ -1143,21 +1228,92 @@ canvas_display_button_release(GtkWidget * widget, GdkEventButton * event) + } else if ((m_select == VLINE_MS || m_select == HLINE_MS) + && display_act->img.exist_img) { + if (display_act->gpd.exist_piv) { + destroy_all_vectors(&display_act->gpd); + disp->display_piv = FALSE; + } + + if (disp->intreg.exist) destroy_all_intregs(disp); + + + m_select_index_x = 0; + m_select_index_y = 0; + + if (m_select == VLINE_MS) { + piv_eval_par.int_line_row_end = y; + + piv_eval_par.row_start = piv_eval_par.int_line_row_start; + piv_eval_par.row_end = piv_eval_par.int_line_row_end; + piv_eval_par.col_start = piv_eval_par.int_line_col - + piv_eval_par.int_size_2 / 2 +/* + piv_eval_par.pre_shift_col */ + + 1; + + piv_eval_par.col_end = piv_eval_par.int_line_col + + piv_eval_par.int_size_2 / 2 + + piv_eval_par.pre_shift_col ; + + } else { + piv_eval_par.int_line_col_end = x; + + piv_eval_par.col_start = piv_eval_par.int_line_col_start; + piv_eval_par.col_end = piv_eval_par.int_line_col_end; + piv_eval_par.row_start = piv_eval_par.int_line_row - + piv_eval_par.int_size_2 / 2 +/* + piv_eval_par.pre_shift_row */ + + 1; + + piv_eval_par.row_end = piv_eval_par.int_line_row + + piv_eval_par.int_size_2 / 2 + + piv_eval_par.pre_shift_col; + } + + if (gci_line != NULL) { + gtk_object_destroy(GTK_OBJECT(gci_line)); + gci_line = NULL; + } + + if (!disp->display_intregs + && GTK_CHECK_MENU_ITEM(view_menu_display4)->active) { + show_all_intregs(disp); + disp->display_intregs = TRUE; + } +/* + * updating entry's for col/row_start_end + */ + + gtk_spin_button_set_value(GTK_SPIN_BUTTON + (gpiv->piveval->spinbutton_colstart), + piv_eval_par.col_start); + gtk_spin_button_set_value(GTK_SPIN_BUTTON + (gpiv->piveval->spinbutton_rowstart), + piv_eval_par.row_start); + gtk_spin_button_set_value(GTK_SPIN_BUTTON + (gpiv->piveval->spinbutton_colend), + piv_eval_par.col_end); + gtk_spin_button_set_value(GTK_SPIN_BUTTON + (gpiv->piveval->spinbutton_rowend), + piv_eval_par.row_end); + + + } else if (m_select == ENABLE_AREA_MS && gci_aoi != NULL) { enable_col_end = x; enable_row_end = y; if (display_act->gpd.exist_piv) { for (i = 0; i < display_act->gpd.piv_data.ny; i++) { for (j = 0; j < display_act->gpd.piv_data.nx; j++) { - if (display_act->gpd.piv_data.point_x[i][j] >= + if (disp->gpd.piv_data.point_x[i][j] >= enable_col_start - && display_act->gpd.piv_data.point_x[i][j] < + && disp->gpd.piv_data.point_x[i][j] < enable_col_end - && display_act->gpd.piv_data.point_y[i][j] >= + && disp->gpd.piv_data.point_y[i][j] >= enable_row_start - && display_act->gpd.piv_data.point_y[i][j] < + && disp->gpd.piv_data.point_y[i][j] < enable_row_end) { - display_act->gpd.piv_data.peak_no[i][j] = 1; + disp->gpd.piv_data.peak_no[i][j] = 1; if (disp->display_piv) update_vector(i, j, &display_act->gpd); @@ -1169,6 +1325,7 @@ canvas_display_button_release(GtkWidget * widget, GdkEventButton * event) gci_aoi = NULL; + } else if (m_select == DISABLE_AREA_MS && gci_aoi != NULL) { enable_col_end = x; enable_row_end = y; @@ -1193,41 +1350,6 @@ canvas_display_button_release(GtkWidget * widget, GdkEventButton * event) } gtk_object_destroy(GTK_OBJECT(gci_aoi)); gci_aoi = NULL; - - - } else if ((m_select == VLINE_MS || m_select == HLINE_MS) - && display_act->img.exist_img) { - if (display_act->gpd.exist_piv) { - destroy_all_vectors(&display_act->gpd); - display_act->gpd.exist_piv = FALSE; - disp->display_piv = FALSE; - } - - if (disp->intreg.exist) { - destroy_all_intregs(disp); -/* destroy_all_intregs1(display_act); */ -/* destroy_all_intregs2(display_act); */ -/* intreg.exist = 0; */ - } - - m_select_index_x = 0; - m_select_index_y = 0; - - if (m_select == VLINE_MS) { - piv_eval_par.int_line_row_end = y; - piv_eval_par.int_geo = LINE_C; - } else { - piv_eval_par.int_line_col_end = x; - piv_eval_par.int_geo = LINE_R; - } - - if (gci_line != NULL) { - gtk_object_destroy(GTK_OBJECT(gci_line)); - gci_line = NULL; - } - - -/* interrogate(&display_act->gpd.piv_data, display_act->img.img1, display_act->img.img2); */ } @@ -1237,15 +1359,14 @@ canvas_display_button_release(GtkWidget * widget, GdkEventButton * event) } -gint canvas_display_leave_notify(GtkWidget * widget, - GdkEventMotion * event) +gint +canvas_display_leave_notify(GtkWidget * widget, + GdkEventMotion * event) { /* gint x, y; */ /* GdkModifierType state; */ Display * disp = gtk_object_get_data(GTK_OBJECT(widget), "disp"); GpivConsole *gpiv = gtk_object_get_data(GTK_OBJECT(widget), "gpiv"); - gint index_x_old = disp->index_x_old; - gint index_y_old = disp->index_y_old; GtkWidget * view_menu_display4 = gtk_object_get_data(GTK_OBJECT(disp->mwin), "view_menu_display4"); @@ -1259,43 +1380,36 @@ gint canvas_display_leave_notify(GtkWidget * widget, if (m_select == SINGLE_POINT_MS && disp->intreg.exist /* && !disp->display_intregs */ ) { - gnome_canvas_item_set (GNOME_CANVAS_ITEM(disp->intreg.gci_intreg1[0][0]), - "x1", (double) disp->intreg.data.point_x[0][0] - - piv_eval_par.int_size_1 / 2, - "y1", (double) disp->intreg.data.point_y[0][0] - - piv_eval_par.int_size_1 / 2, - "x2", (double) disp->intreg.data.point_x[0][0] - + piv_eval_par.int_size_1 / 2, - "y2", (double) disp->intreg.data.point_y[0][0] - + piv_eval_par.int_size_1 / 2, - NULL); - - gnome_canvas_item_set (GNOME_CANVAS_ITEM(disp->intreg.gci_intreg2[0][0]), - "x1", (double) disp->intreg.data.point_x[0][0] - - piv_eval_par.int_size_1 / 2 - + piv_eval_par.pre_shift_col, - "y1", (double) disp->intreg.data.point_y[0][0] - - piv_eval_par.int_size_1 / 2 - + piv_eval_par.pre_shift_row, - "x2", (double) disp->intreg.data.point_x[0][0] - + piv_eval_par.int_size_1 / 2 - + piv_eval_par.pre_shift_col, - "y2", (double) disp->intreg.data.point_y[0][0] - + piv_eval_par.int_size_1 / 2 - + piv_eval_par.pre_shift_row, - NULL); - - if (!disp->display_intregs) { + + update_intreg1(m_select_index_y, m_select_index_x, disp); + update_intreg2(m_select_index_y, m_select_index_x, disp); + + if (disp->display_intregs) { show_all_intregs(disp); disp->display_intregs = TRUE; } - } - if (m_select == AOI_MS - || m_select == SINGLE_POINT_MS + if (display_act->gpd.exist_piv && !disp->display_piv) { + show_all_vectors(&display_act->gpd); + disp->display_piv = TRUE; + } + + + } else if (m_select == DRAG_MS) { + update_intreg1(disp->index_y_old, disp->index_x_old, disp); + update_intreg2(disp->index_y_old, disp->index_x_old, disp); + + + } else if (m_select == SINGLE_AREA_MS && disp->intreg.exist) { + update_intreg1(0, 0, disp); + update_intreg2(0, 0, disp); + + + + } else if (m_select == AOI_MS || m_select == VLINE_MS || m_select == HLINE_MS) { - if (!disp->display_intregs + if (disp->intreg.exist && !disp->display_intregs && GTK_CHECK_MENU_ITEM(view_menu_display4)->active) { show_all_intregs(disp); disp->display_intregs = TRUE; @@ -1361,22 +1475,25 @@ gint canvas_display_leave_notify(GtkWidget * widget, + +/* + * General + */ if (cursor != NULL) { gdk_cursor_destroy(cursor); cursor = NULL; } + if (disp->intreg.gci_intreg2[disp->index_y_old][disp->index_x_old] + != NULL) { + update_intreg2(disp->index_y_old, disp->index_x_old, disp); + } + + if (disp->intreg.gci_intreg1[disp->index_y_old][disp->index_x_old] + != NULL) { + update_intreg1(disp->index_y_old, disp->index_x_old, disp); + } - if (disp->intreg.gci_intreg2[index_y_old][index_x_old] != NULL) - gnome_canvas_item_set(disp->intreg. - gci_intreg2[index_y_old][index_x_old], - "outline_color", - "yellow", NULL); - if (disp->intreg.gci_intreg1[index_y_old][index_x_old] != NULL) - gnome_canvas_item_set(disp->intreg. - gci_intreg1[index_y_old][index_x_old], - "outline_color", - "blue", NULL); disp->index_x_old = 0; disp->index_y_old = 0; @@ -1426,41 +1543,52 @@ void view_toggle_rulers(GtkWidget * widget, gpointer data) } -void view_toggle_stretch_display(GtkWidget * widget, gpointer data) +void +view_toggle_stretch_display(GtkWidget * widget, + gpointer data) { Display * disp = display_act; - gint screen_width = 0, screen_height = 0; - gint new_width = 0, new_height = 0; - - screen_width = gdk_screen_width(); - screen_height = gdk_screen_height(); - new_width = (gint) (disp->zoom_factor * gpiv_par.img_width + VIEW_HMARGE); - new_height = (gint) (disp->zoom_factor * gpiv_par.img_height + VIEW_VMARGE); + gint screen_width = gdk_screen_width(); + gint screen_height = gdk_screen_height(); + gint new_width = (gint) (disp->zoom_factor * gpiv_par.img_width + + VIEW_HMARGE); + gint new_height = (gint) (disp->zoom_factor * gpiv_par.img_height + + VIEW_VMARGE); /* if (GTK_CHECK_MENU_ITEM(widget)->active) { */ -/* gpiv_par.stretch_window = TRUE; */ + if (new_width < screen_width && new_height < screen_height) { gnome_win_hints_set_state(disp->mwin, 0); gdk_window_resize(disp->mwin->window, new_width, new_height); + } else if (new_width > screen_width && new_height < screen_height) { gnome_win_hints_set_state(disp->mwin, WIN_STATE_MAXIMIZED_HORIZ); + } else if (new_width < screen_width && new_height > screen_height) { gnome_win_hints_set_state(disp->mwin, WIN_STATE_MAXIMIZED_VERT); + } else if (new_width > screen_width && new_height > screen_height) { gnome_win_hints_set_state(disp->mwin, WIN_STATE_MAXIMIZED_HORIZ + WIN_STATE_MAXIMIZED_VERT); - } -/* } else { */ -/* gpiv_par.stretch_window = FALSE; */ -/* } */ + } else { + gpiv_warning("view_toggle_stretch_display: Should not arrive here"); + } + + gtk_widget_set_usize (disp->canvas, + (gint) (disp->zoom_factor * gpiv_par.img_width), + (gint) (disp->zoom_factor * gpiv_par.img_height)); + disp->stretch_window_tmp = TRUE; + disp->zoom_factor_old = disp->zoom_factor; } -void view_toggle_img1(GtkWidget * widget, gpointer data) +void +view_toggle_img1(GtkWidget * widget, + gpointer data) { if (display_act->img.exist_img) { if (GTK_CHECK_MENU_ITEM(widget)->active) { @@ -1665,7 +1793,7 @@ TODO: for Gnome canvas*/ while ((disp->img.rgb_img_width) % 4 != 0) { disp->img.rgb_img_width++; } - g_warning("display_img:: added: %d", disp->img.rgb_img_width - gpiv_par.img_width); +/* g_warning("display_img:: added: %d", disp->img.rgb_img_width - gpiv_par.img_width); */ disp->img.graybuf_img = g_malloc(disp->img.rgb_img_width * gpiv_par.img_height); pos = disp->img.graybuf_img; @@ -1843,9 +1971,9 @@ create_intreg_data(Display * disp) gpiv_piv_count_pivdata_fromimage(&data, image_par, piv_eval_par); gpiv_alloc_pivdata(&data); + disp->intreg.exist = TRUE; gpiv_piv_select_int_point(&data, image_par, piv_eval_par); disp->intreg.data = data; - disp->intreg.exist = 1; } @@ -2061,7 +2189,7 @@ create_intreg2(gint i, float x, y; assert (disp != NULL); - assert (disp->intreg.exist == 1); + assert (disp->intreg.exist == 1); x = disp->intreg.data.point_x[i][j]; y = disp->intreg.data.point_y[i][j]; @@ -2101,14 +2229,14 @@ update_intreg2(gint i, gint j, Display * disp) assert (disp->intreg.exist == 1); assert (disp->intreg.gci_intreg1[i][j] != NULL); - x = disp->intreg.data.point_x[i][j]; - y = disp->intreg.data.point_y[i][j]; + x = disp->intreg.data.point_x[i][j] + piv_eval_par.pre_shift_col; + y = disp->intreg.data.point_y[i][j] + piv_eval_par.pre_shift_row; /* ------------------------------ Using centre points of interr regs */ - start_x = (int) x - piv_eval_par.int_size_1 / 2; - start_y = (int) y - piv_eval_par.int_size_1 / 2; - end_x = (int) x + piv_eval_par.int_size_1 / 2; - end_y = (int) y + piv_eval_par.int_size_1 / 2; + start_x = (int) x - piv_eval_par.int_size_2 / 2; + start_y = (int) y - piv_eval_par.int_size_2 / 2; + end_x = (int) x + piv_eval_par.int_size_2 / 2; + end_y = (int) y + piv_eval_par.int_size_2 / 2; if (disp->intreg.gci_intreg2[i][j] != NULL) { gnome_canvas_item_set(GNOME_CANVAS_ITEM @@ -2117,7 +2245,7 @@ update_intreg2(gint i, gint j, Display * disp) "y1", (double) start_y, "x2", (double) end_x, "y2", (double) end_y, - "outline_color", "blue", + "outline_color", "yellow", "width_units", (double) THICKNESS, NULL); } diff --git a/src/display.h b/src/display.h index 2b8c33f..0e207fe 100644 --- a/src/display.h +++ b/src/display.h @@ -29,8 +29,11 @@ /* * (callback) functions for the display * $Log: display.h,v $ - * Revision 1.1 2003-06-17 17:10:52 gerber - * Initial revision + * Revision 1.2 2003-06-27 13:47:26 gerber + * display ruler, line/point evaluation + * + * Revision 1.1.1.1 2003/06/17 17:10:52 gerber + * Imported gpiv * */ @@ -74,6 +77,13 @@ on_displaypopup_handler(GtkWidget *widget, GdkEvent *event); void select_zoomscale(gpointer data, guint action, GtkWidget * widget); +/* void */ +/* select_zoomscale(GtkMenuItem * menuitem, gpointer data, guint action); */ + +void +zoom_display(Display *disp, gint zoom_index); + + /* ORIGINAL CALLBACK (DIDN'T WORK) gpointer data, guint action, GtkWidget*widgetvoid */ void view_toggle_rulers(GtkWidget *widget, gpointer data); diff --git a/src/display_interface.c b/src/display_interface.c index 6318520..5c62b8d 100644 --- a/src/display_interface.c +++ b/src/display_interface.c @@ -27,8 +27,11 @@ /* * interface for create_display * $Log: display_interface.c,v $ - * Revision 1.1 2003-06-17 17:10:52 gerber - * Initial revision + * Revision 1.2 2003-06-27 13:47:26 gerber + * display ruler, line/point evaluation + * + * Revision 1.1.1.1 2003/06/17 17:10:52 gerber + * Imported gpiv * */ #include "gpiv_gtk.h" @@ -138,13 +141,20 @@ create_display(gchar * fname, /* }*/ -/* gtk_window_set_policy (GTK_WINDOW (disp->mwin), */ -/* FALSE, */ -/* TRUE, */ -/* FALSE); */ + gtk_window_set_policy (GTK_WINDOW (disp->mwin), + FALSE, + FALSE, + TRUE); +/* + * for gtk 1.4 (or newer?) + */ +/* gtk_window_set_user_resizeable(GTK_WINDOW (disp->mwin), */ +/* FALSE); */ -/* table */ +/* + * table + */ disp->table = gtk_table_new(2, 3, FALSE); @@ -154,14 +164,12 @@ create_display(gchar * fname, disp->table, (GtkDestroyNotify) gtk_widget_unref); gtk_widget_show(disp->table); -/* gtk_container_add (GTK_CONTAINER (viewport_display), - disp->table); */ gtk_container_add(GTK_CONTAINER(disp->mwin), disp->table); /* - * button with arrow disabled as conflicts with popup menu + * button with arrow disabled as it conflicts with popup menu */ /* disp->button_origin = gtk_button_new(); */ /* disp->arrow_origin = gtk_arrow_new(GTK_ARROW_RIGHT, GTK_SHADOW_OUT); */ @@ -200,16 +208,22 @@ create_display(gchar * fname, 2, 0, 1, - (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), + (GtkAttachOptions) (GTK_EXPAND/* | GTK_FILL */), (GtkAttachOptions) (GTK_FILL), 0, 0); -/* gtk_ruler_set_range (GTK_RULER (disp->hruler), 0, 500, 0, 1279); */ + gtk_ruler_set_range(GTK_RULER(disp->hruler), - 0, - gpiv_par.img_width - 1, - 0, - gpiv_par.img_height - 1); + 0.0, + (gfloat) (gpiv_par.img_width - 1), + 0.0, + (gfloat) (gpiv_par.img_width - 1)); + gtk_widget_set_usize (disp->hruler, + (gint) (disp->zoom_factor * gpiv_par.img_width), + RULER_WIDTH); + gtk_widget_set_uposition (disp->hruler, RULER_WIDTH, 0); + + disp->vruler = gtk_vruler_new(); gtk_widget_ref(disp->vruler); @@ -224,16 +238,20 @@ create_display(gchar * fname, 1, 1, 2, - (GtkAttachOptions) (GTK_FILL), - (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), + (GtkAttachOptions) (GTK_EXPAND /* GTK_FILL */), + (GtkAttachOptions) (GTK_EXPAND /* | GTK_FILL */), 0, 0); -/* gtk_ruler_set_range (GTK_RULER (disp->vruler), 0, 550, 0, 1023); */ - gtk_ruler_set_range(GTK_RULER(disp->vruler), - 0, - gpiv_par.img_width - 1, - 0, - gpiv_par.img_height - 1); + + gtk_ruler_set_range(GTK_RULER(disp->vruler), + 0.0, + (gfloat) (gpiv_par.img_height - 1), + 0.0, + (gfloat) (gpiv_par.img_height - 1)); + gtk_widget_set_usize (disp->vruler, + RULER_WIDTH, + (gint) (disp->zoom_factor * gpiv_par.img_height)); + gtk_widget_set_uposition (disp->vruler, 0, RULER_WIDTH); /* @@ -247,7 +265,6 @@ create_display(gchar * fname, disp->scrolledwindow, (GtkDestroyNotify) gtk_widget_unref); gtk_widget_show(disp->scrolledwindow); -/* gtk_container_add (GTK_CONTAINER (disp->mwin), disp->scrolledwindow); */ gtk_table_attach(GTK_TABLE(disp->table), disp->scrolledwindow, 1, @@ -262,7 +279,10 @@ create_display(gchar * fname, (disp->scrolledwindow), GTK_POLICY_ALWAYS, GTK_POLICY_ALWAYS); -/* gtk_widget_set_usize (disp->scrolledwindow_buf, 160, -2); */ + +/* gtk_widget_set_usize (disp->scrolledwindow, */ +/* gpiv_par.img_width, */ +/* gpiv_par.img_height); */ disp->scrolledwindow_hadj = @@ -283,6 +303,9 @@ create_display(gchar * fname, gtk_object_set_data(GTK_OBJECT(disp->scrolledwindow_hadj), "var_type", "0"); + gtk_object_set_data(GTK_OBJECT(disp->scrolledwindow_hadj), + "disp", + disp); gtk_signal_connect(GTK_OBJECT(disp->scrolledwindow_hadj), "value_changed", GTK_SIGNAL_FUNC @@ -308,6 +331,9 @@ create_display(gchar * fname, gtk_object_set_data(GTK_OBJECT(disp->scrolledwindow_vadj), "var_type", "1"); + gtk_object_set_data(GTK_OBJECT(disp->scrolledwindow_vadj), + "disp", + disp); gtk_signal_connect(GTK_OBJECT(disp->scrolledwindow_vadj), "value_changed", GTK_SIGNAL_FUNC @@ -317,12 +343,14 @@ create_display(gchar * fname, /* * gnome canvas */ - gtk_widget_push_visual(gdk_imlib_get_visual()); - gtk_widget_push_colormap(gdk_imlib_get_colormap()); /* gtk_widget_push_visual (gdk_rgb_get_visual ()); */ /* gtk_widget_push_colormap (gdk_rgb_get_cmap ()); */ +/* disp->canvas = gnome_canvas_new_aa (); */ - disp->canvas = gnome_canvas_new /* _aa */ (); + gtk_widget_push_visual(gdk_imlib_get_visual()); + gtk_widget_push_colormap(gdk_imlib_get_colormap()); + + disp->canvas = gnome_canvas_new (); gtk_widget_pop_colormap(); gtk_widget_pop_visual(); gtk_widget_ref(disp->canvas); @@ -347,7 +375,6 @@ create_display(gchar * fname, disp->canvas); - gtk_object_set_data(GTK_OBJECT(disp->canvas), "disp", disp); @@ -373,7 +400,7 @@ create_display(gchar * fname, gtk_signal_connect(GTK_OBJECT(disp->canvas), "leave_notify_event", GTK_SIGNAL_FUNC(canvas_display_leave_notify), -NULL); + NULL); /* @@ -382,16 +409,16 @@ NULL); gtk_signal_connect_object(GTK_OBJECT(disp->canvas), "motion_notify_event", (GtkSignalFunc) - EVENT_METHOD(disp->vruler, + EVENT_METHOD(disp->hruler, motion_notify_event), - GTK_OBJECT(disp->vruler)); + GTK_OBJECT(disp->hruler)); gtk_signal_connect_object(GTK_OBJECT(disp->canvas), "motion_notify_event", (GtkSignalFunc) - EVENT_METHOD(disp->hruler, + EVENT_METHOD(disp->vruler, motion_notify_event), - GTK_OBJECT(disp->hruler)); + GTK_OBJECT(disp->vruler)); /* @@ -427,33 +454,34 @@ NULL); /* GTK_OBJECT(display_menu)); */ /* the navigation window button See GIMP */ - disp->nav_ebox = gtk_event_box_new(); - gtk_widget_ref(disp->nav_ebox); - gtk_object_set_data_full(GTK_OBJECT(disp->mwin), - "nav_ebox", - disp->nav_ebox, - (GtkDestroyNotify) gtk_widget_unref); - gtk_table_attach(GTK_TABLE(disp->table), - disp->nav_ebox, - 1, - 2, - 1, - 2, - (GtkAttachOptions) (GTK_FILL), - (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), - 0, - 0); - gtk_widget_show(disp->nav_ebox); - gtk_signal_connect(GTK_OBJECT(disp->nav_ebox), - "button_press_event", - GTK_SIGNAL_FUNC(nav_popup_click_handler), - NULL); +/* disp->nav_ebox = gtk_event_box_new(); */ +/* gtk_widget_ref(disp->nav_ebox); */ +/* gtk_object_set_data_full(GTK_OBJECT(disp->mwin), */ +/* "nav_ebox", */ +/* disp->nav_ebox, */ +/* (GtkDestroyNotify) gtk_widget_unref); */ +/* gtk_table_attach(GTK_TABLE(disp->table), */ +/* disp->nav_ebox, */ +/* 1, */ +/* 2, */ +/* 1, */ +/* 2, */ +/* (GtkAttachOptions) (GTK_FILL), */ +/* (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), */ +/* 0, */ +/* 0); */ +/* gtk_widget_show(disp->nav_ebox); */ +/* gtk_signal_connect(GTK_OBJECT(disp->nav_ebox), */ +/* "button_press_event", */ +/* GTK_SIGNAL_FUNC(nav_popup_click_handler), */ +/* NULL); */ /* disp->pixmap = gtk_pixmap_new (navbutton_pixmap, navbutton_mask); */ /* gtk_container_add (GTK_CONTAINER (disp->nav_ebox), disp->pixmap); */ /* gtk_widget_show (disp->pixmap); */ + g_warning("::5 END"); return disp; } @@ -465,9 +493,7 @@ create_display_menu(Display * disp) GtkWidget *display_menu = NULL; display_menu = gtk_menu_new(); - gtk_object_set_data( -/* GTK_OBJECT(display_act->gpd.display->mwin), */ - GTK_OBJECT(disp->mwin), + gtk_object_set_data(GTK_OBJECT(disp->mwin), "display_menu", display_menu); gnome_app_fill_menu(GTK_MENU_SHELL(display_menu), @@ -495,7 +521,6 @@ create_display_menu(Display * disp) gtk_object_set_data(GTK_OBJECT(disp->mwin), "view_menu_display2", view_menu_display[2].widget); - g_warning("display_img1 = %d", disp->display_img1); if (disp->display_img1) { gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM (view_menu_display[2].widget), @@ -512,7 +537,6 @@ create_display_menu(Display * disp) gtk_object_set_data(GTK_OBJECT(disp->mwin), "view_menu_display3", view_menu_display[3].widget); - g_warning("display_img2 = %d", disp->display_img2); if (disp->display_img2) { gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM (view_menu_display[3].widget), @@ -529,7 +553,6 @@ create_display_menu(Display * disp) gtk_object_set_data(GTK_OBJECT(disp->mwin), "view_menu_display4", view_menu_display[4].widget); - g_warning("display_intregs = %d", disp->display_intregs); if (disp->display_intregs) { gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM (view_menu_display[4].widget), @@ -618,6 +641,12 @@ create_display_menu(Display * disp) (zoomscale_menu_display[0].widget), TRUE); } + gtk_object_set_data(GTK_OBJECT(zoomscale_menu_display[0].widget), + "disp", + disp); + gtk_object_set_data(GTK_OBJECT(zoomscale_menu_display[0].widget), + "zoom_index", + "0"); @@ -631,6 +660,12 @@ create_display_menu(Display * disp) (zoomscale_menu_display[1].widget), TRUE); } + gtk_object_set_data(GTK_OBJECT(zoomscale_menu_display[1].widget), + "disp", + disp); + gtk_object_set_data(GTK_OBJECT(zoomscale_menu_display[1].widget), + "zoom_index", + "1"); @@ -644,6 +679,12 @@ create_display_menu(Display * disp) (zoomscale_menu_display[2].widget), TRUE); } + gtk_object_set_data(GTK_OBJECT(zoomscale_menu_display[2].widget), + "disp", + disp); + gtk_object_set_data(GTK_OBJECT(zoomscale_menu_display[2].widget), + "zoom_index", + "2"); @@ -657,6 +698,12 @@ create_display_menu(Display * disp) (zoomscale_menu_display[3].widget), TRUE); } + gtk_object_set_data(GTK_OBJECT(zoomscale_menu_display[3].widget), + "disp", + disp); + gtk_object_set_data(GTK_OBJECT(zoomscale_menu_display[3].widget), + "zoom_index", + "3"); @@ -670,6 +717,12 @@ create_display_menu(Display * disp) (zoomscale_menu_display[4].widget), TRUE); } + gtk_object_set_data(GTK_OBJECT(zoomscale_menu_display[4].widget), + "disp", + disp); + gtk_object_set_data(GTK_OBJECT(zoomscale_menu_display[4].widget), + "zoom_index", + "4"); @@ -683,6 +736,12 @@ create_display_menu(Display * disp) (zoomscale_menu_display[5].widget), TRUE); } + gtk_object_set_data(GTK_OBJECT(zoomscale_menu_display[5].widget), + "disp", + disp); + gtk_object_set_data(GTK_OBJECT(zoomscale_menu_display[5].widget), + "zoom_index", + "5"); /* diff --git a/src/display_interface.h b/src/display_interface.h index 1ceec47..70522d1 100644 --- a/src/display_interface.h +++ b/src/display_interface.h @@ -28,8 +28,11 @@ /* * widgets prototypes of display * $Log: display_interface.h,v $ - * Revision 1.1 2003-06-17 17:10:52 gerber - * Initial revision + * Revision 1.2 2003-06-27 13:47:26 gerber + * display ruler, line/point evaluation + * + * Revision 1.1.1.1 2003/06/17 17:10:52 gerber + * Imported gpiv * */ @@ -136,19 +139,20 @@ struct _Display { GtkWidget *table; GtkWidget *button_origin; GtkWidget *arrow_origin; + GtkWidget *hruler; + GtkWidget *vruler; GtkWidget *scrolledwindow; GtkObject *scrolledwindow_hadj; GtkObject *scrolledwindow_vadj; GtkWidget *canvas; GtkWidget *view_options; - GtkWidget *vruler; - GtkWidget *hruler; GtkWidget *appbar; GtkWidget *nav_ebox; + gboolean stretch_window_tmp; gint zoom_index; - float zoom_factor; - gboolean stretch_window; + gfloat zoom_factor_old; + gfloat zoom_factor; gint vector_scale; gchar msg_display_default[MAX_CHARS]; @@ -168,6 +172,7 @@ struct _Display { gboolean display_sstrain; gboolean display_nstrain; + gboolean index_old; gint index_x_old; gint index_y_old; gint xgrab_first; diff --git a/src/gpiv_gtk.h b/src/gpiv_gtk.h index 18fff74..ae47030 100644 --- a/src/gpiv_gtk.h +++ b/src/gpiv_gtk.h @@ -28,8 +28,11 @@ /* * Graphical User Interface for gpiv * $Log: gpiv_gtk.h,v $ - * Revision 1.1 2003-06-17 17:10:52 gerber - * Initial revision + * Revision 1.2 2003-06-27 13:47:26 gerber + * display ruler, line/point evaluation + * + * Revision 1.1.1.1 2003/06/17 17:10:52 gerber + * Imported gpiv * */ @@ -49,7 +52,7 @@ #define PROGNAME "GP_GUI." /* Abbreviation of program name; used for error messages and parameter keys are concatenated to it */ -#define RCSID "$Id: gpiv_gtk.h,v 1.1 2003-06-17 17:10:52 gerber Exp $" /* Revision Control System (RCS) version */ +#define RCSID "$Id: gpiv_gtk.h,v 1.2 2003-06-27 13:47:26 gerber Exp $" /* Revision Control System (RCS) version */ #define ERR_IVAL = 99 /* Some arbitrary integer error value */ #define ADJ_MIN -50.0 /* minimum value for adjustment */ @@ -76,8 +79,9 @@ char IMAGE_HEIGHT_LABEL[MAX_CHARS]; /* * Extra marge for display */ -#define VIEW_HMARGE 38 -#define VIEW_VMARGE 62 +#define VIEW_HMARGE 38 +#define VIEW_VMARGE 62 +#define RULER_WIDTH 17 /* width of the rulers in the display window */ #define MAX_DATA (IMAGE_WIDTH_MAX / 8) /* Maximum number of data/estimators/Interr. Areas per row */ #define MAX_BUFS 10 /* maximum number of buffers (=displays) */ @@ -156,6 +160,7 @@ struct _GpivPar { gboolean process_substract; /* used by gpiv toolbar to run substract */ gboolean process_vorstra; /* used by gpiv toolbar to run vorstra */ + gboolean stretch; gint zoom_index; /* index for displayed zooming */ gint vector_scale; /* scale of vectors to be displayed */ gboolean stretch_window; /* stretch display window for image area */ diff --git a/src/main.c b/src/main.c index dbc5ca0..1b57640 100644 --- a/src/main.c +++ b/src/main.c @@ -28,8 +28,11 @@ /* * main routines of gpiv * $Log: main.c,v $ - * Revision 1.1 2003-06-17 17:10:52 gerber - * Initial revision + * Revision 1.2 2003-06-27 13:47:26 gerber + * display ruler, line/point evaluation + * + * Revision 1.1.1.1 2003/06/17 17:10:52 gerber + * Imported gpiv * */ @@ -117,9 +120,9 @@ int main(int argc, char *argv[]) N_("enables displaying of normal strain data"), NULL}, {"hdf", '\0', POPT_ARG_NONE, &gpiv_par.hdf, 0, - N_("save data in hdf5 format with .gpi extension"), NULL}, + N_("save data in HDF5 format with .gpi extension"), NULL}, {"hdf_img", '\0', POPT_ARG_NONE, &gpiv_par.hdf_img, 0, - N_("include image data in .gpi file (hdf5 format)"), NULL}, + N_("include image data in .gpi file (HDF5 format)"), NULL}, {"print", 'p', POPT_ARG_NONE, &print_par, 0, N_("print parameters and other info to stdout"), NULL}, @@ -165,7 +168,7 @@ int main(int argc, char *argv[]) N_("show tooltips"), NULL}, {"view_gpivbuttons", '\0', POPT_ARG_NONE, &gpiv_par.view_gpivbuttons, 0, - N_("view the gpiv buttons of the application"), NULL}, + N_("view the GPIV buttons of the application"), NULL}, {"view_tabulator", '\0', POPT_ARG_NONE, &gpiv_par.view_tabulator, 0, N_("view the tabulator of the application"), NULL}, @@ -174,6 +177,7 @@ int main(int argc, char *argv[]) }; #ifdef ENABLE_NLS +setlocale (LC_ALL, ""); bindtextdomain(PACKAGE, PACKAGE_LOCALE_DIR); textdomain(PACKAGE); #endif @@ -554,18 +558,16 @@ int main(int argc, char *argv[]) options, 0, NULL); gdk_rgb_init(); - g_warning("main::gpiv_par.display_img1 = %d", gpiv_par.display_img1); - - gpiv_scan_resourcefiles(IMAGE_PAR_KEY, &image_par, print_par); - gpiv_scan_resourcefiles(EVAL_PAR_KEY, &piv_eval_par, print_par); - gpiv_scan_resourcefiles(VALID_PAR_KEY, &piv_valid_par, print_par); - gpiv_scan_resourcefiles(POST_PAR_KEY, &piv_post_par, print_par); + gpiv_scan_resourcefiles(IMAGE_PAR_KEY, &image_par, print_par); + gpiv_scan_resourcefiles(EVAL_PAR_KEY, &piv_eval_par, print_par); + gpiv_scan_resourcefiles(VALID_PAR_KEY, &piv_valid_par, print_par); + gpiv_scan_resourcefiles(POST_PAR_KEY, &piv_post_par, print_par); /* checking image_par is done in open_img (concole.c) */ /* gpiv_img_check_header_read(image_par); */ - gpiv_piv_check_parameters_read(piv_eval_par); - gpiv_valid_check_parameters_read(piv_valid_par); - gpiv_post_check_parameters_read(piv_post_par); + gpiv_piv_check_parameters_read(piv_eval_par); + gpiv_valid_check_parameters_read(piv_valid_par); + gpiv_post_check_parameters_read(piv_post_par); if(gpiv_par.img_width <= IMAGE_WIDTH_MAX diff --git a/src/piveval.c b/src/piveval.c index 4f051a3..67b721d 100644 --- a/src/piveval.c +++ b/src/piveval.c @@ -28,8 +28,11 @@ /* * (callback) functions for Piv evaluation window/tabulator * $Log: piveval.c,v $ - * Revision 1.1 2003-06-17 17:10:52 gerber - * Initial revision + * Revision 1.2 2003-06-27 13:47:26 gerber + * display ruler, line/point evaluation + * + * Revision 1.1.1.1 2003/06/17 17:10:52 gerber + * Imported gpiv * */ @@ -45,13 +48,63 @@ alloc_bufmem_per_intarea(int index_y, int index_x, GpivData * gpd, ImagePar image_par, - int int_size_0); + int int_size_0) +/* -------------------------------------------------------------------- + Memory allocation of covariance in a packed interrogation area array */ +{ + + gpiv_piv_bounds_cov(&gpd->cov[index_y][index_x], + int_size_0, image_par); + + gpd->cov[index_y][index_x].z = + gpiv_matrix(gpd->cov[index_y][index_x].z_rl, + gpd->cov[index_y][index_x].z_rh, + gpd->cov[index_y][index_x].z_cl, + gpd->cov[index_y][index_x].z_ch); + +/* + * Memory allocation of interrogation area's + */ + gpd->intreg1[index_y][index_x] = + gpiv_matrix(0, int_size_0 - 1, 0, int_size_0 - 1); + gpd->intreg2[index_y][index_x] = + gpiv_matrix(0, int_size_0 - 1, 0, int_size_0 - 1); + memset(gpd->intreg1[index_y][index_x][0], 0, + (sizeof(float)) * int_size_0 * int_size_0); + memset(gpd->intreg2[index_y][index_x][0], 0, + (sizeof(float)) * int_size_0 * int_size_0); +} + + + static void free_bufmem_per_intarea(int index_y, - int index_x, - GpivData * gpd, - ImagePar image_par, - int int_size_0); + int index_x, + GpivData * gpd, + ImagePar image_par, + int int_size_0) +{ + gpiv_piv_bounds_cov(&gpd->cov[index_y][index_x], + int_size_0, image_par); + + gpiv_free_matrix(gpd->cov[index_y][index_x].z, + gpd->cov[index_y][index_x].z_rl, + gpd->cov[index_y][index_x].z_rh, + gpd->cov[index_y][index_x].z_cl, + gpd->cov[index_y][index_x].z_ch); + + gpiv_free_matrix(gpd->intreg1[index_y][index_x], 0, int_size_0 - 1, + 0, int_size_0 - 1); + + gpiv_free_matrix(gpd->intreg2[index_y][index_x], 0, int_size_0 - 1, + 0, int_size_0 - 1); + + gpd->intreg1[index_y][index_x] = NULL; + gpd->intreg2[index_y][index_x] = NULL; + +} + + /* * Piv evaluation window/tabulator callbacks */ @@ -572,38 +625,29 @@ adjust_radiobutton_piv_int(PivEval * eval, gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON (eval->radiobutton_intsize2_2), TRUE); } else if (int_size_1 == 32) { -/* g_warning("adjust_radiobutton_piv_int:: 32 call"); */ gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON (eval->radiobutton_intsize2_3), TRUE); -/* g_warning("adjust_radiobutton_piv_int:: 32 return"); */ } else if (int_size_1 == 64) { -/* g_warning("adjust_radiobutton_piv_int:: 64 call"); */ gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON (eval->radiobutton_intsize2_4), TRUE); -/* g_warning("adjust_radiobutton_piv_int:: 64 return"); */ } else if (int_size_1 >= 128) { gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON (eval->radiobutton_intsize2_5), TRUE); } -/* g_warning("adjust_radiobutton_piv_int:: 1"); */ if (int_size_1 <= 64) { -/* g_warning("adjust_radiobutton_piv_int:: 1a"); */ gtk_widget_set_sensitive(GTK_WIDGET(eval->radiobutton_intsize2_4), TRUE); if (int_size_1 <= 32) { -/* g_warning("adjust_radiobutton_piv_int:: 1b"); */ gtk_widget_set_sensitive(GTK_WIDGET (eval->radiobutton_intsize2_3), TRUE); if (int_size_1 <= 16) { -/* g_warning("adjust_radiobutton_piv_int:: 1c"); */ gtk_widget_set_sensitive(GTK_WIDGET (eval->radiobutton_intsize2_2), TRUE); /* if (int_size_1 <= 8) { */ -/* g_warning("adjust_radiobutton_piv_int:: 1d"); */ /* gtk_widget_set_sensitive(GTK_WIDGET */ /* (eval->radiobutton_intsize2_1), */ /* TRUE); */ @@ -612,27 +656,20 @@ adjust_radiobutton_piv_int(PivEval * eval, } } -/* fprintf(stderr, "adjust_radiobutton_piv_int:: 2"); */ - - if (int_size_1 >= 16) { -/* g_warning("adjust_radiobutton_piv_int:: 3a"); */ /* gtk_widget_set_sensitive(GTK_WIDGET(eval->radiobutton_intsize2_1), */ /* FALSE); */ if (int_size_1 >= 32) { -/* g_warning("adjust_radiobutton_piv_int:: 3b"); */ gtk_widget_set_sensitive(GTK_WIDGET (eval->radiobutton_intsize2_2), FALSE); if (int_size_1 >= 64) { -/* g_warning("adjust_radiobutton_piv_int:: 3c"); */ gtk_widget_set_sensitive(GTK_WIDGET (eval->radiobutton_intsize2_3), FALSE); if (int_size_1 >= 128) { -/* g_warning("adjust_radiobutton_piv_int:: 3d"); */ gtk_widget_set_sensitive(GTK_WIDGET (eval->radiobutton_intsize2_4), FALSE); @@ -640,7 +677,6 @@ adjust_radiobutton_piv_int(PivEval * eval, } } } -/* g_warning("adjust_radiobutton_piv_int:: leave"); */ } @@ -727,8 +763,9 @@ on_darea_piv_disprocess_cov_expose(GtkWidget * widget, -void on_button_piv_enter(GtkWidget *widget, - gpointer data) +void +on_button_piv_enter(GtkWidget *widget, + gpointer data) { GpivConsole * gpiv = gtk_object_get_data(GTK_OBJECT(widget), "gpiv"); gchar *msg = _("Analyses a PIV image (pair)"); @@ -736,10 +773,12 @@ void on_button_piv_enter(GtkWidget *widget, } -void on_button_piv(GtkWidget * widget, gpointer data) -{ +void +on_button_piv(GtkWidget * widget, + gpointer data) /* ------------------------------------------------------------------- The actual calculation of particle image displacements */ +{ GpivConsole * gpiv = gtk_object_get_data(GTK_OBJECT(widget), "gpiv"); gint row, ibuf; @@ -807,7 +846,7 @@ exec_piv(GpivConsole * gpiv) fname_old_piv); } } - } else { + } else { gpiv_piv_count_pivdata_fromimage(&display_act->gpd.piv_data, image_par, piv_eval_par); } @@ -818,7 +857,6 @@ exec_piv(GpivConsole * gpiv) if (m_select == SINGLE_POINT_MS || m_select == SINGLE_AREA_MS || m_select == DRAG_MS) { - m_select = NO_MS; gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON (gpiv->piveval->radiobutton_mouse_1), TRUE); @@ -834,6 +872,7 @@ exec_piv(GpivConsole * gpiv) /* (m_select == SINGLE_AREA_MS && ) { */ gpiv_alloc_pivdata(&display_act->gpd.piv_data); + display_act->gpd.exist_piv = TRUE; if (piv_eval_par.old_piv == 1) { @@ -844,7 +883,6 @@ exec_piv(GpivConsole * gpiv) fname_old_piv); } } - display_act->gpd.exist_piv = TRUE; /* printf ("\n%s: returned from gpiv_fread_pivdata\n", function_name); */ /* gpiv_write_pivdata(oldpiv_data, c_line, 0, 0, RCSID); */ @@ -868,7 +906,6 @@ exec_piv(GpivConsole * gpiv) interrogate(&display_act->gpd.piv_data, display_act->img.img1, display_act->img.img2, gpiv); - display_act->gpd.exist_piv = TRUE; @@ -877,90 +914,9 @@ exec_piv(GpivConsole * gpiv) * Copy parameters in Buffer structure for saving and, eventual, later use */ -/* - * image parameters - */ - display_act->img.image_par.s_scale = image_par.s_scale; - display_act->img.image_par.t_scale = image_par.t_scale; - display_act->img.image_par.z_off_x = image_par.z_off_x; - display_act->img.image_par.z_off_y = image_par.z_off_y; - display_act->img.image_par.s_scale_logic = 1; - display_act->img.image_par.t_scale_logic = 1; - display_act->img.image_par.z_off_logic = 1; - - display_act->gpd.piv_eval_par.ad_int = piv_eval_par.ad_int; - display_act->gpd.piv_eval_par.autokey = piv_eval_par.autokey; - display_act->gpd.piv_eval_par.cmpr = piv_eval_par.cmpr; - -/* - * evaluation parameters - */ - display_act->gpd.piv_eval_par.int_geo = piv_eval_par.int_geo; - display_act->gpd.piv_eval_par.col_start = piv_eval_par.col_start; - display_act->gpd.piv_eval_par.col_end = piv_eval_par.col_end; - display_act->gpd.piv_eval_par.int_point_col = piv_eval_par.int_point_col; - display_act->gpd.piv_eval_par.int_point_row = piv_eval_par.int_point_row; - - display_act->gpd.piv_eval_par.int_line_col = piv_eval_par.int_line_col; - display_act->gpd.piv_eval_par.int_line_col_start = piv_eval_par.int_line_col_start; - display_act->gpd.piv_eval_par.int_line_col_end = piv_eval_par.int_line_col_end; - display_act->gpd.piv_eval_par.int_line_row = piv_eval_par.int_line_row; - display_act->gpd.piv_eval_par.int_line_row_start = piv_eval_par.int_line_row_start; - display_act->gpd.piv_eval_par.int_line_row_end = piv_eval_par.int_line_row_end; - display_act->gpd.piv_eval_par.int_point_col = piv_eval_par.int_point_col; - display_act->gpd.piv_eval_par.int_point_row = piv_eval_par.int_point_row; - - display_act->gpd.piv_eval_par.int_size_1 = piv_eval_par.int_size_1; - display_act->gpd.piv_eval_par.int_size_2 = piv_eval_par.int_size_2; - display_act->gpd.piv_eval_par.int_shift = piv_eval_par.int_shift; - display_act->gpd.piv_eval_par.old_piv = piv_eval_par.old_piv; - display_act->gpd.piv_eval_par.peak = piv_eval_par.peak; - display_act->gpd.piv_eval_par.pre_shift_col = piv_eval_par.pre_shift_col; - display_act->gpd.piv_eval_par.pre_shift_row = piv_eval_par.pre_shift_row; - display_act->gpd.piv_eval_par.print_cov = piv_eval_par.print_cov; - display_act->gpd.piv_eval_par.print_par = piv_eval_par.print_par; - display_act->gpd.piv_eval_par.print_piv = piv_eval_par.print_piv; - display_act->gpd.piv_eval_par.row_end = piv_eval_par.row_end; - display_act->gpd.piv_eval_par.row_start = piv_eval_par.row_start; - display_act->gpd.piv_eval_par.weight = piv_eval_par.weight; - display_act->gpd.piv_eval_par.zero_off = piv_eval_par.zero_off; - display_act->gpd.piv_eval_par.central_diff = piv_eval_par.central_diff; - display_act->gpd.piv_eval_par.ifit = piv_eval_par.ifit; - - - - - display_act->gpd.piv_eval_par.autokey_logic = 1; - display_act->gpd.piv_eval_par.int_geo_logic = 1; - display_act->gpd.piv_eval_par.col_start_logic = 1; - display_act->gpd.piv_eval_par.col_end_logic = 1; - display_act->gpd.piv_eval_par.int_line_row_logic = 1; - display_act->gpd.piv_eval_par.int_line_row_start_logic = 1; - display_act->gpd.piv_eval_par.int_line_row_end_logic = 1; - display_act->gpd.piv_eval_par.int_line_col_logic = 1; - display_act->gpd.piv_eval_par.int_line_col_start_logic = 1; - display_act->gpd.piv_eval_par.int_line_col_end_logic = 1; - display_act->gpd.piv_eval_par.int_point_col_logic = 1; - display_act->gpd.piv_eval_par.int_point_row_logic = 1; - - display_act->gpd.piv_eval_par.ifit_logic = 1; - display_act->gpd.piv_eval_par.int_size = 1; - display_act->gpd.piv_eval_par.int_size_1_logic = 1; - display_act->gpd.piv_eval_par.int_size_2_logic = 1; - display_act->gpd.piv_eval_par.int_shift_logic = 1; - display_act->gpd.piv_eval_par.old_piv_logic = 1; - display_act->gpd.piv_eval_par.pre_shift_col_logic = 1; - display_act->gpd.piv_eval_par.peak_logic = 1; - display_act->gpd.piv_eval_par.pre_shift_row_logic = 1; - display_act->gpd.piv_eval_par.print_par_logic = 1; - display_act->gpd.piv_eval_par.print_piv_logic = 1; - display_act->gpd.piv_eval_par.print_cov_logic = 1; - display_act->gpd.piv_eval_par.row_start_logic = 1; - display_act->gpd.piv_eval_par.row_end_logic = 1; - display_act->gpd.piv_eval_par.weight_logic = 1; - display_act->gpd.piv_eval_par.zero_off_logic = 1; - display_act->gpd.piv_eval_par.central_diff_logic = 1; - + copy_img_par(image_par, &display_act->img.image_par, TRUE, print_par); + copy_piv_par(piv_eval_par, &display_act->gpd.piv_eval_par, TRUE, + print_par); exec_process = FALSE; } else { @@ -983,7 +939,7 @@ interrogate(PivData * piv_data, /* -------------------------------------------------------------------- PIV analyses of an image pair */ { -#define EXT_PIV ".piv" +/* #define EXT_PIV ".piv" */ int index_x = 0, index_y = 0, int_size_0, fname_logic = 1; gfloat progres_value; @@ -1005,78 +961,16 @@ interrogate(PivData * piv_data, * parameters/variables */ gpiv_piv_test_parameter(&image_par, &piv_eval_par, fname_logic); - - image_par_ACT.ncolumns = image_par.ncolumns; - image_par_ACT.nrows = image_par.nrows; - image_par_ACT.x_corr = image_par.x_corr; - - image_par_ACT.ncolumns_logic = 1; - image_par_ACT.nrows_logic = 1; - image_par_ACT.x_corr_logic = 1; - - - piv_eval_par_ACT.ad_int = piv_eval_par.ad_int; - piv_eval_par_ACT.autokey = piv_eval_par.autokey; - piv_eval_par_ACT.cmpr = piv_eval_par.cmpr; - piv_eval_par_ACT.ifit = piv_eval_par.ifit; - - piv_eval_par_ACT.int_geo = piv_eval_par.int_geo; - piv_eval_par_ACT.col_start = piv_eval_par.col_start; - piv_eval_par_ACT.col_end = piv_eval_par.col_end; - piv_eval_par_ACT.row_end = piv_eval_par.row_end; - piv_eval_par_ACT.row_start = piv_eval_par.row_start; - piv_eval_par_ACT.int_line_col = piv_eval_par.int_line_col; - piv_eval_par_ACT.int_line_col_start = piv_eval_par.int_line_col_start; - piv_eval_par_ACT.int_line_col_end = piv_eval_par.int_line_col_end; - piv_eval_par_ACT.int_line_row = piv_eval_par.int_line_row; - piv_eval_par_ACT.int_line_row_start = piv_eval_par.int_line_row_start; - piv_eval_par_ACT.int_line_row_end = piv_eval_par.int_line_row_end; - piv_eval_par_ACT.int_point_col = piv_eval_par.int_point_col; - piv_eval_par_ACT.int_point_row = piv_eval_par.int_point_row; - + copy_img_par(image_par, &image_par_ACT, TRUE, print_par); + copy_piv_par(piv_eval_par, &piv_eval_par_ACT, TRUE, print_par); if (piv_eval_par_ACT.ad_int == 1) { piv_eval_par_ACT.int_size_1 = piv_eval_par.int_size_2; } else { piv_eval_par_ACT.int_size_1 = piv_eval_par.int_size_1; } - piv_eval_par_ACT.int_size_2 = piv_eval_par.int_size_2; - piv_eval_par_ACT.int_shift = piv_eval_par.int_shift; - piv_eval_par_ACT.old_piv = piv_eval_par.old_piv; - piv_eval_par_ACT.peak = piv_eval_par.peak; - piv_eval_par_ACT.pre_shift_col = piv_eval_par.pre_shift_col; - piv_eval_par_ACT.pre_shift_row = piv_eval_par.pre_shift_row; - piv_eval_par_ACT.print_cov = piv_eval_par.print_cov; - piv_eval_par_ACT.print_par = piv_eval_par.print_par; - piv_eval_par_ACT.print_piv = piv_eval_par.print_piv; - piv_eval_par_ACT.row_end = piv_eval_par.row_end; - piv_eval_par_ACT.row_start = piv_eval_par.row_start; - piv_eval_par_ACT.weight = piv_eval_par.weight; - piv_eval_par_ACT.zero_off = piv_eval_par.zero_off; - piv_eval_par_ACT.central_diff = piv_eval_par.central_diff; - - - piv_eval_par_ACT.autokey_logic = 1; - piv_eval_par_ACT.col_start_logic = 1; - piv_eval_par_ACT.col_end_logic = 1; - piv_eval_par_ACT.ifit_logic = 1; - piv_eval_par_ACT.int_size_1_logic = 1; - piv_eval_par_ACT.int_size_2_logic = 1; - piv_eval_par_ACT.int_shift_logic = 1; - piv_eval_par_ACT.old_piv_logic = 1; - piv_eval_par_ACT.peak_logic= 1; - piv_eval_par_ACT.pre_shift_col_logic = 1; - piv_eval_par_ACT.pre_shift_row_logic = 1; - piv_eval_par_ACT.print_cov_logic = 1; - piv_eval_par_ACT.print_par_logic = 1; - piv_eval_par_ACT.print_piv_logic = 1; - piv_eval_par_ACT.row_end_logic = 1; - piv_eval_par_ACT.row_start_logic = 1; - piv_eval_par_ACT.weight_logic = 1; - piv_eval_par_ACT.zero_off_logic = 1; - piv_eval_par_ACT.central_diff = 1; - -/* g_warning("interrogate:: ENTER"); */ + + if (piv_eval_par.zero_off || piv_eval_par.ad_int) { sweep_last = 0; @@ -1137,9 +1031,9 @@ interrogate(PivData * piv_data, */ if (piv_eval_par_ACT.int_geo == POINT || m_select == SINGLE_AREA_MS - || m_select == SINGLE_POINT_MS || m_select == DRAG_MS) { + || m_select == SINGLE_POINT_MS + || m_select == DRAG_MS) { - img1_ACT = &img1[0]; img2_ACT = &img2[0]; piv_data_ACT = *piv_data; @@ -1157,7 +1051,8 @@ interrogate(PivData * piv_data, } alloc_bufmem_per_intarea(m_select_index_y, m_select_index_x, - &display_act->gpd, image_par_ACT, int_size_0); + &display_act->gpd, image_par_ACT, + int_size_0); /* @@ -1249,9 +1144,9 @@ interrogate(PivData * piv_data, /* img2_ACT = &img2[0]; */ /* } else { */ - img1_ACT = &img1[0]; - img2_ACT = &img2[0]; - piv_data_ACT = *piv_data; + img1_ACT = &img1[0]; + img2_ACT = &img2[0]; + piv_data_ACT = *piv_data; /* } */ @@ -1272,13 +1167,14 @@ interrogate(PivData * piv_data, /* create_all_intregs2(&display_act->gpd); */ - gpiv_piv_bounds_cov(&w_k, int_size_0, image_par_ACT); /* piv_eval_par_ACT.int_size_2 ?? */ - w_k.z = gpiv_matrix(w_k.z_rl, w_k.z_rh, w_k.z_cl, w_k.z_ch); - if (piv_eval_par.weight == 1) { - gpiv_piv_weight_kernel_lin(&w_k, int_size_0); - } else { - gpiv_piv_weight_kernel_1(&w_k); - } + gpiv_piv_bounds_cov(&w_k, int_size_0, image_par_ACT); /* piv_eval_par_ACT.int_size_2 ?? */ + w_k.z = gpiv_matrix(w_k.z_rl, w_k.z_rh, w_k.z_cl, w_k.z_ch); + + if (piv_eval_par.weight == 1) { + gpiv_piv_weight_kernel_lin(&w_k, int_size_0); + } else { + gpiv_piv_weight_kernel_1(&w_k); + } /* @@ -1289,46 +1185,46 @@ interrogate(PivData * piv_data, /* gpiv_piv_print_parameters(piv_eval_par_ACT); */ /* } */ - for (index_y = 0; index_y < piv_data_ACT.ny; index_y++) { - for (index_x = 0; index_x < piv_data_ACT.nx; index_x++) { - if (cancel_process) break; - alloc_bufmem_per_intarea(index_y, index_x, &display_act->gpd, - image_par_ACT, int_size_0); + for (index_y = 0; index_y < piv_data_ACT.ny; index_y++) { + for (index_x = 0; index_x < piv_data_ACT.nx; index_x++) { + if (cancel_process) break; + alloc_bufmem_per_intarea(index_y, index_x, &display_act->gpd, + image_par_ACT, int_size_0); /* * Printing the progress of processing */ - progres_value = - 100 * (index_y * piv_data->nx + index_x + - 1) / (piv_data->nx * piv_data->ny); - if (piv_eval_par.zero_off && piv_eval_par.ad_int) { - g_snprintf(progres_string, MAX_CHARS, - "piv sweep #%d " - "(int. size = %d): " - "%d%% processed", - sweep, - piv_eval_par_ACT.int_size_2, - (gint) progres_value); - } else if (piv_eval_par.zero_off && piv_eval_par.ad_int == 0) { - g_snprintf(progres_string, MAX_CHARS, - "piv sweep #%d: " - "%d%% processed", - sweep, - (gint) progres_value); - } else { - g_snprintf(progres_string, MAX_CHARS, - "%d%% processed", - (gint) progres_value); - } + progres_value = + 100 * (index_y * piv_data->nx + index_x + + 1) / (piv_data->nx * piv_data->ny); + if (piv_eval_par.zero_off && piv_eval_par.ad_int) { + g_snprintf(progres_string, MAX_CHARS, + "piv sweep #%d " + "(int. size = %d): " + "%d%% processed", + sweep, + piv_eval_par_ACT.int_size_2, + (gint) progres_value); + } else if (piv_eval_par.zero_off && piv_eval_par.ad_int == 0) { + g_snprintf(progres_string, MAX_CHARS, + "piv sweep #%d: " + "%d%% processed", + sweep, + (gint) progres_value); + } else { + g_snprintf(progres_string, MAX_CHARS, + "%d%% processed", + (gint) progres_value); + } - while (g_main_iteration(FALSE)); - gtk_progress_set_value(gnome_appbar_get_progress - (GNOME_APPBAR(gpiv->appbar)), - progres_value); - gnome_appbar_push(GNOME_APPBAR(gpiv->appbar), - progres_string); + while (g_main_iteration(FALSE)); + gtk_progress_set_value(gnome_appbar_get_progress + (GNOME_APPBAR(gpiv->appbar)), + progres_value); + gnome_appbar_push(GNOME_APPBAR(gpiv->appbar), + progres_string); /* @@ -1338,33 +1234,33 @@ interrogate(PivData * piv_data, * this will reduce the snr during integration */ - gpiv_piv_eval_int_reg(index_y, - index_x, - img1_ACT, - img2_ACT, - display_act->gpd.intreg1[index_y][index_x], - display_act->gpd.intreg2[index_y][index_x], - &display_act->gpd.cov[index_y][index_x], - &w_k, - &fftwis, - &fftwis_inv, - &piv_data_ACT, - sweep, - sweep_last, - image_par_ACT, - piv_eval_par_ACT); + gpiv_piv_eval_int_reg(index_y, + index_x, + img1_ACT, + img2_ACT, + display_act->gpd.intreg1[index_y][index_x], + display_act->gpd.intreg2[index_y][index_x], + &display_act->gpd.cov[index_y][index_x], + &w_k, + &fftwis, + &fftwis_inv, + &piv_data_ACT, + sweep, + sweep_last, + image_par_ACT, + piv_eval_par_ACT); /* * Check on validity of data */ - if (isnan(/* (double) */ display_act->gpd.piv_data.dx[index_y][index_x]) != 0 - || isnan(/* (double) */ display_act->gpd.piv_data.dy[index_y][index_x]) != 0) { - display_act->gpd.piv_data.dx[index_y][index_x] = 0.0; - display_act->gpd.piv_data.dy[index_y][index_x] = 0.0; - display_act->gpd.piv_data.snr[index_y][index_x] = 99.9; - display_act->gpd.piv_data.peak_no[index_y][index_x] = -1; - } + if (isnan(/* (double) */ display_act->gpd.piv_data.dx[index_y][index_x]) != 0 + || isnan(/* (double) */ display_act->gpd.piv_data.dy[index_y][index_x]) != 0) { + display_act->gpd.piv_data.dx[index_y][index_x] = 0.0; + display_act->gpd.piv_data.dy[index_y][index_x] = 0.0; + display_act->gpd.piv_data.snr[index_y][index_x] = 99.9; + display_act->gpd.piv_data.peak_no[index_y][index_x] = -1; + } @@ -1375,7 +1271,7 @@ interrogate(PivData * piv_data, /* * Only draw the vectors for last sweep */ - if (sweep_last) { + if (sweep_last) { /* while (!(my_in=getchar())) sleep(10); */ /* fprintf(stderr, "interrogate:: i=%d j=%d x=%f y=%f dx=%f dy=%f\n", */ @@ -1387,7 +1283,7 @@ interrogate(PivData * piv_data, /* if ( buf->gci_vector[index_y][index_x] == NULL) { */ - display_vector(index_y, index_x, &display_act->gpd); + display_vector(index_y, index_x, &display_act->gpd); /* } else { */ @@ -1405,21 +1301,21 @@ interrogate(PivData * piv_data, * Draw interrogation areas, covariance function, display piv vector * WATCH OUT WITH CMPR!! */ - if (piv_eval_par.print_cov == 1) { - display_piv_vector(index_y, - index_x, - display_act->gpd.piv_data, + if (piv_eval_par.print_cov == 1) { + display_piv_vector(index_y, + index_x, + display_act->gpd.piv_data, + gpiv->piveval); + display_img_intreg1(display_act->gpd.intreg1[index_y][index_x], + piv_eval_par_ACT.int_size_2, + gpiv->piveval); + display_img_intreg2(display_act->gpd.intreg2[index_y][index_x], + piv_eval_par_ACT.int_size_2, + gpiv->piveval); + display_img_cov(&display_act->gpd.cov[index_y][index_x], + piv_eval_par_ACT.int_size_2, gpiv->piveval); - display_img_intreg1(display_act->gpd.intreg1[index_y][index_x], - piv_eval_par_ACT.int_size_2, - gpiv->piveval); - display_img_intreg2(display_act->gpd.intreg2[index_y][index_x], - piv_eval_par_ACT.int_size_2, - gpiv->piveval); - display_img_cov(&display_act->gpd.cov[index_y][index_x], - piv_eval_par_ACT.int_size_2, - gpiv->piveval); - } + } /* @@ -1428,9 +1324,10 @@ interrogate(PivData * piv_data, /* => to exec_piv */ - free_bufmem_per_intarea(index_y, index_x, &display_act->gpd, - image_par_ACT, int_size_0); - + free_bufmem_per_intarea(index_y, index_x, + &display_act->gpd, + image_par_ACT, int_size_0); + /* fprintf(stderr, "\n::i=%d j=%d zero_off=%d ad_int=%d int_size_1=%d" */ /* "piv_eval_par_ACT.int_size_2=%d int_size_0=%d sweep=%d\n", */ @@ -1439,8 +1336,8 @@ interrogate(PivData * piv_data, /* piv_eval_par_ACT.int_size_2, int_size_0, sweep); */ - } - } + } + } } @@ -1454,34 +1351,34 @@ interrogate(PivData * piv_data, * Adjust piv_eval_par_ACT.int_size_2 in case int_size_1 is not a power of two */ - if (piv_eval_par_ACT.ad_int == 1) { + if (piv_eval_par_ACT.ad_int == 1) { /* fprintf(stderr, "\n::int_size_1=%d int_size_1_ACT=%d" */ /* "piv_eval_par.int_size_2_ACT=%d cmpr_fact=%d", */ /* piv_eval_par.int_size_1, piv_eval_par_ACT.int_size_1, */ /* piv_eval_par_ACT.int_size_2, cmpr_fact); */ - if (sweep_last == 1) exit_while = 1; + if (sweep_last == 1) exit_while = 1; if (piv_eval_par_ACT.int_size_2*cmpr_fact/2 == piv_eval_par.int_size_1 || piv_eval_par_ACT.int_size_2*cmpr_fact/4 < piv_eval_par.int_size_1) { - piv_eval_par_ACT.int_size_1 = piv_eval_par.int_size_1 / cmpr_fact; - piv_eval_par_ACT.int_size_2 = piv_eval_par.int_size_1 / cmpr_fact; + piv_eval_par_ACT.int_size_1 = piv_eval_par.int_size_1 / cmpr_fact; + piv_eval_par_ACT.int_size_2 = piv_eval_par.int_size_1 / cmpr_fact; sweep_last = 1; } else { - piv_eval_par_ACT.int_size_1 = piv_eval_par_ACT.int_size_2 / 2; - piv_eval_par_ACT.int_size_2 = piv_eval_par_ACT.int_size_2 / 2; + piv_eval_par_ACT.int_size_1 = piv_eval_par_ACT.int_size_2 / 2; + piv_eval_par_ACT.int_size_2 = piv_eval_par_ACT.int_size_2 / 2; } } - if (piv_eval_par.zero_off == 1 && piv_eval_par_ACT.ad_int != 1) { - sweep_last = 1; - } + if (piv_eval_par.zero_off == 1 && piv_eval_par_ACT.ad_int != 1) { + sweep_last = 1; + } - sweep++; - if (sweep == MAX_SWEEP) { - sweep_last = 1; - piv_eval_par_ACT.ifit = piv_eval_par.ifit; - } -fprintf(stderr, "\n"); -fprintf(stderr, "\n"); + sweep++; + if (sweep == MAX_SWEEP) { + sweep_last = 1; + piv_eval_par_ACT.ifit = piv_eval_par.ifit; + } + fprintf(stderr, "\n"); + fprintf(stderr, "\n"); } @@ -1494,14 +1391,13 @@ fprintf(stderr, "\n"); gpiv_fwrite_fftw_wisdom(-1, fftwis_inv); - display_act->gpd.exist_piv = TRUE; - display_act->gpd.scaled_piv = FALSE; - display_act->gpd.saved_piv = FALSE; + display_act->gpd.scaled_piv = FALSE; + display_act->gpd.saved_piv = FALSE; /* display_act->display_piv = TRUE; */ /* gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(viewmenu_uiinfo[5].widget), TRUE); */ - display_act->gpd.exist_cov = TRUE; + display_act->gpd.exist_cov = TRUE; /* gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(viewmenu_uiinfo[6].widget), TRUE); */ } @@ -1510,68 +1406,6 @@ fprintf(stderr, "\n"); -static void -alloc_bufmem_per_intarea(int index_y, - int index_x, - GpivData * gpd, - ImagePar image_par, - int int_size_0) -{ - -/* -------------------------------------------------------------------- - Memory allocation of covariance in a packed interrogation area array */ - gpiv_piv_bounds_cov(&gpd->cov[index_y][index_x], - int_size_0, image_par); - - gpd->cov[index_y][index_x].z = - gpiv_matrix(gpd->cov[index_y][index_x].z_rl, - gpd->cov[index_y][index_x].z_rh, - gpd->cov[index_y][index_x].z_cl, - gpd->cov[index_y][index_x].z_ch); - -/* - * Memory allocation of interrogation area's - */ - gpd->intreg1[index_y][index_x] = - gpiv_matrix(0, int_size_0 - 1, 0, int_size_0 - 1); - gpd->intreg2[index_y][index_x] = - gpiv_matrix(0, int_size_0 - 1, 0, int_size_0 - 1); - memset(gpd->intreg1[index_y][index_x][0], 0, - (sizeof(float)) * int_size_0 * int_size_0); - memset(gpd->intreg2[index_y][index_x][0], 0, - (sizeof(float)) * int_size_0 * int_size_0); -} - - -static void -free_bufmem_per_intarea(int index_y, - int index_x, - GpivData * gpd, - ImagePar image_par, - int int_size_0) -{ - gpiv_piv_bounds_cov(&gpd->cov[index_y][index_x], - int_size_0, image_par); - - gpiv_free_matrix(gpd->cov[index_y][index_x].z, - gpd->cov[index_y][index_x].z_rl, - gpd->cov[index_y][index_x].z_rh, - gpd->cov[index_y][index_x].z_cl, - gpd->cov[index_y][index_x].z_ch); - - gpiv_free_matrix(gpd->intreg1[index_y][index_x], 0, int_size_0 - 1, - 0, int_size_0 - 1); - - gpiv_free_matrix(gpd->intreg2[index_y][index_x], 0, int_size_0 - 1, - 0, int_size_0 - 1); - - gpd->intreg1[index_y][index_x] = NULL; - gpd->intreg2[index_y][index_x] = NULL; - -} - - - /* * Display functions in PIV tabulator canvas */ diff --git a/src/pivpost.c b/src/pivpost.c index 0ae5301..cc2fe8f 100644 --- a/src/pivpost.c +++ b/src/pivpost.c @@ -28,8 +28,11 @@ /* * (callback) functions for Piv post processing window/tabulator * $Log: pivpost.c,v $ - * Revision 1.1 2003-06-17 17:10:52 gerber - * Initial revision + * Revision 1.2 2003-06-27 13:47:26 gerber + * display ruler, line/point evaluation + * + * Revision 1.1.1.1 2003/06/17 17:10:52 gerber + * Imported gpiv * */ @@ -320,6 +323,16 @@ exec_scale(PivPost * pivpost) gtk_error("exec_scale:: Failure calling gpiv_post_scale"); } +/* + * Adjusting display rulers + * TODO + */ +/* gtk_ruler_set_range(GTK_RULER(display_act->hruler), */ +/* (gfloat) image_par.z_off_x, */ +/* (gfloat) (gpiv_par.img_width * image_par.s_scale - 1), */ +/* (gfloat) image_par.z_off_x, */ +/* (gfloat) (gpiv_par.img_width * image_par.s_scale - 1)); */ + free_post_bufmems(display_act); } else { gtk_warning(_("no PIV data")); diff --git a/src/preferences.c b/src/preferences.c index 30794d8..fac2da5 100644 --- a/src/preferences.c +++ b/src/preferences.c @@ -27,8 +27,11 @@ /* * $Log: preferences.c,v $ - * Revision 1.1 2003-06-17 17:10:52 gerber - * Initial revision + * Revision 1.2 2003-06-27 13:47:26 gerber + * display ruler, line/point evaluation + * + * Revision 1.1.1.1 2003/06/17 17:10:52 gerber + * Imported gpiv * */ @@ -318,7 +321,7 @@ GtkWidget *create_preferences (GpivConsole *gpiv) vbox_io); - checkbutton_pref_hdf = gtk_check_button_new_with_label (_("hdf5 format (.gpi)")); + checkbutton_pref_hdf = gtk_check_button_new_with_label (_("HDF5 format (.gpi)")); gtk_widget_ref (checkbutton_pref_hdf); gtk_object_set_data_full (GTK_OBJECT (preferences), "checkbutton_pref_hdf", @@ -2135,8 +2138,8 @@ on_button_pref_ok(GtkWidget *widget, store_defaultpar(); if (img_set) { - gtk_warning("In order to affect image width and height,\n" - "restart gpiv"); + gtk_warning(_("In order to affect image width and height,\n" + "restart GPIV")); } gnome_dialog_close(GNOME_DIALOG(gpiv_preferences)); @@ -2152,8 +2155,8 @@ on_button_pref_apply(GtkWidget *widget, { GpivConsole *gpiv = gtk_object_get_data(GTK_OBJECT(widget), "gpiv"); apply_gpivpar(gpiv); - if (img_set) gtk_warning("In order to change image width and height,\n" - "press OK button and restart gpiv"); + if (img_set) gtk_warning(_("In order to change image width and height,\n" + "press OK button and restart GPIV")); } void diff --git a/src/utils.c b/src/utils.c index 96b09e2..d75fe25 100644 --- a/src/utils.c +++ b/src/utils.c @@ -28,8 +28,11 @@ /* * utility functions for gpiv * $Log: utils.c,v $ - * Revision 1.1 2003-06-17 17:10:52 gerber - * Initial revision + * Revision 1.2 2003-06-27 13:47:26 gerber + * display ruler, line/point evaluation + * + * Revision 1.1.1.1 2003/06/17 17:10:52 gerber + * Imported gpiv * */ @@ -208,55 +211,63 @@ free_post_bufmems(Display * disp void copy_img_par (ImagePar image_par_src, ImagePar * image_par_dest, + gboolean force, int print_par ) /* * copy image parameters from src to dest */ { - if (image_par_src.nrows_logic && !image_par_dest->nrows_logic) { + if (force + || (image_par_src.nrows_logic && !image_par_dest->nrows_logic)) { image_par_dest->nrows = image_par_src.nrows; image_par_dest->nrows_logic = 1; if (print_par) gpiv_warning("nrows = %d", image_par_dest->nrows); } - if (image_par_src.ncolumns_logic && !image_par_dest->ncolumns_logic) { + if (force + || (image_par_src.ncolumns_logic && !image_par_dest->ncolumns_logic)) { image_par_dest->ncolumns = image_par_src.ncolumns; image_par_dest->ncolumns_logic = 1; if (print_par) gpiv_warning("ncolumns = %d", image_par_dest->ncolumns); } - if(image_par_src.nbits_logic && !image_par_dest->nbits_logic) { + if(force + || (image_par_src.nbits_logic && !image_par_dest->nbits_logic)) { image_par_dest->nbits = image_par_src.nbits; image_par_dest->nbits_logic = 1; if (print_par) gpiv_warning("nbits = %d", image_par_dest->nbits); } - if(image_par_src.x_corr_logic && !image_par_dest->x_corr_logic) { + if(force + || (image_par_src.x_corr_logic && !image_par_dest->x_corr_logic)) { image_par_dest->x_corr = image_par_src.x_corr; image_par_dest->x_corr_logic = 1; if (print_par) gpiv_warning("x_corr = %d", image_par_dest->x_corr); } - if (image_par_src.s_scale_logic && !image_par_dest->s_scale_logic) { + if (force + || (image_par_src.s_scale_logic && !image_par_dest->s_scale_logic)) { image_par_dest->s_scale = image_par_src.s_scale; image_par_dest->s_scale_logic = 1; if (print_par) gpiv_warning("s_scale = %d", image_par_dest->s_scale); } - if(image_par_src.t_scale_logic && !image_par_dest->t_scale_logic) { + if(force + || (image_par_src.t_scale_logic && !image_par_dest->t_scale_logic)) { image_par_dest->t_scale = image_par_src.t_scale; image_par_dest->t_scale_logic = 1; if (print_par) gpiv_warning("t_scale = %d", image_par_dest->t_scale); } - if (image_par_src.z_off_logic && !image_par_dest->z_off_logic) { + if (force + || (image_par_src.z_off_logic && !image_par_dest->z_off_logic)) { image_par_dest->z_off_x = image_par_src.z_off_x; image_par_dest->z_off_y = image_par_src.z_off_y; image_par_dest->z_off_logic = 1; @@ -266,7 +277,8 @@ copy_img_par (ImagePar image_par_src, } } - if (image_par.project_logic && !image_par_dest->project_logic) { + if (force + || (image_par.project_logic && !image_par_dest->project_logic)) { image_par_dest->project_logic = 1; snprintf(image_par_dest->project, MAX_CHARS, "%s", image_par_src.project); @@ -275,8 +287,9 @@ copy_img_par (ImagePar image_par_src, } - if (image_par.creation_date_logic - && !image_par_dest->creation_date_logic) { + if (force + || (image_par.creation_date_logic + && !image_par_dest->creation_date_logic)) { image_par_dest->creation_date_logic = 1; snprintf(image_par_dest->creation_date, MAX_CHARS, "%s", image_par_src.creation_date); @@ -296,7 +309,8 @@ copy_img_par (ImagePar image_par_src, } - if (image_par_src.location_logic && !image_par_dest->location_logic) { + if (force + || (image_par_src.location_logic && !image_par_dest->location_logic)) { image_par_dest->location_logic = 1; snprintf(image_par_dest->location, MAX_CHARS, "%s", image_par_src.location); @@ -305,7 +319,8 @@ copy_img_par (ImagePar image_par_src, } - if (image_par_src.comment_logic && !image_par_dest->comment_logic) { + if (force + || (image_par_src.comment_logic && !image_par_dest->comment_logic)) { image_par_dest->comment_logic = 1; snprintf(image_par_dest->comment, MAX_CHARS, "%s", image_par_src.comment); @@ -316,6 +331,234 @@ copy_img_par (ImagePar image_par_src, +void +copy_piv_par(PivEvalPar piv_eval_par_src, + PivEvalPar * piv_eval_par_dest, + gboolean force, + int print_par + ) +{ + if (force + || ( piv_eval_par_src.col_start_logic + && !piv_eval_par_dest->col_start_logic)) { + piv_eval_par_dest->col_start = piv_eval_par_src.col_start; + piv_eval_par_dest->col_start_logic = 1; + } + + if (force + || ( piv_eval_par_src.col_end_logic + && !piv_eval_par_dest->col_end_logic)) { + piv_eval_par_dest->col_end = piv_eval_par_src.col_end; + piv_eval_par_dest->col_end_logic = 1; + } + + if (force + || ( piv_eval_par_src.row_start_logic + && !piv_eval_par_dest->row_start_logic)) { + piv_eval_par_dest->row_start = piv_eval_par_src.row_start; + piv_eval_par_dest->row_start_logic = 1; + } + + if (force + || ( piv_eval_par_src.row_end_logic + && !piv_eval_par_dest->row_end_logic)) { + piv_eval_par_dest->row_end = piv_eval_par_src.row_end; + piv_eval_par_dest->row_end_logic = 1; + } + + + if (force + || ( piv_eval_par_src.int_geo_logic + && !piv_eval_par_dest->int_geo_logic)) { + piv_eval_par_dest->int_geo = piv_eval_par_src.int_geo; + piv_eval_par_dest->int_geo_logic = 1; + } + + if (force + || ( piv_eval_par_src.int_line_col_logic + && !piv_eval_par_dest->int_line_col_logic)) { + piv_eval_par_dest->int_line_col = piv_eval_par_src.int_line_col; + piv_eval_par_dest->int_line_col_logic = 1; + } + + if (force + || ( piv_eval_par_src.int_line_col_start_logic + && !piv_eval_par_dest->int_line_col_start_logic)) { + piv_eval_par_dest->int_line_col_start = + piv_eval_par_src.int_line_col_start; + piv_eval_par_dest->int_line_col_start_logic = 1; + } + + if (force + || ( piv_eval_par_src.int_line_col_end_logic + && !piv_eval_par_dest->int_line_col_end_logic)) { + piv_eval_par_dest->int_line_col_end = + piv_eval_par_src.int_line_col_end; + piv_eval_par_dest->int_line_col_end_logic = 1; + } + + if (force + || ( piv_eval_par_src.int_line_row_logic + && !piv_eval_par_dest->int_line_row_logic)) { + piv_eval_par_dest->int_line_row = piv_eval_par_src.int_line_row; + piv_eval_par_dest->int_line_row_logic = 1; + } + + if (force + || ( piv_eval_par_src.int_line_row_start_logic + && !piv_eval_par_dest->int_line_row_start_logic)) { + piv_eval_par_dest->int_line_row_start = + piv_eval_par_src.int_line_row_start; + piv_eval_par_dest->int_line_row_start_logic = 1; + } + + if (force + || ( piv_eval_par_src.int_line_row_end_logic + && !piv_eval_par_dest->int_line_row_end_logic)) { + piv_eval_par_dest->int_line_row_end = + piv_eval_par_src.int_line_row_end; + piv_eval_par_dest->int_line_row_end_logic = 1; + } + + if (force + || ( piv_eval_par_src.int_point_col_logic + && !piv_eval_par_dest->int_point_col_logic)) { + piv_eval_par_dest->int_point_col = piv_eval_par_src.int_point_col; + piv_eval_par_dest->int_point_col_logic = 1; + } + + if (force + || ( piv_eval_par_src.int_point_row_logic + && !piv_eval_par_dest->int_point_row_logic)) { + piv_eval_par_dest->int_point_row = piv_eval_par_src.int_point_row; + piv_eval_par_dest->int_point_row_logic = 1; + } + + if (force + || ( piv_eval_par_src.int_size_1_logic + && !piv_eval_par_dest->int_size_1_logic)) { + piv_eval_par_dest->int_size_1 = piv_eval_par_src.int_size_1; + piv_eval_par_dest->int_size_1_logic = 1; + } + + if (force + || ( piv_eval_par_src.int_size_2_logic + && !piv_eval_par_dest->int_size_2_logic)) { + piv_eval_par_dest->int_size_2 = piv_eval_par_src.int_size_2; + piv_eval_par_dest->int_size_2_logic = 1; + } + + if (force + || ( piv_eval_par_src.int_shift_logic + && !piv_eval_par_dest->int_shift_logic)) { + piv_eval_par_dest->int_shift = + piv_eval_par_src.int_shift; + piv_eval_par_dest->int_shift_logic = 1; + } + + if (force + || ( piv_eval_par_src.pre_shift_col_logic + && !piv_eval_par_dest->pre_shift_col_logic)) { + piv_eval_par_dest->pre_shift_col = piv_eval_par_src.pre_shift_col; + piv_eval_par_dest->pre_shift_col_logic = 1; + } + + if (force + || ( piv_eval_par_src.pre_shift_row_logic + && !piv_eval_par_dest->pre_shift_row_logic)) { + piv_eval_par_dest->pre_shift_row = piv_eval_par_src.pre_shift_row; + piv_eval_par_dest->pre_shift_row_logic = 1; + } + + if (force + || ( piv_eval_par_src.old_piv_logic + && !piv_eval_par_dest->old_piv_logic)) { + piv_eval_par_dest->old_piv = piv_eval_par_src.old_piv; + piv_eval_par_dest->old_piv_logic = 1; + } + + if (force + || ( piv_eval_par_src.peak_logic + && !piv_eval_par_dest->peak_logic)) { + piv_eval_par_dest->peak = piv_eval_par_src.peak; + piv_eval_par_dest->peak_logic = 1; + } + + if (force + || ( piv_eval_par_src.print_cov_logic + && !piv_eval_par_dest->print_cov_logic)) { + piv_eval_par_dest->print_cov = piv_eval_par_src.print_cov; + piv_eval_par_dest->print_cov_logic = 1; + } + + if (force + || ( piv_eval_par_src.print_par_logic + && !piv_eval_par_dest->print_par_logic)) { + piv_eval_par_dest->print_par = piv_eval_par_src.print_par; + piv_eval_par_dest->print_par_logic = 1; + } + + if (force + || ( piv_eval_par_src.print_piv_logic + && !piv_eval_par_dest->print_piv_logic)) { + piv_eval_par_dest->print_piv = piv_eval_par_src.print_piv; + piv_eval_par_dest->print_piv_logic = 1; + } + + if (force + || ( piv_eval_par_src.weight_logic + && !piv_eval_par_dest->weight_logic)) { + piv_eval_par_dest->weight = piv_eval_par_src.weight; + piv_eval_par_dest->weight_logic = 1; + } + + + if (force + || ( piv_eval_par_src.zero_off_logic + && !piv_eval_par_dest->zero_off_logic)) { + piv_eval_par_dest->zero_off = piv_eval_par_src.zero_off; + piv_eval_par_dest->zero_off_logic = 1; + } + + if (force + || ( piv_eval_par_src.central_diff_logic + && !piv_eval_par_dest->central_diff_logic)) { + piv_eval_par_dest->central_diff = piv_eval_par_src.central_diff; + piv_eval_par_dest->central_diff_logic = 1; + } + + if (force + || ( piv_eval_par_src.ifit_logic + && !piv_eval_par_dest->ifit_logic)) { + piv_eval_par_dest->ifit = piv_eval_par_src.ifit; + piv_eval_par_dest->ifit_logic = 1; + } + + if (force + || ( piv_eval_par_src.ad_int_logic + && !piv_eval_par_dest->ad_int_logic)) { + piv_eval_par_dest->ad_int = piv_eval_par_src.ad_int; + piv_eval_par_dest->ad_int_logic = 1; + } + + if (force + || ( piv_eval_par_src.autokey_logic + && !piv_eval_par_dest->autokey_logic)) { + piv_eval_par_dest->autokey = piv_eval_par_src.autokey; + piv_eval_par_dest->autokey_logic = 1; + } + + if (force + || ( piv_eval_par_src.cmpr_logic + && !piv_eval_par_dest->cmpr_logic)) { + piv_eval_par_dest->cmpr = piv_eval_par_src.cmpr; + piv_eval_par_dest->cmpr_logic = 1; + } + +} + + + /* * gtk routnies */ diff --git a/src/utils.h b/src/utils.h index ce16211..efd2af8 100644 --- a/src/utils.h +++ b/src/utils.h @@ -26,8 +26,11 @@ /* * widgets prototypes of display * $Log: utils.h,v $ - * Revision 1.1 2003-06-17 17:10:52 gerber - * Initial revision + * Revision 1.2 2003-06-27 13:47:26 gerber + * display ruler, line/point evaluation + * + * Revision 1.1.1.1 2003/06/17 17:10:52 gerber + * Imported gpiv * */ @@ -68,10 +71,18 @@ void free_post_bufmems(Display * disp); void -copy_img_par (ImagePar image_par_src, - ImagePar * image_par_dest, - int print_par - ); +copy_img_par(ImagePar image_par_src, + ImagePar * image_par_dest, + gboolean force, + int print_par + ); + +void +copy_piv_par(PivEvalPar piv_eval_par_src, + PivEvalPar * piv_eval_par_dest, + gboolean force, + int print_par + ); /* * general gtk functions -- 2.11.4.GIT