class DataNodeSet : public RefCountedObject

A DataNodeSet is a set of unique nodes within a DataSource.

The set items are identified by the DataNodeSetItem class, which identifies a node within the data source. The node is identified by:

Creating sets

The contents of the set can be added manually or created by the DataNodeSetGenerator.

The sets supports standard boolean set operations: Union, intersect and subtract.

Note! The set stores the items in a sorted order for performance reasons. This means that the indices of the items in the set will change whenever the content of the set is modified. Please keep this in mind when using the itemIndex() and item() methods.

Public Functions

DataNodeSet(int setId)

Constructs an empty node set.

Specify a unique id.

bool isEqual(const DataNodeSet &rhs) const

Returns true if the other set has the same items as this set.

Note: Will return true for two sets with the same contents even if their id’s are different.

int id() const

Returns the id of the data node set.

size_t itemCount() const

Returns the number of DataNodeSetItem’s in the set.

size_t itemIndex(const DataNodeSetItem &item) const

Returns the index of the given item.

Note! This index is only valid as long as the set is not modified.

DataNodeSetItem item(size_t index) const

Returns the item at the given index.

Note! The order of the items in a set will change if the set is changed. See note in class documentation.

void addItem(const DataNodeSetItem &item)

Adds the given item to the set.

If the item is already present, the set remains unchanged

void addItems(int geometryId, int partId, const std::vector<size_t> &nodeIndices)

Adds a list of nodes to the set.

This is a much faster way to add a lot of nodes (within one part) to a set than to use the single add method.

As sets contain unique items, only the items that are not already in the set are added.

void removeItem(const DataNodeSetItem &item)

Removes the given item from the set.

void removeAllItems()

Removes all items from the set.

void unionWith(const DataNodeSet &other)

Adds all the items in the given other set to this set.

This method performs a union operation with the given set, resulting in all items present in the given other set to be added to this set. As sets store unique items only, the resulting number of items will be less than or equal to the sum of items in this set and the other set.

void intersect(const DataNodeSet &other)

Removes any item that is not present in both sets.

This method performs a intersect set operation with the given other set. The result of this operation will be the nodes both in this set and the other set.

void subtract(const DataNodeSet &other)

Removes all the items in the given other set from this set.

This method performs a subtract set operation. Any set item in the given other set that is also present in this set will be removed from this set.