[Drawkit] Evolved DXF --> DK Example Application
Allan Daly
allandaly at me.com
Fri Oct 30 21:48:49 PDT 2009
Hi DK list,
I just published another slightly more polished DK application that
allows for DXF import. This one uses the multiple-document
architecture and provides a simple tool and layers palette. For both
these palettes I think I've finally kicked the problems created by
Cocoa sending the "documentDidChange" notifications too early (I hope)
so that when new documents are created or you navigate away from, then
back to, the application the tool and layer palettes get all out of
synch. The DKDemo application has this problem if you look carefully.
Also, the DXFReader framework has been updated to include
notifications as the DXF file parsing proceeds so that the client
application can find out what's happening and provide feedback to the
user. This new example app uses progress indicators to track both the
DXF parsing and the subsequent DK object creation.
There are a number of other features listed below. I hope this will be
a useful demo application for anyone learning DK and/or learning the
DXFReader framework. The example app can be found at http://brown-bird.net/Projects/DKDocTest.html
.
-Allan
DKDocTest Application Key Features:
Implements the DKDrawingDocument Multiple-Document Structure
* allows for multiple independent documents to co-exist
* each document tracks different layers, tool selections, etc
* documents can be saved and opened, etc
* saved documents use the native DKDrawingDocument format (.drawing)
so can be opened by other DK-based apps
Layer Palette that implements NSOutlineView
* allow drag and drop to reorder layers and move layers in to / out of
layer groups
* shows visible and locked status of layers and layer groups
* correctly deals with fetching and refreshing layers when creating
new documents and navigating to/from other apps in Finder
Extends (via category) DKDrawingDocument for easy DKLayerGroup creation
* creates a new method called "newLayerGroupWithLayer:" that creates a
layer group with some default layers inside
Implements a Simple Tool Palette
* tool palette allows for selection of DK tools
* tool palette sets "sticky" tool property when a tool is double-clicked
* tool palette provides visual feedback of "sticky" tool status
(checkbox)
* tool palette allows user to set "sticky" status directly (checkbox)
* implements a "pan" or "hand" tool (code provided by Graham Cox)
* correctly deals with fetching and refreshing tool selection and
"sticky" status when creating new docs and navigating to/from other apps
Provides DXF Import
* under the "Testing" menu there is a DXF import feature
* uses the DXFReader library
* DXFReader library has been upgraded to provide notifications to
allow a client application to track DXF parsing progress
* uses a progress sheet with NSProgressIndicator feedback to user on
DXF parsing and DK object creation status
* provides a detailed example of how to use the DXFReader library and
to convert the results to DK objects
* creates layers in the new DK document that match the layers in the
DXF file
* creates a layer group for all the DXF layers for easy management of
those layers
* NOTE: DXF import only handles these entities at this time
- LINE
- POLYLINE
- ARC
- CIRCLE
- TEXT
- MTEXT
- INSERTs and BLOCKs containing the entities listed above
Provides simple example text and shape insert code
* under the "Testing" menu there are example commands for adding text,
shapes, layers, and layer groups
* code for these commands may be helpful to those starting out with DK
(like me a year ago)
Misc
* configures and uses a drawing grid set up for feet and inches
* "View" menu allows enable/disable of rulers
Custom Changes to DrawKit
* I deleted the test inside the DKShapeGroup that tests to see if more
than one object is being assigned to a group -- this allows a single
object to be placed inside of a group (allowed in DXFs and I can't see
a problem with it in DK -- a bit strange, but logical)
* Notifications added to DKToolController to signal when the
"automaticallyRevertsToSelectionTool" property changes
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.apptree.net/pipermail/drawkit-apptree.net/attachments/20091030/29b1be7a/attachment.htm>
More information about the Drawkit
mailing list