Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Sirius » Export custom figures
Export custom figures [message #1737100] Tue, 05 July 2016 16:53 Go to next message
Iain Whiteside is currently offline Iain WhitesideFriend
Messages: 17
Registered: June 2016
Junior Member
Hi,

I am using Sirius 4.0.

I have defined several custom edit parts, and corresponding Draw2D/GEF figures. When I attempt to export to anything other than JPEG, I get an error (for SVG, for example):

The class org.eclipse.sirius.diagram.ui.tools.internal.render.SiriusGraphicsSVG has not implemented this new graphics function.

In fact, JPEG doesn't even work correctly as my two labels (defined using the Draw2D label and FlowPage figures) are not being displayed.

My question is whether this should be expected or if it is a bug? If expected, is there a mechanism by which I can define export functions for my figures?
Re: Export custom figures [message #1737139 is a reply to message #1737100] Wed, 06 July 2016 06:03 Go to previous messageGo to next message
Maxime Porhel is currently offline Maxime PorhelFriend
Messages: 516
Registered: July 2009
Location: Nantes, France
Senior Member
Hi Iain,


Le 05/07/2016 à 18:53, Iain Whiteside a écrit :
> Hi,
>
> I am using Sirius 4.0.
>
> I have defined several custom edit parts, and corresponding Draw2D/GEF
> figures. When I attempt to export to anything other than JPEG, I get an
> error (for SVG, for example):
>
> The class
> org.eclipse.sirius.diagram.ui.tools.internal.render.SiriusGraphicsSVG
> has not implemented this new graphics function.

Do you have the complete error stack ? It might help us to identify the
problem.

>
> In fact, JPEG doesn't even work correctly as my two labels (defined
> using the Draw2D label and FlowPage figures) are not being displayed.
>
> My question is whether this should be expected or if it is a bug? If
> expected, is there a mechanism by which I can define export functions
> for my figures?

I looked in SiriusGraphicsSVG hierarchy and found the following
candidates methods which will throws the same exception:
.. translate(float, float) -> try to use translate(int, int)
.. shear(float, float)
.. setTextAntialias(int)
.. setLineDashOffset(float)
.. setInterpolation(int)
.. setForeGroundPattern(Pattern)
.. scale(foat, float) -> try to use scale(double)
.. rotate(float)
.. getTextAntialias()
.. getLineMiterLimit()
.. getLineCap()
.. getLineJoin()


Note that SiriusGraphicsSVG/SiriusGraphicsToGraphics2DAdaptor have been
copied from
org.eclipse.gmf.runtime.draw2d.ui.render.awt.internal.graphics.GraphicsToGraphics2DAdaptor/org.eclipse.gmf.runtime.draw2d.ui.render.awt.internal.svg.export.GraphicsSVG
which seems to correct some of those issues.


We might need more clues (the stack will be a good start) to be able to
help you to find which method causes the rpoblem in your case and give
some advices to wrokaround the problem in a first time.

Could you open a Bugzilla [1] to track the issue ?


Regards,
--
Maxime - Obeo

Need training or professional services for Sirius?
http://www.obeodesigner.com/sirius
--
[1] https://bugs.eclipse.org/bugs/enter_bug.cgi?product=Sirius


Maxime Porhel - Obeo

Need training or professional services for Sirius?
http://www.obeodesigner.com/sirius
Re: Export custom figures [message #1737141 is a reply to message #1737139] Wed, 06 July 2016 06:19 Go to previous messageGo to next message
Maxime Porhel is currently offline Maxime PorhelFriend
Messages: 516
Registered: July 2009
Location: Nantes, France
Senior Member
Le 06/07/2016 à 08:03, Maxime Porhel a écrit :
> Note that SiriusGraphicsSVG/SiriusGraphicsToGraphics2DAdaptor have been
> copied from
>
org.eclipse.gmf.runtime.draw2d.ui.render.awt.internal.graphics.GraphicsToGraphics2DAdaptor/org.eclipse.gmf.runtime.draw2d.ui.render.awt.internal.svg.export.GraphicsSVG
>
> which seems to correct some of those issues.

I wrongly read getTextAntialias instead of getAntialias(). After a
closer look as the classes we used to copy, they did not change since
our copy, so the problem you encounter would also occur during export of
image ith the default GMF classes.


--
Maxime - Obeo

Need training or professional services for Sirius?
http://www.obeodesigner.com/sirius


Maxime Porhel - Obeo

Need training or professional services for Sirius?
http://www.obeodesigner.com/sirius
Re: Export custom figures [message #1737285 is a reply to message #1737141] Wed, 06 July 2016 22:44 Go to previous messageGo to next message
Iain Whiteside is currently offline Iain WhitesideFriend
Messages: 17
Registered: June 2016
Junior Member
Thanks for the helpful replies.

It looks like the problem stems from my use of org.eclipse.draw2d.Graphics.setBackgroundPattern(Pattern p), which is not supported in the Graphics class that SiriusGraphicsSVG extends. In fact, SiriusGraphicsToGraphics2DAdaptor provides a method using GradientPoint, which is the java.awt equivalent. Is this a mistake, or is there a missing translation from Pattern to GradientPoint? I can file a bugzilla if required.

Re: Export custom figures [message #1738546 is a reply to message #1737285] Wed, 20 July 2016 17:50 Go to previous messageGo to next message
Iain Whiteside is currently offline Iain WhitesideFriend
Messages: 17
Registered: June 2016
Junior Member
Hi,

Just checking if the behaviour mentioned in my previous reply is intended or a bug? Shall I open a bugzilla?

Thanks!

Iain

Re: Export custom figures [message #1738587 is a reply to message #1738546] Thu, 21 July 2016 07:12 Go to previous message
Maxime Porhel is currently offline Maxime PorhelFriend
Messages: 516
Registered: July 2009
Location: Nantes, France
Senior Member
Hi,

Le 20/07/2016 à 19:50, Iain Whiteside a écrit :
> Hi,
>
> Just checking if the behaviour mentioned in my previous reply is
> intended or a bug? Shall I open a bugzilla?

The behavior you mention is intended : the image generator creates AWT
images.

For your background pattern case, you might look at
org.eclipse.sirius.diagram.ui.tools.api.figure.GradientHelper.setColorsGradation(Graphics,
ViewGradientFigureDesc) which is used by Sirius to handle the gradient
of containers (in
org.eclipse.sirius.diagram.ui.tools.api.figure.GradientRoundedRectangle.fillShape(Graphics)
for example). It will do is the translation from Pattern to
GradientPoint for you, if you have the good type of figure. Otherwise
you will see how we manage and cache it.

>
> Thanks!
>
> Iain
>
>

Regards,

--
Maxime - Obeo

Need training or professional services for Sirius?
http://www.obeodesigner.com/sirius


Maxime Porhel - Obeo

Need training or professional services for Sirius?
http://www.obeodesigner.com/sirius
Previous Topic:Update cells in a cross table
Next Topic:Prevent Default Sirius ViewOrdering
Goto Forum:
  


Current Time: Thu Apr 25 02:03:24 GMT 2024

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

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

Back to the top