hide all comments

DSM-tech

Creating symbols

February 07, 2007 19:56:37 +0200 (EET)

Microsoft's Mike Hatch is trying to use DSL Tools to build a simple architecture modeling language, ArchiMate . To get an idea how simple the graphics are, look at the notation . Even so, he hit problems right at the very start: DSL Tools only supports some predefined arrowheads for roles -- the ends of the lines that attach to objects -- but he wanted a circle. With some help from the forum, he got things working by hand coding 50 lines of C# . The result includes such pearls as:

protected override System.Drawing.Drawing2D.GraphicsPath
GetPath(Microsoft.VisualStudio.Modeling.Diagrams.RectangleD bounds)

Since I wanted an excuse to play around with screencasts again, I made a quick one of how to do the same thing in MetaEdit+: draw a circle. Yup, that's it: took less than 10 seconds to open the Symbol Editor from the model, draw the circle, and save the change so the model updated on the fly. Just to prove that there's no "customization cliff" waiting right after a plain back circle, I went on to make the circle orange, with a radial fill to make the circle look like a sphere with light shining on it, and moved the center point of the fill to make it more 3D. Total lines of code: 0. Total time: 35 seconds (the movie carries on for another 10 because the otherwise impressive BB Flashback Express won't let me crop it).

If you're lucky, the screencast is below (339KB Flash). If it doesn't appear inline, you can go here. There's no sound, but you can scroll back and forth and refer to the previous paragraph if you feel lost.

Some things to spot:

  • The model updates instantly as soon as the changes to the symbol are saved. This makes it rather easier to get the right size than if you have to type "((float)(bounds.X + .01), (float)(bounds.Y + .01), (float)(bounds.Width * .8), (float)(bounds.Height * .8));", close the entire VisualStudio with the model, regenerate the XML files, recompile and link, and restart the entire VisualStudio with the model.
  • The green "Actor" symbol in the model takes about 30 seconds to draw. Fountain fills are just eye candy, but kind of tasty.
  • If you build a symbol in MetaEdit+ today, it will work in all future versions. If you build a symbol by writing 50 lines of code in DSL Tools today, I wouldn't place any bets that it will work in even the next minor release.
  • You caught me using a UML model! I promise it won't happen again...

Enclosures:
[http://www.metacase.com/blogs/stevek/images/rolesymbol.swf ( Size: Unknown )]