Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » GMF (Graphical Modeling Framework) » export ecore model to an image
export ecore model to an image [message #219630] Sat, 21 February 2009 11:06 Go to next message
Sebastian is currently offline SebastianFriend
Messages: 14
Registered: July 2009
Junior Member
Hello!

I'm developing an application, that handles ecore models and diagrams. One
part should be, that diagrams are exported to image files automatically by
the application. There should be no diagram editor visible to the user. So
the solution with the context menu doesn't work.
I have a model and a diagram file and what I want to get is an image file.
Is there a possibility to use parts of gmf and emft to do this?


Sebastian
Re: export ecore model to an image [message #219646 is a reply to message #219630] Sat, 21 February 2009 11:33 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: thomas.beyer81.t-online.de

Hello Sebastian,

yes you can do so.
GMF provides all you need.

First of all, create a DiagramEditPart-instance with
OffScreenEditPartFactory and second use the CopyToImageUtil to save the
diagram to a file.
All works without ever opening an editor.
If you need further help, let me know.

Regards, Thomas


Sebastian schrieb:
> Hello!
>
> I'm developing an application, that handles ecore models and diagrams.
> One part should be, that diagrams are exported to image files
> automatically by the application. There should be no diagram editor
> visible to the user. So the solution with the context menu doesn't work.
> I have a model and a diagram file and what I want to get is an image file.
> Is there a possibility to use parts of gmf and emft to do this?
>
>
> Sebastian
>
>
Re: export ecore model to an image [message #219660 is a reply to message #219646] Sat, 21 February 2009 13:09 Go to previous messageGo to next message
Sebastian is currently offline SebastianFriend
Messages: 14
Registered: July 2009
Junior Member
Hello Thomas,

this is exactly that what I want to do. Thanks.
At the moment my problem is, that I don't know how to load an ecore
diagram file into a Diagram-Object. So I can't create a DiagramEditPart.
Can you give me a hint how should I do this, please?

regards
Sebastian
Re: export ecore model to an image [message #219677 is a reply to message #219660] Sat, 21 February 2009 19:21 Go to previous message
Sebastian is currently offline SebastianFriend
Messages: 14
Registered: July 2009
Junior Member
To get to Diagram object I tried to use the EcoreTools Plugin.

Resource resource =
EcoreDiagramEditorUtil.createDiagram(diagramURI,
modelURI, new SilentProgressMonitor());

Diagram diagram = (Diagram) resource.getContents().get(0);

With this I get a Diagram, but the export to an SVG-Imgae results only in
a SVG-Document with no graphical elements in it.

DiagramEditPart diagramEditPart = OffscreenEditPartFactory
.getInstance().createDiagramEditPart(diagram, new Shell());
CopyToImageUtil copyToImageUtil = new CopyToImageUtil();
copyToImageUtil.copyToImage(diagramEditPart, destination,
ImageFileFormat.SVG, new SilentProgressMonitor());

Where could be a mistake?


regards
Sebastian
Previous Topic:Keyboard navigation with GMF
Next Topic:test a gmf application
Goto Forum:
  


Current Time: Fri Apr 26 22:32:30 GMT 2024

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

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

Back to the top