Skip to main content



      Home
Home » Eclipse Projects » GEF » How to extend Figure to create a rectangle with a line?
How to extend Figure to create a rectangle with a line? [message #644016] Thu, 09 December 2010 00:19 Go to next message
Eclipse UserFriend
I'm using GEF as a drawing editor to draw and create custom shapes. There is a scale on the left side of the editor.

One of the shapes I'm trying to produce is a rectangle. 2 lines extend from the top and bottom edge of the rectangle toward the scale (essentially to help the user measure the height of the rectangle). In other words, the lines start from the very left of the screen, and end at the top left and bottom left corner of the rectangle. The lines should move with the rectangle even if it gets moved or resized.

How do I extend RectangleFigure to produce these 2 lines? I'm playing with layouts, and adding PolyLines to the figure, but it doesn't seem to be working. I'm not sure how to retrieve the corrdinates to pass to Polyline, and even if I input some arbitrary values, the line gets cut off and bounded by the rectangle. I can't get it to extend to the scale.


Any advice? Thanks.
Re: How to extend Figure to create a rectangle with a line? [message #645604 is a reply to message #644016] Sat, 18 December 2010 12:18 Go to previous messageGo to next message
Eclipse UserFriend
I think you have 3 options:

1. Make a figure that covers the entire area between the rectangle and the scale. Then you can draw whatever you like inside that figure. Maybe the rectangle would be just a child of that figure.

2. Implement the lines as connections between the rectangle and the scale, using specialized anchors to ensure that the lines go to the right place.

3. Draw the lines only inside of the scale figure, dependent on the selected rectangle.
Re: How to extend Figure to create a rectangle with a line? [message #645696 is a reply to message #645604] Sun, 19 December 2010 20:29 Go to previous message
Eclipse UserFriend
I've managed to solve the problem by overriding the getContentPane() method on the parent edit part, and creating 2 children edit parts that draw the lines on the diagram.
Previous Topic:Drag & drop in Outline view is completely broken
Next Topic:serialize GEF Diagram
Goto Forum:
  


Current Time: Fri Apr 18 07:23:58 EDT 2025

Powered by FUDForum. Page generated in 0.02931 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top