LVectorLayer::LVectorLayer

#include "ltwrappr.h"

L_VOID LVectorLayer::LVectorLayer(pLayer, pVector=NULL)

L_VOID LVectorLayer::LVectorLayer(pVector)

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

pVECTORLAYER pLayer;

/* pointer to a VECTORLAYER structure */

LVectorBase L_FAR * 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.
class LMyVectorBase4: public LVectorBase
{
public:
   L_INT          m_nLayerCount ;

public:
   LMyVectorBase4() {m_nLayerCount=0;};
   virtual ~LMyVectorBase4(){};
   virtual L_INT EnumLayersCallBack(pVECTORHANDLE pVector, pVECTORLAYER pLayer);
};

L_INT LMyVectorBase4::EnumLayersCallBack(pVECTORHANDLE pVector, pVECTORLAYER pLayer)
{
   LVectorLayer VectorLayer(pLayer, this);
   L_TCHAR szMsg[100];
   m_nLayerCount++;

   VECTORLAYERDESC LayerDesc;
   VectorLayer.GetLayerDesc(&LayerDesc);
   wsprintf(szMsg, TEXT("Layer\nName[%s]\nSize[%d]\nLocked[%d]\nVisible[%d]"),
      LayerDesc.szName,
      LayerDesc.nSize,
      LayerDesc.bLocked,
      LayerDesc.bVisible
      );
   MessageBox(NULL, szMsg, TEXT(""), MB_OK);  
   return SUCCESS ;
   //...LVectorLayer destructor called when VectorLayer goes out of scope
}

L_VOID Example74(HWND hWnd, LMyVectorBase4 *pMyVector)
{
   LMyVectorBase4 MyVector;
   L_TCHAR szMsg[100];

   pMyVector->m_nLayerCount=0;
   pMyVector->EnumLayers();
   wsprintf(szMsg, TEXT("Total Layers[%d]"), pMyVector->m_nLayerCount);
   MessageBox(NULL, szMsg, TEXT(""), MB_OK);
}

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

//Example95
L_VOID Example95(HWND hWnd, LVectorBase *pVector)
{
   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.
}

This is an example for LVectorLayer::LVectorLayer(pLayerDesc=NULL, pVector=NULL):

// This example will add a new layer to a vector handle. 
L_VOID Example68(HWND hWnd, LVectorBase *pVector)
{
   LVectorLayer VectorLayer;
   VECTORLAYERDESC LayerDesc;
   
   VectorLayer.GetLayerDesc(&LayerDesc);
   lstrcpy(LayerDesc.szName, TEXT("Terry's New Layer"));
   VectorLayer.SetLayerDesc(&LayerDesc);
   
   if (SUCCESS != pVector->AddLayer(&VectorLayer, VECTOR_FLAGS_RENAME_DUPLICATES))
   {
      MessageBox( NULL, TEXT("Could not add layer!"), TEXT(""), MB_OK );
   }

   //...LVectorLayer destructor is called when VectorLayer goes out of scope.
}

 

This is also an example for LVectorLayer::LVectorLayer(pLayerDesc=NULL, pVector=NULL):

// This example demonstrates the use of the LVectorLayer constructor

L_VOID Example94(HWND hWnd, LVectorBase *pVector)
{
   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);
      
   if (SUCCESS != pVector->AddLayer (&VectorLayer, VECTOR_FLAGS_RENAME_DUPLICATES))
   {
      MessageBox( NULL, TEXT("Could not add layer!"), TEXT(""), MB_OK );
   }

   //...LVectorLayer destructor is called when VectorLayer goes out of scope.
}