#include <point-ref.h>
PointRef is basically a pair of things: (1) a pointer to a PointSetList, and (2) an index (or set of indices) into that PointSetList that references one particular Feature. Since there are two ways to reference a particular Feature in a PointSetList (either by specifying which PointSet it's in followed by the index of that point within that PointSet, or just by specifying a single index as if you were ignoring PointSet boundaries), PointRef will transparently convert between these two methods of describing a Feature, making it easy to use PointSetLists for different applications.
Note that PointRefs become invalid if the PointSetList is modified. PointRef by itself does not perform any consistency checking.
Public Member Functions | |
PointRef (const PointSetList *data, int feature_index) | |
Refer to a point initially by specifying a single index. | |
PointRef (const PointSetList *data, int which_point_set, int which_point) | |
Refer to a point initially by specifying which PointSet and index. | |
PointRef (const PointSetList *data, int feature_index, int which_point_set, int which_point) | |
Refer to a point by providing both methods of accessing a Feature. | |
const Feature & | GetFeature () const |
Get the Feature referred to by this PointRef. | |
int | GetWhichPointSet () const |
Find the index of the PointSet that this point is in. | |
int | GetWhichPoint () const |
Find the index of the point within the PointSet that it's in. | |
int | GetFeatureIndex () const |
Get the index of the point in the list of all Features in this PointSetList. |
PointRef | ( | const PointSetList * | data, | |
int | feature_index | |||
) |
Refer to a point initially by specifying a single index.
PointRef | ( | const PointSetList * | data, | |
int | which_point_set, | |||
int | which_point | |||
) |
Refer to a point initially by specifying which PointSet and index.
PointRef | ( | const PointSetList * | data, | |
int | feature_index, | |||
int | which_point_set, | |||
int | which_point | |||
) |
Refer to a point by providing both methods of accessing a Feature.
This constructor does not do any consistency checking i.e., to check whether feature_index refers to the same point as (which_point_set, which_point). You should only use this constructor if you know for sure; the reason for this constructor is to quickly build a PointRef if you already know all the indices.
int GetWhichPointSet | ( | ) | const |
Find the index of the PointSet that this point is in.
This will usually be used in conjunction with GetWhichPoint().
int GetWhichPoint | ( | ) | const |
Find the index of the point within the PointSet that it's in.
This will usually be used in conjunction with GetWhichPointSet().
int GetFeatureIndex | ( | ) | const |
Get the index of the point in the list of all Features in this PointSetList.