Determines whether the specified object(s) is (are) within the specified rectangle.
#include "ltwrappr.h"
virtual L_INT LVectorBase::IsObjectInsideRect(pRect, bInside, dwFlags=0)
Pointer to a RECT structure that contains information about a bounding rectangle.
Pointer to a variable to be updated with a value that indicates whether the object is inside the specified parallelogram. Possible values are:
Value | Meaning |
---|---|
TRUE | The specified object(s) is(are) within the specified parallelogram. |
FALSE | The specified object(s) is(are) not within the specified parallelogram. |
Flag that indicates which object(s) to test. This flag is valid only if pObject is NULL. If pObject is not NULL, this parameter is ignored. Possible values are:
Value | Meaning |
---|---|
0 | Test all objects in the vector handle to determine whether they are in the specified rectangle. |
VECTOR_FLAGS_SELECTED_ONLY | Test only the selected objects within the vector handle. |
Value | Meaning |
---|---|
SUCCESS | The function was successful. |
< 1 | An error occurred. Refer to Return Codes. |
The rectangle is given in screen (physical) coordinates.
The current view port, pan position, camera, scale, translation and rotation values are all considered when determining whether the object is within the rectangle.
This example displays tests if all vector objects are inside a rectangle.
L_INT LVectorBase__IsObjectInsideRectExample(HWND hWnd, LVectorBase *pVector)
{
UNREFERENCED_PARAMETER(pVector);
L_INT nRet;
LVectorBase Vector;
RECT rcBounds;
L_BOOL bInside;
nRet = Vector.Load(MAKE_IMAGE_PATH(TEXT("random.dxf")));
if(nRet != SUCCESS)
return nRet;
//Define a rectangle
rcBounds.left =0;
rcBounds.top =0;
rcBounds.right =50;
rcBounds.bottom =50;
nRet = Vector.IsObjectInsideRect(&rcBounds, &bInside);
if(nRet != SUCCESS)
return nRet;
if (bInside)
MessageBox(hWnd, TEXT("IsObjectInsideRect() returns TRUE"), TEXT(""), MB_OK);
else
MessageBox(hWnd, TEXT("IsObjectInsideRect() returns FALSE"), TEXT(""), MB_OK);
return SUCCESS;
}