CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
List of all members | Public Member Functions | Public Attributes | Static Public Attributes
svgfig.Line Class Reference
Inheritance diagram for svgfig.Line:
svgfig.Curve svgfig.HLine svgfig.LineAxis svgfig.VLine svgfig.XAxis svgfig.YAxis

Public Member Functions

def __init__
 
def __repr__
 
def Path
 
def SVG
 
- Public Member Functions inherited from svgfig.Curve
def __init__
 
def __repr__
 
def Path
 
def sample
 end nested class More...
 
def subsample
 
def SVG
 

Public Attributes

 arrow_end
 
 attr
 
 f
 
 high
 
 loop
 
 low
 
 y2
 
- Public Attributes inherited from svgfig.Curve
 attr
 
 f
 
 high
 
 last_samples
 
 loop
 
 low
 

Static Public Attributes

dictionary defaults = {}
 
- Static Public Attributes inherited from svgfig.Curve
dictionary defaults = {}
 
int discontinuity_limit = 5
 
float linearity_limit = 0.05
 
 random_sampling = True
 
int recursion_limit = 15
 

Detailed Description

Draws a line between two points.

Line(x1, y1, x2, y2, arrow_start, arrow_end, attribute=value)

x1, y1                  required        the starting point
x2, y2                  required        the ending point
arrow_start             default=None    if an identifier string/Unicode,
                                        draw a new arrow object at the
                                        beginning of the line; if a marker,
                                        draw that marker instead
arrow_end               default=None    same for the end of the line
attribute=value pairs   keyword list    SVG attributes

Definition at line 1977 of file svgfig.py.

Constructor & Destructor Documentation

def svgfig.Line.__init__ (   self,
  x1,
  y1,
  x2,
  y2,
  arrow_start = None,
  arrow_end = None,
  attr 
)

Definition at line 1996 of file svgfig.py.

1997  def __init__(self, x1, y1, x2, y2, arrow_start=None, arrow_end=None, **attr):
1998  self.x1, self.y1, self.x2, self.y2 = x1, y1, x2, y2
1999  self.arrow_start, self.arrow_end = arrow_start, arrow_end
2001  self.attr = dict(self.defaults)
2002  self.attr.update(attr)
def __init__
Definition: svgfig.py:1996
dictionary defaults
Definition: svgfig.py:1510

Member Function Documentation

def svgfig.Line.__repr__ (   self)

Definition at line 1993 of file svgfig.py.

References svgfig.SVG.attr, svgfig.Path.attr, svgfig.Curve.attr, reco::PdfInfo.x1, L1MonitorDigi.x1(), L1DataEmulDigi.x1(), TrackingTools_PatternTools::dictionary.x1, CTPPSFastTrack.x1(), DDTrap.x1(), DDPseudoTrap.x1(), APD.x1, Exhume::CrossSection.x1, svgfig.VLine.x1, svgfig.YAxis.x1, reco::PdfInfo.x2, L1MonitorDigi.x2(), L1DataEmulDigi.x2(), TrackingTools_PatternTools::dictionary.x2, CTPPSFastTrack.x2(), DDTrap.x2(), DDPseudoTrap.x2(), APD.x2, Exhume::CrossSection.x2, trklet::IMATH_TrackletCalculatorDisk.x2, trklet::IMATH_TrackletCalculatorOverlap.x2, trklet::IMATH_TrackletCalculator.x2, svgfig.VLine.x2, svgfig.YAxis.x2, CTPPSFastTrack.y1(), DDTrap.y1(), DDPseudoTrap.y1(), svgfig.HLine.y1, svgfig.XAxis.y1, and svgfig.Line.y2.

Referenced by data_sources.json_file.__str__().

1994  def __repr__(self):
1995  return "<Line (%g, %g) to (%g, %g) %s>" % (self.x1, self.y1, self.x2, self.y2, self.attr)
def __repr__
Definition: svgfig.py:1993
def svgfig.Line.Path (   self,
  trans = None,
  local = False 
)
Apply the transformation "trans" and return a Path object in
global coordinates.  If local=True, return a Path in local coordinates
(which must be transformed again).

Definition at line 2035 of file svgfig.py.

2036  def Path(self, trans=None, local=False):
2037  """Apply the transformation "trans" and return a Path object in
2038  global coordinates. If local=True, return a Path in local coordinates
2039  (which must be transformed again)."""
2040  self.f = lambda t: (self.x1 + t*(self.x2 - self.x1), self.y1 + t*(self.y2 - self.y1))
2041  self.low = 0.
2042  self.high = 1.
2043  self.loop = False
2044 
2045  if trans == None:
2046  return Path([("M", self.x1, self.y1, not local), ("L", self.x2, self.y2, not local)], **self.attr)
2047  else:
2048  return Curve.Path(self, trans, local)
def Path
Definition: svgfig.py:2035
def svgfig.Line.SVG (   self,
  trans = None 
)
Apply the transformation "trans" and return an SVG object.

