L_AnnDefine

#include "l_bitmap.h"

L_LTANN_API L_INT L_AnnDefine(hObject, pPoint, uState)

HANNOBJECT hObject;

/* handle to the annotation object */

LPPOINT pPoint;

/* pointer to a POINT structure */

L_UINT uState;

/* state of the process of modifying the annotation object */

Specifies the shape when creating or transforming an annotation object. This function specifies one point in the current window each time it is called. This function is available in the Document/Medical Toolkits.

Parameter

Description

hObject

Handle to the annotation object.

pPoint

Pointer to a POINT structure. The points in the array must be in the order in which the vertices are connected. To define the line that closes a polygon, the last point in the array is connected to the first point of the array. To define a rectangle, the last point is the opposite vertex of the first point.

uState

State of the process of modifying the annotation object.

 

Value

Meaning

 

ANNDEFINE_BEGINSET

[0] This is the first point to define a new object.

 

ANNDEFINE_BEGINMOVE

[1] This is the point from which to move the object.

 

ANNDEFINE_BEGINROTATE

[2] This is the starting point for calculating the angle of rotation.

 

ANNDEFINE_BEGINRESIZE

[3] This is the starting point for calculating how to resize the object.

 

ANNDEFINE_BEGINSELECT

[4] This is the first corner of the rectangle used to select objects.

 

ANNDEFINE_APPEND

[5] This is the next point when defining an object that requires more than two points.

 

ANNDEFINE_UPDATE

[6] This is the current mouse position during creation of the object. Use this on a mouse move event to reflect the current shape of the object.

 

ANNDEFINE_END

[7] This is the last point.

 

ANNDEFINE_BEGINMOVESELECTED

[8] This is the point from which to move all selected objects.

 

ANNDEFINE_BEGINROTATESELECTED

[9] This is the starting point for calculating the angle of rotation for all selected objects.

 

ANNDEFINE_BEGINRESIZESELECTED

[10] This is the starting point for calculating the how to resize all selected objects.

 

ANNDEFINE_BEGINMOVEPOINT

[11] This is a starting point, used when moving one point on an annotation object.

The behavior depends on the annotation object being manipulated.

This can be used to move a single point on any of the following annotation objects:

ANNOBJECT_LINE

ANNOBJECT_POLYLINE

ANNOBJECT_POLYGON

ANNOBJECT_POINTER

ANNOBJECT_FREEHAND

ANNOBJECT_FREEHANDHOTSPOT

ANNOBJECT_RULER

ANNOBJECT_CROSSPRODUCT

ANNOBJECT_PROTRACTOR

ANNOBJECT_CURVE

ANNOBJECT_CURVECLOSED

You can use ANNDEFINE_BEGINMOVEPOINT to perform a simultaneous rotate and resize for the following objects: When doing this, call L_AnnDefine with the ANNDEFINE_SETANCHORPOINT flag prior to calling L_AnnDefine with the ANNDEFINE_BEGINMOVEPOINT flag.

(Note that you must set an anchor point prior to using ANNDEFINE_BEGINMOVEPOINT)

ANNOBJECT_RECT

ANNOBJECT_ELLIPSE

ANNOBJECT_HILITE

ANNOBJECT_REDACT

ANNOBJECT_TEXT

ANNOBJECT_NOTE

ANNOBJECT_STAMP

ANNOBJECT_HOTSPOT

 

ANNDEFINE_BEGINMOVENAME

[12] This is the starting point from which to move the object name.

 

ANNDEFINE_SETANCHORPOINT

[13] This is an anchor point. Use this value when rotating an annotation object around a point other than its center. When doing this, call L_AnnDefine with this flag prior to calling L_AnnDefine with the ANNDEFINE_BEGINROTATE flag.

Returns

SUCCESS

The function was successful.

< 1

An error occurred. Refer to Return Codes.

Comments

(Document/Medical) Before calling this function, you must create the object, and the object must have a window handle (which can be inherited from the container).

To specify the shape of an object that is defined by a polygon, you call this function repeatedly to create an array of points, which must be in the order in which the vertices are connected. To define the line that closes a polygon, the last point in the array is connected to the first point of the array.

To specify the shape of an object that is defined by a rectangle, you call this function for each of two opposite corners.

You can also call this function on mouse move events during the definition of an object to update the current view of the object being defined. Thus, this function can handle the display of the object during and after its creation.

When rotating or resizing an object, you call this function for the first point and last point, and this function determines the angle of rotation or resize parameters based on the difference in the points.

When rotating an annotation object around a point other than its center, call L_AnnDefine with the ANNDEFINE_SETANCHORPOINT flag set, prior to calling L_AnnDefine with the ANNDEFINE_BEGINROTATE flag set. For example, to rotate an object around the point (10,20) in client coordinates, do the following:

(Assume that pMousePos->pt is the current mouse location in client coordinates)

   POINT ptLocation;
   ptLocation.x = 10;
   ptLocation.y = 20;
   L_AnnDefine(hObject,  &ptLocation, ANNDEFINE_SETANCHORPOINT);
   L_AnnDefine(hObject,  &pMousePos->pt, ANNDEFINE_BEGINROTATE);

    // One or more ANNDEFINE_APPEND
   L_AnnDefine(pData->hObjectChange, &pMousePos->pt, ANNDEFINE_APPEND); 

    L_AnnDefine(pData->hObjectChange, &pMousePos->pt, ANNDEFINE_END); 

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

Windows 2000 / XP/Vista.

See Also

Functions:

L_AnnCreate, L_AnnCreateContainer,

 

L_AnnCreateItem, L_AnnInsert, L_AnnRemove,

 

L_AnnDestroy, L_AnnAddUserHandle, L_AnnAdjustPoint, L_AnnChangeUserHandle, L_AnnConvert, L_AnnDefine2, L_AnnDeleteUserHandle, L_AnnEnumerateHandles, L_AnnGetRestrictToContainer, L_AnnGetRotateAngle, L_AnnGetUserHandle, L_AnnGetUserHandles, L_AnnHitTest, L_AnnRestrictCursor, L_AnnSetRestrictToContainer

Topics:

Annotation Functions: Creating and Deleting Annotations

 

Implementing Annotations

 

Types of Annotations

 

Annotation Objects - Default Values

 

Implementing an Automated Annotation Program

 

Implementing a Non-automated Annotation Program

 

Implementing Custom Annotations

Example

This example uses static variables to simulate user input to create a rectangular annotation object.

/* You must call this function twice. */
 L_INT AnnDefineExample(HWND     hWnd,
                                      HANNOBJECT hContainer)/* Container annotation object */
{
   L_INT nRet;
   POINT             ThisPoint;     /* Simulates the mouse position in the current window */
   static RECT       rClientRect;   /* Rectangle for the window's client area */
   static HANNOBJECT MyObj;         /* Annotation object being created */
   static L_INT      CallCount = 0; /* Counter for simulating user input */

   /* Update the call count */
   ++CallCount;
   switch (CallCount)
   {
   case 1:
      /* Create the rectangle annotation */
      nRet = L_AnnCreateItem(hContainer, ANNOBJECT_RECT, TRUE, &MyObj);
      if(nRet != SUCCESS)
         return nRet;
      /* Get the rectangle for the window's client area */
      GetClientRect(hWnd,&rClientRect);
      /* Set the point for one corner (Use lower right to show flexibility) */
      ThisPoint.x = rClientRect.right * 4/5;
      ThisPoint.y = rClientRect.bottom * 4/5;
      /* Begin defining the rectangular annotation object */
      nRet = L_AnnDefine(MyObj, &ThisPoint, ANNDEFINE_BEGINSET);
      if(nRet != SUCCESS)
         return nRet;
      break;
   case 2:
      /* Set the point for the opposite corner of the rectangle */
      ThisPoint.x = rClientRect.right / 2;
      ThisPoint.y = rClientRect.bottom / 2;
      /* Finish defining the rectangular annotation object */
      nRet = L_AnnDefine(MyObj, &ThisPoint, ANNDEFINE_END);
      if(nRet != SUCCESS)
         return nRet;
      break;
   default:
      CallCount = 0;
   }
   return SUCCESS;
}