Determines whether the specified object is within the specified rectangle.
#include "ltwrappr.h"
L_INT LVectorObject::IsObjectInsideRect(pRect, bInside)
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 is within the specified parallelogram. |
FALSE | The specified object is not within the specified parallelogram. |
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 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;
}