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 2049 of file svgfig.py.

Constructor & Destructor Documentation

◆ __init__()

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

Definition at line 2077 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
2081 
2082  self.attr = dict(self.defaults)
2083  self.attr.update(attr)
2084 
def __init__(self, dataset, job_number, job_id, job_name, isDA, isMC, applyBOWS, applyEXTRACOND, extraconditions, runboundary, lumilist, intlumi, maxevents, gt, allFromGT, alignmentDB, alignmentTAG, apeDB, apeTAG, bowDB, bowTAG, vertextype, tracktype, refittertype, ttrhtype, applyruncontrol, ptcut, CMSSW_dir, the_dir)
#define update(a, b)

Member Function Documentation

◆ __repr__()

def svgfig.LineGlobal.__repr__ (   self)

◆ SVG()

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

Definition at line 2085 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(), trackerTFP::State.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(), trackerTFP::State.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, 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, str): 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, str):
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, str):
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
2122 
def make_marker(id, shape, attr)
Definition: svgfig.py:1965
def totrans(expr, vars=("x", "y"), globals=None, locals=None)
Definition: svgfig.py:598

Member Data Documentation

◆ arrow_end

svgfig.LineGlobal.arrow_end

Definition at line 2080 of file svgfig.py.

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

◆ attr

svgfig.LineGlobal.attr

◆ defaults

dictionary svgfig.LineGlobal.defaults = {}
static

Definition at line 2068 of file svgfig.py.

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

◆ local2

svgfig.LineGlobal.local2

Definition at line 2079 of file svgfig.py.

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

◆ y2

svgfig.LineGlobal.y2