Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Graphiti » SVG Export(Save Image as SVG)
SVG Export [message #644015] Thu, 09 December 2010 05:08 Go to next message
Murthy Bhat is currently offline Murthy BhatFriend
Messages: 159
Registered: July 2009
Senior Member
Hello,

I have been trying out GRAPHITI for some time now and exploring in graphiti some common features available in GEF/GMF. I have a requirement to save the image as 'SVG', Well I could easily export my IFigure into svg in gef and gmf, I am not finding a way in graphiti to do it.

I tried to export the IFigure as I would normally do in GEF( as below) but am hitting some exceptions.

public static void saveAsSVG(String saveLocation, IFigure rootFigure) {
Rectangle rootFigureBounds = rootFigure.getBounds();
GraphicsSVG graphics = GraphicsSVG.getInstance(rootFigureBounds.getTranslated(rootF igureBounds.getLocation().negate()));
SVGIDGenerator generator = new SVGIDGenerator();

graphics.getSVGGraphics2D().getGeneratorContext().setIDGener ator(generator);
graphics.translate(rootFigureBounds.getLocation().negate());
rootFigure.paint(graphics);
OutputStream outputStream = null;
try {
outputStream = new FileOutputStream (saveLocation);
graphics.getSVGGraphics2D().stream(new BufferedWriter(new OutputStreamWriter(outputStream)));
} catch (Exception e) {
e.printStackTrace();
}
}

It appears to me like some controls in graphiti do not support the same graphics element . Could someone please help me out here.

Thanks in advance.

Regards,
Murthy
Re: SVG Export [message #644028 is a reply to message #644015] Thu, 09 December 2010 07:32 Go to previous messageGo to next message
Murthy Bhat is currently offline Murthy BhatFriend
Messages: 159
Registered: July 2009
Senior Member
After a little investigation I was able to find that the svg export works perfectly fine if my diagram does not contain any Texts,Labels. I am hitting a 'NotImplemented' exception from graphics exactly at line graphics.setTextAntialias(SWT.ON); in GFText.java

Any thoughts ?

Re: SVG Export [message #644030 is a reply to message #644028] Thu, 09 December 2010 07:54 Go to previous messageGo to next message
Matthias Gorning is currently offline Matthias GorningFriend
Messages: 81
Registered: April 2010
Location: Germany
Member
If you install the graphiti plugin "org.eclipse.graphiti.export.batik" it is possible to save the diagram (or only selected parts) as type svg. From the context menu choose "Export Diagram...".

But we faced the same problem: Text and Labels are not exported.
Re: SVG Export [message #644047 is a reply to message #644030] Thu, 09 December 2010 09:02 Go to previous messageGo to next message
Tim Kaiser is currently offline Tim KaiserFriend
Messages: 118
Registered: July 2009
Senior Member
Hi Murthy

you can install the new feature

org.eclipse.graphiti.sdk.plus.feature

from our update site.
It contains the svg export functionality.

Text should be rendered correctly if you export the whole diagram.

Does it work?

Best, Tim





"Matthias Gorning" <matthias.gorning@sap.com> wrote in message
news:idq1m9$fj3$1@news.eclipse.org...
> If you install the graphiti plugin "org.eclipse.graphiti.export.batik" it
> is possible to save the diagram (or only selected parts) as type svg. From
> the context menu choose "Export Diagram...".
> But we faced the same problem: Text and Labels are not exported.
Re: SVG Export [message #644049 is a reply to message #644047] Thu, 09 December 2010 09:29 Go to previous message
Murthy Bhat is currently offline Murthy BhatFriend
Messages: 159
Registered: July 2009
Senior Member
Hello Tim,

Thanks. It helped. It works lbeautifully.

Regards,
Murthy
Previous Topic:rectilinear connection routing
Next Topic:Grid width and resizing
Goto Forum:
  


Current Time: Fri Mar 29 11:03:39 GMT 2024

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

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

Back to the top