Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » GMF (Graphical Modeling Framework) » Insert an image in a diagram node
Insert an image in a diagram node [message #967249] Thu, 01 November 2012 16:06 Go to next message
Hristina Pavlovska is currently offline Hristina PavlovskaFriend
Messages: 4
Registered: October 2012
Junior Member
Hi all,

I want to insert an .png image in a diagram node (no SVG). Has anyone experience to share on the subject?

What I did till now is:
- Created Figure descriptor in .gmfgraph by adding Rectangle->CustomFigure.
- Did the following changes in my XXEditPart code:

-----------------------------------------------
Image img = new Image(Display.getDefault(),"path_to_my_img");

ImageFigure imgF = new ImageFigure();
imgF.setImage(img);

// Add it to the figure
this.add(imgF);

// Set figure size as picture size
this.setMaximumSize(imgF.getSize());
this.setMinimumSize(imgF.getSize());

-----------------------------------------------

But no image appears on the diagram.

I'm looking forward to hear any suggestion.

Thanks,
Hristina
Re: Insert an image in a diagram node [message #972190 is a reply to message #967249] Mon, 05 November 2012 12:33 Go to previous message
Ralph Gerbig is currently offline Ralph GerbigFriend
Messages: 697
Registered: November 2009
Senior Member
Hi Hristina,

you could try to embed the png picture into an SVG file and use GMFGraph Model's capabilities for doing your job without any coding. This will save you the effort to customize the code generation templates in the end. What is the reason for insisting on PNG? If you use SVG figures your diagram will look much nicer in the end.

Ralph
Previous Topic:Access GMF Diagram Elements and Attributes/Properties
Next Topic:GMF Mindmap Example & Broken Links
Goto Forum:
  


Current Time: Fri Dec 19 12:22:09 GMT 2014

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

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