CMS 3D CMS Logo

Public Member Functions | Public Attributes | Static Public Attributes

svgfig::Rect Class Reference

Inheritance diagram for svgfig::Rect:
svgfig::Curve

List of all members.

Public Member Functions

def __init__
def __repr__
def Path
def SVG

Public Attributes

 attr
 f
 high
 loop
 low
 y2

Static Public Attributes

dictionary defaults = {}

Detailed Description

Draws a rectangle.

Rect(x1, y1, x2, y2, attribute=value)

x1, y1                  required        the starting point
x2, y2                  required        the ending point
attribute=value pairs   keyword list    SVG attributes

Definition at line 2180 of file svgfig.py.


Constructor & Destructor Documentation

def svgfig::Rect::__init__ (   self,
  x1,
  y1,
  x2,
  y2,
  attr 
)

Reimplemented from svgfig::Curve.

Definition at line 2194 of file svgfig.py.

02195                                             :
02196     self.x1, self.y1, self.x2, self.y2 = x1, y1, x2, y2
02197 
02198     self.attr = dict(self.defaults)
02199     self.attr.update(attr)


Member Function Documentation

def svgfig::Rect::__repr__ (   self)

Reimplemented from svgfig::Curve.

Definition at line 2191 of file svgfig.py.

02192                     :
02193     return "<Rect (%g, %g), (%g, %g) %s>" % (self.x1, self.y1, self.x2, self.y2, self.attr)

def svgfig::Rect::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.

Definition at line 2204 of file svgfig.py.

02205                                          :
02206     """Apply the transformation "trans" and return a Path object in
02207     global coordinates.  If local=True, return a Path in local coordinates
02208     (which must be transformed again)."""
02209     if trans == None:
02210       return Path([("M", self.x1, self.y1, not local), ("L", self.x2, self.y1, not local), ("L", self.x2, self.y2, not local), ("L", self.x1, self.y2, not local), ("Z",)], **self.attr)
02211 
02212     else:
02213       self.low = 0.
02214       self.high = 1.
02215       self.loop = False
02216 
02217       self.f = lambda t: (self.x1 + t*(self.x2 - self.x1), self.y1)
02218       d1 = Curve.Path(self, trans, local).d
02219 
02220       self.f = lambda t: (self.x2, self.y1 + t*(self.y2 - self.y1))
02221       d2 = Curve.Path(self, trans, local).d
02222       del d2[0]
02223 
02224       self.f = lambda t: (self.x2 + t*(self.x1 - self.x2), self.y2)
02225       d3 = Curve.Path(self, trans, local).d
02226       del d3[0]
02227 
02228       self.f = lambda t: (self.x1, self.y2 + t*(self.y1 - self.y2))
02229       d4 = Curve.Path(self, trans, local).d
02230       del d4[0]
02231 
02232       return Path(d=(d1 + d2 + d3 + d4 + [("Z",)]), **self.attr)

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

Reimplemented from svgfig::Curve.

Definition at line 2200 of file svgfig.py.

02201                            :
02202     """Apply the transformation "trans" and return an SVG object."""
02203     return self.Path(trans).SVG()


Member Data Documentation

Reimplemented from svgfig::Curve.

Definition at line 2194 of file svgfig.py.

dictionary svgfig::Rect::defaults = {} [static]

Reimplemented from svgfig::Curve.

Definition at line 2189 of file svgfig.py.

Reimplemented from svgfig::Curve.

Definition at line 2206 of file svgfig.py.

Reimplemented from svgfig::Curve.

Definition at line 2206 of file svgfig.py.

Reimplemented from svgfig::Curve.

Definition at line 2206 of file svgfig.py.

Reimplemented from svgfig::Curve.

Definition at line 2206 of file svgfig.py.

Definition at line 2194 of file svgfig.py.