LVectorLayer::EnumObjectsCallBack

#include "ltwrappr.h"

virtual L_INT LVectorLayer::EnumObjectscallBack(pVector, pObject)

Processes each vector object enumerated by the LVectorLayer::EnumObjects function.

Parameters

pVECTORHANDLE pVector

Pointer to the class object's associated vector image that contains the objects to enumerate.

pVECTOROBJECT pObject

Pointer to the vector object being processed.

Returns

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

Comments

The LVectorLayer::EnumObjects function calls this function as it gets a pointer to each vector object.

To use this function, derive a class from LVectorLayer and override the EnumObjectsCallBack member function. Note that LVectorLayer::EnumObjectsCallBack does not return an LVectorObject object.

You can attach the pVECTOROBJECT pObject to an LVectorObject class object and call LVectorObject::LockObject and LVectorObject::UnlockObject to get detailed information about each vector object.

Required DLLs and Libraries

See Also

Functions

Example

This example copies all objects from active layer of vector source to vector destination (active layer).

class LMyVectorLayer: public LVectorLayer 
{ 
public: 
   LVectorBase *m_pVectorDst; 
 
public: 
   LMyVectorLayer() {}; 
   virtual ~LMyVectorLayer(){}; 
   virtual L_INT EnumObjectsCallBack(pVECTORHANDLE pVector, pVECTOROBJECT pObject); 
}; 
 
L_INT LMyVectorLayer::EnumObjectsCallBack(pVECTORHANDLE pVector, pVECTOROBJECT pObject) 
{ 
   LVectorBase   VectorBase(pVector); 
   LVectorObject VectorObject(pObject, &VectorBase); 
   m_pVectorDst->CopyObject(&VectorObject); 
   VectorBase.SetHandle(NULL, FALSE); 
   return SUCCESS ; 
} 
 
L_INT LVectorLayer__EnumObjectsCallBackExample(HWND hWnd, LVectorBase *pVectorDst) 
{ 
   UNREFERENCED_PARAMETER(hWnd); 
 
   //Load a source vector 
   L_INT       nRet; 
   LVectorBase VectorSrc; 
 
   nRet = VectorSrc.Load(MAKE_IMAGE_PATH(TEXT("random.dxf"))); 
   if(nRet != SUCCESS) 
      return nRet; 
 
   //Get the active layer of source 
   LMyVectorLayer  VectorLayer; 
   nRet = VectorSrc.GetActiveLayer(&VectorLayer); 
   if(nRet != SUCCESS) 
      return nRet; 
 
   //Set the destination vector where objects from source will be copied 
   VectorLayer.m_pVectorDst = pVectorDst; 
 
   //Enumerate all objects in Active layer (and copy to dest vector) 
   nRet = VectorLayer.EnumObjects(); 
   if(nRet != SUCCESS) 
      return nRet; 
 
   return SUCCESS; 
} 

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

LEADTOOLS Vector C++ Class Library Help