angle of rotation


Author
Message
Laura Monica Ibeas Poch
Laura Monica Ibeas Poch
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
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
Nevron Support
Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)
Group: Administrators
Posts: 3.1K, Visits: 4.2K

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
Laura Monica Ibeas Poch
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
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
Laura Monica Ibeas Poch
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
Posts: 8, Visits: 6

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


GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search