Module gwy :: Class DataView
[hide private]
[frames] | no frames]

Class DataView

source code

Instance Methods [hide private]
 
__init__(data)
Creates a new data-displaying widget for data.
source code
 
get_base_layer()
Returns the base layer this data view currently uses.
source code
 
set_base_layer(layer)
Plugs layer to data_view as the base layer.
source code
 
get_alpha_layer()
Returns the alpha layer this data view currently uses, or NULL if none is present.
source code
 
set_alpha_layer(layer)
Plugs layer to data_view as the alpha layer.
source code
 
get_top_layer()
Returns the top layer this data view currently uses, or NULL if none is present.
source code
 
set_top_layer(layer)
Plugs layer to data_view as the top layer.
source code
 
get_data_prefix()
Gets the prefix for the container data channel that the data view is currently set to display.
source code
 
set_data_prefix(prefix)
Sets the prefix for the container data channel to display in a data view.
source code
 
get_hexcess()
Return the horizontal excess of widget size to data size.
source code
 
get_vexcess()
Return the vertical excess of widget size to data size.
source code
 
set_zoom(zoom)
Sets zoom of data_view to zoom.
source code
 
get_zoom()
Returns current ideal zoom of a data view.
source code
 
get_real_zoom()
Returns current real zoom of a data view.
source code
 
get_data()
Returns the data container used by data_view.
source code
 
UNIMPLEMENTED_coords_xy_clamp(xscr, yscr)
Fixes screen coordinates xscr and yscr to be inside the data-displaying area (which can be smaller than widget size).
source code
 
UNIMPLEMENTED_coords_xy_cut_line(x0scr, y0scr, x1scr, y1scr)
Fixes screen coordinates of line endpoints to be inside the data-displaying area (which can be smaller than widget size).
source code
 
coords_xy_to_real(xscr, yscr, xreal, yreal)
Recomputes screen coordinates relative to widget origin to physical coordinates in the sample.
source code
 
UNIMPLEMENTED_coords_real_to_xy(xreal, yreal, xscr, yscr)
Recomputes physical coordinate in the sample to screen coordinate relative to widget origin.
source code
 
get_xmeasure()
Returns the ratio between horizontal physical lengths and horizontal screen lengths in pixels.
source code
 
get_ymeasure()
Returns the ratio between vertical physical lengths and horizontal screen lengths in pixels.
source code
 
get_pixel_data_sizes(xres, yres)
Obtains pixel dimensions of data displayed by a data view.
source code
 
get_real_data_sizes(xreal, yreal)
Obtains physical dimensions of data displayed by a data view.
source code
 
UNIMPLEMENTED_get_real_data_offsets(xoffset, yoffset)
Obtains physical offsets of data displayed by a data view.
source code
 
UNIMPLEMENTED_get_metric(metric)
Fills metric matrix for a data view.
source code
 
get_pixbuf(max_width, max_height)
Creates and returns a pixbuf from the data view.
source code
 
export_pixbuf(zoom, draw_alpha, draw_top)
Exports data view to a pixbuf.
source code
Method Details [hide private]

__init__(data)
(Constructor)

source code 

Creates a new data-displaying widget for data.

A newly created DataView doesn't display anything. You have to add some layers to it, at least a base layer with DataView.set_base_layer(), and possibly others with DataView.set_alpha_layer() and DataView.set_top_layer().

The top layer is special. It must be a vector layer and can receive mouse and keyboard events.

The base layer it also special. It must be always present, and must not be transparent or vector.

Returns:
A newly created data view as a GtkWidget.

get_base_layer()

source code 

Returns the base layer this data view currently uses.

A base layer should be always present.

Returns:
The currently used base layer.

set_base_layer(layer)

source code 

Plugs layer to data_view as the base layer.

If another base layer is present, it's unplugged.

The layer must not be a vector layer. Theoretically, it can be NULL to use no base layer, but then data_view will probably display garbage.

Parameters:
  • layer - A layer to be used as the base layer for data_view. (PixmapLayer*)

