# IBM Visualization Data Explorer Programmer's Reference

[ Bottom of Page | Previous Page | Next Page | Table of Contents | Partial Table of Contents | Index ]

## 17.2 Example 1: sealevel.c

The first example which we will discuss is sealevel.c. This sample program starts the Data Explorer user interface in `-image` mode, and then loads a visual program (see Figure 12).

Figure 12. sealevel.net

The visual program contains a DXLInput tool which can receive values from the DXLink program. It is named `contour_line_value`. The DXLink program sends several different values to this DXLInput tool, and the resulting image is displayed to the user.

    #include <stdio.h>
    #include "dx/dxl.h"
    #ifndef BASE
    #define BASE "/usr/lpp/dx"
    #endif
    /*
     * define an error handler
     */
    void ErrorHandler(DXLConnection *conn, const char *msg, void *data)
    {
        printf("DXL Error: %s\n", msg);
    }
    main(int argc, char *argv[])
    {
        DXLConnection *conn = NULL;
        char result[100];
        /*
         * Start Data Explorer in -image mode with certain menus disabled.
         */
        conn = DXLStartDX(
                  "dx -image -noExitOptions -noExecuteMenus -noConnectionMenus",
                  NULL);
        if (conn == NULL)
        {
            fprintf(stderr,"Could not connect\n");
            perror("DXLStartDX");
            exit(1);
        }
        /*
         * Set the error handler
         */
        DXLSetErrorHandler(conn, ErrorHandler, NULL);
        /*
         * Load the visual program to run
         */
        DXLLoadVisualProgram(conn, BASE"/samples/dxlink/sealevel.net");
        /*
         * Set the value of the DXLInput tool which is labelled
         * "contour_line_value" and execute.
         */
        DXLSetValue(conn, "contour_line_value", "0");
        DXLExecuteOnce(conn);
        /*
         * Set the value of the DXLInput tool which is labelled
         * "contour_line_value" and execute.
         */
        DXLSetValue(conn, "contour_line_value", "2");
        DXLExecuteOnce(conn);
        /*
         * Set the value of the DXLInput tool which is labelled
         * "contour_line_value" and execute.
         */
        DXLSetValue(conn, "contour_line_value", "5");
        DXLExecuteOnce(conn);
        /*
         * Set the value of the DXLInput tool which is labelled
         * "contour_line_value" and execute.
         */
        DXLSetValue(conn, "contour_line_value", "20");
        DXLExecuteOnce(conn);
        /*
         * Set the value of the DXLInput tool which is labelled
         * "contour_line_value" and execute.
         */
        DXLSetValue(conn, "contour_line_value", "50");
        DXLExecuteOnce(conn);
        printf("An image window will appear\n");
        printf("and a sequence of images will be created.\n");
        printf("When you are finished, hit return to quit:");
        gets(result);
        DXLExitDX(conn);
    }

[ Top of Page | Previous Page | Next Page | Table of Contents | Partial Table of Contents | Index ]
[Data Explorer Documentation | QuickStart Guide | User's Guide | User's Reference | Programmer's Reference | Installation and Configuration Guide ]

[Data Explorer Home Page | Contact Data Explorer | Same document on Data Explorer Home Page ]

[IBM Home Page | Order | Search | Contact IBM | Legal ]