Rotate GraphicsAlgorithm [message #1265616] |
Thu, 06 March 2014 05:15  |
Eclipse User |
|
|
|
Hello everybody!
I want to rotate some GraphicsAlgorithms like rectangles, polygons, polylines, etc. by an self defined int value (angle).
For example something like this (whereas there is no method called rotate):
Shape shape = peCreateService.createShape(containerShape, false);
Rectangle rectangle = gaService.createRectangle(shape);
rectangle.rotate(270);
In tis example it would be a rotation by 270°.
Can somebody help me?
|
|
|
|
|
|
|
|
Re: Rotate GraphicsAlgorithm [message #1385394 is a reply to message #1270793] |
Fri, 06 June 2014 02:55  |
Eclipse User |
|
|
|
I want to refer on that topic again, as I haven't found a solution yet.
I have defined some quite extensive shapes as following:
There is a container shape placed somewhere on the graphical editor (not he origin of course), which contains other shapes (rectangles, lines, polygons, etc.). All these basic shapes in the container form a complex overall shape.
In some cases I want to rotate that compound shape by an defined angle. Of course it would be the best solution to just rotate the container and the content would be rotated automatically (that would be the case if the container rectangle would define its own coordinate system) but unfortunately it is not possible. I also tried to translate each of the shapes to the origin, rotate it by using coordinate transformation
http://en.wikipedia.org/wiki/Transformation_matrix#Rotation
and then translate it back to the original position. But as the shapes are really complex, I am not able to represent them properly.
I also thought about using Graphics2D - as it supports AffineTransform - by converting the Graphiti shapes into Graphics2D shapes, rotate them and then transform them back to Graphiti shapes. But in my oppinion this is not a really good solution, as Graphics2D and Graphiti are quite different.
What in your opinion would be the best solution to realise that?
P.S. It would be sufficient to just rotate the elements by 90°, 180° and 270° for now.
[Updated on: Fri, 06 June 2014 02:57] by Moderator
|
|
|
Powered by
FUDForum. Page generated in 0.05798 seconds