| 1 |
Saving and loading Gaphor diagrams |
|---|
| 2 |
|
|---|
| 3 |
The idea is to keep the file format as simple and extensible as possible. |
|---|
| 4 |
|
|---|
| 5 |
This is the format as used by Gaphor. |
|---|
| 6 |
|
|---|
| 7 |
Everything interesting is between the `Gaphor' start and end tag. |
|---|
| 8 |
|
|---|
| 9 |
The file is as flat as possible: UML elements (including Diagram) are at |
|---|
| 10 |
toplevel, no nesting. |
|---|
| 11 |
A UML element can have two tags: `Reference' and `Value'. Reference is used to |
|---|
| 12 |
point to other UML elements, Value has a value inside (an integer or astring). |
|---|
| 13 |
|
|---|
| 14 |
Diagram is a special case. Since this element contains a diagram canvas inside, |
|---|
| 15 |
it may become pretty big (with lots of nested elements). |
|---|
| 16 |
This is handled by the load and save function of the Diagram class. |
|---|
| 17 |
All elements inside a canvas have a tag `Item'. |
|---|
| 18 |
|
|---|
| 19 |
<?xml version="1.0" ?> |
|---|
| 20 |
<Gaphor version="1.0"> |
|---|
| 21 |
<Element type="Model" id="1"> |
|---|
| 22 |
<Reference name="ownedElement" refid="2"/> |
|---|
| 23 |
<Reference name="ownedElement" refid="3"/> |
|---|
| 24 |
<Reference name="ownedElement" refid="4"/> |
|---|
| 25 |
</Element> |
|---|
| 26 |
<Element type="Diagram" id="2"> |
|---|
| 27 |
<Reference name="namespace" refid="1"/> |
|---|
| 28 |
<Canvas extents="(9.0, 9.0, 189.0, 247.0)" grid_bg="0xFFFFFFFF" |
|---|
| 29 |
grid_color="0x80ff" grid_int_x="10.0" grid_int_y="10.0" |
|---|
| 30 |
grid_ofs_x="0.0" grid_ofs_y="0.0" snap_to_grid="0" |
|---|
| 31 |
static_extents="0"> |
|---|
| 32 |
<CanvasItem affine="(1.0, 0.0, 0.0, 1.0, 0.0, 0.0)" cid="0x8292114" |
|---|
| 33 |
type="CanvasGroup"> |
|---|
| 34 |
<CanvasItem affine="(1.0, 0.0, 0.0, 1.0, 150.0, 50.0)" cid="0x8293e74" |
|---|
| 35 |
height="78.0" subject="3" type="Actor" width="38.0"/> |
|---|
| 36 |
<CanvasItem affine="(1.0, 0.0, 0.0, 1.0, 10.0, 10.0)" cid="0x82e7d74" |
|---|
| 37 |
height="26.0" subject="5" type="Comment" width="100.0"/> |
|---|
| 38 |
</CanvasItem> |
|---|
| 39 |
</Canvas> |
|---|
| 40 |
</Element> |
|---|
| 41 |
<Element type="Actor" id="3"> |
|---|
| 42 |
<Value name="name"> |
|---|
| 43 |
<![CDATA[Actor]]> </Value> |
|---|
| 44 |
<Reference name="namespace" refid="1"/> |
|---|
| 45 |
</Element> |
|---|
| 46 |
<Element type="UseCase" id="4"> |
|---|
| 47 |
<Reference name="namespace" refid="1"/> |
|---|
| 48 |
</Element> |
|---|
| 49 |
<Element type="Comment" id="5"/> |
|---|
| 50 |
</Gaphor> |
|---|