LVectorDialog::DoModalVectorNewObject

#include "ltwrappr.h"

virtual L_INT LVectorDialog::DoModalVectorNewObject(hWndParent, nType, pVectorLayer, pVectorObject);

virtual L_INT LVectorDialog::DoModalVectorNewObject(hWndParent, pVectorLayer, pVectorObject);

HWND hWndParent;

/* window handle */

L_INT nType;

/* object type */

LVectorLayer * pVectorLayer;

/* pointer to a vector layer object */

LVectorObject * pVectorObject;

/* pointer to the new vector object */

Brings up the New Object dialog. This function is available in the LEADTOOLS Vector Imaging Pro Toolkit.

Parameter

Description

hWndParent

Handle of the window that owns the dialog.

pVectorLayer

Pointer to the destination vector layer. If this parameter is NULL, the object will be added to the active layer.

nType

Object type. Possible values are:

 

Value

Meaning

 

VECTOR_VERTEX

3D vertex in space.

 

VECTOR_LINE

Line.

 

VECTOR_RECTANGLE

Rectangle.

 

VECTOR_POLYLINE

Polyline.

 

VECTOR_POLYBEZIER

Poly Bezier curve.

 

VECTOR_POLYGON

Polygon.

 

VECTOR_ELLIPSE

Ellipse.

 

VECTOR_CIRCLE

Circle.

 

VECTOR_ARC

Arc.

 

VECTOR_TEXT

Text.

 

VECTOR_PIE

Pie section.

 

VECTOR_CHORD

Chord.

 

VECTOR_POLYDRAW

Polydraw.

 

VECTOR_RASTER

Raster.

 

VECTOR_STOCK

Stock object from a stock library.

pVectorObject

Pointer to an LVectorObject object to be updated with the object information of the newly added vector object. For more information, refer to the Comments section below.

Returns

SUCCESS

The function was successful.

< 1

An error occurred. Refer to Return Codes.

Comments

For LVectorDialog::DoModalVectorNewObject(hWndParent, nType, pVectorLayer, pVectorObject):

If pVectorObject == NULL then the object is added to the vector, but no object information is provided in pVectorObject (since it is NULL). The object type of the dialog is determined by nType

If pVectorObject != NULL then pVectorObject is updated with the object information entered through the dialog.

For LVectorDialog::DoModalVectorNewObject(hWndParent, pVectorLayer, pVectorObject):

If pVectorObject == NULL then the function returns an error. (WRPERR_INVALID_PARAMETERS).

If pVectorObject != NULL then the dialog is initialized using the data present in pVectorObject. When the function returns, pVectorObject is updated with the object information entered through the dialog..

Note: To get or set specific properties using LVectorObject::LockObject and LVectorObject::UnlockObject, the type of objectc pointed to by pVectorObject must be the same as the object type given in nType. For example, if nType is VECTOR_LINE, then pVectorObject must point to an LVectorLine object.

Required DLLs and Libraries

LVKRN
LVDLG
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:

LVectorDialog::DoModalVectorEditObject, Class Members

Topics:

Vector CommonDialogs

Example

// This example will call the DoModalVectorNewObject() dialog to create a line object in active layer.
// Line parameters are passed to initialize the dialog.
L_VOID Example88(HWND hWnd, LVectorBase *pVector)
{
   LVectorDialog VectorDlg;
   
   VectorDlg.SetVector (pVector);
   VectorDlg.EnablePreview ();
   VectorDlg.EnableAutoProcess ();  
   
   VECTORLINE Line;
   Line.Pen.nSize  = sizeof(VECTORPEN);

   Line.Pen .bExtPen = FALSE;
   Line.Pen.NewPen.LogPen.lopnStyle = PS_SOLID;
   Line.Pen.NewPen.LogPen.lopnWidth.x = 10;
   Line.Pen.NewPen.LogPen.lopnWidth.y = 10;
   Line.Pen.NewPen.LogPen.lopnColor = RGB(255,0,0);
   
   Line.Point[ 0 ].x = 50.0;
   Line.Point[ 0 ].y = 50.0;
   Line.Point[ 0 ].z =  0.0;

   Line.Point[ 1 ].x =  70.0;
   Line.Point[ 1 ].y =  50.0;
   Line.Point[ 1 ].z =   0.0;
   
   LVectorLine VectorLine(&Line);
   
   L_INT nRet = VectorDlg.DoModalVectorNewObject(hWnd, NULL, &VectorLine);
   if (nRet == SUCCESS)
   {
      L_TCHAR szMsg[200];

      //Get the line descriptor
      VectorLine.LockObject(&Line);
      VectorLine.UnlockObject (&Line);
      
      wsprintf(szMsg, TEXT("Line Color[%x]\nLine Points (%d,%d,%d) - (%d,%d,%d)"),
         Line.Pen.NewPen.LogPen.lopnColor,
         (int)Line.Point[0].x,
         (int)Line.Point[0].y,
         (int)Line.Point[0].z,
         (int)Line.Point[1].x,
         (int)Line.Point[1].y,
         (int)Line.Point[1].z);
      
      MessageBox(hWnd, szMsg,TEXT(""), MB_OK);
   }
   
}

// This example will call the DoModalNewObject() dialog to create a line object in active layer.
// Line parameters are defaulted.

L_VOID Example89(HWND hWnd, LVectorBase *pVector)
{
   LVectorDialog VectorDlg;
   
   VectorDlg.SetVector (pVector);
   VectorDlg.EnablePreview ();
   VectorDlg.EnableAutoProcess ();  
      
   L_INT nRet = VectorDlg.DoModalVectorNewObject(hWnd, VECTOR_LINE, NULL, NULL);   
}