Modifies the point pptMove based on the angle from line (pptAnchor, pptMove) and the horizontal.
#include "ltwrappr.h"
static L_INT LAnnotation::AdjustPoint (pptAnchor, pptMove, dAngle, nType)
Pointer to an ANNPOINT structure representing the anchor point.
Pointer to an ANNPOINT structure representing the point to be adjusted.
Angle of rotation in radians. Ranges from -Pi to Pi, (-3.1415 - 3.1415) where a positive angle corresponds to clockwise rotation.
Type of adjustment to point. Possible values are:
Type | Value |
---|---|
ANNADJUST_HORIZONTAL | [1] |
ANNADJUST_VERTICAL | [2] |
ANNADJUST_45_DEGREES_FAVOR_X | [3] |
ANNADJUST_45_DEGREES_FAVOR_Y | [4] |
Value | Meaning |
---|---|
SUCCESS | The function was successful. |
< 1 | An error occurred. Refer to Return Codes. |
This utility function is used when creating custom annotation objects. It can be used to calculate the horizontal, vertical, or 45 degree component of a rotated annotation object. It can also be used to easily restrict the mouse cursor on rotated annotation objects.
As an example, consider a rectangle that is rotated 35 degrees in the clockwise direction.
The user has clicked on the Anchor point, and moved the mouse to the Move point.
To find the horizontal component of the line that goes from (Anchor, Move), make the following call, and the ptMove point is adjusted to contain only the horizontal component.
The adjusted ptMove can be seen in step 4.
LAnnotation::AdjustPoint(&ptAnchor, &ptMove, 35*PI/180, ANNADJUST_HORIZONTAL)
Conceptually, the following occurs:
Initial situation.
Points and rectangle are rotated 35 degrees counter clockwise.
Move point is adjusted to contain only the horizontal component.
Points and rectangle are rotated 35 degrees clockwise to give adjusted Move point.
Win32, x64.
L_INT LAnnotation_AdjustPointExample(LAnnotation *pObjectChange,
LAnnotation *pObjectNeighbor,
pANNPOINT ptAnchor,
pANNPOINT ptMove,
L_INT dAngle,
POINT MousePos)
{
L_INT nRet;
L_DOUBLE dx, dy;
POINT pt;
nRet = LAnnotation::AdjustPoint(ptAnchor, ptMove, dAngle, ANNADJUST_HORIZONTAL);
if(nRet !=SUCCESS)
return nRet;
dx = (ptMove->x - ptAnchor->x)/2;
dy = (ptMove->y - ptAnchor->y)/2;
pt = MousePos;
pt.x = (LONG)(ptAnchor->x + dx);
pt.y = (LONG)(ptAnchor->y + dy);
nRet = pObjectChange->Define(&MousePos, ANNDEFINE_APPEND);
if(nRet != SUCCESS)
return nRet;
nRet = pObjectNeighbor->Define(&pt, ANNDEFINE_APPEND);
if(nRet != SUCCESS)
return nRet;
return SUCCESS;
}
Help Collections
Raster .NET | C API | C++ Class Library | HTML5 JavaScript
Document .NET | C API | C++ Class Library | HTML5 JavaScript
Medical .NET | C API | C++ Class Library | HTML5 JavaScript
Medical Web Viewer .NET
Multimedia
Direct Show .NET | C API | Filters
Media Foundation .NET | C API | Transforms
Supported Platforms
.NET, Java, Android, and iOS/macOS Assemblies
Imaging, Medical, and Document
C API/C++ Class Libraries
Imaging, Medical, and Document
HTML5 JavaScript Libraries
Imaging, Medical, and Document