LVectorClone::SetGroup
#include "ltwrappr.h"
virtual L_INT LVectorClone::SetGroup(pVectorGroup)
LVectorGroup *pVectorGroup; |
/* pointer to a vector group object */ |
Associates a vector group with a vector clone.
Parameter |
Description |
pVectorGroup |
Pointer to an LVectorGroup object to be associated with the clone object. |
Returns
SUCCESS |
The function was successful. |
< 1 |
An error occurred. Refer to Return Codes. |
Comments
A vector clone object must be associated with a vector group before it can be added to an LVectorBase object, using LVectorBase::AddObject or LVectorLayer::AddObject.
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: |
|
Topics: |
Example
This example will add a three square to a LVectorBase object and to a LVectorGroup object.
A "clone" vector object will be created from the group, and displayed with purple hatched brush.
L_VOID CreateRectangle( LVectorBase *pVector, LVectorGroup *pGroup, VECTORPOINT point0, VECTORPOINT point1, COLORREF crPen, COLORREF crBrush) { VECTORRECTANGLE Rectangle; Rectangle.Point[0] = point0; Rectangle.Point[1] = point1; Rectangle.Brush.nSize = sizeof(VECTORBRUSH); Rectangle.Brush.VectorBrushStyle = VECTORBRUSH_STANDARD; Rectangle.Brush.BrushType.StandardBrush.LogBrush.lbColor = crBrush; Rectangle.Brush.BrushType.StandardBrush.LogBrush.lbStyle = BS_SOLID; Rectangle.Pen.nSize = sizeof( VECTORPEN ); Rectangle.Pen.bExtPen = FALSE; Rectangle.Pen.NewPen.LogPen.lopnStyle = PS_SOLID; Rectangle.Pen.NewPen.LogPen.lopnWidth.x = 2; Rectangle.Pen.NewPen.LogPen.lopnWidth.y = 2; Rectangle.Pen.NewPen.LogPen.lopnColor = crPen; LVectorRectangle VectorRectangle(&Rectangle); pVector->AddObject(&VectorRectangle); pGroup->AddObject(&VectorRectangle); } L_INT LVectorClone__SetGroupExample(HWND hWnd, LVectorBase *pVector) { UNREFERENCED_PARAMETER(hWnd); //Create a new group L_INT nRet; LVectorGroup VectorGroup; VECTORGROUPDESC GroupDesc; VECTORPOINT point0, point1; COLORREF color; nRet = VectorGroup.GetGroupDesc(&GroupDesc); if(nRet != SUCCESS) return nRet; lstrcpy(GroupDesc.szName, TEXT("My New Group")); nRet = VectorGroup.SetGroupDesc(&GroupDesc); if(nRet != SUCCESS) return nRet; nRet = pVector->AddGroup(&VectorGroup); if(nRet != SUCCESS) return nRet; //Create three rectangle objects and add to the group //Add first rectangle point0.x = 10; point0.y = 10; point0.z = 10; point1.x = 30; point1.y = 30; point1.z = 10; color = RGB(255,0,0); CreateRectangle(pVector, &VectorGroup, point0, point1, color, color); //Add second rectangle point0.x = 30; point0.y = 30; point0.z = 10; point1.x = 50; point1.y = 50; point1.z = 10; color = RGB(0,255,0); CreateRectangle(pVector, &VectorGroup, point0, point1, color, color); //Add third rectangle point0.x = 50; point0.y = 50; point0.z = 10; point1.x = 70; point1.y = 70; point1.z = 10; color = RGB(0,0,255); CreateRectangle(pVector, &VectorGroup, point0, point1, color, color); //Create a clone of the group VECTORCLONE Clone; LVectorClone VectorClone; nRet = VectorClone.SetGroup(&VectorGroup); if(nRet != SUCCESS) return nRet; nRet = VectorClone.LockObject(&Clone); if(nRet != SUCCESS) return nRet; Clone.dwFlags = VECTOR_CLONE_USE_PEN | VECTOR_CLONE_USE_BRUSH; Clone.Pen.bExtPen = FALSE; Clone.Pen.NewPen.LogPen.lopnColor = RGB(0,0,0); Clone.Brush.BrushType.StandardBrush.LogBrush.lbColor = RGB(255,0,255); Clone.Brush.BrushType.StandardBrush.LogBrush.lbStyle = BS_HATCHED; Clone.Point.x = 40; Clone.Point.y = 40; Clone.Point.z = 40; Clone.Rotation.x = 0; Clone.Rotation.y = 0; Clone.Rotation.z = 45; nRet = VectorClone.UnlockObject(&Clone); if(nRet != SUCCESS) return nRet; nRet = pVector->AddObject(&VectorClone ); if(nRet != SUCCESS) return nRet; //~LVectorClone() destructor gets called when VectorClone object goes out of scope return SUCCESS; }