[Drawkit] SVG / other file format support

scott.francis at thomsonreuters.com scott.francis at thomsonreuters.com
Mon May 12 11:42:08 PDT 2008


I have been a bit of a lurker on this list, but I would wholeheartedly
endorse SVG as a native file format.  I had hoped to look at tackling
something similar but it is a couple items down my list.

At first blush your idea about different parsers seems to make sense.  I
would imagine you would want to implement Version 1.1 of the SVG spec
first, but there are some things in 1.2 that I find attractive (text
flow).  This would allow some separation of the two so a Version 1.2
parser could build off the 1.1.

Anyway, I'm with you, for whatever that is worth.

-Scott Francis 

-----Original Message-----
From: drawkit-bounces at lists.apptree.net
[mailto:drawkit-bounces at lists.apptree.net] On Behalf Of Brad Larson
Sent: Monday, May 12, 2008 1:21 PM
To: drawkit at lists.apptree.net
Subject: [Drawkit] SVG / other file format support

After a significant delay, I'm starting to work on porting our drawing
software across to DrawKit.  One thing that we will need is native
load/save support for our custom XML file format, and we're looking at
moving to SVG.  I am willing to add this functionality to DrawKit, but I
noticed that you have SVG import and export on the roadmap and I thought
I'd get your thoughts first before I started.

How, architecturally, would you like this to be added?  Personally, I
would like to see SVG as a native file format for DrawKit, rather than
something you have to do a File | Import and Export for.  It is a highly
extensible standard that a lot of people are getting behind (including
Apple with WebKit).  Inkscape uses SVG as its native file format and it
seems to keep up well with all of its capabilities.  If you'd prefer to
have different file formats be handled via import and export instead of
the standard load / save functions, I could do that, too.

Right now, all loading from disk is handled with a simple unarchiver in
DKDrawing's drawingWithData: method that takes only an NSData object.
If you were able to pass in the filename or extension, you might be able
to have different parsers for different file extensions (svg, svgz, dxf,
ai, etc.) within this method.  The same could be done  
in reverse for the writeToFile:atomically: method.   This would make  
it possible to do different file formats during the load / save
operation.  If so, would you want separate helper classes for each
different file type, load / save methods under DKDrawing, or DKDrawing
categories for each file type?

I figure saving would be accomplished by iterating through the internal
store of objects and calling an svgRepresentation method, or something
corresponding to the file format, on them.  This might be where separate
categories for the file formats would be useful, so that the drawing
objects could each have their own input / output methods.

I wanted to check first so that anything I did would not conflict with
anything you had in mind or had already started.

______________________
Brad Larson
SonoPlot, Inc.
3030 Laura Lane, Suite 120
Middleton, WI 53562



_______________________________________________
Drawkit mailing list
Drawkit at lists.apptree.net
http://lists.apptree.net/listinfo.cgi/drawkit-apptree.net


More information about the Drawkit mailing list