LVectorBase::IsObjectInsideRect

#include "ltwrappr.h"

virtual L_INT LVectorBase::IsObjectInsideRect(pRect, bInside, dwFlags=0)

const RECT *pRect;

/* pointer to a RECT structure */

L_BOOL *bInside;

/* pointer to a variable */

L_UINT32 dwFlags;

/* flags */

Determines whether the specified object(s) is (are) within the specified rectangle.

Parameter

Description

pRect

Pointer to a RECT structure that contains information about a bounding rectangle.

bInside

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.

 

dwFlags

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.

Returns

SUCCESS

The function was successful.

< 1

An error occurred. Refer to Return Codes.

Comments

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.

Required DLLs and Libraries

LVKRN

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application.

See Also

Functions:

LVectorBase::IsObjectInsideParallelogram, LVectorBase::GetObjectParallelogram, LVectorBase::GetObjectRect, LVectorObject::IsObjectInsideRect

Topics:

Manipulating Objects or Vertices within a Vector Image

 

Vector Images: Obtaining Object Information

Example

This example displays tests if all vector objects are inside a rectangle.

#define MAKE_IMAGE_PATH(pFileName) TEXT("C:\\Users\\Public\\Documents\\LEADTOOLS Images\\")pFileName
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;
}