Hello Paolo,
Sorry about the late response.
Shape Scripts provide a means to override the presentation of EA's drawn elements (nodes, paths, and labels).
In the case of nodes, scripts may control the drawing of the entire node, or just the little icons that sometimes appear in the top left corner (eg. Tables).
The bounding box of a node is a canvas for the scripts to draw on. A number of commands are at users' disposal to draw geometric primitives such as lines, rectangles, ellipses, arcs, polygons, and text.
Paths have 3 overridable regions: the line segments and the two arrow heads. The arrow heads each have rectangular canvas' that scripts may draw to, just like nodes. The canvas's rotate with the line, or may be at a fixed orthagonal angle protruding from joining element. Each line segment of a path may also become a canvas that is rotated so that the top corners of the canvas are the respective start and end points of the segment.
We've provided basic conditional branching based on properties of the element being drawn. This means users can dynamicly change the appearance of a particuar node by changing say it's status type, or by adding a particular tagged value.
The shapescripts are applied to elements based on the elements Type & Stereotype - just like the current Metafile override facility (for those unfamiliar with this feature please see Configuration->Stereotypes->UML).
There are a few limitations - at this stage the language is pretty basic; expressions are limited to the condition part of an if statement and currently are no user definable variables. Only properties of the drawn element are exposed; traversing to data in other parts of the model is not currently supported.
Hopefully these limitations may be overcome in time.
Here's an example script that results in a element being drawn as it usually would, but with a small circle being drawn in the the top right region of a node - the circle is green if the node has the status of "Approved", red otherwise:
decoration dot
{
//Position the decoration in the
//north eastern region of the node
orientation = "ne";
if(HasStatus("Approved"))
SetFillColor(0,255,0); //Set the fill to green
else
SetFillColor(255,0,0); //Set the fill to red
StartPath();
//Draw a circle with the bounding rect of
//x1=0%, y1=0%, x2=100%, y2=100%
Ellipse(0,0,100,100);
EndPath();
//Paint the path
FillAndStrokePath();
}
The following script replaces the entire element with a rectangle, and draws it's name in the center:
shape main
{
h_align = "center";
v_align = "center";
StartPath();
Rectangle(0,0,100,100);
EndPath();
FillAndStrokePath();
Print("#NAME#");
}
Questions are welcome.
Ash