LAnnotation::AdjustPoint

#include "ltwrappr.h"

static L_INT LAnnotation::AdjustPoint (pptAnchor, pptMove, dAngle, nType)

pANNPOINT pptAnchor;

pointer to an ANNPOINT structure that contains the anchor point

pANNPOINT pptMove;

pointer to an ANNPOINT structure that contains the point to be adjusted

L_DOUBLE dAngle;

angle of rotation

L_INT nType;

type of adjustment to point

Modifies the point pptMove based on the angle from line (pptAnchor, pptMove) and the horizontal.

Parameter Description
pptAnchor Pointer to an ANNPOINT structure representing the anchor point.
pptMove Pointer to an ANNPOINT structure representing the point to be adjusted.
dAngle Angle of rotation in radians. Ranges from -Pi to Pi, (-3.1415 - 3.1415) where a positive angle corresponds to clockwise rotation.
nType Type of adjustment to point. Possible values are:
  Value Meaning
  ANNADJUST_HORIZONTAL [1]
  ANNADJUST_VERTICAL [2]
  ANNADJUST_45_DEGREES_FAVOR_X [3]
  ANNADJUST_45_DEGREES_FAVOR_Y [4]

Returns

SUCCESS

The function was successful.

< 1

An error occurred. Refer to Return Codes.

Comments

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.

image\Ann14doc.gif

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:

1.

Initial situation.

2.

Points and rectangle are rotated 35 degrees counter clockwise.

3.

Move point is adjusted to contain only the horizontal component.

4.

Points and rectangle are rotated 35 degrees clockwise to give adjusted Move point.

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:

Class Members, LAnnotation::Define, , LAnnotation::Define2, LAnnContainer::Convert, LAnnotation::GetRestrictToContainer, LAnnEncrypt::GetRotateAngle, LAnnContainer::HitTest, LAnnContainer::RestrictCursor, LAnnotation::SetRestrictToContainer

Topics:

Implementing Annotations

 

Automated User Interface for Annotations

 

Annotation Functions: Creating and Deleting Annotations

 

Types of Annotations

 

Annotation Functions: Implementing Custom Annotations

 

Annotation Functions: Creating Custom Annotations

 

Annotation Functions: Object Properties

Example

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 Version 19.0.2017.10.27
Products | Support | Contact Us | Copyright Notices
© 1991-2017 LEAD Technologies, Inc. All Rights Reserved.
LEADTOOLS Raster Imaging C++ Class Library Help