MatrixObject::GetXY

Description

Get matrix object xy mapping coordinates

Syntax

BOOL GetXY( double & dXMin, double & dYMin, double & dXMax, double & dYMax )
BOOL GetXY( vector &vXScale, vector& vYScale = NULL )

Parameters

dXMin
[input] map 1st column (0) of matrix to this X value
dYMin
[input] map 1st row (0) of matrix to this Y value
dXMax
[input] map last column (nCols-1) of matrix to this X value
dYMax
[input] map last row (nRows-1) of matrix to this Y value

vXScale
[input] matrix x mapping scales
vYScale
[input] matrix y mapping scales

Return

TRUE if success, otherwise FALSE.

Examples

EX1

// Matrix must be active window
void MatrixObject_GetXY_Ex1()
{
    MatrixLayer ml = Project.ActiveLayer();
    if( ml )
    {
        MatrixObject mo = ml.MatrixObjects(0);
        double x1, x2, y1, y2;
        mo.GetXY(x1, y1, x2, y2);
        printf("Matrix XY map: x = (%g, %g), y = (%g, %g)\n", x1,x2, y1, y2);
    }
    else
        printf("No active matrix\n");
}

EX2

// Matrix window should be the active window
// SYNTAX : Matrix_Object_GetXY_Ex2() or (200) or (200, 0) or (200, 0, 1) for example
void MatrixObject_GetXY_Ex12(int nRows = 100, int nRestore = 1, int nFillData = 0)
{
    MatrixLayer ml = Project.ActiveLayer(); // Get Active Window/Layer
    if( ml )
    {
       MatrixObject mo = ml.MatrixObjects(0); // Get MatrixObject from layer
       DWORD dw = 0;
       if(nRestore)
           dw |= OCD_RESTORE;
       if(nFillData)
           dw |= OCD_INITDATA;
       mo.SetSize(nRows, 20, dw);
       printf("matrix has %d rows and %d columns\n", mo.GetNumRows(), mo.GetNumCols());
       double x1, x2, y1, y2;
       mo.GetXY(x1, y1, x2, y2);
       printf("matrix XY: x = (%g, %g), y = (%g, %g)\n", x1,x2, y1, y2);
    }
    else
        printf("No active matrix\n");
}

EX3

// Matrix must be active window
// SYNTAX : MatrixObject_GetXY_Ex3(50) for example
void MatrixObject_GetXY_Ex3(int nr)
{
    MatrixLayer ml = Project.ActiveLayer();
    if( ml )
    {
        MatrixObject mo = ml.MatrixObjects(0);
        mo.SetNumRows(nr);
        printf("matrix has %d rows and %d columns\n", mo.GetNumRows(), mo.GetNumCols());
        double x1, x2, y1, y2;
        mo.GetXY(x1, y1, x2, y2);
        printf("matrix XY: x = (%g, %g), y = (%g, %g)\n", x1,x2, y1, y2);
    }
    else
        printf("No active matrix\n");
}

Remark

Get matrix object xy mapping coordinates. All matrices have linearly mapped values for columns and rows.

See Also

MatrixObject::SetXY, Matrix::GetXMax, Matrix::GetYMin, Matrix::GetYMax, Matrix::SetXMin, Matrix::SetYMin, Matrix::SetXMax, Matrix::SetYMax

Header to Include

origin.h