Leaper Vision Toolkit
中文 / English 2.x
Public Member Functions | Properties
ILRect Interface Reference

This interface represents a rotatable rectangle(LRect object) More...

Inheritance diagram for ILRect:
ILGeomObject ILObject LRect

Public Member Functions

ILRectAdjust (double dtop, double dbottom, double dleft, double dright)
 
void Draw (BOOL bFill, HDC hdc, double zoomX, double zoomY, double panX, double panY)
 
void FromRectRegion (ILRectRegion *val)
 
void FromRotRectRegion (ILRotRectRegion *val)
 
double GetArea ()
 
ILLineGetBottom ()
 
ILPointGetBottomLeft ()
 
ILPointGetBottomRight ()
 
ILRectGetBoundingRect ()
 
ILPointGetCenter ()
 
ILLineGetLeft ()
 
double GetPerimeter ()
 
ILPointsGetPoints ()
 
ILLineGetRight ()
 
ILLineGetTop ()
 
ILPointGetTopLeft ()
 
ILPointGetTopRight ()
 
LPVPointTestResult PointTest (ILPoint *point)
 
ILPolygonResample (int num)
 
ILPolygonResampleByStep (double step, double stepThreshold)
 
void Set (double x, double y, double w, double h, double a)
 
ILRectRegionToRectRegion ()
 
ILRotRectRegionToRotRectRegion ()
 
ILRectTransform (ILTransform *tf)
 
ILRectTranslate (double offsetX, double offsetY)
 
- Public Member Functions inherited from ILGeomObject
void Drag (LPVGeomHandle geomHandle, int posX, int posY, double zoomX, double zoomY, double panX, double panY)
 
void EnableHandle (LPVGeomHandle geomHandle, BOOL enabled)
 
LPVGeomHandle HitTest (int posX, int posY, double zoomX, double zoomY, double panX, double panY)
 
void ScaleTo (double factorX, double factorY)
 
void TransformTo (ILTransform *tf)
 
void TranslateTo (double offsetX, double offsetY)
 
- Public Member Functions inherited from ILObject
ILObjectCopy ()
 
LPVErrorCode Load (LString filename)
 
void Reset ()
 
LPVErrorCode Save (LString filename)
 
BOOL Valid ()
 

Properties

double Angle [get, set]
 The angle of the rectangle, if this is a rotated rectangle.
 
double Height [get, set]
 The height of the rectangle.
 
double Width [get, set]
 The width of the rectangle.
 
double X [get, set]
 The x-coordinate of the rectangle's center.
 
double Y [get, set]
 The y-coordinate of the rectangle's center.
 
- Properties inherited from ILObject
LString Name [get, set]
 Name of the object. By default, the object has no name.
In most cases, LPV classes don't make use of the names.
The name is drawn on canvas around the object if ILDrawable::SetDrawName() is enabled. More...
 

Detailed Description

This interface represents a rotatable rectangle(LRect object)

Member Function Documentation

◆ Adjust()

ILRect* Adjust ( double  dtop,
double  dbottom,
double  dleft,
double  dright 
)

Adds dtop, dbottom, dleft and dright respectively to the existing coordinates of the rectangle and return a new rectangle

Parameters
[in]dtopThe top border adjustment
[in]dbottomThe bottom border adjustment
[in]dleftThe left border adjustment
[in]drightThe right border adjustment
Return values
resultReturn the new rectangle

◆ Draw()

void Draw ( BOOL  bFill,
HDC  hdc,
double  zoomX,
double  zoomY,
double  panX,
double  panY 
)

Draw the rectangle on HDC.

Parameters
[in]bFillWhether to fill the circle using current brush.
See also
Use Draw Functions
Remarks
This function is currently not available on Linux / MacOS platform.

◆ FromRectRegion()

void FromRectRegion ( ILRectRegion val)

Set placement of the rectangle from the input rectangle region, the angle is fixed to 0.

◆ FromRotRectRegion()

void FromRotRectRegion ( ILRotRectRegion val)

Set placement of the rectangle from the input rotated rectangle region.

◆ GetArea()

double GetArea ( )

Get the area of the rectangle

Return values
valReturn the area value

