Skip to main content



      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 06:06 Go to next message
Eclipse UserFriend
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 06: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 08:09 Go to previous messageGo to next message
Eclipse UserFriend
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 14:21 Go to previous message
Eclipse UserFriend
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: Tue Jul 08 09:25:47 EDT 2025

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

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

Back to the top