CMS 3D CMS Logo

List of all members | Public Member Functions | Public Attributes | Static Public Attributes
svgfig.Dots Class Reference

Public Member Functions

def __init__ (self, d=[], symbol=None, width=1., height=1., **attr)
 
def __repr__ (self)
 
def SVG (self, trans=None)
 

Public Attributes

 attr
 
 d
 
 height
 
 symbol
 
 width
 

Static Public Attributes

dictionary defaults = {}
 

Detailed Description

Dots draws SVG symbols at a set of points.

d                      required               list of (x,y) points
symbol                 default=None           SVG symbol or a new identifier to
                                              label an auto-generated symbol;
                                              if None, use pre-defined _circular_dot
width, height          default=1, 1           width and height of the symbols
                                              in SVG coordinates
attribute=value pairs  keyword list           SVG attributes

Definition at line 1908 of file svgfig.py.

Constructor & Destructor Documentation

◆ __init__()

def svgfig.Dots.__init__ (   self,
  d = [],
  symbol = None,
  width = 1.,
  height = 1.,
**  attr 
)

Definition at line 1924 of file svgfig.py.

1924  def __init__(self, d=[], symbol=None, width=1., height=1., **attr):
1925  self.d = list(d)
1926  self.width = width
1927  self.height = height
1928 
1929  self.attr = dict(self.defaults)
1930  self.attr.update(attr)
1931 
1932  if symbol == None:
1933  self.symbol = _circular_dot
1934  elif isinstance(symbol, SVG):
1935  self.symbol = symbol
1936  else:
1937  self.symbol = make_symbol(symbol)
1938 

Member Function Documentation

◆ __repr__()

def svgfig.Dots.__repr__ (   self)

Definition at line 1921 of file svgfig.py.

1921  def __repr__(self):
1922  return "<Dots (%d nodes) %s>" % (len(self.d), self.attr)
1923 

References svgfig.SVG.attr, svgfig.Path.attr, svgfig.Curve.attr, svgfig.Poly.attr, svgfig.Text.attr, svgfig.TextGlobal.attr, svgfig.Dots.attr, svgfig.Fig.d, svgfig.Plot.d, svgfig.Frame.d, svgfig.Path.d, svgfig.Poly.d, svgfig.Text.d, svgfig.TextGlobal.d, and svgfig.Dots.d.

Referenced by data_sources.json_file.__str__().

◆ SVG()

def svgfig.Dots.SVG (   self,
  trans = None 
)
Apply the transformation "trans" and return an SVG object.

Definition at line 1939 of file svgfig.py.

1939  def SVG(self, trans=None):
1940  """Apply the transformation "trans" and return an SVG object."""
1941  if isinstance(trans, str): trans = totrans(trans)
1942 
1943  output = SVG("g", SVG("defs", self.symbol))
1944  id = "#%s" % self.symbol["id"]
1945 
1946  for p in self.d:
1947  x, y = p[0], p[1]
1948 
1949  if trans == None: X, Y = x, y
1950  else: X, Y = trans(x, y)
1951 
1952  item = SVG("use", x=X, y=Y, xlink__href=id)
1953  if self.width != None: item["width"] = self.width
1954  if self.height != None: item["height"] = self.height
1955  output.append(item)
1956 
1957  return output
1958 

References svgfig.Fig.d, svgfig.Plot.d, svgfig.Frame.d, svgfig.Path.d, svgfig.Poly.d, svgfig.Text.d, svgfig.TextGlobal.d, svgfig.Dots.d, svgfig.Plot.height, svgfig.Frame.height, svgfig.Dots.height, svgfig.Dots.symbol, svgfig.totrans(), svgfig.Plot.width, svgfig.Frame.width, and svgfig.Dots.width.

Member Data Documentation

◆ attr

svgfig.Dots.attr

◆ d

svgfig.Dots.d

◆ defaults

dictionary svgfig.Dots.defaults = {}
static

Definition at line 1919 of file svgfig.py.

Referenced by tree.Tree.reset(), and tree.Tree.var().

◆ height

svgfig.Dots.height

◆ symbol

svgfig.Dots.symbol

Definition at line 1933 of file svgfig.py.

Referenced by svgfig.Dots.SVG().

◆ width

svgfig.Dots.width
svgfig.totrans
def totrans(expr, vars=("x", "y"), globals=None, locals=None)
Definition: svgfig.py:598
svgfig.make_symbol
def make_symbol(id, shape="dot", **attr)
Definition: svgfig.py:1894
update
#define update(a, b)
Definition: TrackClassifier.cc:10