LAnnotation::GetRect (original) (raw)
Summary
Gets the current defining rectangle of the annotation object.
Syntax
#include "ltwrappr.h"
virtual L_INT LAnnotation::GetRect(pRect, pRectName=NULL)
Parameters
pANNRECT pRect
Pointer to an ANNRECT structure to be updated with the annotation object's current rectangle. Pass NULL if you do not wish to retrieve this information.
pANNRECT pRectName
Address of a variable to be updated with the bounding rectangle of the name of the annotation object. Pass NULL if you do not wish to retrieve this information.
Returns
Value | Meaning |
---|---|
SUCCESS | The function was successful. |
< 1 | An error occurred. Refer to Return Codes. |
Comments
Every object has a defining rectangle, which intersects the object's outermost points.
The defining rectangle, which is used to size and position objects, is different from the bounding rectangle as follows:
The defining rectangle intersects the outermost points that define the object. If a line is more than one pixel wide, its defining points are in the middle of the line.
The bounding rectangle accounts for line width and is used as the rectangle to be invalidated when displaying an object. If the line width is an even number, the bounding rectangle is enlarged slightly to allow for variations in how the center of the line is defined on different systems. Refer to the LAnnotation::GetBoundingRect function.
Half the width of an object's outer line is outside its defining rectangle.
If the annotation object name is being displayed (see LAnnotation::SetNameOptions and LAnnotation::GetNameOptions for more information on annotation objects names), it can appear far away from the annotation object itself. For this reason, a separate defining rectangle for the annotation object name can be obtained by passing the address of a variable of the type RECT for the argument pRectName.
Required DLLs and Libraries
- LTANN
- For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application.
Platforms
Win32, x64.
See Also
Functions
Topics
- Annotation Functions: Getting and Setting Geometric Properties
- Annotation Functions: Using Window Coordinates to Define an Object
- Displaying and Manipulating Annotation Objects
Example
L_INT LAnnotation_GetRectExample(LAnnotation & Annotation)
{
L_INT nRet;
ANNRECT rcAnnObjectBounds;
ANNRECT rcAnnNameBounds;
L_TCHAR szMessage[256];
nRet = Annotation.GetRect(&rcAnnObjectBounds, &rcAnnNameBounds);
if(nRet != SUCCESS)
return nRet;
wsprintf(szMessage, TEXT("Object Bounds: %lf, %lf, %lf, %lf\n")
TEXT("Name Bounds: %lf, %lf, %lf, %lf"),
rcAnnObjectBounds.left,
rcAnnObjectBounds.top,
rcAnnObjectBounds.right,
rcAnnObjectBounds.bottom,
rcAnnNameBounds.left,
rcAnnNameBounds.top,
rcAnnNameBounds.right,
rcAnnNameBounds.bottom);
MessageBox(NULL, szMessage, TEXT("Testing"), MB_OK);
return SUCCESS;
}
LEADTOOLS Raster Imaging C++ Class Library Help