Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Graphiti » Insert image as shape
Insert image as shape [message #1006590] Thu, 31 January 2013 22:27 Go to next message
Emerson Simbolon is currently offline Emerson Simbolon
Messages: 12
Registered: April 2012
Junior Member
Hi all, I wonder whether Graphiti supports custom image as shape or not. I want to create components arrangement. Each component already has its own image defined. So, what I need is to arrange those image in Graphiti editor.

Thanks in advance.

Emerson
Re: Insert image as shape [message #1006687 is a reply to message #1006590] Fri, 01 February 2013 07:38 Go to previous messageGo to next message
Michael Wenz is currently offline Michael Wenz
Messages: 1270
Registered: July 2009
Location: Walldorf, Germany
Senior Member
Emerson,

there's a graphics algorithm image available, so instead of e.g. a rectangle
with text you could use that.

Michael
Re: Insert image as shape [message #1008626 is a reply to message #1006687] Wed, 13 February 2013 06:00 Go to previous messageGo to next message
Emerson Simbolon is currently offline Emerson Simbolon
Messages: 12
Registered: April 2012
Junior Member
Hi Wenz,

I don't understand how to use your instruction. I looked down the the gaService instance of Graphiti. I create an Image instance using "createImage(containershape,stringid)". I lost it when I didn't found any function related to how to set the picture url. Can you point me a code snippet to insert an image?

Thanks and regards.
Emerson
Re: Insert image as shape [message #1009724 is a reply to message #1008626] Fri, 15 February 2013 10:37 Go to previous messageGo to next message
Michael Wenz is currently offline Michael Wenz
Messages: 1270
Registered: July 2009
Location: Walldorf, Germany
Senior Member
Emerson,

images have an ID that is used from within a diagram and defined within the
image provider. The tutorial page
http://help.eclipse.org/juno/index.jsp?topic=%2Forg.eclipse.graphiti.doc%2Fresources%2Fdocu%2Fgfw%2Fimages.htm&cp=27_1_6
should give you an idea how to handle them.

Michael
Re: Insert image as shape [message #1009976 is a reply to message #1009724] Sat, 16 February 2013 01:00 Go to previous messageGo to next message
Emerson Simbolon is currently offline Emerson Simbolon
Messages: 12
Registered: April 2012
Junior Member
index.php/fa/13447/0/
What I want to achieve is described by picture above. I try to add image instance like this:
Image image = gaService.createImage(containerShape, GraphBTImageProvider.IMG_EREFERENCE);


But nothing happens, even the green box was not drawn. However, I tried to apply the registered image id (GraphBTImageProvider.IMG_EREFERENCE) to a ContextButton and it appeared. I think, the tutorial is not what I looking for (but still essential), or maybe I am mistaken something in using the registered image to a pictogram element.

[Updated on: Sat, 16 February 2013 01:04]

Report message to a moderator

Re: Insert image as shape [message #1011979 is a reply to message #1009976] Wed, 20 February 2013 11:11 Go to previous messageGo to next message
Michael Wenz is currently offline Michael Wenz
Messages: 1270
Registered: July 2009
Location: Walldorf, Germany
Senior Member
Emerson,

Sorry for the late reply, this somehow dropped in the depths of the forum...

Are the sizes set correctly for the image? Default is 0, so nothing
appears. Also you may need to set stretch/proportional flags on the image
depending on the size.

Michael
Re: Insert image as shape [message #1012018 is a reply to message #1011979] Wed, 20 February 2013 12:54 Go to previous messageGo to next message
Emerson Simbolon is currently offline Emerson Simbolon
Messages: 12
Registered: April 2012
Junior Member
Thanks Michael, now it works Smile

However, to make sure I will use the feature, I want to ask, can I add/register the picture at run time. E.g, user just added a picture through a form, then, he opens the Graphiti editor. At that time, the picture shows up in the palette, ready to be included in the canvas. If this is not possible, maybe I will code the feature myself. But, if it is possible, I'll worship Graphiti for make me save my precious hours.

Thanks as always.
Emerson
Re: Insert image as shape [message #1012910 is a reply to message #1012018] Fri, 22 February 2013 07:50 Go to previous message
Michael Wenz is currently offline Michael Wenz
Messages: 1270
Registered: July 2009
Location: Walldorf, Germany
Senior Member
Emerson,

basically, the image provider manages a hash map containing ids and paths
for your images. You should be able to call addImageFilePath also after the
user added the picture. What you would need to care about yourself would be
removal of images in case you want to support that as well.

Michael
Previous Topic:OPTION_SCHEMA_LOCATION has no effect
Next Topic:Drawing 2 different connections for same source and target pictograms
Goto Forum:
  


Current Time: Fri May 24 05:11:58 EDT 2013

Powered by FUDForum. Page generated in 0.07351 seconds