◆ GetBottom()

ILLine* GetBottom ( )

Get the button segment line of the rectangle from the bottom-left to the bottom-right corner

◆ GetBottomLeft()

ILPoint* GetBottomLeft ( )

Get the bottom-left corner point of the rectangle

◆ GetBottomRight()

ILPoint* GetBottomRight ( )

Get the bottom-right corner point of the rectangle

◆ GetBoundingRect()

ILRect* GetBoundingRect ( )

Get the bounding rectangle of the rectangle. For not-rotated rectangle, the bounding rectangle should be exactly the same as itself.

◆ GetCenter()

ILPoint* GetCenter ( )

Get the center point of the rectangle

◆ GetLeft()

ILLine* GetLeft ( )

Get the left segment line of the rectangle from the top-left to the bottom-left corner

◆ GetPerimeter()

double GetPerimeter ( )

Get the perimeter of the rectangle

Return values
valReturn the perimeter value

◆ GetPoints()

ILPoints* GetPoints ( )

Get all corner points of the rectangle for further calculation, like generate bounding shape, fitting. It's in the following order: bottom-left, top-left, top-right, bottom-right.

Return values
valReturn the collection of points.

◆ GetRight()

ILLine* GetRight ( )

Get the right segment line of the rectangle from the top-right to bottom-right corner

◆ GetTop()

ILLine* GetTop ( )

Get the top segment line of the rectangle from the top-left to the top-right corner

◆ GetTopLeft()

ILPoint* GetTopLeft ( )

Get the top-left corner point of the rectangle

◆ GetTopRight()

ILPoint* GetTopRight ( )

Get the top-right corner point of the rectangle

◆ PointTest()

LPVPointTestResult PointTest ( ILPoint point)

Determines whether the point is inside this rectangle, outside, or lies on the edge.

Parameters
[in]pointThe input point
Return values
valReturn the test result

◆ Resample()

ILPolygon* Resample ( int  num)

Resample the rectangle object into a closed polygon of the specified vertex count. The 4 corner points are always kept in the resampled result.

Parameters
[in]numThe count of the resampled vertexes. Should be an even number, and at least 4.
Return values
resultReturn the resampling result polygon
See also
ResampleByStep()

◆ ResampleByStep()

ILPolygon* ResampleByStep ( double  step,
double  stepThreshold 
)

Resample the rectangle object into a closed polygon, based on the given fixed interval step. The 4 corner points are always kept in the resampled result.

Parameters
[in]stepThe interval step.
[in]stepThresholdThe last resampling vertex of a segment should be omitted if the remaining length to the rectangle corner is smaller than the threshold. By default, it's 0 means \( Step / 4 \).
Return values
resultReturn the resampling result polygon
See also
Resample()

◆ Set()

void Set ( double  x,
double  y,
double  w,
double  h,
double  a 
)

Set placement of the rectangle

Parameters
[in]xThe x-coordinate of the rectangle's center
[in]yThe x-coordinate of the rectangle's center
[in]wThe width of the rectangle
[in]hThe height of the rectangle
[in]aThe angle of the rectangle, by default, it's 0 means a non-rotated rectangle.

◆ ToRectRegion()

ILRectRegion* ToRectRegion ( )

Generate a rectangle region use the rectangle object

Return values
valReturn the rectangle region

◆ ToRotRectRegion()

ILRotRectRegion* ToRotRectRegion ( )

Generate a rotated rectangle region use the rectangle object

Return values
Returnthe rotated rectangle region

◆ Transform()

ILRect* Transform ( ILTransform tf)

Transform the rectangle via the given transformation and return a new rectangle. Note that for an affine or perspective transformation, the result rectangle is the bounding rotated rectangle of the mapping result points of the rectangle's corners. For the transformation result of a rectangle can be any quadrangle.

Parameters
[in]tfThe transformation.
Return values
Returnthe new rectangle

◆ Translate()

ILRect* Translate ( double  offsetX,
double  offsetY 
)

Translate the rectangle by the given offset and return a new rectangle

Parameters
[in]offsetXThe x-coordinate of the offset
[in]offsetYThe y-coordinate of the offset
Return values
resultReturn the new rectangle