Image as a Node [message #653371] |
Wed, 09 February 2011 14:58 |
akoeck Messages: 62 Registered: December 2010 |
Member |
|
|
I want to use a image as my node.
But I'm not realy sure how to do this. My image is a simple PNG-image. So how do I make this? Using an SVGFigure, a CustomFigure or what else?
Maybe there is an official or unoffical tutorial. But I couldn't find one.
Thanks in advance.
[Updated on: Wed, 09 February 2011 14:58] Report message to a moderator
|
|
|
|
Re: Image as a Node [message #653867 is a reply to message #653822] |
Fri, 11 February 2011 16:00 |
No real name Messages: 3 Registered: February 2011 |
Junior Member |
|
|
Hi,
I don't understand why no one is answering this simple question. Very sad.
I also need to know how to add images, but I was afraid to ask because lots of questions aren't answered here, although there are lots of viewers. I didn't had this experience in other expert forums so far. Can't believe no one knows the answer, too. But maybe there aren't enough active experts in here.
If the question is too easy and already came up hundreds of times so that the mods are tired of it, there should be a FAQ or some sticky thread with this topic. And one could a least give a hint if this question already has been answered somewhere. It's not always easy to find the right stuff (especially without an advanced search)
To the thread starter:
I tried to do it as described in the linked thread too but it's not working. There are no errors showing up since I added the missing import statements etc, but there's also no image showing up in my rectangle.
Some questions:
1) Does it only work for svg images?
2) Did you specify anything else in your figure descriptor than mentioned in that rough explanation from the thread you posted? (some property, child access or anything else)
3) How do I have to specify the image folder correctly? Is it like
"icons/..." or
"/icons/..." or
"package_name/icons/..."
or do I need to specify a
new path("icons/...")
first?? How can I even check if it's correct without trying and compiling over and over again? I just don't know if the path is correct.
4) What "dependency" exactly do I have to add in the plugin.xml?
Thanks & regards,
Alex
[Updated on: Fri, 11 February 2011 16:03] Report message to a moderator
|
|
|
Re: Image as a Node [message #653971 is a reply to message #653867] |
Sat, 12 February 2011 07:50 |
akoeck Messages: 62 Registered: December 2010 |
Member |
|
|
No Real Name wrote on Fri, 11 February 2011 11:00 | Hi,
1) Does it only work for svg images?
|
I'm using PNG's, so it chould also work with other types of images.
Quote: |
2) Did you specify anything else in your figure descriptor than mentioned in that rough explanation from the thread you posted? (some property, child access or anything else)
|
Only the normal stuff:
Figure Gallery
--Figure Descriptor
----Rectangle
------CustomFigure (with the properties from the link)
Node (MyFigure)
Quote: |
3) How do I have to specify the image folder correctly? Is it like
"icons/..." or
"/icons/..." or
"package_name/icons/..."
or do I need to specify a
new path("icons/...")
first?? How can I even check if it's correct without trying and compiling over and over again? I just don't know if the path is correct.
|
This is how I add my image:
URL url = Platform.getBundle("Your_Plug-In_ID").getEntry("/images/image.png");
ScalableImageFigure mYFigure = new ScalableImageFigure(RenderedImageFactory.getInstance(url), true, true, true);
this.add(mYFigure);
Quote: |
4) What "dependency" exactly do I have to add in the plugin.xml?
|
The missing Dependency was org.eclipse.gmf.runtime.draw2d.ui.render
[Updated on: Sat, 12 February 2011 07:52] Report message to a moderator
|
|
|
|
Re: Image as a Node [message #654110 is a reply to message #653975] |
Mon, 14 February 2011 09:11 |
akoeck Messages: 62 Registered: December 2010 |
Member |
|
|
No Real Name wrote on Sat, 12 February 2011 04:17 | Thanks for your reply!
Unfortunately the image is still not appearing in the node
I think something must be wrong about the URL.
No Real Name wrote on Sat, 12 February 2011 02:50 |
This is how I add my image:
URL url = Platform.getBundle("Your_Plug-In_ID").getEntry("/images/image.png");
ScalableImageFigure mYFigure = new ScalableImageFigure(RenderedImageFactory.getInstance(url), true, true, true);
this.add(mYFigure);
|
"Your_Plug-In_ID" is the value from "plugin.xml -> overview -> ID", right?
In your example, the folder "/images" is on the same level as the "src" folder in your plugin-project, right?
Do you have any other suggestions how I could create the URL? (there seem to be several different possibilities)
Cheers,
Alex
|
Yes, the ID is the value from the plugin.xml.
My Images folder is on the same level like the plugin.xml.
Don't know if there is another way to get the correct path.
Are you sure you got the dependencys all right?
|
|
|
Powered by
FUDForum. Page generated in 0.04865 seconds