📄 gsegyfile_test.c
字号:
/* * gsegyfile_test - Test of SEG-Y file access and traces sort * * Copyright (C) 2005-2006 Vladimir Bashkardin * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as * published by the Free Software Foundation; either version 2 of the * License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more av. * * You should have received a copy of the GNU General Public * License along with this program; if not, write to the * Free Software Foundation, Inc., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. * * Author: Vladimir Bashkardin <vovizmus@users.sourceforge.net> */#include <gtk/gtk.h>#include <gsegyfile/gsegyfile.h>static gboolean close (GtkWidget *widget, GdkEvent* event, gpointer data) { gtk_main_quit (); return FALSE;}static gboolean test_file_scan_fraction_handler (GSEGYFile *segy_file, gfloat fraction, GSEGYFileError *file_error, gpointer data) { return TRUE;}static void button_clicked (GtkWidget *widget, gpointer data) { GSEGYEndianess *endianess; GSEGYFormatWizard *format_wizard; GSEGYFile *test_file; GSEGYSeismicAccessor *seis_access; GSEGYFileError *error; endianess = g_segy_endianess_new (TRUE, TRUE); format_wizard = g_segy_format_wizard_new (endianess); test_file = g_segy_file_new ("data/test.sgy"); error = g_segy_file_get_error (test_file); if (error && error->id != G_SEGY_FILE_NO_ERROR) {#ifdef DEBUG if (error->gerror) g_printf ("File open error: id = %d, message = %s\n", error->id, error->gerror->message); else g_printf ("File open error: id = %d\n", error->id);#endif g_object_unref (test_file); g_object_unref (format_wizard); g_object_unref (endianess); return; } g_signal_connect (G_OBJECT (test_file), "scan_fraction", (GCallback)test_file_scan_fraction_handler, NULL); g_segy_file_set_format (test_file, format_wizard, NULL); if (error && error->id != G_SEGY_FILE_NO_ERROR) {#ifdef DEBUG if (error->gerror) g_printf ("File format check error: id = %d, message = %s\n", error->id, error->gerror->message); else g_printf ("File format check error: id = %d\n", error->id);#endif g_object_unref (test_file); g_object_unref (format_wizard); g_object_unref (endianess); return; } seis_access = g_segy_file_get_seismic_accessor (test_file); g_segy_seismic_accessor_sort (seis_access, 5, 7, TRUE, TRUE); g_object_unref (seis_access); g_object_unref (test_file); g_object_unref (format_wizard); g_object_unref (endianess);}int main (int argc, char *argv[]) { GtkWidget *window, *button; gtk_init (&argc, &argv); window = gtk_window_new (GTK_WINDOW_TOPLEVEL); gtk_window_set_title (GTK_WINDOW (window), "SEG-Y file access sample"); gtk_signal_connect (GTK_OBJECT (window), "delete_event", GTK_SIGNAL_FUNC (close), NULL); button = gtk_button_new_with_label ("Test"); gtk_container_add (GTK_CONTAINER (window), button); gtk_signal_connect (GTK_OBJECT (button), "clicked", GTK_SIGNAL_FUNC (button_clicked), NULL); gtk_widget_show (button); gtk_widget_show (window); gtk_main (); return (0);}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -