Gwy3DView

Gwy3DView — OpenGL 3D data display

Synopsis




enum        Gwy3DMovement;
            Gwy3DView;
            Gwy3DViewClass;
GtkWidget*  gwy_3d_view_new                 (GwyContainer *data);
void        gwy_3d_view_update              (Gwy3DView *gwy3dview);
GwyPalette* gwy_3d_view_get_palette         (Gwy3DView *gwy3dview);
void        gwy_3d_view_set_palette         (Gwy3DView *gwy3dview,
                                             GwyPalette *palette);
const gchar* gwy_3d_view_get_gradient       (Gwy3DView *gwy3dview);
void        gwy_3d_view_set_gradient        (Gwy3DView *gwy3dview,
                                             const gchar *gradient);
Gwy3DMovement gwy_3d_view_get_status        (Gwy3DView *gwy3dview);
void        gwy_3d_view_set_status          (Gwy3DView *gwy3dview,
                                             Gwy3DMovement mv);
gboolean    gwy_3d_view_get_orthographic    (Gwy3DView *gwy3dview);
void        gwy_3d_view_set_orthographic    (Gwy3DView *gwy3dview,
                                             gboolean orthographic);
gboolean    gwy_3d_view_get_show_axes       (Gwy3DView *gwy3dview);
void        gwy_3d_view_set_show_axes       (Gwy3DView *gwy3dview,
                                             gboolean show_axes);
gboolean    gwy_3d_view_get_show_labels     (Gwy3DView *gwy3dview);
void        gwy_3d_view_set_show_labels     (Gwy3DView *gwy3dview,
                                             gboolean show_labels);
gboolean    gwy_3d_view_get_use_lights      (Gwy3DView *gwy3dview);
void        gwy_3d_view_set_use_lights      (Gwy3DView *gwy3dview,
                                             gboolean use_lights);
guint       gwy_3d_view_get_reduced_size    (Gwy3DView *gwy3dview);
void        gwy_3d_view_set_reduced_size    (Gwy3DView *gwy3dview,
                                             guint reduced_size);
GwyGLMaterial* gwy_3d_view_get_material     (Gwy3DView *gwy3dview);
void        gwy_3d_view_set_material        (Gwy3DView *gwy3dview,
                                             GwyGLMaterial *material);
GdkPixbuf*  gwy_3d_view_get_pixbuf          (Gwy3DView *gwy3dview,
                                             guint xres,
                                             guint yres);
GwyContainer* gwy_3d_view_get_data          (Gwy3DView *gwy3dview);
void        gwy_3d_view_reset_view          (Gwy3DView *gwy3dview);
GtkAdjustment* gwy_3d_view_get_rot_x_adjustment
                                            (Gwy3DView *gwy3dview);
GtkAdjustment* gwy_3d_view_get_rot_y_adjustment
                                            (Gwy3DView *gwy3dview);
GtkAdjustment* gwy_3d_view_get_view_scale_adjustment
                                            (Gwy3DView *gwy3dview);
GtkAdjustment* gwy_3d_view_get_z_deformation_adjustment
                                            (Gwy3DView *gwy3dview);
GtkAdjustment* gwy_3d_view_get_light_z_adjustment
                                            (Gwy3DView *gwy3dview);
GtkAdjustment* gwy_3d_view_get_light_y_adjustment
                                            (Gwy3DView *gwy3dview);
gdouble     gwy_3d_view_get_max_view_scale  (Gwy3DView *gwy3dview);
gdouble     gwy_3d_view_get_min_view_scale  (Gwy3DView *gwy3dview);
gboolean    gwy_3d_view_set_max_view_scale  (Gwy3DView *gwy3dview,
                                             gdouble new_max_scale);
gboolean    gwy_3d_view_set_min_view_scale  (Gwy3DView *gwy3dview,
                                             gdouble new_min_scale);
Gwy3DLabelDescription* gwy_3d_view_get_label_description
                                            (Gwy3DView *gwy3dview,
                                             Gwy3DLabelName label_name);

Object Hierarchy


  GObject
   +----GtkObject
         +----GtkWidget
               +----GtkDrawingArea
                     +----Gwy3DView

Implemented Interfaces

Gwy3DView implements AtkImplementorIface.

Description

Gwy3DView displays a data field as a threedimensional heightfield using OpenGL. You can create a new 3D view for a data container with gwy_3d_view_new(). By default, it inherits properties like palette from data view settings, but supports separate settings -- see gwy_3d_view_set_palette() et al.

Gwy3DView allows the user to interactively rotate, scale, z-scale the data or move lights, depending on its movement state. There are no controls provided for mode change, you have to provide some yourself and set the movement mode with gwy_3d_view_set_status(). There are GtkAdjustment's for each view parameter, you can fetch them with gwy_3d_view_get_rot_x_adjustment(), gwy_3d_view_get_rot_y_adjustment(), etc.

Due to lack of real GwyWatchable implementation in data fields, you have to call gwy_3d_view_update() to instruct the 3D view to update self, when data changes.

Details

enum Gwy3DMovement

typedef enum {
    GWY_3D_NONE           = 0,
    GWY_3D_ROTATION       = 1,
    GWY_3D_SCALE          = 2,
    GWY_3D_DEFORMATION    = 3,
    GWY_3D_LIGHT_MOVEMENT = 4
} Gwy3DMovement;

The type of 3D view change that happens when user drags it with mouse.

GWY_3D_NONE View cannot be changed by user.
GWY_3D_ROTATION View can be rotated.
GWY_3D_SCALE View can be scaled.
GWY_3D_DEFORMATION View can be scaled.
GWY_3D_LIGHT_MOVEMENT Light position can be changed.

Gwy3DView

typedef struct _Gwy3DView Gwy3DView;


Gwy3DViewClass

typedef struct {
    GtkDrawingAreaClass parent_class;

    gpointer reserved1;             /* reserved for future use (signals) */
    gpointer reserved2;
    gpointer reserved3;
    gpointer reserved4;
} Gwy3DViewClass;


gwy_3d_view_new ()

GtkWidget*  gwy_3d_view_new                 (GwyContainer *data);

Creates a new threedimensional OpenGL display of data. The widget is initialized from container data.

data : A GwyContainer containing the data to display.
Returns : The new OpenGL 3D widget as a GtkWidget.

Since 1.5


gwy_3d_view_update ()

void        gwy_3d_view_update              (Gwy3DView *gwy3dview);

Instructs a 3D data view to update self and repaint. The values of GwyDataField data, GwyPalette palette are updated from container container. If necessary new downsampled data are created. Old values of data and palette are unreferenced.

The display lists are recreated if the widget is realized. This may take a great amount of processor time (seconds).

gwy3dview : A 3D data view widget.

Since 1.5


gwy_3d_view_get_palette ()

GwyPalette* gwy_3d_view_get_palette         (Gwy3DView *gwy3dview);

Warning

gwy_3d_view_get_palette is deprecated and should not be used in newly-written code.

Returns the palette a 3D data view uses.

gwy3dview : A 3D data view widget.
Returns : The palette gwy3dview uses.

Since 1.5


gwy_3d_view_set_palette ()

void        gwy_3d_view_set_palette         (Gwy3DView *gwy3dview,
                                             GwyPalette *palette);

Warning

gwy_3d_view_set_palette is deprecated and should not be used in newly-written code.

Sets the palette of a 3D data view.

The display lists are recreated if the widget is realized. This may take a great amount of processor time (seconds). Further, the widget is redrawn.

gwy3dview : A 3D data view widget.
palette : A palette.

Since 1.5


gwy_3d_view_get_gradient ()

const gchar* gwy_3d_view_get_gradient       (Gwy3DView *gwy3dview);

Returns the color gradient a 3D data view uses.

gwy3dview : A 3D data view widget.
Returns : The color gradient.

Since 1.8


gwy_3d_view_set_gradient ()

void        gwy_3d_view_set_gradient        (Gwy3DView *gwy3dview,
                                             const gchar *gradient);

Sets the color gradient a 3D data view should use.

gwy3dview : A 3D data view widget.
gradient : Name of gradient gwy3dview should use. It should exist.

Since 1.8


gwy_3d_view_get_status ()

Gwy3DMovement gwy_3d_view_get_status        (Gwy3DView *gwy3dview);

Returns a Gwy3DMovement describing actual type of response on the mouse motion event.

gwy3dview : A 3D data view widget.
Returns : actual type of response on the mouse motion event

Since 1.5


gwy_3d_view_set_status ()

void        gwy_3d_view_set_status          (Gwy3DView *gwy3dview,
                                             Gwy3DMovement mv);

Sets the type of widget response on the mouse motion event. See Gwy3DMovement.

gwy3dview : A 3D data view widget.
mv : A new type of response on the mouse motion event.

Since 1.5


gwy_3d_view_get_orthographic ()

gboolean    gwy_3d_view_get_orthographic    (Gwy3DView *gwy3dview);

gwy3dview : A 3D data view widget.
Returns : TRUE if projection of the data is orthografic FALSE if projection of the data is perspective

Since 1.5


gwy_3d_view_set_orthographic ()

void        gwy_3d_view_set_orthographic    (Gwy3DView *gwy3dview,
                                             gboolean orthographic);

Sets the type of projection of the 3D data to the screen and redraws widget (if realized).

gwy3dview : A 3D data view widget.
orthographic : Whether the projection of the data is orthograpic (TRUE) or perspective (FALSE).

Since 1.5


gwy_3d_view_get_show_axes ()

gboolean    gwy_3d_view_get_show_axes       (Gwy3DView *gwy3dview);

Returns whether the axes are shown within the widget.

gwy3dview : A 3D data view widget.
Returns : visibility of the axes

Since 1.5


gwy_3d_view_set_show_axes ()

void        gwy_3d_view_set_show_axes       (Gwy3DView *gwy3dview,
                                             gboolean show_axes);

Show/hide axes within gwy3dview. Widget is invalidated if necessary.

gwy3dview : A 3D data view widget.
show_axes : Show/hide axes

Since 1.5


gwy_3d_view_get_show_labels ()

gboolean    gwy_3d_view_get_show_labels     (Gwy3DView *gwy3dview);

Returns whether the axes labels are shown within the gwy3dview. The labels are visible only if show_axes is TRUE.

gwy3dview : A 3D data view widget.
Returns : Whwteher the axes labels are visible.

Since 1.5


gwy_3d_view_set_show_labels ()

void        gwy_3d_view_set_show_labels     (Gwy3DView *gwy3dview,
                                             gboolean show_labels);

Show/hide lables of the axes within gwy3dview. Widget is invalidated if necessary. The labels of the axes are visible only if show_axes is TRUE.

gwy3dview : A 3D data view widget.
show_labels : Show/hide axes labels

Since 1.5


gwy_3d_view_get_use_lights ()

gboolean    gwy_3d_view_get_use_lights      (Gwy3DView *gwy3dview);

Returns whether the lighst are on or off within the gwy3dview.

gwy3dview : A 3D data view widget.
Returns : TRUE if the lights are on, FALSE if they are off.

Since 1.5


gwy_3d_view_set_use_lights ()

void        gwy_3d_view_set_use_lights      (Gwy3DView *gwy3dview,
                                             gboolean use_lights);

Turn lights on/off within gwy3dview.

Widget is invalidated if necessary.

gwy3dview : A 3D data view widget.
use_lights : TRUE if lights should be used, FALSE to use palette.

Since 1.5


gwy_3d_view_get_reduced_size ()

guint       gwy_3d_view_get_reduced_size    (Gwy3DView *gwy3dview);

Returns the size of the downsampled data. The downampled data are used when fast rendering of surface is needed (in the situations like mouse rotations etc.)

gwy3dview : A 3D data view widget.
Returns : The size of the downsampled data.

Since 1.5


gwy_3d_view_set_reduced_size ()

void        gwy_3d_view_set_reduced_size    (Gwy3DView *gwy3dview,
                                             guint reduced_size);

Sets the size of the downsampled data. In case of the original data are not square, the reduced_size is the greater size of the downsampled data, the other dimension is proportional to the original size.

If necessary a display list is recreated and widget is invalidated

gwy3dview : A 3D data view widget.
reduced_size : The size of the downsampled data.

Since 1.5


gwy_3d_view_get_material ()

GwyGLMaterial* gwy_3d_view_get_material     (Gwy3DView *gwy3dview);

Returns a GwyGLMaterial used to draw data with lights on.

gwy3dview : A 3D data view widget.
Returns : A GwyGLMaterial used to draw data with lights on.

Since 1.5


gwy_3d_view_set_material ()

void        gwy_3d_view_set_material        (Gwy3DView *gwy3dview,
                                             GwyGLMaterial *material);

Sets the material of the surface. If the material is GWY_GL_MATERIAL_NONE the surface is drawn using the colors obtained from the palette. If any other material is the the lights are turned on and the surface is rendered using this material.

This function does NOT take reference on material.

gwy3dview : A 3D data view widget.
material : A GwyGLMaterial used to draw data with lights on.

Since 1.5


gwy_3d_view_get_pixbuf ()

GdkPixbuf*  gwy_3d_view_get_pixbuf          (Gwy3DView *gwy3dview,
                                             guint xres,
                                             guint yres);

Copies the contents of the framebuffer to the GdkPixbuf.

The size of the pixbuf is currently indentical with the size of the widget. xres and yres will be implemented to set the resolution of the pixbuf.

gwy3dview : A 3D data view widget.
xres : Requested pixbuf x-resolution. This parameters is currently unimplemented.
yres : Requested pixbuf y-resolution. This parameters is currently unimplemented.
Returns : A newly allocated GdkPixbuf with copy of the framebuffer.

Since 1.5


gwy_3d_view_get_data ()

GwyContainer* gwy_3d_view_get_data          (Gwy3DView *gwy3dview);

Returns the data container this 3D view displays.

gwy3dview : A 3D data view widget.
Returns : The container as a GwyContainer.

Since 1.5


gwy_3d_view_reset_view ()

void        gwy_3d_view_reset_view          (Gwy3DView *gwy3dview);

Resets angle of the view, scale, deformation ant the position of the light to the "default" values. Invalidates the widget.

gwy3dview : A 3D data view widget.

Since 1.5


gwy_3d_view_get_rot_x_adjustment ()

GtkAdjustment* gwy_3d_view_get_rot_x_adjustment
                                            (Gwy3DView *gwy3dview);

Returns a GtkAdjustment with settings of the Phi angle of rotation.

gwy3dview : A 3D data view widget.
Returns : a GtkAdjustment with settings of the Phi angle of rotation

Since 1.5


gwy_3d_view_get_rot_y_adjustment ()

GtkAdjustment* gwy_3d_view_get_rot_y_adjustment
                                            (Gwy3DView *gwy3dview);

Returns a GtkAdjustment with settings of the Theta angle of rotation

gwy3dview : A 3D data view widget.
Returns : a GtkAdjustment with settings of the Theta angle of rotation

Since 1.5


gwy_3d_view_get_view_scale_adjustment ()

GtkAdjustment* gwy_3d_view_get_view_scale_adjustment
                                            (Gwy3DView *gwy3dview);

Returns a GtkAdjustment with settings of the view zoom

gwy3dview : A 3D data view widget.
Returns : a GtkAdjustment with settings of the view zoom

Since 1.5


gwy_3d_view_get_z_deformation_adjustment ()

GtkAdjustment* gwy_3d_view_get_z_deformation_adjustment
                                            (Gwy3DView *gwy3dview);

Returns a GtkAdjustment with settings of the zoom of the z-axis

gwy3dview : A 3D data view widget.
Returns : a GtkAdjustment with settings of the zoom of the z-axis

Since 1.5


gwy_3d_view_get_light_z_adjustment ()

GtkAdjustment* gwy_3d_view_get_light_z_adjustment
                                            (Gwy3DView *gwy3dview);

Returns a GtkAdjustment with settings of the Phi angle of light position.

gwy3dview : A 3D data view widget.
Returns : a GtkAdjustment with settings of the Phi angle of light position

Since 1.5


gwy_3d_view_get_light_y_adjustment ()

GtkAdjustment* gwy_3d_view_get_light_y_adjustment
                                            (Gwy3DView *gwy3dview);

Returns a GtkAdjustment with settings of the Theta angle of light position.

gwy3dview : A 3D data view widget.
Returns : a GtkAdjustment with settings of the Theta angle of light position

Since 1.5


gwy_3d_view_get_max_view_scale ()

gdouble     gwy_3d_view_get_max_view_scale  (Gwy3DView *gwy3dview);

Returns the maximal zoom of the 3D data view

gwy3dview : A 3D data view widget.
Returns : the maximal zoom of the 3D data view

Since 1.5


gwy_3d_view_get_min_view_scale ()

gdouble     gwy_3d_view_get_min_view_scale  (Gwy3DView *gwy3dview);

Returns the minimal zoom of the 3D data view

gwy3dview : A 3D data view widget.
Returns : the minimal zoom of the 3D data view

Since 1.5


gwy_3d_view_set_max_view_scale ()

gboolean    gwy_3d_view_set_max_view_scale  (Gwy3DView *gwy3dview,
                                             gdouble new_max_scale);

Sets the new maximal zoom of 3D data view. Recommended values are 0.5 - 5.0.

gwy3dview : A 3D data view widget.
new_max_scale : maximal zoom of the 3D data view
Returns : whether the function finished succesfully (allways)

Since 1.5


gwy_3d_view_set_min_view_scale ()

gboolean    gwy_3d_view_set_min_view_scale  (Gwy3DView *gwy3dview,
                                             gdouble new_min_scale);

Sets the new manimal zoom of 3D data view. Recommended values are 0.5 - 5.0.

gwy3dview : A 3D data view widget.
new_min_scale : minimal zoom of the 3D data view
Returns : whether the function finished succesfully (allways)

Since 1.5


gwy_3d_view_get_label_description ()

Gwy3DLabelDescription* gwy_3d_view_get_label_description
                                            (Gwy3DView *gwy3dview,
                                             Gwy3DLabelName label_name);

Returns a Gwy3DLabelDescription structure containing informations about labels shown within 3D data view.

gwy3dview : A 3D data view widget.
label_name : identifier of the label
Returns : a Gwy3DLabelDescription structure containing informations about labels shown within 3D data view.

Since 1.5

See Also

Gwy3DWindow, GwyGLMaterial