CMS 3D CMS Logo

List of all members | Public Member Functions | Public Attributes
svgfig.Fig Class Reference

Public Member Functions

def __init__ (self, d, kwds)
 
def __repr__ (self)
 
def SVG (self, trans=None)
 

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.

741  def __init__(self, *d, **kwds):
742  self.d = list(d)
743  defaults = {"trans":None}
744  defaults.update(kwds)
745  kwds = defaults
746 
747  self.trans = kwds["trans"]; del kwds["trans"]
748  if len(kwds) != 0:
749  raise TypeError("Fig() got unexpected keyword arguments %s" % kwds.keys())
750 
def __init__(self, d, kwds)
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.

Referenced by data_sources.json_file.__str__().

733  def __repr__(self):
734  if self.trans == None:
735  return "<Fig (%d items)>" % len(self.d)
736  elif isinstance(self.trans, basestring):
737  return "<Fig (%d items) x,y -> %s>" % (len(self.d), self.trans)
738  else:
739  return "<Fig (%d items) %s>" % (len(self.d), self.trans.__name__)
740 
def __repr__(self)
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.

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

Member Data Documentation

svgfig.Fig.d
svgfig.Fig.trans

Definition at line 734 of file svgfig.py.

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