Friday, May 3, 2024
 Popular · Latest · Hot · Upcoming
4
rated 0 times [  4] [ 0]  / answers: 1 / hits: 8276  / 1 Year ago, sun, february 5, 2023, 4:50:20

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.


More From » libreoffice

 Answers
5

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!


[#43168] Monday, February 6, 2023, 1 Year  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
heathree

Total Points: 157
Total Questions: 132
Total Answers: 108

Location: Honduras
Member since Mon, Apr 5, 2021
3 Years ago
;