|
Re: Is draw2d for me? [message #240448 is a reply to message #240432] |
Mon, 07 January 2008 08:05 |
Eclipse User |
|
|
|
Originally posted by: Gerhard.Hinterndorfer.pedrics.at
Hi Bryan,
in my opinion the real advantage of draw2D starts if you want be able to
select your figures (leafs of your tree) separately later on: change the
colours, change the mouse pointer, display a tooltip, ...
If you just want to draw the polygons I think SWT would be fine. The SWT
example from http://www.eclipse.org/swt/examples.php show also how to
use zoom and scroll.
@Draw2D: generally you need to decide if you want use absolute or
relative coordinates in your figures (see e.a.
http://help.eclipse.org/help32/index.jsp?topic=/org.eclipse. draw2d.doc.isv/guide/coordinates.html
)
> understand the XYLayout. I simply want to add a child figure to a
> parent at a specific x, y location within the parent. ....
Some Layouts in draw2D need a constrain, that they can operate probably.
In case of the XYLayout you need to pass a rectangle as constraint. All
figures connected with this XYLayout Object are extended to that passed
"rectangle constraint".
Maybe in your case it could be also an alternative to work without any
Layout? Then the figures dimensions are used to display ....
@scrolling in draw2D: have a look to
http://publib.boulder.ibm.com/infocenter/rtnlhelp/v6r0m0/ind ex.jsp?topic=/org.eclipse.draw2d.doc.isv/reference/api/org/e clipse/draw2d/doc-files/demo3.html
for an example.
Maybe also ScrollableThumbnail is something for you? Here a short example:
import org.eclipse.draw2d.parts.ScrollableThumbnail;
======= code snippet start =============
.. . .
// a ScrollPane for viewing the Figure
ScrollPane scroll = new ScrollPane();
.. . .
// new thumbnail including displaying the viewport of the
// scroll pane
ScrollableThumbnail thumb =
new ScrollableThumbnail(scroll.getViewport());
// the thumbnail shal displaying all the figures
thumb.setSource(figure);
======= code snippet end =============
hipe that helps
cheers
Gerhard
Bryan Hunt wrote:
> I have a database that describes a tree of polygons where a parent
> polygon provides a x,y list of its verticies, and the x, y coordinate of
> the starting vertex of each child contained within the parent. I need
> to display this data such that the first layer of children are visible
> and drilling down into a child will make the child the top level polygon
> with it's children now rendered. I also need to support zoom and
> scrolling. Is draw2d for me?
>
> I've looked a bit a draw2d and it seems it might work, but I don't quite
> understand the XYLayout. I simply want to add a child figure to a
> parent at a specific x, y location within the parent. Is that what the
> "constraint" is for? Is there a good example I can look at?
>
> Is there a good example that shows how to draw polygons in a ViewPart?
>
> Bryan
>
|
|
|
Powered by
FUDForum. Page generated in 0.03098 seconds