Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    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 05:19 Go to next message
oinkl is currently offline oinklFriend
Messages: 17
Registered: September 2010
Junior Member
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 17:18 Go to previous messageGo to next message
Felix L J Mayer is currently offline Felix L J MayerFriend
Messages: 202
Registered: July 2009
Senior Member
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] Mon, 20 December 2010 01:29 Go to previous message
oinkl is currently offline oinklFriend
Messages: 17
Registered: September 2010
Junior Member
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: Thu Apr 25 09:24:58 GMT 2024

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

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

Back to the top