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.LineGlobal Class Reference

Public Member Functions

def __init__
 
def __repr__
 
def SVG
 

Public Attributes

 arrow_end
 
 attr
 
 local2
 
 y2
 

Static Public Attributes

dictionary defaults = {}
 

Detailed Description

Draws a line between two points, one or both of which is in
global coordinates.

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

x1, y1                  required        the starting point
x2, y2                  required        the ending point
local1                  default=False   if True, interpret first point as a
                                        local coordinate (apply transform)
local2                  default=False   if True, interpret second point as a
                                        local coordinate (apply transform)
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 2048 of file svgfig.py.

Constructor & Destructor Documentation

def svgfig.LineGlobal.__init__ (   self,
  x1,
  y1,
  x2,
  y2,
  local1 = False,
  local2 = False,
  arrow_start = None,
  arrow_end = None,
  attr 
)

Definition at line 2076 of file svgfig.py.

2077  def __init__(self, x1, y1, x2, y2, local1=False, local2=False, arrow_start=None, arrow_end=None, **attr):
2078  self.x1, self.y1, self.x2, self.y2 = x1, y1, x2, y2
2079  self.local1, self.local2 = local1, local2
2080  self.arrow_start, self.arrow_end = arrow_start, arrow_end
2082  self.attr = dict(self.defaults)
2083  self.attr.update(attr)
dictionary defaults
Definition: svgfig.py:2067

Member Function Documentation

def svgfig.LineGlobal.__repr__ (   self)

Definition at line 2069 of file svgfig.py.

References svgfig.SVG.attr, svgfig.Path.attr, svgfig.Curve.attr, svgfig.Poly.attr, svgfig.Text.attr, svgfig.TextGlobal.attr, svgfig.Dots.attr, svgfig.Line.attr, svgfig.LineGlobal.attr, svgfig.LineGlobal.local2, reco::PdfInfo.x1, L1MonitorDigi.x1(), L1DataEmulDigi.x1(), TrackingTools_PatternTools::dictionary.x1, DDTrap.x1(), DataFormats_TrackReco::dictionary.x1, DataFormats_METReco::dictionary.x1, DDPseudoTrap.x1(), Exhume::CrossSection.x1, svgfig.VLine.x1, svgfig.YAxis.x1, reco::PdfInfo.x2, L1MonitorDigi.x2(), L1DataEmulDigi.x2(), TrackingTools_PatternTools::dictionary.x2, DDTrap.x2(), DataFormats_TrackReco::dictionary.x2, DDPseudoTrap.x2(), DataFormats_METReco::dictionary.x2, Exhume::CrossSection.x2, svgfig.VLine.x2, svgfig.YAxis.x2, DDTrap.y1(), DDPseudoTrap.y1(), svgfig.HLine.y1, svgfig.XAxis.y1, svgfig.Line.y2, and svgfig.LineGlobal.y2.

2070  def __repr__(self):
2071  local1, local2 = "", ""
2072  if self.local1: local1 = "L"
2073  if self.local2: local2 = "L"
2074 
2075  return "<LineGlobal %s(%s, %s) to %s(%s, %s) %s>" % (local1, str(self.x1), str(self.y1), local2, str(self.x2), str(self.y2), self.attr)
def svgfig.LineGlobal.SVG (   self,
  trans = None 
)
Apply the transformation "trans" and return an SVG object.

Definition at line 2084 of file svgfig.py.

References svgfig.Line.arrow_end, svgfig.LineGlobal.arrow_end, svgfig.Ticks.arrow_start, svgfig.SVG.attr, svgfig.Path.attr, svgfig.Curve.attr, svgfig.Poly.attr, svgfig.Text.attr, svgfig.TextGlobal.attr, svgfig.Dots.attr, svgfig.Line.attr, svgfig.LineGlobal.attr, svgfig.LineGlobal.local2, svgfig.make_marker(), svgfig.totrans(), reco::PdfInfo.x1, L1MonitorDigi.x1(), L1DataEmulDigi.x1(), TrackingTools_PatternTools::dictionary.x1, DDTrap.x1(), DataFormats_TrackReco::dictionary.x1, DataFormats_METReco::dictionary.x1, DDPseudoTrap.x1(), Exhume::CrossSection.x1, svgfig.VLine.x1, svgfig.YAxis.x1, reco::PdfInfo.x2, L1MonitorDigi.x2(), L1DataEmulDigi.x2(), TrackingTools_PatternTools::dictionary.x2, DDTrap.x2(), DataFormats_TrackReco::dictionary.x2, DDPseudoTrap.x2(), DataFormats_METReco::dictionary.x2, Exhume::CrossSection.x2, svgfig.VLine.x2, svgfig.YAxis.x2, DDTrap.y1(), DDPseudoTrap.y1(), svgfig.HLine.y1, svgfig.XAxis.y1, svgfig.Line.y2, and svgfig.LineGlobal.y2.

2085  def SVG(self, trans=None):
2086  """Apply the transformation "trans" and return an SVG object."""
2087  if isinstance(trans, basestring): trans = totrans(trans)
2088 
2089  X1, Y1, X2, Y2 = self.x1, self.y1, self.x2, self.y2
2090 
2091  if self.local1: X1, Y1 = trans(X1, Y1)
2092  if self.local2: X2, Y2 = trans(X2, Y2)
2093 
2094  line = SVG("path", d="M%s %s L%s %s" % (X1, Y1, X2, Y2), **self.attr)
2095 
2096  if (self.arrow_start != False and self.arrow_start != None) or (self.arrow_end != False and self.arrow_end != None):
2097  defs = SVG("defs")
2098 
2099  if self.arrow_start != False and self.arrow_start != None:
2100  if isinstance(self.arrow_start, SVG):
2101  defs.append(self.arrow_start)
2102  line.attr["marker-start"] = "url(#%s)" % self.arrow_start["id"]
2103  elif isinstance(self.arrow_start, basestring):
2104  defs.append(make_marker(self.arrow_start, "arrow_start"))
2105  line.attr["marker-start"] = "url(#%s)" % self.arrow_start
2106  else:
2107  raise TypeError, "arrow_start must be False/None or an id string for the new marker"
2108 
2109  if self.arrow_end != False and self.arrow_end != None:
2110  if isinstance(self.arrow_end, SVG):
2111  defs.append(self.arrow_end)
2112  line.attr["marker-end"] = "url(#%s)" % self.arrow_end["id"]
2113  elif isinstance(self.arrow_end, basestring):
2114  defs.append(make_marker(self.arrow_end, "arrow_end"))
2115  line.attr["marker-end"] = "url(#%s)" % self.arrow_end
2116  else:
2117  raise TypeError, "arrow_end must be False/None or an id string for the new marker"
2118 
2119  return SVG("g", defs, line)
2120 
2121  return line
def totrans
Definition: svgfig.py:597
def make_marker
Definition: svgfig.py:1964

Member Data Documentation

svgfig.LineGlobal.arrow_end

Definition at line 2079 of file svgfig.py.

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

svgfig.LineGlobal.attr

Definition at line 2081 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.LineGlobal.defaults = {}
static

Definition at line 2067 of file svgfig.py.

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

svgfig.LineGlobal.local2

Definition at line 2078 of file svgfig.py.

Referenced by svgfig.LineGlobal.__repr__(), and svgfig.LineGlobal.SVG().

svgfig.LineGlobal.y2

Definition at line 2077 of file svgfig.py.

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