get_alpha_layer()

source code 

Returns the alpha layer this data view currently uses, or NULL if none is present.

Returns:
The currently used alpha layer.

set_alpha_layer(layer)

source code 

Plugs layer to data_view as the alpha layer.

If another alpha layer is present, it's unplugged.

The layer must not be a vector layer. It can be NULL, meaning no alpha layer is to be used.

Parameters:
  • layer - A layer to be used as the alpha layer for data_view. (PixmapLayer*)

get_top_layer()

source code 

Returns the top layer this data view currently uses, or NULL if none is present.

Returns:
The currently used top layer.

set_top_layer(layer)

source code 

Plugs layer to data_view as the top layer.

If another top layer is present, it's unplugged.

The layer must be a vector layer. It can be NULL, meaning no top layer is to be used.

Parameters:
  • layer - A layer to be used as the top layer for data_view. (VectorLayer*)

get_data_prefix()

source code 

Gets the prefix for the container data channel that the data view is currently set to display.

Returns:
The container data prefix (eg. "/0/data").

set_data_prefix(prefix)

source code 

Sets the prefix for the container data channel to display in a data view.

This function only affects where the data view itself takes parameters from, it does not affect layer keys.

Parameters:
  • prefix - Container prefix for data (eg. "/0/data"). (string)

get_hexcess()

source code 

Return the horizontal excess of widget size to data size.

Do not use. Only useful for DataWindow implementation.

Returns:
The execess.

get_vexcess()

source code 

Return the vertical excess of widget size to data size.

Do not use. Only useful for DataWindow implementation.

Returns:
The execess.

set_zoom(zoom)

source code 

Sets zoom of data_view to zoom.

Zoom greater than 1 means larger image on screen and vice versa.

Note window manager can prevent the window from resize and thus the zoom from change.

Parameters:
  • zoom - A new zoom value. (float)

get_zoom()

source code 

Returns current ideal zoom of a data view.

More precisely the zoom value requested by DataView.set_zoom(), if it's in use (real zoom may differ a bit due to pixel rounding). If zoom was set by explicite widget size change, real and requested zoom are considered to be the same.

When a resize is queued, the new zoom value is returned.

In other words, this is the zoom data_view would like to have. Use DataView.get_real_zoom() to get the real zoom.

Returns:
The zoom as a ratio between ideal displayed size and base data field size.

get_real_zoom()

source code 

Returns current real zoom of a data view.

This is the zoom value a data view may not wish to have, but was imposed by window manager or other constraints. Unlike ideal zoom set by DataView.set_zoom(), this value cannot be set.

When a resize is queued, the current (old) value is returned.

Returns:
The zoom as a ratio between real displayed size and base data field size.

get_data()

source code 

Returns the data container used by data_view.

Returns:
The data as a Container.

UNIMPLEMENTED_coords_xy_clamp(xscr, yscr)

source code 

Fixes screen coordinates xscr and yscr to be inside the data-displaying area (which can be smaller than widget size).

Parameters:
  • xscr - A screen x-coordinate relative to widget origin. (gint*)
  • yscr - A screen y-coordinate relative to widget origin. (gint*)

UNIMPLEMENTED_coords_xy_cut_line(x0scr, y0scr, x1scr, y1scr)

source code 

Fixes screen coordinates of line endpoints to be inside the data-displaying area (which can be smaller than widget size).

Since: 2.11

Parameters:
  • x0scr - First point screen x-coordinate relative to widget origin. (gint*)
  • y0scr - First point screen y-coordinate relative to widget origin. (gint*)
  • x1scr - Second point screen x-coordinate relative to widget origin. (gint*)
  • y1scr - Second point screen y-coordinate relative to widget origin. (gint*)

coords_xy_to_real(xscr, yscr, xreal, yreal)

source code 

Recomputes screen coordinates relative to widget origin to physical coordinates in the sample.

