DotNode

class visualife.diagrams.DotNode(id, x, y, r, **attrs)

Bases: visualife.diagrams.NodeBase

Creates a node that is dot.

This node type has no text on it. It may be used as a marker, e.g. to mark a joint between Connector lines

param id:

(string) id to be set to the SVG element of the rectangle

param x:

(number) X of the dot’s center

param y:

(number) Y of the dot’s center

param r:

(number) radius of the dot

param attrs:

see below

Keyword Arguments:
 
  • node_style (string or dict) – a style for drawing the dot

The example below creates a DotNode with radius = 50. Four additional small dots mark its top(), left(), bottom() and right() position.

from browser import document
from visualife.core import HtmlViewport
from visualife.diagrams import DotNode

drawing = HtmlViewport(document['svg-dot'],200,200)
dot = DotNode("dot-0", 100, 100, 50)
t = DotNode("dot-1", dot.top.x, dot.top.y, 5)
l = DotNode("dot-2", dot.left.x, dot.left.y, 5)
b = DotNode("dot-3", dot.bottom.x, dot.bottom.y, 5)
r = DotNode("dot-4", dot.right.x, dot.right.y, 5)
for d in [dot, t, l, b, r]:
  d.draw(drawing)
drawing.close()

Attributes Summary

bottom Coordinates of the lowest point of this dot
left Coordinates of the left-most point of this dot
r Radius of this dot
right Coordinates of the right-most point of this dot
top Coordinates of the highest point of this dot

Methods Summary

draw(viewport, **kwargs) Draw this dot node on a viewport

Attributes Documentation

bottom

Coordinates of the lowest point of this dot

Returns:(Point) the lowest point of this dot
left

Coordinates of the left-most point of this dot

Returns:(Point) the left-most point of this dot
r

Radius of this dot

Returns:(number) radius of this dot
right

Coordinates of the right-most point of this dot

Returns:(Point) the right-most point of this dot
top

Coordinates of the highest point of this dot

Returns:(Point) the highest point of this dot

Methods Documentation

draw(viewport, **kwargs)

Draw this dot node on a viewport

Parameters: