CMS 3D CMS Logo

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

Public Member Functions

def __init__ (self, x1, y1, x2, y2, local1=False, local2=False, arrow_start=None, arrow_end=None, attr)
 
def __repr__ (self)
 
def SVG (self, trans=None)
 

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.

2076  def __init__(self, x1, y1, x2, y2, local1=False, local2=False, arrow_start=None, arrow_end=None, **attr):
2077  self.x1, self.y1, self.x2, self.y2 = x1, y1, x2, y2
2078  self.local1, self.local2 = local1, local2
2079  self.arrow_start, self.arrow_end = arrow_start, arrow_end
2080 
2081  self.attr = dict(self.defaults)
2082  self.attr.update(attr)
2083 
def __init__(self, x1, y1, x2, y2, local1=False, local2=False, arrow_start=None, arrow_end=None, attr)
Definition: svgfig.py:2076
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, str, reco::PdfInfo.x1, L1MonitorDigi.x1(), L1DataEmulDigi.x1(), CTPPSFastTrack.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(), CTPPSFastTrack.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, CTPPSFastTrack.y1(), DDTrap.y1(), DDPseudoTrap.y1(), svgfig.HLine.y1, svgfig.XAxis.y1, svgfig.Line.y2, and svgfig.LineGlobal.y2.

Referenced by data_sources.json_file.__str__().

2069  def __repr__(self):
2070  local1, local2 = "", ""
2071  if self.local1: local1 = "L"
2072  if self.local2: local2 = "L"
2073 
2074  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)
2075 
def __repr__(self)
Definition: svgfig.py:2069
#define str(s)
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(), CTPPSFastTrack.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(), CTPPSFastTrack.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, CTPPSFastTrack.y1(), DDTrap.y1(), DDPseudoTrap.y1(), svgfig.HLine.y1, svgfig.XAxis.y1, svgfig.Line.y2, and svgfig.LineGlobal.y2.

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

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