Parameters:
  • xscr - A screen x-coordinate relative to widget origin. (int)
  • yscr - A screen y-coordinate relative to widget origin. (int)
  • xreal - Where the physical x-coordinate in the data sample should be stored. (float)
  • yreal - Where the physical y-coordinate in the data sample should be stored. (float)

UNIMPLEMENTED_coords_real_to_xy(xreal, yreal, xscr, yscr)

source code 

Recomputes physical coordinate in the sample to screen coordinate relative to widget origin.

Parameters:
  • xreal - A physical x-coordinate in the data sample.. (float)
  • yreal - A physical y-coordinate in the data sample. (float)
  • xscr - Where the screen x-coordinate relative to widget origin should be stored. (gint*)
  • yscr - Where the screen y-coordinate relative to widget origin should be stored. (gint*)

get_xmeasure()

source code 

Returns the ratio between horizontal physical lengths and horizontal screen lengths in pixels.

Returns:
The horizontal measure.

get_ymeasure()

source code 

Returns the ratio between vertical physical lengths and horizontal screen lengths in pixels.

Returns:
The vertical measure.

get_pixel_data_sizes(xres, yres)

source code 

Obtains pixel dimensions of data displayed by a data view.

This is a convenience method, the same values could be obtained by DataField.get_xres() and DataField.get_yres() of the data field displayed by the base layer.

Parameters:
  • xres - Location to store x-resolution of displayed data (or NULL). (int)
  • yres - Location to store y-resolution of displayed data (or NULL). (int)

get_real_data_sizes(xreal, yreal)

source code 

Obtains physical dimensions of data displayed by a data view.

Physical coordinates are always taken from data field displayed by the base layer. This is a convenience method, the same values could be obtained by DataField.get_xreal() and DataField.get_yreal() of the data field displayed by the base layer.

Parameters:
  • xreal - Location to store physical x-dimension of the displayed data without excess (or NULL). (float)
  • yreal - Location to store physical y-dimension of the displayed data without excess (or NULL). (float)

UNIMPLEMENTED_get_real_data_offsets(xoffset, yoffset)

source code 

Obtains physical offsets of data displayed by a data view.

Physical coordinates are always taken from data field displayed by the base layer. This is a convenience method, the same values could be obtained by DataField.get_xoffset() and DataField.get_yoffset() of the data field displayed by the base layer.

Since: 2.16

Parameters:
  • xoffset - Location to store physical x-offset of the top corner of displayed data without excess (or NULL). (gdouble*)
  • yoffset - Location to store physical y-offset of the top corner of displayed data without excess (or NULL). (gdouble*)

UNIMPLEMENTED_get_metric(metric)

source code 

Fills metric matrix for a data view.

The metric matrix essentially transforms distances in physical coordinates to screen distances. It is to be used with functions like gwy_math_find_nearest_point() and gwy_math_find_nearest_line() when the distance should be screen-Euclidean.

Parameters:
  • metric - Metric matrix 2x2 (stored in sequentially by rows: m11, m12, m12, m22). (gdouble*)

get_pixbuf(max_width, max_height)

source code 

Creates and returns a pixbuf from the data view.

If the data is not square, the resulting pixbuf is also nonsquare. The returned pixbuf also never has an alpha channel.

Parameters:
  • max_width - Pixbuf width that should not be exceeeded. Value smaller than 1 means unlimited size. (int)
  • max_height - Pixbuf height that should not be exceeeded. Value smaller than 1 means unlimited size. (int)
Returns:
The pixbuf as a newly created GdkPixbuf, it should be freed when no longer needed. It is never larger than the actual data size, as max_width and max_height are only upper limits.

export_pixbuf(zoom, draw_alpha, draw_top)

source code 

Exports data view to a pixbuf.

Parameters:
  • zoom - Zoom to export data with (unrelated to data view zoom). (float)
  • draw_alpha - True to draw alpha layer (mask). (bool)
  • draw_top - True to draw top layer (selection). (bool)
Returns:
A newly created pixbuf, it must be freed by caller.