LVectorFile::LVectorFile

#include "ltwrappr.h"

L_VOID LVectorFile::LVectorFile(L_VOID)

L_VOID LVectorFile::LVectorFile(pLVector)

L_VOID LVectorFile::LVectorFile(pLVector, pFileName)

LVectorBase * pLVector;

/* pointer to a LEAD vector object */

L_TCHAR * pFileName;

/* file name */

Constructs and initializes the member variables of the class object.

Parameter

Description

pLVector

Pointer to a LEAD vector object, used to initialize the LVectorFile object.

pFileName

Character string that contains the name of the file.

Returns

None

Comments

LVectorFile::LVectorFile() is a constructor for the LVectorFile class.

LVectorFile::LVectorFile(pLVector) also sets the vector for the class object.

LVectorFile::LVectorFile(pLVector, pFileName) also sets the vector for the class object and the filename to associate with the object.

Required DLLs and Libraries

LVKRN
LTFIL

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:

LVectorFile::~LVectorFile, Class Members

Example

#define MAKE_IMAGE_PATH(pFileName) TEXT("C:\\Users\\Public\\Documents\\LEADTOOLS Images\\")pFileName
// This is an example for LVectorFile::LVectorFile():
L_INT LVectorFile__LVectorFileExample_1(HWND hWnd)
{
   L_INT       nRet;
   RECT        rect;
   LVectorBase Vector;
   LVectorFile VectorFile;
   VectorFile.SetVector(&Vector);
   VectorFile.SetFileName(MAKE_IMAGE_PATH(TEXT("random.dxf")));
   nRet = VectorFile.LoadFile();
   if(nRet != SUCCESS)
      return nRet;
   nRet = Vector.AttachToWindow(hWnd);
   if(nRet != SUCCESS)
      return nRet;
   GetClientRect(hWnd, &rect);
   nRet = Vector.SetViewport(&rect);
   if(nRet != SUCCESS)
      return nRet;
   VectorFile.SetFileName(MAKE_IMAGE_PATH(TEXT("image3.wmf")));
   nRet = VectorFile.SaveFile(FILE_WMF);
   if(nRet != SUCCESS)
      return nRet;
   return SUCCESS;
}
// This is an example for LVectorFile::LVectorFile(pLVector):
L_INT LVectorFile__LVectorFileExample_2(HWND hWnd)
{
   L_INT       nRet;
   LVectorBase Vector;
   LVectorFile VectorFile(&Vector);
   //LVectorFile object is invalid until object and filename habe been associated
   if (VectorFile.IsValid())
      MessageBox(hWnd, TEXT("IsValid() returns TRUE"), TEXT(""), MB_OK);
   else
      MessageBox(hWnd, TEXT("IsValid() returns FALSE"), TEXT(""), MB_OK);
   VectorFile.SetFileName(MAKE_IMAGE_PATH(TEXT("random.dxf")));
   nRet = VectorFile.LoadFile();
   if(nRet != SUCCESS)
      return nRet;
    //LVectorFile object is invalid unless a file has been loaded
   if (VectorFile.IsValid())
      MessageBox(hWnd, TEXT("IsValid() returns TRUE"), TEXT(""), MB_OK);
   else
      MessageBox(hWnd, TEXT("IsValid() returns FALSE"), TEXT(""), MB_OK);
   //destructor called when out of scope
   return SUCCESS;
}
// This is an example for LVectorFile::LVectorFile(pLVector, pFileName):
L_INT LVectorFile__LVectorFileExample_3(HWND hWnd)
{
   L_INT       nRet;
   LVectorBase Vector;
   LVectorFile VectorFile(&Vector, MAKE_IMAGE_PATH(TEXT("random.dxf")));
   nRet = VectorFile.LoadFile();
   if(nRet != SUCCESS)
      return nRet;
   //Get pointer to internal file name
   MessageBox(hWnd, VectorFile.GetFileName(), TEXT(""), MB_OK);
   //Get copy of internal file name
   L_TCHAR  szTemp[100];
   L_UINT   uBuffSize;
   nRet = VectorFile.GetFileName(szTemp, &uBuffSize);
   if(nRet != SUCCESS)
      return nRet;
   MessageBox(hWnd, szTemp, TEXT(""), MB_OK);
   return SUCCESS;
}