LVectorObject::IsObjectInsideRect

#include "ltwrappr.h"

virtual L_INT LVectorObject::IsObjectInsideRect(pRect, bInside)

const RECT *pRect;

/* pointer to a RECT structure */

L_BOOL *bInside;

/* pointer to a variable */

Determines whether the specified object is 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 is within the specified parallelogram.

 

FALSE

The specified object is not within the specified parallelogram.

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:

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

Topics:

Manipulating Objects or Vertices within a Vector Image

 

Vector Images: Obtaining Object Information

Example

This example selects all vertices inside a given rectangle.

#define MAKE_IMAGE_PATH(pFileName) TEXT("C:\\Users\\Public\\Documents\\LEADTOOLS Images\\")pFileName
class LMyVectorBase3: public LVectorBase
{
public:
   RECT    m_Rect;
public:
   LMyVectorBase3();
   virtual ~LMyVectorBase3() ;
   virtual L_INT EnumObjectsCallBack(pVECTORHANDLE pVector, pVECTOROBJECT pObject);
};
LMyVectorBase3::LMyVectorBase3()
{
}
LMyVectorBase3::~LMyVectorBase3()
{
}
L_INT LMyVectorBase3::EnumObjectsCallBack(pVECTORHANDLE pVector, pVECTOROBJECT pObject)
{
   L_BOOL bInside;
   LVectorBase   VectorBase(pVector);
   LVectorObject VectorObject(pObject, &VectorBase);
   //Select object if inside parallelogram
   VectorObject.IsObjectInsideRect(&m_Rect,&bInside);
   if (bInside)
      VectorObject.SelectObject();
   return SUCCESS ;
}
L_INT LVectorObject__IsObjectInsideRectExample(HWND hWnd)
{
   UNREFERENCED_PARAMETER(hWnd);
   L_INT          nRet;
   LMyVectorBase3 Vector;
   nRet = Vector.Load(MAKE_IMAGE_PATH(TEXT("random.dxf")));
   if(nRet != SUCCESS)
      return nRet;
   //Define a 3D parallelogram
   Vector.m_Rect.left =0;
   Vector.m_Rect.top=0;
   Vector.m_Rect.right=50;
   Vector.m_Rect.bottom = 50;
   //Select all objects inside this rectangle
   nRet = Vector.EnumObjects();
   if(nRet != SUCCESS)
      return nRet;
   return SUCCESS;
}