Profile Picture

angle of rotation

Posted By Laura Monica Ibeas Poch 13 Years Ago
Author
Message
Laura Monica Ibeas Poch
Posted 13 Years Ago
View Quick Profile
Forum Newbie

Forum Newbie (7 reputation)Forum Newbie (7 reputation)Forum Newbie (7 reputation)Forum Newbie (7 reputation)Forum Newbie (7 reputation)Forum Newbie (7 reputation)Forum Newbie (7 reputation)Forum Newbie (7 reputation)Forum Newbie (7 reputation)

Group: Forum Members
Last Active: 8 Years Ago
Posts: 8, Visits: 6

Hello:

I would like to save the shapes of a diagram in a database and later make the diagram from this database. I was thinking to save x, y, width, heigh and angle, but I can´t get this value. How can I do this?

Thank you

 



Nevron Support
Posted 13 Years Ago
View Quick Profile
Supreme Being

Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)

Group: Forum Members
Last Active: Last Week
Posts: 3,054, Visits: 4,009

Hi,

In order to store the rotation of the shape you need to save the shape's transformation matrix in you database. The transformation matrix stores the rotation, the scaling, the skew and the translation applied to the shape and can be obtained from the shape's Transform property.



Best Regards,
Nevron Support Team



Laura Monica Ibeas Poch
Posted 13 Years Ago
View Quick Profile
Forum Newbie

Forum Newbie (7 reputation)Forum Newbie (7 reputation)Forum Newbie (7 reputation)Forum Newbie (7 reputation)Forum Newbie (7 reputation)Forum Newbie (7 reputation)Forum Newbie (7 reputation)Forum Newbie (7 reputation)Forum Newbie (7 reputation)

Group: Forum Members
Last Active: 8 Years Ago
Posts: 8, Visits: 6

I have found it. The GetLengthOrientation method gives me the angle in radians, if I transform it to degrees I can store it in a database. Now, when I create the shape from database, the width is not working ok. I give the location, height and width and then rotate the shape, and it does not work ok. My code:

Dim rect As NShape = factory.CreateShape(BasicShapes.Rectangle)

Dim x As Single = CSng(fila.Item(tbplazas.XColumn.Caption).ToString)

Dim y As Single = CSng(fila.Item(tbplazas.YColumn.Caption).ToString)

Dim ancho As Single = CSng(fila.Item(tbplazas.AnchoColumn.Caption).ToString)

Dim alto As Single = CSng(fila.Item(tbplazas.AltoColumn.Caption).ToString)

Dim angulo As Single = CSng(fila.Item(tbplazas.AnguloColumn.Caption).ToString)

NDrawingDocument1.ActiveLayer.AddChild(rect)

rect.Height = alto

rect.Width = ancho

rect.Location = New NPointF(x, y)

rect.Name = fila.Item(tbplazas.IdColumn.Caption).ToString

rect.Rotate(CoordinateSystem.Scene, angulo, rect.Center)

Why the width is changed after the rotation?



Laura Monica Ibeas Poch
Posted 13 Years Ago
View Quick Profile
Forum Newbie

Forum Newbie (7 reputation)Forum Newbie (7 reputation)Forum Newbie (7 reputation)Forum Newbie (7 reputation)Forum Newbie (7 reputation)Forum Newbie (7 reputation)Forum Newbie (7 reputation)Forum Newbie (7 reputation)Forum Newbie (7 reputation)

Group: Forum Members
Last Active: 8 Years Ago
Posts: 8, Visits: 6

Thank you, I stored M11, M12, M21, M22, DX and DY and it seems to work fine.





Similar Topics


Reading This Topic