# eric6.Graphics.UMLClassDiagramBuilder

Module implementing a dialog showing a UML like class diagram.

### Global Attributes

None

### Classes

UMLClassDiagramBuilder | Class implementing a builder for UML like class diagrams.

### Functions

None

## UMLClassDiagramBuilder

Class implementing a builder for UML like class diagrams.

### Derived from

UMLDiagramBuilder

### Class Attributes

None

### Class Methods

None

### Methods

UMLClassDiagramBuilder | Constructor
__addExternalClass | Private method to add a class defined outside the module.
__addLocalClass | Private method to add a class defined in the module.
__arrangeClasses | Private method to arrange the shapes on the canvas.
__createAssociations | Private method to generate the associations between the class shapes.
__getCurrentShape | Private method to get the named shape.
buildDiagram | Public method to build the class shapes of the class diagram.
getPersistenceData | Public method to get a string for data to be persisted.
initialize | Public method to initialize the object.
parsePersistenceData | Public method to parse persisted data.

### Static Methods

None

#### UMLClassDiagramBuilder (Constructor)

UMLClassDiagramBuilder(dialog, view, project, file, noAttrs=False)

Constructor

dialog
  reference to the UML dialog (UMLDialog)
view
  reference to the view object (UMLGraphicsView)
project
  reference to the project object (Project)
file
  file name of a python module to be shown (string)
noAttrs=
  flag indicating, that no attributes should be shown (boolean)

#### UMLClassDiagramBuilder.__addExternalClass

__addExternalClass(_class, x, y)

Private method to add a class defined outside the module.

If the canvas is too small to take the shape, it is enlarged.

_class
  class to be shown (string)
x
  x-coordinate (float)
y
  y-coordinate (float)

#### UMLClassDiagramBuilder.__addLocalClass

__addLocalClass(className, _class, x, y, isRbModule=False)

Private method to add a class defined in the module.

className
  name of the class to be as a dictionary key (string)
_class
  class to be shown (ModuleParser.Class)
x
  x-coordinate (float)
y
  y-coordinate (float)
isRbModule
  flag indicating a Ruby module (boolean)

#### UMLClassDiagramBuilder.__arrangeClasses

__arrangeClasses(nodes, routes, whiteSpaceFactor=1.2)

Private method to arrange the shapes on the canvas.

The algorithm is borrowed from Boa Constructor.

nodes
  list of nodes to arrange
routes
  list of routes
whiteSpaceFactor
  factor to increase whitespace between items (float)

#### UMLClassDiagramBuilder.__createAssociations

__createAssociations(routes)

Private method to generate the associations between the class shapes.

routes
  list of relationsships

#### UMLClassDiagramBuilder.__getCurrentShape

__getCurrentShape(name)

Private method to get the named shape.

name
  name of the shape (string)

Returns:
  shape (QGraphicsItem)

#### UMLClassDiagramBuilder.buildDiagram

buildDiagram()

Public method to build the class shapes of the class diagram.

The algorithm is borrowed from Boa Constructor.

#### UMLClassDiagramBuilder.getPersistenceData

getPersistenceData()

Public method to get a string for data to be persisted.

Returns:
  persisted data string (string)

#### UMLClassDiagramBuilder.initialize

initialize()

Public method to initialize the object.

#### UMLClassDiagramBuilder.parsePersistenceData

parsePersistenceData(version, data)

Public method to parse persisted data.

version
  version of the data (string)
data
  persisted data to be parsed (string)

Returns:
  flag indicating success (boolean)

Up