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

Class Selection

source code

Instance Methods [hide private]
 
get_object_size()
Gets the number of coordinates that make up a one selection object.
source code
 
clear()
Clears a selection.
source code
 
get_object(i, data)
Gets one selection object.
source code
 
set_object(i, data)
Sets one selection object.
source code
 
delete_object(i)
Deletes a one selection object.
source code
 
set_data(nselected, data)
Sets selection data.
source code
 
get_max_objects()
Gets the maximum number of selected objects.
source code
 
set_max_objects(max_objects)
Sets the maximum number of objects allowed to select.
source code
 
is_full()
Checks whether the maximum number of objects is selected.
source code
 
crop(xmin, ymin, xmax, ymax)
Limits objects in a selection to a rectangle.
source code
 
UNIMPLEMENTED_filter(filter, data)
Removes selection objects matching certain criteria.
source code
 
changed(i)
Emits "changed" signal on a selection.
source code
 
finished()
Emits "finished" signal on a selection.
source code
 
get_data()
Return list of selected points.
source code
Method Details [hide private]

get_object_size()

source code 

Gets the number of coordinates that make up a one selection object.

Returns:
The number of coordinates in one selection object.

clear()

source code 

Clears a selection.

get_object(i, data)

source code 

Gets one selection object.

Parameters:
  • i - Index of object to get. (int)
  • data - Array to store selection object data to. Object data is an array of coordinates whose precise meaning is defined by particular selection types. (gdouble*)
Returns:
True if there was such an object and data was filled.

set_object(i, data)

source code 

Sets one selection object.

This method can be also used to append objects (if the maximum number is not exceeded). Since there cannot be holes in the object list, i must be then equal to either the number of selected objects or special value -1 meaning append to end.

Parameters:
  • i - Index of object to set. (int)
  • data - Object selection data. It's an array of coordinates whose precise meaning is defined by particular selection types. (const-gdouble*)
Returns:
The index of actually set object (useful namely when i is -1).

delete_object(i)

source code 

Deletes a one selection object.

Since there cannot be holes in the object list, the rest of selection objects is moved to close the gap.

Parameters:
  • i - Index of object to delete. (int)

set_data(nselected, data)

source code 

Sets selection data.

Parameters:
  • nselected - The number of selected objects. (int)
  • data - Selection data, that is an array nselected * Selection.get_object_size() long with selected object coordinates. (const-gdouble*)

get_max_objects()

source code 

Gets the maximum number of selected objects.

Returns:
The maximum number of selected objects;

set_max_objects(max_objects)

source code 

Sets the maximum number of objects allowed to select.

When selection reaches this number of selected objects, it emits "finished" signal.

Parameters:
  • max_objects - The maximum number of objects allowed to select. Note particular selection types may allow only specific values. (int)

is_full()

source code 

Checks whether the maximum number of objects is selected.

Returns:
True when the maximum possible number of objects is selected, False otherwise.

crop(xmin, ymin, xmax, ymax)

source code 

Limits objects in a selection to a rectangle.

Objects that are fully outside specified rectangle are removed. Objects partially outside may be removed or cut, depending on what makes sense for the specific selection type. If the selection class does not implement this method then all objects are removed.

Since: 2.16

Parameters:
  • xmin - Minimum x-coordinate. (float)
  • ymin - Minimum y-coordinate. (float)
  • xmax - Maximum x-coordinate. (float)
  • ymax - Maximum y-coordinate. (float)

UNIMPLEMENTED_filter(filter, data)

source code 

Removes selection objects matching certain criteria.

Since: 2.16

Parameters:
  • filter - Function returning True for objects that should be kept, False for objects that should be removed. (SelectionFilterFunc)
  • data - User data passed to filter. (gpointer)

changed(i)

source code 

Emits "changed" signal on a selection.

Parameters:
  • i - Index of object that changed. Use -1 when not applicable, e.g., when complete selection was changed, cleared, or truncated. (int)

finished()

source code 

Emits "finished" signal on a selection.

get_data()

source code 

Return list of selected points.

Returns:
a list of selected data