Definition at line 2003 of file svgfig.py.

References svgfig.Line.arrow_end, svgfig.Ticks.arrow_start, svgfig.make_marker(), SiStripHistoPlotter::PlotParameter.Path, Json::PathArgument.Path, and svgfig.Curve.Path().

2004  def SVG(self, trans=None):
2005  """Apply the transformation "trans" and return an SVG object."""
2006 
2007  line = self.Path(trans).SVG()
2008 
2009  if (self.arrow_start != False and self.arrow_start != None) or (self.arrow_end != False and self.arrow_end != None):
2010  defs = SVG("defs")
2011 
2012  if self.arrow_start != False and self.arrow_start != None:
2013  if isinstance(self.arrow_start, SVG):
2014  defs.append(self.arrow_start)
2015  line.attr["marker-start"] = "url(#%s)" % self.arrow_start["id"]
2016  elif isinstance(self.arrow_start, str):
2017  defs.append(make_marker(self.arrow_start, "arrow_start"))
2018  line.attr["marker-start"] = "url(#%s)" % self.arrow_start
2019  else:
2020  raise TypeError("arrow_start must be False/None or an id string for the new marker")
2021 
2022  if self.arrow_end != False and self.arrow_end != None:
2023  if isinstance(self.arrow_end, SVG):
2024  defs.append(self.arrow_end)
2025  line.attr["marker-end"] = "url(#%s)" % self.arrow_end["id"]
2026  elif isinstance(self.arrow_end, str):
2027  defs.append(make_marker(self.arrow_end, "arrow_end"))
2028  line.attr["marker-end"] = "url(#%s)" % self.arrow_end
2029  else:
2030  raise TypeError("arrow_end must be False/None or an id string for the new marker")
2031 
2032  return SVG("g", defs, line)
2033 
2034  return line
def make_marker
Definition: svgfig.py:1965

Member Data Documentation

svgfig.Line.arrow_end

Definition at line 1998 of file svgfig.py.

Referenced by svgfig.Line.SVG(), svgfig.LineGlobal.SVG(), and svgfig.CurveAxis.SVG().

svgfig.Line.attr

Definition at line 2000 of file svgfig.py.

Referenced by svgfig.LineGlobal.__repr__(), svgfig.Ticks.__repr__(), svgfig.Axes.__repr__(), svgfig.HGrid.__repr__(), svgfig.VGrid.__repr__(), svgfig.Grid.__repr__(), svgfig.LineGlobal.SVG(), svgfig.Axes.SVG(), svgfig.XErrorBars.SVG(), and svgfig.YErrorBars.SVG().

dictionary svgfig.Line.defaults = {}
static

Definition at line 1991 of file svgfig.py.

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

svgfig.Line.f

Definition at line 2039 of file svgfig.py.

Referenced by svgfig.Ticks.__repr__(), ztail.Decoder.initial_synchronize(), and svgfig.Ticks.orient_tickmark().

svgfig.Line.high

Definition at line 2041 of file svgfig.py.

Referenced by svgfig.Ticks.__repr__(), svgfig.HGrid.__repr__(), svgfig.VGrid.__repr__(), svgfig.Ticks.compute_logminiticks(), svgfig.Ticks.compute_logticks(), svgfig.Ticks.compute_miniticks(), svgfig.Ticks.compute_ticks(), svgfig.Ticks.interpret(), svgfig.Ticks.orient_tickmark(), and svgfig.Ticks.regular_miniticks().

svgfig.Line.loop

Definition at line 2042 of file svgfig.py.

svgfig.Line.low

Definition at line 2040 of file svgfig.py.

Referenced by svgfig.Ticks.__repr__(), svgfig.HGrid.__repr__(), svgfig.VGrid.__repr__(), svgfig.Ticks.compute_logminiticks(), svgfig.Ticks.compute_logticks(), svgfig.Ticks.compute_miniticks(), svgfig.Ticks.compute_ticks(), svgfig.Ticks.interpret(), svgfig.Ticks.orient_tickmark(), and svgfig.Ticks.regular_miniticks().

svgfig.Line.y2

Definition at line 1997 of file svgfig.py.

Referenced by svgfig.Line.__repr__(), svgfig.LineGlobal.__repr__(), svgfig.VLine.__repr__(), svgfig.Rect.__repr__(), svgfig.LineAxis.__repr__(), svgfig.Rect.Path(), and svgfig.LineGlobal.SVG().