CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros 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 1976 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 1995 of file svgfig.py.

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

Member Function Documentation

def svgfig.Line.__repr__ (   self)

Definition at line 1992 of file svgfig.py.

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

1993  def __repr__(self):
1994  return "<Line (%g, %g) to (%g, %g) %s>" % (self.x1, self.y1, self.x2, self.y2, self.attr)
def __repr__
Definition: svgfig.py:1992
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 2034 of file svgfig.py.

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

Definition at line 2002 of file svgfig.py.

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

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

Member Data Documentation

svgfig.Line.arrow_end

Definition at line 1997 of file svgfig.py.

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

svgfig.Line.attr

Definition at line 1999 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 1990 of file svgfig.py.

svgfig.Line.f

Definition at line 2038 of file svgfig.py.

Referenced by svgfig.Ticks.__repr__(), Vispa.Views.RootCanvasView.RootCanvasView.createGraph(), Vispa.Views.RootCanvasView.RootCanvasView.createLegoPlot(), and svgfig.Ticks.orient_tickmark().

svgfig.Line.high

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.loop

Definition at line 2041 of file svgfig.py.

svgfig.Line.low

Definition at line 2039 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 1996 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().