2.2.4.24.35 Layer::WorldToView


Description

Convert world to logical coordinates.

Syntax

BOOL WorldToView( const double * pWorld, double * pView, int nCount, int nDim = 0 )

Parameters

pWorld
[input] pointer to world coordinates buffer
pView
[output] pointer to view coordinates buffer
nCount
[input] the number of values in the buffer
nDim
[input] optional dimension specifier. 0=all dimensions, 1=only 1st, 2=only 2nd dimension, etc.

Return

0 if success.

Examples

EX1

void WorldToView_ex1()
{
    GraphLayer gl = Project.ActiveLayer();
    if( gl )
      {
          double world[2];
          double view[2];
          world[0] = 3.123456789012345;
          world[1] = 7.123456789012345;
          int nError = gl.WorldToView(world, view, 2);
          nError = gl.ViewToWorld(view, world, 2);
    }
}

void WorldToView_ex2(int nDim=1)
{
    GraphLayer gl = Project.ActiveLayer();
    if( gl )
      {
          double dw = 3.123456789012345;
          double dv;
          double dd;
          int nError = gl.WorldToView(&dw, &dv, 1, nDim);
          nError = gl.ViewToWorld(&dv, &dd, 1, nDim);
          double diff = dd - dw;
    }
}

Remark

See Also

Layer::ViewToWorld

Header to Included

origin.h