A DataNodeSet is a set of unique nodes within a DataSource. More...
Public Member Functions | |
DataNodeSet (int setId) | |
Constructs an empty node set. More... | |
bool | isEqual (const DataNodeSet &rhs) const |
Returns true if the other set has the same items as this set. More... | |
int | id () const |
Returns the id of the data node set. More... | |
size_t | itemCount () const |
Returns the number of DataNodeSetItem's in the set. More... | |
size_t | itemIndex (const DataNodeSetItem &item) const |
Returns the index of the given item. More... | |
DataNodeSetItem | item (size_t index) const |
Returns the item at the given index. More... | |
void | addItem (const DataNodeSetItem &item) |
Adds the given item to the set. More... | |
void | addItems (int geometryId, int partId, const std::vector< size_t > &nodeIndices) |
Adds a list of nodes to the set. More... | |
void | removeItem (const DataNodeSetItem &item) |
Removes the given item from the set. More... | |
void | removeAllItems () |
Removes all items from the set. More... | |
void | unionWith (const DataNodeSet &other) |
Adds all the items in the given other set to this set. More... | |
void | intersect (const DataNodeSet &other) |
Removes any item that is not present in both sets. More... | |
void | subtract (const DataNodeSet &other) |
Removes all the items in the given other set from this set. More... | |
![]() | |
void | addRef () const |
Increments the reference count for this object. More... | |
void | release () const |
Decrements the reference count for this object. More... | |
int | refCount () const |
Returns the reference count for this object. More... | |
void | setRefCountZero () const |
Sets the ref count to zero, but DOES NOT delete the object. More... | |
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:
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.
cee::ug::DataNodeSet::DataNodeSet | ( | int | setId | ) |
Constructs an empty node set.
Specify a unique id.
void cee::ug::DataNodeSet::addItem | ( | const DataNodeSetItem & | item | ) |
Adds the given item to the set.
If the item is already present, the set remains unchanged
void cee::ug::DataNodeSet::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.
int cee::ug::DataNodeSet::id | ( | ) | const |
Returns the id of the data node set.
void cee::ug::DataNodeSet::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.
bool cee::ug::DataNodeSet::isEqual | ( | const DataNodeSet & | other | ) | 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.
DataNodeSetItem cee::ug::DataNodeSet::item | ( | size_t | index | ) | const |
Returns the item at the given index.
size_t cee::ug::DataNodeSet::itemCount | ( | ) | const |
Returns the number of DataNodeSetItem's in the set.
size_t cee::ug::DataNodeSet::itemIndex | ( | const DataNodeSetItem & | item | ) | const |
Returns the index of the given item.
void cee::ug::DataNodeSet::removeAllItems | ( | ) |
Removes all items from the set.
void cee::ug::DataNodeSet::removeItem | ( | const DataNodeSetItem & | item | ) |
Removes the given item from the set.
void cee::ug::DataNodeSet::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.
void cee::ug::DataNodeSet::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.