Thursday, January 20, 2011

Boo Shapes Plugin (Part III)

Almost succeeded to make Boo shapes to have library like coding.
This code have little relation with the previous post about Boo shapes. The previous code was to export your code to Boo, to make possible to "survive" to NaroCAD XML document changes.
This code changes are shapes that if they implement ShapeLibrary class (or for Boo: BooShapeLibrary) they are accessible in an unified way and they can be made to NaroCAD as composed shapes.
I've bin hit by some Boo compiler bugs so this is a new BooShapeLibrary class defined which did make me to not finish yet (probably tomorrow or over the weekend will be last issues pinned down).
What will mean for now? That will be defined two actions/shapes (regular polygon and gear) as live shapes and the code will be separated by a contract based design, and as in future if desired any complex shapes can be defined using the same template, will make possible to define and compose shapes from here. So both gear and regular polygon are defined on top of simple shapes. Another part is that you can define complex shapes from both from Boo/C# and looking from BooGearPlugin source-code you can identify easier where is shape creation and where is event creation. This is important for complex shape creation and when you want to separate preview from code.
What may mean for future? It may mean that a Library View may be added and will expose all those shapes in an unified manner, and all dependencies will be solved in a similar fashion as MetaActions/Property grid. At the end you will be able to benefit from shapes that will be hard to be defined just from clicks, but also imply some more complex definition with relation with extern code and some default values that also may be provided as shape dependencies.

No comments: