Standard Vector Layers: Gwyddion Widgets Library Reference Manual

## Standard Vector Layers Standard Vector Layers — Vector layers that are distributed with Gwyddion |

## Overview

Vector layers, implementing means how user can draw on data views, are provided by layer modules, so that third party tools (implemented by tool modules) can define their own means of user interaction.

There are several standard layers distributed with Gwyddion, and their features and interface is the subject of this section. All layers are subclasses of GwyVectorLayer sharing its basic interface. Each layer lets the user draw or select different shapes, therefore each module also defines its own selection object type determining the format of selection data. All selections are subclasses of GwySelection. By convention, layer type Foo is called GwyLayerFoo and the corresponding selection type GwySelectionFoo.

Layers and selections sometimes have additional object properties not present in the base classes, these are described here too.

## GwyLayerAxis, GwySelectionAxis

    GObject*    g_object_new(g_type_from_name("GwyLayerAxis"), NULL);
    GObject*    g_object_new(g_type_from_name("GwySelectionAxis"), NULL);

The layer allows selecting one or more horizontal or vertical (full-width or full-height) lines, called axes. It can be also viewes as a way to select separate x or y coordinates.

Selection data consists of single coordinates. More precisely, of y-coordinates for horizontal axes and x-coordinates for vertical axes. Each coordinate represents a selected axis.

### GwyLayerAxis properties

None.

### GwySelectionAxis properties

"`orientation`" (GwyOrientation : Read / Write) | Line orientation: horizontal or vertical. The default orientation is horizontal.

## GwyLayerCross, GwySelectionCross

    GObject*    g_object_new(g_type_from_name("GwyLayerCross"), NULL);
    GObject*    g_object_new(g_type_from_name("GwySelectionCross"), NULL);

The layer allows selecting a number of simultaneous horizontal and vertical lines. Usually the selection is displayed as a large cross, but it can also show only the horizontal and vertical lines or just the cross point marker.

Selection data consists of coordinate pairs (x, y) representing selected cross centres.

### GwyLayerCross properties

"`draw-horizontal`" (gboolean : Read / Write) | Whether the horizontal line should be drawn. The default is draw the horizontal line.
"`draw-vertical`" (gboolean : Read / Write) | Whether the vertical line should be drawn. The default is draw the vertical line.
"`thickness`" (gint : Read / Write) | Width of orthogonal ticks at line ends. The default is no ticks.

### GwySelectionCross properties

None.

## GwyLayerEllipse, GwySelectionEllipse

    GObject*    g_object_new(g_type_from_name("GwyLayerEllipse"), NULL);
    GObject*    g_object_new(g_type_from_name("GwySelectionEllipse"), NULL);

The layer allows selecting a number of ellipses.

Selection data consists of quadruples of coordinates (x0, y0, x1, y1), each representing one selected ellipse, where x0 and y0 are coordinates of one bounding box corner and x1 and y1 of the opposite corner. Each one can be any of the four bounding box corners, there is no guarantee one is for example always top-left.

### GwyLayerEllipse properties

"`draw-reflection`" (gboolean : Read / Write) | Whether central reflection of selection should be drawn too. The default is to not draw reflection.
"`snap-to-center`" (gboolean : Read / Write) | Whether the selection should snap to the center. The default is not to snap.

### GwySelectionEllipse properties

None.

## GwyLayerLine, GwySelectionLine

    GObject*    g_object_new(g_type_from_name("GwyLayerLine"), NULL);
    GObject*    g_object_new(g_type_from_name("GwySelectionLine"), NULL);

The layer allows selecting one or more lines of arbitrary orientation and length, optionally can display line numbers next to each line.

Selection data consists of quadruples of coordinates (x0, y0, x1, y1), each representing one selected line, where x0 and y0 are coordinates of one line end and x1 and y1 of the other end.

### GwyLayerLine properties

"`line-numbers`" (gboolean : Read / Write) | Whether line numbers should be displayed next to them. The default is to show line numbers.
"`thickness`" (gint : Read / Write) | Width of orthogonal ticks at line ends. The default is no ticks.
"`center-tick`" (gboolean : Read / Write) | Whether an tick is drawn in the line centre. The default is not to drawn the central tick. Since: 2.42

### GwySelectionLine properties

None.

## GwyLayerPoint, GwySelectionPoint

    GObject*    g_object_new(g_type_from_name("GwyLayerPoint"), NULL);
    GObject*    g_object_new(g_type_from_name("GwySelectionPoint"), NULL);

The layer allows selecting a number of points, either displayed as crosses, crosses with concentric circles, or with no graphical representation (the latter mainly useful with only one selected point).

