Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Graphiti » Ability to get visible size of diagram?
Ability to get visible size of diagram? [message #876086] Wed, 23 May 2012 18:01 Go to next message
Brian Fitzpatrick is currently offline Brian Fitzpatrick
Messages: 495
Registered: July 2009
Senior Member
Hi all...

I have to say that though Graphiti was a little rough to get going with at first, once I got over the first hump we've been making great progress on our editor.

We've had a request however that I'm not quite sure how to handle. Is there a way to get the visible size of the editor as opposed to the full size of the diagram?

For instance, if the editor's "view port" on the diagram is only 300x400 and the full diagram is 1024x768, is there a way to determine how much is visible?

I've been poking about in previous forum posts, the docs, and the APIs but haven't seen a way to do this yet.

Any ideas?

Thanks in advance and thanks for the great framework!
--Fitz
Re: Ability to get visible size of diagram? [message #876307 is a reply to message #876086] Thu, 24 May 2012 06:50 Go to previous messageGo to next message
Michael Wenz is currently offline Michael Wenz
Messages: 1531
Registered: July 2009
Location: Walldorf, Germany
Senior Member
Hm, there's no Graphiti API for that, but you may retrieve the information
directly from the GEF graphical viewer in the editor.

Michael
Re: Ability to get visible size of diagram? [message #876475 is a reply to message #876307] Thu, 24 May 2012 13:27 Go to previous messageGo to next message
Brian Fitzpatrick is currently offline Brian Fitzpatrick
Messages: 495
Registered: July 2009
Senior Member
Do you by chance have an example?

I was able to figure this out:
GraphicalViewer gv = SwitchyardSCAEditor.getActiveEditor().getGraphicalViewer();
org.eclipse.graphiti.ui.internal.editor.GFFigureCanvas canvas = (org.eclipse.graphiti.ui.internal.editor.GFFigureCanvas) gv.getControl();
int viewwidth = canvas.getViewport().getClientArea().width;
int viewheight = canvas.getViewport().getClientArea().height;


But unfortunately the GraphicalViewer doesn't seem to be instantiated by the time I need the dimensions to resize the shape I want to resize...
Re: Ability to get visible size of diagram? [message #876701 is a reply to message #876475] Fri, 25 May 2012 02:24 Go to previous message
Erdal Karaca is currently offline Erdal Karaca
Messages: 703
Registered: July 2009
Senior Member
Another [quick and dirty] workaround (which should work, I think) would be to remember the parent Composite provided in createPartControl of the editor and ask for its size, i.e. the editor would be responsible for obtaining the "viewport" size...
Previous Topic:How do I override equals() of diagram editor input
Next Topic:trying to create a simulator using Graphiti
Goto Forum:
  


Current Time: Thu Apr 24 14:57:35 EDT 2014

Powered by FUDForum. Page generated in 0.01724 seconds