# `GSElement`

*Class*

The abstract base class for positioned elements.

## Declaration

```swift
class GSElement
```

```objc
@interface GSElement : GSBaseObject
```

```python
class GSElement(GSBaseObject)
```

## Overview

`GSElement` provides common geometry and Glyphs source encoding behavior for concrete element types such as anchors, guides, hints, and annotations. Do not create instances of `GSElement` directly.

Most elements are contained directly by a layer. Some element types are owned by another object and resolve their layer through that owner, so do not assume that [`GSBaseObject.parent`](/Core/GlyphsCore/GSBaseObject/parent) is a layer. An element can be detached, in which case its layer, glyph, font, and undo manager are unavailable.

The inherited position is expressed in layer coordinates unless the concrete type defines another coordinate system. Concrete subclasses define which geometry participates in bounds, hit testing, and transformations, as well as which additional values are encoded.

## Topics

### Creating an Element

- [`GSElement initWithDict:format:`](/Core/GlyphsCore/GSElement/initWithDict:format:) — Creates a concrete element from a Glyphs source representation.

### Geometry

- [`GSElement transform:`](/Core/GlyphsCore/GSElement/transform:) — Applies an affine transform to the element geometry.
- [`GSElement hitTest:tolerance:`](/Core/GlyphsCore/GSElement/hitTest:tolerance:) — Whether the element can be selected at a point within a tolerance.
- [`GSElement getHandleRect:scale:`](/Core/GlyphsCore/GSElement/getHandleRect:scale:) — A handle rectangle centered on a point for an editor scale.

### Encoding

- [`GSElement setPropertyListValue:format:`](/Core/GlyphsCore/GSElement/setPropertyListValue:format:) — Restores the common element values from a Glyphs source representation.
- [`GSElement propertyListValueFormat:error:`](/Core/GlyphsCore/GSElement/propertyListValueFormat:error:) — A property-list representation of the common element values, or `nil` when all values have their defaults.
- [`GSElement propertyListToData:format:error:`](/Core/GlyphsCore/GSElement/propertyListToData:format:error:) — Appends a Glyphs source representation to a data buffer.

### Textual Representation

- [`GSElement elementString`](/Core/GlyphsCore/GSElement/elementString) — A concise textual representation of the element.

## Relationships

### Inherits From

- [`GSBaseObject`](/Core/GlyphsCore/GSBaseObject)

### Inherited By

- [`GSAnchor`](/Core/GlyphsCore/GSAnchor)
- [`GSAnnotation`](/Core/GlyphsCore/GSAnnotation)
- [`GSGradient`](/Core/GlyphsCore/GSGradient)
- [`GSGuide`](/Core/GlyphsCore/GSGuide)
- [`GSHint`](/Core/GlyphsCore/GSHint)
- [`GSShadow`](/Core/GlyphsCore/GSShadow)

