test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Public Attributes
svgfig.Fig Class Reference

Public Member Functions

def __init__
 
def __repr__
 
def SVG
 

Public Attributes

 d
 
 trans
 

Detailed Description

Stores graphics primitive objects and applies a single coordinate
transformation to them. To compose coordinate systems, nest Fig
objects.

Fig(obj, obj, obj..., trans=function)

obj     optional list    a list of drawing primatives
trans   default=None     a coordinate transformation function

>>> fig = Fig(Line(0,0,1,1), Rect(0.2,0.2,0.8,0.8), trans="2*x, 2*y")
>>> print fig.SVG().xml()
<g>
    <path d='M0 0L2 2' />
    <path d='M0.4 0.4L1.6 0.4ZL1.6 1.6ZL0.4 1.6ZL0.4 0.4ZZ' />
</g>
>>> print Fig(fig, trans="x/2., y/2.").SVG().xml()
<g>
    <path d='M0 0L1 1' />
    <path d='M0.2 0.2L0.8 0.2ZL0.8 0.8ZL0.2 0.8ZL0.2 0.2ZZ' />
</g>

Definition at line 710 of file svgfig.py.

Constructor & Destructor Documentation

def svgfig.Fig.__init__ (   self,
  d,
  kwds 
)

Definition at line 741 of file svgfig.py.

742  def __init__(self, *d, **kwds):
743  self.d = list(d)
744  defaults = {"trans":None}
745  defaults.update(kwds)
746  kwds = defaults
747 
748  self.trans = kwds["trans"]; del kwds["trans"]
749  if len(kwds) != 0:
750  raise TypeError, "Fig() got unexpected keyword arguments %s" % kwds.keys()
def __init__
Definition: svgfig.py:741
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision and the trigger will pass if any such matching triggers are FAIL or EXCEPTION A wildcarded negative criterion that matches more than one trigger in the trigger list("!*","!HLTx*"if it matches 2 triggers or more) will accept the event if all the matching triggers are FAIL.It will reject the event if any of the triggers are PASS or EXCEPTION(this matches the behavior of"!*"before the partial wildcard feature was incorporated).Triggers which are in the READY state are completely ignored.(READY should never be returned since the trigger paths have been run

Member Function Documentation

def svgfig.Fig.__repr__ (   self)

Definition at line 733 of file svgfig.py.

734  def __repr__(self):
735  if self.trans == None:
736  return "<Fig (%d items)>" % len(self.d)
737  elif isinstance(self.trans, basestring):
738  return "<Fig (%d items) x,y -> %s>" % (len(self.d), self.trans)
739  else:
740  return "<Fig (%d items) %s>" % (len(self.d), self.trans.func_name)
def __repr__
Definition: svgfig.py:733
def svgfig.Fig.SVG (   self,
  trans = None 
)
Apply the transformation "trans" and return an SVG object.

Coordinate transformations in nested Figs will be composed.

Definition at line 751 of file svgfig.py.

References svgfig.Fig.d, svgfig.totrans(), and svgfig.Fig.trans.

752  def SVG(self, trans=None):
753  """Apply the transformation "trans" and return an SVG object.
754 
755  Coordinate transformations in nested Figs will be composed.
756  """
757 
758  if trans == None: trans = self.trans
759  if isinstance(trans, basestring): trans = totrans(trans)
760 
761  output = SVG("g")
762  for s in self.d:
763  if isinstance(s, SVG):
764  output.append(s)
765 
766  elif isinstance(s, Fig):
767  strans = s.trans
768  if isinstance(strans, basestring): strans = totrans(strans)
769 
770  if trans == None: subtrans = strans
771  elif strans == None: subtrans = trans
772  else: subtrans = lambda x,y: trans(*strans(x, y))
773 
774  output.sub += s.SVG(subtrans).sub
775 
776  elif s == None: pass
777 
778  else:
779  output.append(s.SVG(trans))
780 
781  return output
def totrans
Definition: svgfig.py:597
def SVG
Definition: svgfig.py:751

Member Data Documentation

svgfig.Fig.d

Definition at line 742 of file svgfig.py.

Referenced by svgfig.Frame.__repr__(), svgfig.Path.__repr__(), svgfig.Poly.__repr__(), svgfig.Text.__repr__(), svgfig.TextGlobal.__repr__(), svgfig.Dots.__repr__(), svgfig.XErrorBars.__repr__(), svgfig.YErrorBars.__repr__(), svgfig.Poly.Path(), svgfig.Fig.SVG(), svgfig.Path.SVG(), svgfig.Text.SVG(), svgfig.TextGlobal.SVG(), svgfig.Dots.SVG(), svgfig.XErrorBars.SVG(), and svgfig.YErrorBars.SVG().

svgfig.Fig.trans

Definition at line 734 of file svgfig.py.

Referenced by svgfig.Fig.SVG(), and svgfig.Plot.SVG().