Products | Support | Send comments on this topic. | Email a link to this topic. | Back to Getting Started | Help Version 18.0.10.23
LEADTOOLS Vector C++ Class Library Help

LVectorLayer::LVectorLayer

Show in webframe

#include "ltwrappr.h"

LVectorLayer::LVectorLayer(pLayer, pVector=NULL)

LVectorLayer::LVectorLayer(pVector)

LVectorLayer::LVectorLayer(pLayerDesc=NULL, pVector=NULL)

pVECTORLAYER pLayer;

/* pointer to a VECTORLAYER structure */

LVectorBase * pVector;

/* pointer to an LVectorBase object */

pVECTORLAYERDESC pLayer;

/* pointer to a VECTORLAYER structure */

Constructs and initializes the different member variables of the LVectorLayer object.

Parameter

Description

pLayer

Pointer to a VECTORLAYER structure that contains information used to create and initialize the new vector layer.

pVector

Pointer to an LVectorBase object. The newly created vector layer will be associated with this LVectorBase object.

pLayerDesc

Pointer to a VECTORLAYERDESC structure that contains information used to create and initialize the new vector layer.

Returns

None

Comments

LVectorLayer::LVectorLayer(pLayer, pVector=NULL) is a constructor for the LVectorLayer object. It takes a valid pVECTORLAYER pointer and creates an LVectorLayer object. This constructor should mainly be used with the LVectorBase::EnumLayers function, which returns a valid pVECTORLAYER pointer in its LVectorBase::EnumLayersCallBack member function.

LVectorLayer::LVectorLayer(pVector) creates a valid LVectorLayer object that is associated with the specified LVectorBase object.

LVectorLayer::LVectorLayer(pLayerDesc=NULL, pVector=NULL) creates an LVectorLayer object based on the information provided in pLayerDesc and associates the newly created LVectorLayer object with the specified LVectorBase object.

To use the LVectorLayer::LVectorLayer(pLayerDesc=NULL, pVector=NULL) constructor, optionally declare a variable of type VECTORLAYERDESC, fill the structure and pass its address to this constructor. To associate the newly created vector layer with an LVectorBase object, pass a valid pointer to an LVectorBase object as the second parameter. If the second parameter is NULL, then the LVectorLayer object is not yet associated with an LVectorBase object. The following functions automatically associate an LVectorLayer object with an LVectorBase object: LVectorBase::AddLayer, LVectorBase::GetLayerByName, LVectorBase::GetLayerByIndex, LVectorBase::SetActiveLayer, and LVectorBase::GetActiveLayer. The LVectorLayer::SetVector also associates an LVectorLayer object with an LVectorBase object.

Required DLLs and Libraries

LVKRN

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application.

See Also

Functions:

LVectorLayer::~LVectorLayer, LVectorBase::AddLayer, LVectorBase::GetLayerByName, LVectorBase::GetLayerByIndex, LVectorBase::SetActiveLayer, LVectorBase::GetActiveLayer, LVectorLayer::SetVector, Class Members

Example

This is an example for LVectorLayer::LVectorLayer(pVector):

// This example enumerates through all layers in a vector.
#ifdef LMyVectorBase4
class LMyVectorBase4: public LVectorBase
{
public:
   L_INT          m_nLayerCount ;
public:
   LMyVectorBase4() {m_nLayerCount=0;};
   virtual ~LMyVectorBase4(){};
   virtual L_INT EnumLayersCallBack(pVECTORHANDLE pVector, pVECTORLAYER pLayer);
};
#endif // #ifdef LMyVectorBase4
L_INT LVectorLayer__LVectorLayerExample_1(HWND hWnd, LMyVectorBase4 *pMyVector)
{
   UNREFERENCED_PARAMETER(hWnd);
   L_INT          nRet;
   LMyVectorBase4 MyVector;
   L_TCHAR        szMsg[100];
   pMyVector->m_nLayerCount=0;
   nRet = pMyVector->EnumLayers();
   if(nRet != SUCCESS)
      return nRet;
   wsprintf(szMsg, TEXT("Total Layers[%d]"), pMyVector->m_nLayerCount);
   MessageBox(NULL, szMsg, TEXT(""), MB_OK);
   return SUCCESS;
}
// This is an example for LVectorLayer::LVectorLayer(pVector):
//Example95
L_INT LVectorLayer__LVectorLayerExample_2(HWND hWnd, LVectorBase *pVector)
{
   UNREFERENCED_PARAMETER(hWnd);
   LVectorLayer   VectorLayer(pVector);
   //Assoicate the LVectorLayer with an LVectorBase
   //Note that most functions that use an LVectorLayer do this automatically
   VectorLayer.SetVector(pVector);
   //...Do something with the vector layer
   //...LVectorLayer destructor is called when VectorLayer goes out of scope.
   return SUCCESS;
}
// This is an example for LVectorLayer::LVectorLayer(pLayerDesc=NULL, pVector=NULL):
// This example will add a new layer to a vector handle. 
L_INT LVectorLayer__LVectorLayerExample_3(HWND hWnd, LVectorBase *pVector)
{
   UNREFERENCED_PARAMETER(hWnd);
   L_INT             nRet;
   LVectorLayer      VectorLayer;
   VECTORLAYERDESC   LayerDesc;
   nRet = VectorLayer.GetLayerDesc(&LayerDesc);
   if(nRet != SUCCESS)
      return nRet;
   lstrcpy(LayerDesc.szName, TEXT("Terry's New Layer"));
   nRet = VectorLayer.SetLayerDesc(&LayerDesc);
   if(nRet != SUCCESS)
      return nRet;
   nRet = pVector->AddLayer(&VectorLayer, VECTOR_FLAGS_RENAME_DUPLICATES);
   if(nRet != SUCCESS)
   {
      MessageBox( NULL, TEXT("Could not add layer!"), TEXT(""), MB_OK );
      return nRet;
   }
   //...LVectorLayer destructor is called when VectorLayer goes out of scope.
   return SUCCESS;
}
// This is also an example for LVectorLayer::LVectorLayer(pLayerDesc=NULL, pVector=NULL):
// This example demonstrates the use of the LVectorLayer constructor
L_INT LVectorLayer__LVectorLayerExample_4(HWND hWnd, LVectorBase *pVector)
{
   UNREFERENCED_PARAMETER(hWnd);
   L_INT             nRet;
   VECTORLAYERDESC   LayerDesc;
   LayerDesc.bLocked = FALSE;
   LayerDesc.bVisible = TRUE;
   LayerDesc.dwTag = 1;
   LayerDesc.nSize = sizeof(VECTORLAYERDESC);
   lstrcpy(LayerDesc.szName, TEXT("My New Layer"));
   LVectorLayer VectorLayer(&LayerDesc);
   nRet = pVector->AddLayer (&VectorLayer, VECTOR_FLAGS_RENAME_DUPLICATES);
   if(nRet != SUCCESS)
   {
      MessageBox( NULL, TEXT("Could not add layer!"), TEXT(""), MB_OK );
      return nRet;
   }
   //...LVectorLayer destructor is called when VectorLayer goes out of scope.
   return SUCCESS;
}
Products | Support | Contact Us | Copyright Notices
© 2006-2014 All Rights Reserved. LEAD Technologies, Inc.