LVectorObject::SetRotation

#include "ltwrappr.h"

virtual L_INT LVectorObject::SetRotation(pRotation, pOrigin=NULL)

const pVECTORPOINT pRotation;

/* pointer to a vector point */

const pVECTORPOINT pOrigin;

/* pointer to a vector point */

Rotates the class object. This function is available in the LEADTOOLS Vector Imaging Pro Toolkit.

Parameter

Description

pRotation

Pointer to a VECTORPOINT structure that contains the rotation values for each axis. The rotation values are in degrees.

pOrigin

Pointer to a VECTORPOINT structure that contains the center of rotation If pOrigin is NULL, the center of the class object.

Returns

SUCCESS

The function was successful.

< 1

An error occurred. Refer to Return Codes.

Comments

Rotates the class object based on the rotation values in pRotation.

The rotation values may be retrieved using LVectorBase::GetRotation.

Note for DirectX:, You cannot select objects or enumerate them.

Note that rotating an object may change the object type. However, not all object types are changed by rotation, and not all rotations result in changing an object type. For example, a rectangle rotated 90 degrees about the z-axis is still a rectangle. A rectangle rotated 45 degrees about the z-axis becomes a polydraw object. The table below indicates object types that may change following rotation and the possible resulting object types.

Original object type

Possible object type following rotation

VECTOR_RECTANGLE

VECTOR_POLYGON

VECTOR_ELLIPSE

VECTOR_POLYDRAW

VECTOR_CIRCLE

VECTOR_POLYDRAW

VECTOR_ARC

VECTOR_POLYDRAW

VECTOR_TEXT

VECTOR_POLYDRAW

VECTOR_PIE

VECTOR_POLYDRAW

If an object type changes, LVectorObject::LockObject and LVectorObject::UnlockObject will return WRPERR_VECTOR_INVALID_OBJECT_TYPE. Object properties can still be inspected and changed by using LVectorObject::GetObjectAttributes and LVectorObject::SetObjectAttributes.

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:

LVectorObject::SetScale, LVectorObject::SetTranslation

Topics:

Working with Vector Objects

Example

This example will rotate a vector object under pPoint.

L_INT LVectorObject__SetRotationExample(HWND hWnd, LVectorBase *pVector, LPPOINT pPoint)
{
   UNREFERENCED_PARAMETER(hWnd);
   LVectorObject  VectorObject;
   L_INT          nRet;
   nRet = pVector->HitTest(pPoint, &VectorObject);
   if (nRet==SUCCESS)
   {
      VECTORPOINT pointRotate;
      pointRotate.x =  0;
      pointRotate.y =  0;
      pointRotate.z = 90;
      nRet = VectorObject.SetRotation(&pointRotate);
      if(nRet != SUCCESS)
         return nRet;
   }
   else
      return nRet;
   return SUCCESS;
}