2.2.4.38.64 Project::SetDatasetMasks

Description

Set dataset mask info

Syntax

int SetDatasetMasks( LPCTSTR lpcszDatasetName, const vector<uint> & vnMaskIndices = NULL, const vector<int> & vnMaskValues = NULL )

Parameters

lpcszDatasetName
[input]name of the Dataset object
vnMaskIndices
[input] array of indices where masks should be set. If NULL, remove all masks from dataset
vnMaskValues
[input] array of mask values at corresponding indices as vnMaskIndices, if NULL, set all in vnMaskIndices to 0

Return

-2 if dataset not found, -3 if both vectors given but not the same size, -4 if vnMaskIndices = NULL but vnMaskValues not, otherwise return number of masked values, which could be smaller then the input vector size if not all given indices are in the range

Examples

EX1

// set all cells that are smaller then zero to be masked
void Project_SetDatasetMasks_ex1(int nCol = 0)
{
   Worksheet wks = Project.ActiveLayer();
   Column cc = wks.Columns(nCol);
   
   string str = cc.GetDatasetName();
   
   Dataset aa(wks, nCol);
   vector<uint> vnInd;
   for(int ii = 0; ii < aa.GetSize(); ii++)
   {
       if(aa[ii] < 0)
           vnInd.Add(ii);
   }
   vector<int> vnVal;
   vnVal.SetSize(vnInd.GetSize());
   vnVal = 1; // set all mask to 1
   int nn = Project.SetDatasetMasks(str, vnInd, vnVal);
   out_int("ret = ", nn);
}

Remark

See Also

Project::GetDatasetMasks

Header to Include

origin.h