.. _UML Diagrams:

UML Diagrams
============


You can create UML diagrams by right-clicking on a struct or unit in any of the views and selecting **Show Diagram** or from the editor, right-click on a struct or unit name and select :menuselection:`Show --> Diagram`.

.. |select-types| image:: ../../images/icons/obj16/graphviz_select.png
   :class: inline

.. |preferences| image:: ../../images/icons/obj16/graphviz_preferences.png
   :class: inline

You can select the relevant structs or units for which to draw the diagram from the **Select Types** button |select-types| (see :ref:`UML Diagrams - Select Types`).

For the *selected* structs, the diagram can display inheritance, associations (pointers) and class members |preferences| (see :ref:`UML Diagrams - Preferences`).

.. note::

	To see the inherited pointers of a struct or unit, you need to *select* its parents and show at least one level of associations.

For the description of diagram drawing conventions go to :ref:`UML Diagrams - Legend`.

In the diagram editor you can right-click on structs and select :guilabel:`Go To Source` to jump to the source code.

You can jump to the declaration of a field, event, or method via right-click :guilabel:`Go To Source`.

To show or hide members of a struct or unit use right-click :guilabel:`Members`.

.. figure:: ../../images/edt-class-diagram-new.png
	:align: center



.. _UML Diagrams - Select Types:

UML Diagrams - Select Types
~~~~~~~~~~~~~~~~~~~~~~~~~~~



A diagram is created around a set of relevant structs you specify. For example when you decide to show parents, children or associations (from :ref:`UML Diagrams - Preferences`) it applies only to selected structs. In a diagram the selected structs are colored with yellow fill (see also the :ref:`UML Diagrams - Legend`).

The right list shows the selected structs. Use left/right arrows or double click to select the relevant classes.

.. figure:: ../../images/edt-class-diagram-select-new.png
	:align: center




You can also add/remove an element to/from the current selection by right clicking on it in the diagram and choosing :guilabel:`"Select Type"/"Deselect Type"`:

.. figure:: ../../images/edt-class-diagram-select_classes_rightclick-new.png
	:align: center




.. seealso::

  :ref:`UML Diagrams`
  
  :ref:`UML Diagrams - Select Types`
  
  :ref:`UML Diagrams - Legend`


.. _UML Diagrams - Preferences:

UML Diagrams - Preferences
~~~~~~~~~~~~~~~~~~~~~~~~~~



For the selected structs you can choose to show parents, children, associations (pointers), customize the graph layout etc.

.. figure:: ../../images/common/dvt-class-diagram-preferences-new.png
	:align: center




You may choose to:

-  Show all, selected only, a specified depth or no parents for selected classes
-  Show all, selected only, a specified depth or no children for selected classes
-  Show all, selected only, a specified depth or no associations (pointers) for selected classes
-  Show all, public or no members - fields, events, methods and tasks - for the selected classes
-  Customize the graph layout
-  Show full method signature
-  Show labels on association edges
-  Route edges orthogonally
-  Show package information
-  Group by package


.. seealso::

  :ref:`UML Diagrams`
  
  :ref:`UML Diagrams - Select Types`
  
  :ref:`UML Diagrams - Legend`

.. _UML Diagrams - Legend:

UML Diagrams - Legend
~~~~~~~~~~~~~~~~~~~~~



.. list-table::
   :header-rows: 1
   :widths: auto

   * - .. figure:: ../../images/common/edt-class-diagram-legend-a-struct-new.png
     - A struct.
   * - .. figure:: ../../images/common/edt-class-diagram-legend-selected-struct-new.png
     - A selected struct.
   * - .. figure:: ../../images/common/edt-class-diagram-legend-struct-with-members-new.png
     - A selected struct with members. The cells are (in order) for fields, events, and methods (functions and tasks). Each member name is preceded by an access modifier flag: ``+ (plus)`` for public, ``- (minus)`` for private, ``# (hash)`` for protected, and ``~ (tilda)`` for package. Fields that are not generated have an extra ``! (exclamation mark)``, and those that are physical have a ``% (percent)`` after the access modifier flag.
   * - .. figure:: ../../images/common/edt-class-diagram-legend-predefined-struct-new.png
     - A predefined struct.
   * - .. figure:: ../../images/common/edt-class-diagram-legend-inheritance-new.png
     - Inheritance like: a_child_struct inherits from a_parent_struct. Inheritance when: GOOD a_child_struct inherits from a_child_struct.
   * - .. figure:: ../../images/common/edt-class-diagram-legend-association-new.png
     - Association: a_struct points to b_struct (has a field p_to_b of type b_struct).
   * - .. figure:: ../../images/common/edt-class-diagram-legend-irrelevant-when-new.png
     - Relevant/Irrelevant when subtype: GOOD packet, SMALL packet and GOOD SMALL packet are relevant when subtypes (such packet extensions are explicitly defined), BAD packet (dotted gray box) is an irrelevant when subtype (no explicit BAD packet extension).


.. seealso::

  :ref:`UML Diagrams`
 
  :ref:`UML Diagrams - Select Types`
 
  :ref:`UML Diagrams - Legend`
