Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » GMF (Graphical Modeling Framework) » SVG Format.
SVG Format. [message #490763] Sat, 10 October 2009 10:18 Go to next message
Eclipse UserFriend
Originally posted by: asif.tmcp.gmail.com

Hi All,

I am using the SVG figure in the GMF to create diagram elements.

I basically have a gif image which i want to convert to svg.

When I use "Delineate" the images get displayed correctly. While I use
Illustrator the image appears as a broken link.

There seems to be a major difference in the Delineate generated output and
the one generated by Adobe Illustrator.

============== Delineate ============
<?xml version="1.0" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 363.0 363.0">
<rect fill="#FFFFFF" width="363.0" height="363.0"/>
<g stroke="none">
<path fill="#000000" d="M0 0L0 1L0 2L0 3L0 4L0 5L0 6L0 7L0 8L0 9L0 10L0 11L0
12L0 13L0 14L0 15L0 16L0 17L0 18L0 19L0 20L0 21L0 22L0 23L0 24L0 25L0 26L0
27L0 28L1 28L1 27L1 26L1 25L1 24L2 24L2 23L2 22L2 21L3 21L3 20L3 19L4 19L4
18L4 17L5 17L5 16L6 16L6 15L6 14L7 14L7 13L7 12L8 12L9 12L9 11L10 11L10
10L10 9L11 9L12 9L12 8L13 8L13 7L14 7L14 6L15 6L15 5L16 5L17 5L17 4L18 4L19
4L19 3L20 3L21 3L21 2L22 2L23 2L24 2L24 1L25 1L26 1L27 1L27 0L26 0L25 0L24
0L23 0L22 0L21 0L20 0L19 0L18 0L17 0L16 0L15 0L14 0L13 0L12 0L11 0L10 0L9
0L8 0L7 0L6 0L5 0L4 0L3 0L2 0z"/>
..
..
..
<path fill="#f7b062" d="M231 9L232 10z"/>
<path fill="#f29a31" d="M232 9L233 10z"/>
<path fill="#f6ad58" d="M24 10L25 11z"/>
<path fill="#f7b062" d="M234 10L235 11L234 10M22 11L23 12L22 11M236 11L237
12z"/>
<path fill="#f5a345" d="M20 12L21 13z"/>
<path fill="#000000" d="M28 362L29 363z"/>
</g>
</svg>


=========== Adobe Illustrator ==============

<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 13.0.0, SVG Export Plug-In . SVG Version:
6.00 Build 14948) -->
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.0//EN"
"http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd">
<svg version="1.0" id="Layer_1" xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
width="363px" height="363px" viewBox="0 0 363 363" enable-background="new
0 0 363 363" xml:space="preserve">
<image overflow="visible" width="363" height="363"
xlink:href=" data:image/gif;base64,R0lGODlhawFrAff/AP///++DAe+EAu+EA/CIDf SgQ/KXMvShRfGNG/CNGu+DAvCMF/CMFu+HCfCI
DO+HCvCLE/KWMPKXMfGQIvOeQPKULPGOHu+GCPCMGPGTKfWnUfCLFPGRI/Od P++GBvOcPvOcPPCJ
D++FBvCKEfavXvewYvapVfrIkvKWLvexZPGTKvOZNvKXNPSfQvOaOPOZN/KV LvKYNfGPIfGOHfSh
R/SiSPSjSfrIkPeyZ/WkTPWmT/WlTu+FBPWnUPezafObOv7z5vnChvarWPi1 bPGSJfGSJvi2b/i3
cfnAgvWoVPm+f/vNnPi6dvevYPatXPauXfrEivrKlvi5dPrUqvaqVvrGjvnB hPrGjfrMmfrDifrC
iPvhwvCKEPasWvi4cvm8e/KVKfzcufSmSvGOHPm+fvObNfOaOfKYNPObOfSg RPGPH/KVLfGPIPKX
M/GOH/ShRvm9ffSjSvWlTfWpUfWnUvrYsPOcPfGTKPGSJ/GRJfGSKPi7eP3p 1PawYPasW/atW/So
TvrJlPCIC/rKlPexZfrLmPe0avrFjPzkyfrMm/CJEPi1a++GB/m/gP3s2ffB gP769fOkRPKaMfCG
Cfa2b/jIkfjEh/WuXva6cfCMEvGQHvOjQvCGB/GQIPOYL/KUJfGMF/CLFfGN GvKSIvGMFPGOGfGN
GfOeOfGPHfOaM/KTJPCKEvCLEvWyYfSiRPGTI/nGjvOdNvCIDvCPGfSiQvnF jPzn0PWyYv7w4fGP
HPGNGPCLFvSgP/ShQPSfPPScN/jChP/79//7+PSnTPatWPGRIfnDiPCOFu+G CfrHkPCLEf737/Wq
VfKSIfe+evWsVf3v3vauWvCJDvKUJ/GMFvatXvGNF/eyZfe3b/KRIvW0ZvrQ ofCKE/ShRPnIk/GM
Gfi+ffzmzfnJlfGMGPWvW/i+fvi+f/jMmPe7dPGNHfaoUfOlR/GLFfOfPfGN Fvm/f/aqVfWwXfjM
..
..
..
KRdq8sEqu6wvMssbvzxzxjGbTDPOA9tsc849n7sz0Hf6PLS0QRv9G9FJ+3o0 0y2ppDTUoDZtbEAA
Ow==">
</image>
</svg>
======================================================

Any idea what is the difference? Althought both are rendered correctly by
internet browsers using the adobe plugin svgviewer, but GMF renders only the
delineate output correctly.

Thanks and Regards,
asif
Re: SVG Format. [message #490783 is a reply to message #490763] Sat, 10 October 2009 16:07 Go to previous messageGo to next message
Alex Shatalin is currently offline Alex ShatalinFriend
Messages: 141
Registered: July 2009
Senior Member
Hello Asif,

If you have gif image (not SVG) then I suggest you create custom subclass
of ScalableImageFigure pointing passing this as an argument of super() constructor
call and use this custom figure in .gmfgraph. This looks like more straightforward
solution – you should not convert image to some specific format in this case..

-----------------
Alex Shatalin
Re: SVG Format. [message #490831 is a reply to message #490783] Sun, 11 October 2009 18:07 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: asif.tmcp.gmail.com

Hi alex,

Thanks for the response

This is what I tried :

Defined a class CustomScalableFigure subclassing ScalableImageFigure:

public class CustomScalableFigure extends ScalableImageFigure{
private ScalableImageFigure fFigureCustomScalableFigure;
public CustomScalableFigure(RenderedImage image)
{
super(image, True, True, True);
createContents();
}

Now in gmfgraph for Node A
Figure Descriptor AFigure
-- Custom Figure AFigure {Qualified Class Name xxx.CustomScalableFigure}

The generate code is :



public class AEditPart extends ShapeNodeEditPart {

protected IFigure createNodeShape() {

URL url = null;

url = FileLocator.find(SmexDiagramEditorPlugin.getInstance().getBu ndle(),
new Path("images/ipdslam.svg"), null);

RenderedImage img = RenderedImageFactory.getInstance(url);



AFigure figure = new AFigure(img);

return primaryShape = figure;

}

==== altered the generated AFigure code as follows ============

public class AFigure extends CustomScalableFigure {

public AFigure(RenderedImage image) {

super(image,true,true,true);

createContents();

}

===================== The Problem =========================
I am not getting the image rendered at all. I just get an empty box ( the
size of the image) with appropriate Labels, but there is no image displayed.
The URL passed is appropriate.

Do I have to set any properties like height or width?

Sorry for the long mail.

Kind Regards,
asif

"Alex Shatalin" <shatalin@gmail.com> wrote in message
news:b79abbae192c48cc17ebae2ffcf2@news.eclipse.org...
> Hello Asif,
>
> If you have gif image (not SVG) then I suggest you create custom subclass
> of ScalableImageFigure pointing passing this as an argument of super()
> constructor call and use this custom figure in .gmfgraph. This looks like
> more straightforward solution - you should not convert image to some
> specific format in this case..
>
> -----------------
> Alex Shatalin
>
>
Re: SVG Format. Ignore Previous Post [message #490833 is a reply to message #490831] Sun, 11 October 2009 18:13 Go to previous message
Eclipse UserFriend
Originally posted by: asif.tmcp.gmail.com

Hi,

Sorry for the confusion. There was an obvious mistake in the code.
Layout was being called both in the subclass as well as the base class.

I assume layout should only be called in the sub-class.

It works perfectly now, including the resizing of the images.

Thanks and Kind REgards,
asif


"Asif M" <asif.tmcp@gmail.com> wrote in message
news:hat6tf$tkl$1@build.eclipse.org...
> Hi alex,
>
> Thanks for the response
>
> This is what I tried :
>
> Defined a class CustomScalableFigure subclassing ScalableImageFigure:
>
> public class CustomScalableFigure extends ScalableImageFigure{
> private ScalableImageFigure fFigureCustomScalableFigure;
> public CustomScalableFigure(RenderedImage image)
> {
> super(image, True, True, True);
> createContents();
> }
>
> Now in gmfgraph for Node A
> Figure Descriptor AFigure
> -- Custom Figure AFigure {Qualified Class Name
> xxx.CustomScalableFigure}
>
> The generate code is :
>
>
>
> public class AEditPart extends ShapeNodeEditPart {
>
> protected IFigure createNodeShape() {
>
> URL url = null;
>
> url = FileLocator.find(SmexDiagramEditorPlugin.getInstance().getBu ndle(),
> new Path("images/ipdslam.svg"), null);
>
> RenderedImage img = RenderedImageFactory.getInstance(url);
>
>
>
> AFigure figure = new AFigure(img);
>
> return primaryShape = figure;
>
> }
>
> ==== altered the generated AFigure code as follows ============
>
> public class AFigure extends CustomScalableFigure {
>
> public AFigure(RenderedImage image) {
>
> super(image,true,true,true);
>
> createContents();
>
> }
>
> ===================== The Problem =========================
> I am not getting the image rendered at all. I just get an empty box ( the
> size of the image) with appropriate Labels, but there is no image
> displayed.
> The URL passed is appropriate.
>
> Do I have to set any properties like height or width?
>
> Sorry for the long mail.
>
> Kind Regards,
> asif
>
> "Alex Shatalin" <shatalin@gmail.com> wrote in message
> news:b79abbae192c48cc17ebae2ffcf2@news.eclipse.org...
>> Hello Asif,
>>
>> If you have gif image (not SVG) then I suggest you create custom subclass
>> of ScalableImageFigure pointing passing this as an argument of super()
>> constructor call and use this custom figure in .gmfgraph. This looks like
>> more straightforward solution - you should not convert image to some
>> specific format in this case..
>>
>> -----------------
>> Alex Shatalin
>>
>>
>
>
>
Previous Topic:Link property with 4 field...i don't set all [URGENT]
Next Topic:diagram inside of a new view
Goto Forum:
  


Current Time: Thu Apr 18 03:22:21 GMT 2024

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

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

Back to the top