LVectorDialog::DoModalVectorNewObject

Summary

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

Syntax

#include "ltwrappr.h"

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

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

Parameters

HWND hWndParent

Handle of the window that owns the dialog.

LVectorLayer * pVectorLayer

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

L_INT 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.

LVectorObject * 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

Value Meaning
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

See Also

Functions

Topics

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_INT LVectorDialog__DoModalVectorNewObjectExample_1(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); 
   } 
   else 
      return nRet; 
 
   return SUCCESS; 
} 
 
// This example will call the DoModalNewObject() dialog to create a line object in active layer. 
// Line parameters are defaulted. 
 
L_INT LVectorDialog__DoModalVectorNewObjectExample_2(HWND hWnd, LVectorBase *pVector) 
{ 
   LVectorDialog VectorDlg; 
 
   VectorDlg.SetVector (pVector); 
   VectorDlg.EnablePreview (); 
   VectorDlg.EnableAutoProcess ();   
 
   L_INT nRet = VectorDlg.DoModalVectorNewObject(hWnd, VECTOR_LINE, NULL, NULL); 
 
   return nRet; 
} 

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

LEADTOOLS Vector C++ Class Library Help
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2023 LEAD Technologies, Inc. All Rights Reserved.