Re: SVG Parsing

This is very helpful, thanks.

I guess I got confused because when i plugged these rendered values into
a spreadsheet, and divided the template values by the rendered values,
they produced only roughly the same number, not exactly.  Would the
exact scale be lost in render/export ?

Thanks again,


On Mon, 2006-10-02 at 22:37 +0100, Ian Redfern wrote:
It looks like you're looking at router.shape, one of the Cisco ones I
converted from PostScript.

In Dia shapes, the absolute location and scale of the coordinate
system don't matter, and you can pick any origin and multiplier. So
for some A, B and C

svg.x = A + C*shape.x
svg.y = B + C*shape.y

The gsave/setmatrix are comments I left in to allow me to debug the
results of the PostScript conversion - they now serve no purpose.

You can turn the shapes into pure SVG by removing everything but the
<svg:path> tags and wrapping the whole thing in <svg

Ian Redfern.

On Mon, 2006-10-02 at 14:22 -0400, Jason Greenberg wrote: 
Hello,  I'm trying to parse the SVG/XML shape files in javascript, but
before I can even do that, I need to understand what the file format is.

Here's an example of a couple of lines that have been rendered in dia
and exported to svg format (This works great in firefox):

  <path style="fill: none; fill-opacity:0; stroke-width: 0.043; stroke:
#aae6ff" d="M 15.5506 6.3581 L 15.5506,7.43852"/>
  <path style="fill: none; fill-opacity:0; stroke-width: 0.043; stroke:
#000000" d="M 19.9658 6.3581 L 19.9658,7.43852"/>

This makes sense to me, and is fully usable.  The SVG .shape file format
seems to be encoded in a way that I don't understand - here's the same
paths from the shape file in its raw format:

<svg:path d="M1 1216L1 2949" style="stroke: #aae6ff; stroke-width: 0.43;
fill: none"/>
<svg:path d="M7083 1216L7083 2949" style="stroke: #000000; stroke-width:
0.43; fill: none"/>

1) How do the numerical values correspond?  (dividing doesn't seem to
produce the same multiplier)
2) What are these gsave and setmatrix indicators all about?

3) Fingers crossed - does anyone know of a way that I could easily
render these shape files in html using SVG?

Thanks so much!

Jay Greenberg
CCIE #11021

 This e-mail and any attachment is for authorised use by the intended
 recipient(s) only. It may contain proprietary material, confidential
  information and/or be subject to legal privilege. It should not be
copied, disclosed to, retained or used by, any other party. If you are
not an intended recipient then please promptly delete this e-mail and
   any attachment and all copies and inform the sender. Thank you.

Dia-list mailing list
Dia-list gnome org
FAQ at
Main page at

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]