LVectorObject::IsObjectInsideRect

#include "ltwrappr.h"

L_INT LVectorObject::IsObjectInsideRect(pRect, bInside)

Determines whether the specified object is within the specified rectangle.

Parameters

const RECT *pRect

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

L_BOOL *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

Value Meaning
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

See Also

Functions

Topics

Example

This example selects all vertices inside a given rectangle.

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; 
} 

Help Version 20.0.2020.4.2
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2020 LEAD Technologies, Inc. All Rights Reserved.

LEADTOOLS Vector C++ Class Library Help