2.2.4.9.13 DataRange::GetIndices

Description

Find data points inside polygon enclosed by vX, vY, only supported by single XYRange.

Syntax

int GetIndices( vector<int> & vIndicies, const vector & vX, const vector & vY )

Parameters

vIndicies
[output]
vX
[input] polygon to find points inside
vY
[input] polygon to find points inside

Return

Return the size of vIndices.

Examples

//Find data polygon enclosed by vX and vY.
void DataRange_GetIndices_Ex1()
{
	//assume the active workbooka sheet and has least two columns before run this code.
	Worksheet wks = Project.ActiveLayer();
	if ( !wks )
	{
		printf("Can not find any active worksheet!");
		return;
	}
	DataRange dr;
	dr.Create();//init the object
	dr.Add("X", wks, 0, 0, -1, 0);
	dr.Add("Y", wks, 0, 1, -1, 1);
	
	vector vX, vY;
	vX.Uniform(20, 1);//generate random data
	vY.Uniform(20, 4);
	
	vector<int> vIndices;
	dr.GetIndices(vIndices, vX, vY);
	return;
}

Remark

See Also

Header to Include

origin.h