I am drawing a state transition diagram using LibreOffice draw on Ubuntu 11.04. I am able to get almost everything that I needed except the final state. Typically we use two circles embedded in for showing a final state of a state transition diagram. Could someone help me to do that? Please also let me know if there are any better tools for drawing state transition diagrams on Ubuntu. I have looked at Dia, but it is not also useful to draw final state of a state transition diagram like in this.
-
1You might also want to check out LaTeX' very versatile TikZ package: tex.stackexchange.com/questions/45734/drawing-graphs-in-latex and doofussoftware.blogspot.de/2012/07/…. I was also able to find a package in the official repositories that seems to be able to generate STDs.– GlutanimateMay 2, 2013 at 10:22
4 Answers
Actually Dia does allow you to add an end state. Select the UML shapes, then drag the "initial/end state" shape onto your diagram. When you double click the shape, you'll see a button that says "Is final". This lets you define whether the state is initial or final.
EDIT: If you don't like how those look, it's pretty easy to create your own shapes in Dia. They're just SVG files.
Save the following as ~/.dia/shapes/fsm_final_state.shape
:
<?xml version="1.0"?>
<shape xmlns="http://www.daa.com.au/~james/dia-shape-ns"
xmlns:svg="http://www.w3.org/2000/svg">
<name>Finite State Machine - Final State</name>
<icon>fsm_final_state_icon.xpm</icon>
<connections>
<point x="0.0" y="2.5" />
<point x="2.5" y="5.0" />
<point x="5.0" y="2.5" />
<point x="2.5" y="0.0" />
</connections>
<textbox x1="0.0" y1="0.0" x2="5.0" y2="5.0" />
<svg:svg width="5.0" height="5.0">
<svg:circle style="fill: default;" cx="2.5" cy="2.5" r="2.5" />
</svg:svg>
<svg:svg width="4.0" height="4.0">
<svg:circle style="fill: default;" cx="2.5" cy="2.5" r="2.0" />
</svg:svg>
</shape>
Save the following as ~/.dia/shapes/fsm_final_state_icon.xpm
:
/* XPM */
static char * fsm_final_state_icon_xpm[] = {
"16 16 14 1",
" c None",
". c #FFFFFF",
"+ c #FCFCFC",
"@ c #B6B6B6",
"# c #545454",
"$ c #000000",
"% c #101010",
"& c #D8D8D8",
"* c #121212",
"= c #353535",
"- c #A0A0A0",
"; c #EBEBEB",
"> c #040404",
", c #9E9E9E",
"................",
"....+@#$%#@+....",
"...&*=-.;-=*&...",
"..&>,......,>&..",
".+*,........,*+.",
".@=..........=@.",
".#-..........-#.",
".%;..........;%.",
".%;..........;%.",
".#-..........-#.",
".@=..........=@.",
".+*,........,*+.",
"..&>,......,>&..",
"...&*=-.;-=*&...",
"....+@#$%#@+....",
"................"};
Finally, save the following as ~/.dia/sheets/Finite_State_Machine.sheet :
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<sheet xmlns="http://www.lysator.liu.se/~alla/dia/dia-sheet-ns">
<!--File: ~/.dia/sheets/Finite_State_Machine.sheet-->
<name>Finite State Machine</name>
<description>Finite state machine diagrams</description>
<contents>
<!--add shapes here-->
<object name="Finite State Machine - Final State">
<description>Final</description></object>
</contents></sheet>
When you restart Dia you should have a "Finite State Machine" sheet with one shape: a decent looking final state!
-
Thank you. However, it seems that initial and final states are not looking as good as en.wikipedia.org/wiki/File%3aDFAexample.svg Please let me know if you know any other better tools.– samarasaOct 9, 2011 at 0:53
-
Edited my answer with an example of how to make your own shapes in Dia. ;-) Oct 9, 2011 at 1:18
I suggest you to use inkscape to produce graphics like that, it takes a little time to learn how to use the tools but it is well rewarded with the graphic quality of the product.
I suggest you to use Dia software for your state diagram or any other UML or flow diagrams. It contains numbers of shapes and easy drag drop facilities. So go for dia. For more information visit this link.
Lucidchart is a good option. Free version available and works in any decent browser. I know that there dev team are all running Linux so there is that as well because I work there :)