Layer position coordinates convert
BOOL UnitsConvert( int nUnitsTo, double * pVals, int nUnitsFrom = -1 )
return true for success
EX1
//Output layer position after coverting the layer position coordinates to other units. void Layer_UnitsConvert_ex1() { double xx[4]; GraphLayer gl = Project.ActiveLayer(); int nCurrent = gl.GetPosition(xx); int nLast; printf("Current Settings\n%d:LeftTop=%4.2f,%4.2f\tW,H=%4.2f,%4.2f\n", nCurrent, xx[2], xx[3], xx[0], xx[1]); // do convertion with a diff value then actual xx[0] /=2; // width to be half xx[2] += 1; // left to be moved a little printf("Modified Settings\n%d:LeftTop=%4.2f,%4.2f\tW,H=%4.2f,%4.2f\n", nCurrent, xx[2], xx[3], xx[0], xx[1]); out_str("Results of converting to other units"); nLast = nCurrent; for(int ii = M_PERCENT; ii <= M_LINK; ii++) { gl.UnitsConvert(ii, xx, nLast); printf("From %d to %d, new LeftTop=%4.2f,%4.2f\tW,H=%4.2f,%4.2f\n", nLast, ii, xx[2], xx[3], xx[0], xx[1]); nLast = ii; } //check and make sure the codes above didnt change the layer itself nCurrent = gl.GetPosition(xx); printf("after %d: LeftTop=%4.2f,%4.2f\tW,H=%4.2f,%4.2f\n", nCurrent, xx[2], xx[3], xx[0], xx[1]); }
Layer::SetPosition, Layer::GetPosition
origin.h