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

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

Member Function Documentation

def svgfig.LineGlobal.__repr__ (   self)

Definition at line 2070 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(), 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, svgfig.Line.y2, and svgfig.LineGlobal.y2.

Referenced by data_sources.json_file.__str__().

2071  def __repr__(self):
2072  local1, local2 = "", ""
2073  if self.local1: local1 = "L"
2074  if self.local2: local2 = "L"
2075 
2076  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)
#define str(s)
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(), 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, svgfig.Line.y2, and svgfig.LineGlobal.y2.

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

Member Data Documentation

svgfig.LineGlobal.arrow_end

Definition at line 2080 of file svgfig.py.

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

svgfig.LineGlobal.attr

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

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

svgfig.LineGlobal.local2

Definition at line 2079 of file svgfig.py.

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

svgfig.LineGlobal.y2

Definition at line 2078 of file svgfig.py.

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