The Layer class represents a relation one to one between atoms ID and layer ID, and stores the unique active layer. Layer's ID are consecutively and there can't be a ID bigger than m_maxLayer.
#include <avogadro/core/layer.h>
◆ removeLayer()
| void removeLayer |
( |
size_t | layer | ) |
|
Remove layer, renumbering higher layers down by one. Atoms that were in layer are NOT removed from the per-atom array: they move into whichever layer is active once the active layer itself has been updated (see setActiveLayer's effect below), so atomCount() never changes. If layer is the active layer, the layer below becomes active (layer 0 if layer is 0); if the active layer is above layer, its id is decremented to keep naming the same layer. A no-op if layer is greater than maxLayer(), or if maxLayer() is 0 (the only layer cannot be removed).
◆ getLayerID()
| size_t getLayerID |
( |
Index | atom | ) |
const |
- Returns
- the layer ID from the
atom.
◆ activeLayer()
| size_t activeLayer |
( |
| ) |
const |
◆ maxLayer()
| size_t maxLayer |
( |
| ) |
const |
- Returns
- the maximum layer allowed.
◆ layerCount()
| size_t layerCount |
( |
| ) |
const |
- Returns
- the number of layers.
◆ atomCount()
| size_t atomCount |
( |
| ) |
const |
- Returns
- The number of atoms.
◆ clear()
◆ resize()
| void resize |
( |
size_t | count | ) |
|
resize the atom-layer array to count atoms, removing any excess.
◆ addLayer() [1/2]
increase the maximum layer allowed .
◆ addLayer() [2/2]
| void addLayer |
( |
size_t | layer | ) |
|
insert a layer at layer, equal or bigger previous layers will be shifted up by one, and the active layer shifts up with them if it was at or above layer, so it keeps naming the same layer. A no-op if layer is greater than maxLayer() + 1.
◆ setActiveLayer()
| void setActiveLayer |
( |
size_t | layer | ) |
|
change m_activeLayer to layer. A layer id one past maxLayer() is accepted: it lets a caller point the active layer at a layer that does not exist yet, which is then created lazily the first time an atom is actually added to it (see addAtomToActiveLayer() / addAtom()). Anything further out of range is ignored, leaving the active layer unchanged.
◆ swapLayer()
| void swapLayer |
( |
Index | a, |
|
|
Index | b ) |
swap the layer ID from a and b. A no-op if either index is out of range (>= atomCount()).
The documentation for this class was generated from the following file: