Public Member Functions | |
def | __init__ |
def | __repr__ |
def | Path |
def | SVG |
Public Attributes | |
arrow_end | |
attr | |
f | |
high | |
loop | |
low | |
y2 | |
Static Public Attributes | |
dictionary | defaults = {} |
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
def svgfig::Line::__init__ | ( | self, | |
x1, | |||
y1, | |||
x2, | |||
y2, | |||
arrow_start = None , |
|||
arrow_end = None , |
|||
attr | |||
) |
def svgfig::Line::__repr__ | ( | self | ) |
Reimplemented from svgfig::Curve.
Reimplemented in svgfig::VLine, svgfig::HLine, svgfig::LineAxis, svgfig::XAxis, and svgfig::YAxis.
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).
Reimplemented from svgfig::Curve.
Reimplemented in svgfig::VLine, and svgfig::HLine.
Definition at line 2034 of file svgfig.py.
02035 : 02036 """Apply the transformation "trans" and return a Path object in 02037 global coordinates. If local=True, return a Path in local coordinates 02038 (which must be transformed again).""" 02039 self.f = lambda t: (self.x1 + t*(self.x2 - self.x1), self.y1 + t*(self.y2 - self.y1)) 02040 self.low = 0. 02041 self.high = 1. 02042 self.loop = False 02043 02044 if trans == None: 02045 return Path([("M", self.x1, self.y1, not local), ("L", self.x2, self.y2, not local)], **self.attr) 02046 else: 02047 return Curve.Path(self, trans, local)
def svgfig::Line::SVG | ( | self, | |
trans = None |
|||
) |
Apply the transformation "trans" and return an SVG object.
Reimplemented from svgfig::Curve.
Reimplemented in svgfig::LineAxis, svgfig::XAxis, and svgfig::YAxis.
Definition at line 2002 of file svgfig.py.
02003 : 02004 """Apply the transformation "trans" and return an SVG object.""" 02005 02006 line = self.Path(trans).SVG() 02007 02008 if (self.arrow_start != False and self.arrow_start != None) or (self.arrow_end != False and self.arrow_end != None): 02009 defs = SVG("defs") 02010 02011 if self.arrow_start != False and self.arrow_start != None: 02012 if isinstance(self.arrow_start, SVG): 02013 defs.append(self.arrow_start) 02014 line.attr["marker-start"] = "url(#%s)" % self.arrow_start["id"] 02015 elif isinstance(self.arrow_start, basestring): 02016 defs.append(make_marker(self.arrow_start, "arrow_start")) 02017 line.attr["marker-start"] = "url(#%s)" % self.arrow_start 02018 else: 02019 raise TypeError, "arrow_start must be False/None or an id string for the new marker" 02020 02021 if self.arrow_end != False and self.arrow_end != None: 02022 if isinstance(self.arrow_end, SVG): 02023 defs.append(self.arrow_end) 02024 line.attr["marker-end"] = "url(#%s)" % self.arrow_end["id"] 02025 elif isinstance(self.arrow_end, basestring): 02026 defs.append(make_marker(self.arrow_end, "arrow_end")) 02027 line.attr["marker-end"] = "url(#%s)" % self.arrow_end 02028 else: 02029 raise TypeError, "arrow_end must be False/None or an id string for the new marker" 02030 02031 return SVG("g", defs, line) 02032 02033 return line
Reimplemented from svgfig::Curve.
Reimplemented in svgfig::VLine, and svgfig::HLine.
dictionary svgfig::Line::defaults = {} [static] |
Reimplemented from svgfig::Curve.
Reimplemented in svgfig::VLine, svgfig::HLine, svgfig::LineAxis, svgfig::XAxis, and svgfig::YAxis.
Reimplemented from svgfig::Curve.
Reimplemented in svgfig::LineAxis.
Reimplemented from svgfig::Curve.
Reimplemented in svgfig::LineAxis.
Reimplemented from svgfig::Curve.
Reimplemented from svgfig::Curve.
Reimplemented in svgfig::LineAxis.
Reimplemented in svgfig::HLine, and svgfig::XAxis.