Selection data consists of coordinate pairs (x, y) representing selected points.

### GwyLayerPoint properties

"`draw-marker`" (gboolean : Read / Write) | If set to TRUE, points will be displayed. Otherwise they will be invisible.
"`marker-radius`" (gboolean : Read / Write) | Specifies the radius of the circle to draw around all selected points. If set to zero and/or if "`draw-marker`" is set to FALSE, no circle will be drawn. The default radius is zero.
"`point-numbers`" (gboolean : Read / Write) | Whether point numbers should be displayed next to them. The default is not to show point numbers.
"`draw-as-vector`" (gboolean : Read / Write) | Whether points should be instead drawn as vector from the origin. This setting may interact poorly with other drawing options. The default is to draw points as points.

### GwySelectionPoint properties

None.

## GwyLayerRectangle, GwySelectionRectangle

    GObject*    g_object_new(g_type_from_name("GwyLayerRectangle"), NULL);
    GObject*    g_object_new(g_type_from_name("GwySelectionRectangle"), NULL);

The layer allows selecting a number of rectangles, that can be drawn with a couple of fancy/special styles.

Selection data consists of quadruples of coordinates (x0, y0, x1, y1), each representing one selected rectangle, where x0 and y0 are coordinates of one corner and x1 and y1 of the opposite corner. Each one can be any of the four rectangle corners, there is no guarantee one is for example always top-left.

### GwyLayerRectangle properties

"`is-crop`" (gboolean : Read / Write) | Whether lines should be drawn always from border to border, as in the Crop tool. The default is to draw just outline of the selected rectangle.
"`draw-reflection`" (gboolean : Read / Write) | Whether central reflection of selection should be drawn too. The default is to not draw reflection.
"`snap-to-center`" (gboolean : Read / Write) | Whether the selection should snap to the center. The default is to not snap.

### GwySelectionRectangle properties

None.

## GwyLayerLattice, GwySelectionLattice

    GObject*    g_object_new(g_type_from_name("GwyLayerLattice"), NULL);
    GObject*    g_object_new(g_type_from_name("GwySelectionLattice"), NULL);

The layer allows selecting a pair of two-dimensional vectors, that represent a lattice in the plane. The selection is also visualised as a lattice.

Selection data consists of quadruples of coordinates (x0, y0, x1, y1), each representing the two selected lattice vectors, where x0 and y0 are coordinates of one vector and x1 and y1 of the other.

Although the selection can contain multiple such pairs, the layer ignores all except the first one.

### GwyLayerLattice properties

"`n-lines`" (guint : Read / Write) | The number of grille lines drawn along each vector.

### GwySelectionLattice properties

None.

## GwyLayerProjective, GwySelectionProjective

    GObject*    g_object_new(g_type_from_name("GwyLayerProjective"), NULL);
    GObject*    g_object_new(g_type_from_name("GwySelectionProjective"), NULL);

The layer allows selecting tetragons representing perspective projections of a rectangle in the plane. The selection is visualised as the perspective rectangle, possibly with a grid inside.

Selection data consists of octuples of coordinates (x0, y0, x1, y1, x2, y2, x3, y3), each representing the four vertices 0, 1, 2 and 3, in order around the perimeter.

Although the selection can contain multiple such tetragon, the layer ignores all except the first one.

### GwyLayerProjective properties

"`n-lines`" (guint : Read / Write) | The number of grille lines drawn inside the tetragon.
"`convex`" (gboolean : Read / Write) | Whether editing the tetragon must leave it convex and non-degenerated. The result of programatically setting a non-convex selection when convex is TRUE is undefined. The default is to only allow convex tetragons.

### GwySelectionProjective properties

None.

## GwyLayerPath, GwySelectionPath

    GObject*    g_object_new(g_type_from_name("GwyLayerPath"), NULL);
    GObject*    g_object_new(g_type_from_name("GwySelectionPath"), NULL);

The layer allows selecting a long spline curve passing through given points.

Selection data consists of coordinate pairs (x, y) representing the points defining the curve. The curve is implicitly oriented from the first pair to the last one.

### GwyLayerPath properties

"`thickness`" (gint : Read / Write) | Width of orthogonal ticks at line ends. The default is no ticks.

### GwySelectionPath properties

"`closed`" (gdouble : Read / Write) | How much the curve is slack/taut, from the interval [0, sqrt(2)]. Value of 0 corresponds to completely taut curve, i.e. straight lines connecting the points. Value of 1 corresponds to free curve. The default value is 1/sqrt(2).
"`closed`" (gboolean : Read / Write) | Whether the curve is closed, i.e. continues smoothly from the last point back to the first point. The default is open-ended (not closed) curve.