#include <c4d_baseselect.h>
Protected Member Functions | |
Bool | FindNum (Int32 num, Int32 *last, Bool protect=true) const |
Bool | FlushData (Int32 num) |
Bool | InsertData (Int32 num, Int32 a, Int32 b) |
void | Write_API (HyperFile *hf) |
Bool | Read_API (HyperFile *hf) |
Protected Attributes | |
BaseSelectData * | data |
Int32 | cnt |
Int32 | lseg |
Int32 | dirtycnt |
Int32 | lelement |
Friends | |
class | ItemListDataTypeClass |
Constructor/Destructor | |
BaseSelect () | |
virtual | ~BaseSelect () |
Alloc/Free | |
static BaseSelect * | Alloc () |
static void | Free (BaseSelect *&bs) |
Selection/Segment Count | |
Int32 | GetCount () |
Int32 | GetSegments () |
Select/Deselect/Toggle | |
Bool | Select (Int32 num) |
Bool | SelectAll (Int32 min, Int32 max) |
Bool | Deselect (Int32 num) |
Bool | DeselectAll () |
Bool | Toggle (Int32 num) |
Bool | ToggleAll (Int32 min, Int32 max) |
Bool | IsAllSelected (Int32 num) const |
Bool | GetRange (Int32 seg, Int32 *a, Int32 *b) const |
Bool | IsSelected (Int32 num) const |
Bool | FindSegment (Int32 id, Int32 *segment) |
Copy/Merge/Cross | |
Bool | CopyTo (BaseSelect *dest) const |
Bool | Merge (BaseSelect *src) |
Bool | Deselect (BaseSelect *src) |
Bool | Cross (const BaseSelect *src) |
BaseSelect * | GetClone () const |
Bool | IsEqual (const BaseSelect &compare) const |
Conversion from/to Array | |
Bool | FromArray (UChar *selection, Int32 count) |
UChar * | ToArray (Int32 count) |
Private | |
Int32 * | GetData () |
Bool | CopyFrom (BaseSelectData *ndata, Int32 ncnt) |
virtual Bool | Write (HyperFile *hf) |
virtual Bool | Read (HyperFile *hf, Int32 id, Int32 level) |
Used to keep track of point and polygon selections, it may also be used to track other types of element selections.
BaseSelect | ( | ) |
Default constructor.
|
virtual |
Default destructor.
|
protected |
|
static |
Allocates a base selection. Destroy the allocated base selection with Free().
|
static |
Destructs base selections allocated with Alloc().
[in,out] | bs | The base selection to destruct. If the pointer is nullptr nothing happens. The pointer is assigned nullptr afterwards. |
Int32 GetCount | ( | ) |
Gets the number of selected elements.
Int32 GetSegments | ( | ) |
Gets the number of segments that contain elements.
For example: The selections 0..4, 6..7, 9..12 would be three segments. GetSegments() would return 3 and GetCount() would return 11.
Selects an element.
[in] | num | The element index to select. |
Selects all elements in the given range.
[in] | min | The first element to select. |
[in] | max | The last element in the range to select. |
Deselects an element.
[in] | num | The element index to deselect. |
Bool DeselectAll | ( | ) |
Deselect all elements.
Toggles the selection state of an element.
[in] | num | The element index to toggle. |
Toggles the selection state of all elements in the given range.
[in] | min | The first element to toggle. |
[in] | max | The last element to toggle in the range. |
Checks if all elements from 0 to num-1 are selected.
[in] | num | The last element to check. |
Gets the selected elements contained in a segment.
[in] | seg | The segment to get the elements for. 0 <= seg < GetSegments() |
[out] | a | Assigned the index of the first selected element. |
[out] | b | Assigned the index of the last selected element. |
Check the selection state of an element.
To efficiently go through selections use the following code:
This is faster than:
[in] | num | The element index to get the state for. |
Calculates which segment contain the element id and assign it to segment.
[in] | id | An element number. |
[in] | segment | Assigned the found segment index. |
Bool CopyTo | ( | BaseSelect * | dest | ) | const |
Copies the selection elements to another BaseSelect.
[out] | dest | The destination selection. |
Bool Merge | ( | BaseSelect * | src | ) |
Selects all elements that are selected in src.
[in] | src | The source selection. |
Bool Deselect | ( | BaseSelect * | src | ) |
Deselects all elements that are selected in src.
[in] | src | The source selection. |
Bool Cross | ( | const BaseSelect * | src | ) |
Intersects all elements in src.
[in] | src | The source selection. |
BaseSelect* GetClone | ( | ) | const |
Makes a duplicate of the selection with its elements.
Bool IsEqual | ( | const BaseSelect & | compare | ) | const |
Compares the selection with another selection.
[in] | compare | The selection to compare with. |
Gets a number of selected elements from an array. The elements in the array are interpreted as Bool: 0 means the element is unselected, and 1 means it is selected.
[in] | selection | An array of elements to select. The caller owns the pointed array. |
[in] | count | The number of elements in the array. |
Gets an array of selected elements. The elements in the array are interpreted as Bool: 0 means the element is unselected, and 1 means it is selected.
The array is created with NewMemClear() and must be freed with DeleteMem() afterward.
[in] | count | The number of elements to place into the array. |
Int32* GetData | ( | ) |
Private.
Bool CopyFrom | ( | BaseSelectData * | ndata, |
Int32 | ncnt | ||
) |
Private.
|
friend |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |