LAnnCurveClosed::GetPoints

#include "ltwrappr.h"

virtual L_INT LAnnCurveClosed::GetPoints(pPoints)

Fills the specified array of ANNPOINT structures with the vertices of the annotation object.

Parameters

pANNPOINT pPoints

Pointer to the array that this function will fill with the vertices of the object.

Returns

Value Meaning
SUCCESS The function was successful.
< 1 An error occurred. Refer to Return Codes.

Comments

You can use the LAnnCurveClosed::GetPointCount function to determine the required size of the array before calling this function.

The ANNPOINT structure is like a Windows POINT structure, except that it uses double-precision floating point values.

Coordinates of an object's points are relative to its container object. The coordinates are interpreted using the container's scaling factors and offsets, which are described in Low-Level Coordinate System for Annotations.

Required DLLs and Libraries

Platforms

Win32, x64.

See Also

Functions

Topics

Example

This example gets the points for an object, shrinks the object by 1/2 and then puts the points back to the object.

L_INT LAnnCurveClosed_GetPointsExample(HWND hwnd, LAnnContainer& LeadContainer,  
																			L_BOOL fDoubleClick, L_INT x, L_INT y, L_UINT keyFlags) 
{ 
   UNREFERENCED_PARAMETER(keyFlags); 
   UNREFERENCED_PARAMETER(fDoubleClick); 
   UNREFERENCED_PARAMETER(hwnd); 
 
   L_INT nRet; 
 
   HANNOBJECT     hObject; // Local variable for the annotation object  
   POINT          PointToTest; // The point in the window's client area to test  
   L_UINT         TestResult; // Result of the test  
   pANNPOINT pPoints; // Pointer to the points in the object 
   L_UINT  uCount;  // Number of points in the object  
   L_INT  i; 
   ANNRECT rcDefine;// Defining rectangle for the object  
   L_DOUBLE cx; // Center x point 
   L_DOUBLE cy; // Center y point 
   LBuffer LeadBuffer ; 
   ANNHITTESTINFO HitTestInfo;  
 
   memset(&HitTestInfo, 0, sizeof(ANNHITTESTINFO));  
   HitTestInfo.uStructSize = sizeof(ANNHITTESTINFO);  
 
    
 
   // Did we hit an object?  
   // Use incoming coordinates to specify the point to test  
   PointToTest.x = x; 
   PointToTest.y = y; 
 
   // Get the object at the specified point  
   nRet = LeadContainer.HitTest( &PointToTest, &TestResult, &hObject, &HitTestInfo, sizeof(ANNHITTESTINFO)); 
   if(nRet != SUCCESS) 
      return nRet; 
   if ( TestResult == ANNHIT_BODY ) 
   { 
 
      LAnnCurveClosed   LeadCurveClosed(hObject) ; 
      // first, get the # of points in the object 
      uCount = LeadCurveClosed.GetPointCount(); 
 
      LeadBuffer.Reallocate(sizeof(ANNPOINT) * uCount); 
 
      pPoints = (pANNPOINT)LeadBuffer.Lock() ; 
 
      // Now, get the points  
      nRet = LeadCurveClosed.GetPoints(pPoints); 
      if(nRet != SUCCESS) 
         return nRet; 
       
      // Get the defining rect, and find the center point 
      nRet = LeadCurveClosed.GetRect ( &rcDefine ); 
      if(nRet != SUCCESS) 
         return nRet; 
      cx = (rcDefine.right + rcDefine.left) / 2; 
      cy = (rcDefine.bottom + rcDefine.top) / 2; 
      for (i=0; i<(L_INT)uCount; i++) 
      { 
         pPoints[i].x += (cx - pPoints[i].x) / 2; 
         pPoints[i].y += (cy - pPoints[i].y) / 2; 
      } 
      // Put the new points back into the object 
      nRet = LeadCurveClosed.SetPoints ( pPoints, uCount); 
      if(nRet != SUCCESS) 
         return nRet; 
 
      LeadBuffer.Unlock() ; 
   } 
   else 
      return FAILURE;  
   return SUCCESS; 
} 

Help Version 20.0.2020.4.5
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2020 LEAD Technologies, Inc. All Rights Reserved.

LEADTOOLS Raster Imaging C++ Class Library Help