CClusterElementArray Class Reference
 
 
 
CClusterElementArray Class Reference

#include <xsi_cluster.h>


Class Description

An array of cluster elements in a Cluster object.

A cluster maps the geometry component (Point, Segment, Facet, Sample point) indices to cluster element indices. The value of the element in a cluster element array is the geometry component's index.

A cluster element array is read-only.

Warning:
This specialized array is returned by Cluster::GetElements, it is not meant to be created and modified in user-defined functions. If you want to add and remove arbitrary items to a collection, you must use a CRefArray instead.
See also:
Cluster::GetElements
Example:
                using namespace XSI;
                using namespace XSI;
                Application app;
                Model root = app.GetActiveSceneRoot();

                X3DObject myGrid;
                root.AddGeometry( L"Grid", L"MeshSurface", L"", myGrid );

                CLongArray indices(9);
                indices[0] = 8; indices[1] = 16; indices[2] = 24; indices[3] = 32;
                indices[4] = 40; indices[5] = 48; indices[6] = 56; indices[7] = 64;
                indices[8] = 72;

                Cluster myCls;
                myGrid.GetActivePrimitive().GetGeometry().AddCluster(siVertexCluster, L"",
                        indices, myCls );

                CClusterElementArray elements(myCls.GetElements());

                CLongArray values(elements.GetArray());

                for (LONG i=0; i<values.GetCount(); ++i)
                {
                        app.LogMessage(L"Element " + CValue(i).GetAsText() + L"= " +
                                CValue(values[i]).GetAsText());
                }

List of all members.

Public Member Functions

  CClusterElementArray ()
  CClusterElementArray (const CClusterElementArray &in_array)
virtual  ~CClusterElementArray ()
CClusterElementArray operator= (const CClusterElementArray &in_array)
CLongArray  GetArray () const
LONG  GetCount () const
LONG  GetItem (LONG in_index) const
CLongArray  GetItemsByIndex (const CLongArray &in_indices) const
LONG  FindIndex (LONG in_element) const

Constructor & Destructor Documentation

Default constructor

Copy constructor.

Parameters:
in_array constant CClusterElementArray object.
virtual ~CClusterElementArray ( ) [virtual]

Default destructor


Member Function Documentation

CClusterElementArray& operator= ( const CClusterElementArray in_array )

Creates an array from a reference object.

Parameters:
in_array constant CClusterElementArray object.
Returns:
The new CClusterElementArray object.
CLongArray GetArray ( ) const

Returns an array of element values.

Returns:
Array of element values
LONG GetCount ( ) const

Returns the number of cluster element values

Returns:
The number of cluster element values.
LONG GetItem ( LONG  in_index ) const

Returns the cluster element value at a given index (0-based)

Parameters:
in_index Element index.
Returns:
The element value.
CLongArray GetItemsByIndex ( const CLongArray in_indices ) const

Returns cluster element values by indices.

Parameters:
in_indices Array of indices
Returns:
Array of element values
LONG FindIndex ( LONG  in_element ) const

Searches the array for a given element and returns its index

Parameters:
in_element Element index.
Returns:
The element index or -1 if the element is not found.

The documentation for this class was generated from the following file: