2.2.4.8.12 DataPlot::GetDataRegions


Description

Get data regions that are inside the enclosed graphic object

Syntax

int GetDataRegions( OriginObject & obj, vector<int> & vBegin, vector<int> & vEnd, vector<int> * pIndeces = NULL, DWORD dwCtrl = 0 )

Parameters

obj
[input] a graphic object like a Rect or a polygone
vBegin
[output] indexes of regions first points
vEnd
[output] indexes of regions last points
pIndeces
[output] indexes of the found points
dwCtrl
[input] use GDPS_CHECK_EDGE to include points on object's boundary

Return

number of regions found or < 0 for error codes

Examples

EX1

// For this example to run, a graph window must exist in the project.
// Also, the active layer in the Graph should have a graphic object (such as rectangle) with
// the name "Rect" which covers some points
void    DataPlot_GetDataRegions_ex1()
{
    // Create and attach a graph layer from current Graph:
    GraphLayer        gl = Project.ActiveLayer();
    

    DataPlot dp = gl.DataPlots(0); //get the first dataplot on graphlayer
    if ( dp )
    {
        GraphObject grobj = gl.GraphObjects("Rect");
        vector<int> vBegin;
        vector<int> vEnd;
        dp.GetDataRegions(grobj, vBegin, vEnd);
        
        for(int nn = 0; nn < vBegin.GetSize(); nn++)
        {
            printf("begin: %d, end: %d \n", vBegin[nn], vEnd[nn]);
        }
    }
 
}

Remark

See Also

DataPlot::GetDataPoints

Header to Included

origin.h