L_VecIsObjectInsideRect

#include "lvkrn.h"

L_BOOL EXT_FUNCTION L_VecIsObjectInsideRect(pVector, pObject, pRect, dwFlags)

const pVECTORHANDLE pVector;

/* pointer to a vector handle */

const pVECTOROBJECT pObject;

/* pointer to a vector object */

const RECT L_FAR * pRect;

/* pointer to a RECT structure */

L_UINT32 dwFlags;

/* flags */

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

Parameter

Description

pVector

Pointer to a vector handle.

pObject

Pointer to a VECTOROBJECT structure that contains information about a specific object. If this parameter is NULL, the object(s) to test is(are) determined by dwFlags.

pRect

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

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 parallelogram.

 

VECTOR_FLAGS_SELECTED_ONLY

Test only the selected objects within the vector handle.

Returns

TRUE

The specified object(s) is(are) within the specified rectangle.

FALSE

The specified object(s) is(are) not within the specified rectangle or the specified object is not valid.

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:

L_VecIsObjectInsideParallelogram, L_VecGetObjectParallelogram, L_VecGetObjectRect

Example

/* This example will select all objects inside a given rectangle */

L_INT EXT_CALLBACK EnumObjectsProc( pVECTORHANDLE, pVECTOROBJECT, L_VOID * );

void SelectAllObjectsInsideRect( pVECTORHANDLE pVector, RECT L_FAR *pRect )
{
   /* Enumerate all objects in the drawing */
   L_VecEnumObjects( pVector, (pVECTORENUMOBJECTSPROC)EnumObjectsProc, pRect, 0 );
}

L_INT EXT_CALLBACK EnumObjectsProc( pVECTORHANDLE pVector, pVECTOROBJECT pObject, L_VOID L_FAR *pData )
{
   VECTOROBJECT ObjectDesc;
   RECT *pRect = (RECT *) pData;

   /* Check if object is inside the rectangle */
   if( L_VecIsObjectInsideRect( pVector, pObject, pRect, 0L ) )
   {
      L_VecGetObject( pVector, pObject, VECTOR_OBJECT, &ObjectDesc);
      ObjectDesc.dwFlags |= VECTOR_OBJECT_SELECTED;
      L_VecSetObject(pVector, pObject, VECTOR_OBJECT, &ObjectDesc);
      L_VecFreeObject(VECTOR_OBJECT, &ObjectDesc);
   }

   /* Continue the enumeration */
   return( SUCCESS );
}