Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » GMF (Graphical Modeling Framework) » custom figures
custom figures [message #192222] Thu, 12 June 2008 04:40 Go to next message
Amro Al-Akkad is currently offline Amro Al-AkkadFriend
Messages: 33
Registered: July 2009
Member
hello!

I've some questions concerning custom figures:

1)Is it possible to create figures that consists of lines that are
straight and round like a curve. In particular, I'm referring to figures
we created with a sketch tool:
a)input port(http://www.scribd.com/doc/3321556/in), and
b)output port (http://www.scribd.com/doc/3321554/out).

(I know the images are tiny, but if you doubleclick them it'll be ok.)

2)And what about a comp figure, as at
(http://www.scribd.com/doc/3321555/comp)?
3)Please, last but not least take a look at
((http://www.scribd.com/doc/3321602/pipeline).
This shows a pipeline example.

For 1)a)1)b), (see the links above) it is important that the Labels are
placed above in the Center of the figures; I have checked out the Taipan
Example, as there are interesting images, but the labels are always below
or besides the element.

What is further important for me is to be able to modify from code the
Label (for accessing its color, font, size...) of each element, its
foreground and background color.

Any help is appreciated!

Regards,
Amro
Re: custom figures [message #192286 is a reply to message #192222] Thu, 12 June 2008 11:38 Go to previous messageGo to next message
Alexander Shatalin is currently offline Alexander ShatalinFriend
Messages: 2928
Registered: July 2009
Senior Member
Hello Amro Al-Akkad,

> 1)Is it possible to create figures that consists of lines that are
You can always create your own figure (subclass of Shape) and use outlineShape(Graphics
graphics) method for painting your shapes (it is possible to draw arcs there).

> 2)And what about a comp figure, as at
Again. you can paint everything inside outlineShape/fillShape methods or
use image to represent diagram element.

> 3)Please, last but not least take a look at
Looks like a composition of custom figures + custom figures used for labels..

> For 1)a)1)b), (see the links above) it is important that the Labels
> are placed above in the Center of the figures; I have checked out the
You can place any label upon your custom figure using layouts (StackLayout).
See http://www.eclipsecon.org/2008/index.php?page=sub/&id=33 7 as an example
- "subnet" figure used in this presentation is a composite figure containing
SVG image and label displayed upon this image.

-----------------
Alex Shatalin
Re: custom figures + runtime exception [message #192705 is a reply to message #192286] Sun, 15 June 2008 09:10 Go to previous messageGo to next message
Amro Al-Akkad is currently offline Amro Al-AkkadFriend
Messages: 33
Registered: July 2009
Member
hi Alex!

thanks that has helped already a lot.
Both of the port figures--like (http://www.scribd.com/doc/3321556/in)-- I
like to draw, consist of three lines and one arc. So, the best thing is
to use a Path.
It worked fine as a SWT Application-- to draw and fill the figure.

However I received an exception when trying it with GMF:
(start)
!ENTRY org.eclipse.ui 4 0 2008-06-15 10:26:53.281
!MESSAGE Unhandled event loop exception
!STACK 0
org.eclipse.swt.SWTException: Failed to execute runnable
(java.lang.RuntimeException: The class: class
org.eclipse.gmf.runtime.draw2d.ui.render.internal.graphics.R enderedMapModeGraphics
has not implemented this new graphics function)
at org.eclipse.swt.SWT.error(SWT.java:3563)
at org.eclipse.swt.SWT.error(SWT.java:3481)
at
org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchr onizer.java:132)
at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.jav a:3659)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java :3296)
at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.jav a:2389)
at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2353)
at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:22 19)
at org.eclipse.ui.internal.Workbench$4.run(Workbench.java:466)
at
org.eclipse.core.databinding.observable.Realm.runWithDefault (Realm.java:289)
at
org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Work bench.java:461)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.j ava:149)
at
org.eclipse.ui.internal.ide.application.IDEApplication.start (IDEApplication.java:106)
at
org.eclipse.equinox.internal.app.EclipseAppHandle.run(Eclips eAppHandle.java:169)
at
org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher .runApplication(EclipseAppLauncher.java:106)
at
org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher .start(EclipseAppLauncher.java:76)
at
org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseS tarter.java:363)
at
org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseS tarter.java:176)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java: 508)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:447)
at org.eclipse.equinox.launcher.Main.run(Main.java:1173)
at org.eclipse.equinox.launcher.Main.main(Main.java:1148)
Caused by: java.lang.RuntimeException: The class: class
org.eclipse.gmf.runtime.draw2d.ui.render.internal.graphics.R enderedMapModeGraphics
has not implemented this new graphics function
at org.eclipse.draw2d.Graphics.subclassFunctionMission(Graphics .java:897)
at org.eclipse.draw2d.Graphics.drawPath(Graphics.java:202)
(...)

The graphics object (org.eclipse.draw2d.Graphics) expects for its methods:
'drawPath' and 'fillPath' not the 'org.eclipse.draw2d.graph.Path', but
'org.eclipse.swt.graphics.Path'--the same I've used for my SWT
application.
Changing the fore- and background color is quite important for us.
So, I need to use a path, and not 3 polylines in order to fill the inner
of the figure.
As far as I understood for the GraphicsRenderer this functionality has not
already been implemented. Or, do I misunderstand?

Any help is appreciated!

Reagards,
Amro
Re: custom figures + runtime exception [message #192786 is a reply to message #192705] Mon, 16 June 2008 09:59 Go to previous message
Alexander Shatalin is currently offline Alexander ShatalinFriend
Messages: 2928
Registered: July 2009
Senior Member
Hello Amro Al-Akkad,

You are right - currently used version of RenderedMapModeGraphics has no
implementation of 'drawPath' and 'fillPath' method. I suggest you using draw/fill
arc/polyline/polygon instead.

-----------------
Alex Shatalin
Previous Topic:GMF without a model elements file
Next Topic:Visual Aditor
Goto Forum:
  


Current Time: Fri Apr 19 03:37:38 GMT 2024

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

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

Back to the top