Skip to content

Edge Geometry Management

cneben edited this page Sep 29, 2018 · 6 revisions

TODO:

  • Add support for circle and rect shape items (with open mode).
  • Use a QML Loader for loading src/dst shape geometry in EdgeTemplate.qml
  • Split code for src/dst shape generation and add "smart updating" when an edge item property change (regenerate only src or dst geometry using current geometry cache instead of calling updateItem())
  • Add local properties for shape length (actually "edge length") in qan::EdgeItem. Add support for src/dst shape in qan::EdgeStyle, add complete binding from qan::EdgeStyle to qan::EdgeItem when a style is applied to an edge item.
  • [25%] Add an Ortho edge mode to generate only vertical and/or horizontal lines (for example to draw a hierarchy tree or taxonomy).

Actual Design

Generating edge geometry efficiently has a critical impact on performances, since moving a single node or groups might affect geometry for all adjacent edges. QuickQanava strategy is to cache all edge geometry in a specific moveable qan::EdgeItem::GeometryCache struct, and try to minimize changes when the cache is applied to a concrete edge in qan::EdgeItem::updateItem() method.

Concrete visual item for the edge is a QML component inheriting from qan::EdgeItem (or Qan.EdgeItem). Default component is Qan.Edge, to ease creation of custom edge, the visual part of Qan.Edge is delegated to a "QML template", the default version is Qan.EdgeTemplate, it embed QtQuick.Shapes items and connect them to geometry properties in qan::EdgeItem (for example for "curved edges", a QtQuick.Shapes PathCubic is connected to properties qan::EdgeItem::c1 and c2 modelling bezier curve controls points.

Edge Geometry Generation

  • dstA1/dstA2/dstA3 are generated in EdgeItem::generateArrowGeometry()

Source code:

Ortho Edges

Clone this wiki locally