Rotates the class object. This function is available in the LEADTOOLS Vector Imaging Toolkit.
#include "ltwrappr.h"
L_INT LVectorObject::SetRotation(pRotation, pOrigin=NULL)
Pointer to a VECTORPOINT structure that contains the rotation values for each axis. The rotation values are in degrees.
Pointer to a VECTORPOINT structure that contains the center of rotation If pOrigin is NULL, the center of the class object.
Value | Meaning |
---|---|
SUCCESS | The function was successful. |
< 1 | An error occurred. Refer to Return Codes. |
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.
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;
}