DotNode¶
-
class
visualife.diagrams.DotNode(id, x, y, r, **attrs)¶ Bases:
visualife.diagrams.NodeBaseCreates 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
Connectorlinesparam id: (
string) id to be set to the SVG element of the rectangleparam x: (
number) X of the dot’s centerparam y: (
number) Y of the dot’s centerparam r: (
number) radius of the dotparam attrs: see below
Keyword Arguments: - node_style (
stringordict) – a style for drawing the dot
The example below creates a
DotNodewith radius = 50. Four additional small dots mark itstop(),left(),bottom()andright()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
bottomCoordinates of the lowest point of this dot leftCoordinates of the left-most point of this dot rRadius of this dot rightCoordinates of the right-most point of this dot topCoordinates of the highest point of this dot Methods Summary
draw(viewport, **kwargs)Draw this dot node on a viewport Attributes Documentation
-
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
Methods Documentation
-
draw(viewport, **kwargs)¶ Draw this dot node on a viewport
Parameters: - viewport – (
visualife.core.HtmlViewportorvisualife.core.SvgViewport) where to draw this node - kwargs – provide style to draw this dot with node_style key
- viewport – (
- node_style (