Skip to content

Commit

Permalink
[#530] Add UML diagram pictures.
Browse files Browse the repository at this point in the history
  • Loading branch information
jkcoding7 authored and prmr committed Jun 11, 2024
1 parent d0292d0 commit 088e3c3
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions docs/functional/FontRendering.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@ The feature is supported by a `NodeStorage` object that maps individual nodes to

The following class diagram illustrates how the design is realized with the illustration of a `NoteNode` (a node that represents a note on a UML diagram).

![JetUML Class Diagram](FontRendering.class.png)
![JetUML Class Diagram](FontRenderingClass.png)

* The (Class)`DiagramRenderer` declares two methods to manage node caching. `activateNodeStorages()` prepares and activates the cache by going through all its viewers and activating _their_ cache. It should be called once before a diagram is drawn. `deactivateAndClearNodeStorages()` clears the cache by going through all the viewers and clearing _their_ cache. It should be called once after a diagram is drawn.
* For nodes, method `getBounds(DiagramElement)` of interface `DiagramElementRenderer` is implemented by a final method in `AbstractNodeRenderer` that delegates the call to `getBounds` of class `NodeStorage`. This call takes as second argument a `Function<Node,Rectangle>` that is the _bounds calculator_. This function object is use to compute the bounds in case of a cache miss. The design of the bounds calculation mechanism is described below.

The following sequence diagram illustrates a scenario where a diagram that contains a single `NoteNode` is drawn.

![JetUML Class Diagram](FontRendering.sequence.png)
![JetUML Class Diagram](FontRenderingSequence.png)

1. The top section shows the activation of the node storages (caches). What's important to note here is that in practice the `DiagramRenderer` aggregates many `NodeVRenderer` objects, so the call to `activateNodeStorage()` will be repeated once for each element renderer managed by the diagram renderer.
2. The middle section shows how the call to `DiagramRenderer#draw` eventually reaches `NoteNodeRenderer#getBounds`, because this information is used to draw the node. This results in a call to `NodeStorage#getBounds` where the second argument (`::internalGetBounds`) is a _reference to a instance method of a particular object_, namely method `internalGetBounds` of the `NoteNodeRenderer` object.
Expand Down

0 comments on commit 088e3c3

Please sign in to comment.