LAnnotation::AdjustPoint

Summary

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

Syntax

#include "ltwrappr.h"

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

Parameters

pANNPOINT pptAnchor

Pointer to an ANNPOINT structure representing the anchor point.

pANNPOINT pptMove

Pointer to an ANNPOINT structure representing the point to be adjusted.

L_DOUBLE dAngle

Angle of rotation in radians. Ranges from -Pi to Pi, (-3.1415 - 3.1415) where a positive angle corresponds to clockwise rotation.

L_INT nType

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]

Returns

Value Meaning
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

Platforms

Win32, x64.

See Also

Functions

Topics

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 23.0.2024.2.29
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2024 LEAD Technologies, Inc. All Rights Reserved.

LEADTOOLS Raster Imaging C++ Class Library Help

Products | Support | Contact Us | Intellectual Property Notices
© 1991-2023 LEAD Technologies, Inc. All Rights Reserved.