ImageEn for Delphi and C++ Builder ImageEn for Delphi and C++ Builder

 

ImageEn Forum
Profile    Join    Active Topics    Forum FAQ    Search this forumSearch
 All Forums
 ImageEn Library for Delphi, C++ and .Net
 ImageEn and IEvolution Support Forum
 [IEvolution] Rotating vectorial objects

Note: You must be registered in order to post a reply.
To register, click here. Registration is FREE!

View 
UserName:
Password:
Format  Bold Italicized Underline  Align Left Centered Align Right  Horizontal Rule  Insert Hyperlink   Browse for an image to attach to your post Browse for a zip to attach to your post Insert Code  Insert Quote Insert List
   
Message 

 

Emoji
Smile [:)] Big Smile [:D] Cool [8D] Blush [:I]
Tongue [:P] Evil [):] Wink [;)] Black Eye [B)]
Frown [:(] Shocked [:0] Angry [:(!] Sleepy [|)]
Kisses [:X] Approve [^] Disapprove [V] Question [?]

 
Check here to subscribe to this topic.
   

T O P I C    R E V I E W
Claus.Gerlach Posted - Jul 24 2012 : 01:30:01
In our application we use your IEViewer-component to label significant parts of a picture by taking advantage of IEAnnotations object. More specifically, we use points (IEObjectEllipse) for that work. After all sometimes it's necessary to rotate the picture. This will be done by using an additional layer and the "EnableRotateLayers"-property. To put the points on the right place I calculated new coordinates of the objects via matrix tranformation for rotation. This worked fine with IEvolution 4.0.1 component. But with version 4.1.2 it doesn't work. It seems that after rotation you use a new coordinate system. Is there a builtin function where I can rotate objects over a free selectable rotation center and free selectable rotation angel? Or is there a method of anchoring objects to a layer, so rotation of layer means also rotation of objects?

Best regards

Claus Gerlach
5   L A T E S T    R E P L I E S    (Newest First)
Claus.Gerlach Posted - Sep 06 2012 : 01:00:39
I solved the problem:

Rotation of objects didn't fail because of code (posted here) for matrix transformation. It was a problem of the layers.
Using the following code works with IEvolution 4.1.2:

//Adjust position of annotations according to rotation angle of image
private void btnRotateOK_Click(object sender, EventArgs e)
{
    IELayer layer;
 
    //Original code:
    //ieViewerLeft.Image.LayersRemove(0);
    //layer = ieViewerLeft.Image.GetLayer(0);
 
    //New code:
    layer = ieViewerLeft.Image.GetLayer(1);
 
    int center_of_rotation_x = (int) (layer.RotateCenterX * ieViewerLeft.Image.Width);
    int center_of_rotation_y = (int) (layer.RotateCenterY * ieViewerLeft.Image.Height);
    double rotation_angle = layer.Rotate;
 
    //Calling a method, where the annotations are rotated via matrix-transformation
    rotateObjects(ieViewerLeft.Image.Annotations, center_of_rotation_x, center_of_rotation_y, rotation_angle);
 
    ieViewerLeft.EnableRotateLayers = false;
           
    //New code:
    ieViewerLeft.Image.LayersRemove(0);
 
    //some more code…
}



Best regards

Claus Gerlach
Claus.Gerlach Posted - Aug 16 2012 : 01:13:06
Hello,

now I use this code without having a change in the result. It doesn't work, too:

/// <summary>
/// rotate objects over given rotation center and rotation angle
/// </summary>
/// <param name="objects"></param>
/// <param name="drehpunkt_x"></param>
/// <param name="drehpunkt_y"></param>
/// <param name="drehwinkel_grad"></param>
private void dreheObjekte(IEAnnotations objects,
int drehpunkt_x,
int drehpunkt_y,
double drehwinkel_grad)
{
// transform rotation angle from degree to radians
double winkel = drehwinkel_grad / 180 * Math.PI;
for (int i = 0; i < objects.ObjectsCount; i++)
{
IEObject obj = objects.GetObjectFromIndex(i);
IERect rect = obj.Rect;

int width_alt = rect.Rectangle.Width;
int height_alt = rect.Rectangle.Height;
// moving coordinates in order to put rotation center to origin point
rect.Left = rect.Left - drehpunkt_x;
rect.Top = rect.Top - drehpunkt_y;
// processing the matrix transformation
int x_alt = rect.Left;
int y_alt = rect.Top;
rect.Left = (int)(x_alt * Math.Cos(winkel) + y_alt * Math.Sin(winkel));
rect.Top = (int)(-x_alt * Math.Sin(winkel) + y_alt * Math.Cos(winkel));
// moving coordinates back
rect.Left = rect.Left + drehpunkt_x;
rect.Top = rect.Top + drehpunkt_y;
rect.Right = rect.Left + width_alt;
rect.Bottom = rect.Top + height_alt;

obj.Rect = rect;
}
}
fab Posted - Jul 30 2012 : 13:03:49
Coordinate system has not been changed in 4.1.2. Instead of set obj.Left and obj.Top you could try to retrieve the object rect using obj.Rect, set top-left coordinates and re-set obj.Rect with the new rectangle:

IERect objRect = obj.Rect;
...rotate objRect rectangle...
obj.Rect = objRect;
Claus.Gerlach Posted - Jul 26 2012 : 04:13:44
/// <summary>
/// rotate objects over given rotation center and rotation angle
/// </summary>
/// <param name="objects"></param>
/// <param name="drehpunkt_x"></param>
/// <param name="drehpunkt_y"></param>
/// <param name="drehwinkel_grad"></param>
private void dreheObjekte(IEAnnotations objects,
int drehpunkt_x,
int drehpunkt_y,
double drehwinkel_grad)
{
// transform rotation angle from degree to radians
double winkel = drehwinkel_grad / 180 * Math.PI;
for (int i = 0; i < objects.ObjectsCount; i++)
{
IEObject obj = objects.GetObjectFromIndex(i);
// moving coordinates in order to put rotation center to origin point
obj.Left = obj.Left - drehpunkt_x;
obj.Top = obj.Top - drehpunkt_y;
// processing the matrix transformation
int x_alt = obj.Left;
int y_alt = obj.Top;
obj.Left = (int) (x_alt * Math.Cos(winkel) + y_alt * Math.Sin(winkel));
obj.Top = (int) (-x_alt * Math.Sin(winkel) + y_alt * Math.Cos(winkel));
// moving coordinates back
obj.Left = obj.Left + drehpunkt_x;
obj.Top = obj.Top + drehpunkt_y;
}
}
fab Posted - Jul 26 2012 : 01:08:52
Please could you show the code used to rotate objects?