2.2.4.11.12 DatasetObject::SetMask

Description

Set the mask of the DatasetObject.

Syntax

int SetMask(vector<byte>& vMask, bool bReplace = false, bool bUndo = false, int r1 = 0, int r2 = -1)
int SetMask(int nBegin, int nEnd, bool bReplace = false, bool bUndo = false)

Parameters

vMask
[input] the vector containing the mask to apply
bReplace
[input] if true then replace any existing masks else apply to existing mask with arithmetic OR
bUndo
[input] if true then support undo set mask
r1
[input] the begin index of vMask to be masked, 0 means the first element.
r2
[input] the end index of vMask to be masked, -1 means the last element.


nBegin
[input] the first point to be masked
nEnd
[input] the last point to be masked
bReplace
[input] if true then replace any existing masks else apply to existing mask with arithmetic OR
bUndo
[input] if true then support undo set mask

Return

Returns a value less than 0 for error, 0 if no masked points, otherwise the size of the mask.

Examples

EX1

void DatasetObject_SetMask_Ex1()
{
    Worksheet wks = Project.ActiveLayer();

    Column colA = wks.Columns(0);
    DatasetObject doA(colA);

    vector<byte> vMask;
    int nMaskSize = doA.GetMask(vMask);
    if( 0 == nMaskSize )
        out_str("Column does not have any masked points."); 
    else if( 0 < nMaskSize )
    {
        printf("Column's mask size is %d.", nMaskSize);

        Column colB = wks.Columns(1);
        DatasetObject doB(colB);
        doB.SetMask(vMask);
    }
    else // nMaskSize < 0
        out_str("Failed to get column mask.");
}

Remark

See Also

DatasetObject::GetMask

Header to Include

origin.h