/*---------------------------------------------------------------------- GeometryCreate draws a box at a specific origin location (x, y) in frame and of the initial size (width, height) when interracting with the user to mofify a box size (button press). xmin, xmax, ymin, ymax are the maximum values allowed. PosX, PosY, DimX, DimY will be different to zero if these positions or dimensions are user specified. Parameters percentW and percentH will be equal to zero if width and height are independent or will get the percent report (percentH = 100 if height is equal to width). This function returns new values: - x, y the position of the origin. - width, height the dimension of the box. ----------------------------------------------------------------------*/ void GeometryCreate (int frame, int *x, int *y, int *width, int *height, int xmin, int xmax, int ymin, int ymax, PtrBox box, int PosX, int PosY, int DimX, int DimY, int percentW, int percentH) { ThotWindow w; PtrAbstractBox pAb; int xm, ym; int dx, dy; int ret; int xref, yref; ThotBool isEllipse; pAb = box->BxAbstractBox; if (pAb && pAb->AbLeafType == LtCompound) pAb = pAb->AbFirstEnclosed; isEllipse = (pAb && pAb->AbLeafType == LtGraphics && (pAb->AbShape == 'a' || pAb->AbShape == 'c')); /* use relative coordinates */ xm = ym = 0; /* default position */ if (*x < xmin) *x = xmin; else if (*x > xmax) *x = xmax; if (*y < ymin) *y = ymin; else if (*y > ymax) *y = ymin; /* the grid origin is base on the englobing box origin */ dx = DO_ALIGN (*x - xmin); *x = xmin + dx; dy = DO_ALIGN (*y - ymin); *y = ymin + dy; *width = 1; *height = 1; /* draw the current box geometry */ switch (box->BxHorizEdge) { case Right: xref = *width; break; case VertMiddle: xref = *width / 2; break; case VertRef: xref = box->BxVertRef; *width = xref; break; default: xref = 0; break; } switch (box->BxVertEdge) { case Bottom: yref = *height; break; case HorizMiddle: yref = *height / 2; break; case HorizRef: yref = box->BxHorizRef; *height = yref; break; default: yref = 0; break; } /* change the cursor, modify library state */ w = (ThotWindow)FrameTable[frame].WdFrame; if (isEllipse) InvertEllipse (frame, *x, *y, *width, *height, *x + xref, *y + yref); else BoxGeometry (frame, *x, *y, *width, *height, *x + xref, *y + yref); /* Loop on user input to keep the first point */ ret = 0; /* switch off the old box geometry */ if (isEllipse) InvertEllipse (frame, *x, *y, *width, *height, *x + xref, *y + yref); else BoxGeometry (frame, *x, *y, *width, *height, *x + xref, *y + yref); Resizing (frame, *x, *y, width, height, box, xmin, xmax, ymin, ymax, xm, ym, percentW, percentH); }
BoxGeometry^ BoxGeometry::ToManaged(PxBoxGeometry box) { return gcnew BoxGeometry(box.halfExtents.x, box.halfExtents.y, box.halfExtents.z); }