Changeset 1176 for CMIP6dreqbuild


Ignore:
Timestamp:
08/02/18 16:56:42 (22 months ago)
Author:
mjuckes
Message:

updates to tikz

File:
1 edited

Legend:

Unmodified
Added
Removed
  • CMIP6dreqbuild/trunk/src/framework/tikz.py

    r1174 r1176  
    3535    if mode == 'float': 
    3636      self.__dict__[k] = floatify(v) 
     37 
     38  def addChildren(self,nlist): 
     39    '''Add a list of child nodes and create a node list string for use in tikz''' 
     40    self.child = nlist 
     41    self.childList = ''.join( [ '(%s)' % x.label for x in nlist] ) 
     42    self.isParent = True 
    3743 
    3844  def dec(self): 
     
    100106 
    101107nodeTmpl = '''   \\node at (%(x)s,%(y)s) [%(nclass)s%(ncx)s] (%(label)s) {%(decTitle)s} ;\n''' 
     108parentNodeTmpl = '''   \\node [%(nclass)s%(ncx)s, parentLabel=%(decTitle)s fit={%(childList)s}] (%(label)s) {} ;\n''' 
    102109flxTmpl = '''  (%(ffrom)s) edge %(pathDec)s %(flxLabel)s (%(tto)s) \n''' 
    103110flxLabelTmpl = ''' node[below,align=center]{\\bf %s} ''' 
     
    158165    for mip,p in parents: 
    159166      try: 
    160         self.reservoirsIx[ (mip,p) ].child = parents[(mip,p)] 
     167        self.reservoirsIx[ (mip,p) ].addChildren( parents[(mip,p)] ) 
     168        ##self.reservoirsIx[ (mip,p) ].child = parents[(mip,p)] 
    161169        ##self.reservoirsIx[ (mip,p) ].child = thisnode 
    162         self.reservoirsIx[ (mip,p) ].isParent = True 
     170        ##self.reservoirsIx[ (mip,p) ].isParent = True 
    163171      except: 
    164172        print 'Failed to set parent: ', mip,p 
     
    247255  
    248256    vars = set() 
     257    oo.write( '\\begin{pgfonlayer}{child}\n' ) 
    249258    if mip in self.reservoirs: 
    250259      for this in self.reservoirs[mip] + self.reservoirs['all']: 
     
    261270          oo.write( nodeTmpl % this.__dict__ ) 
    262271          vars.add( this.var ) 
     272    oo.write( '\\end{pgfonlayer}{child}\n' ) 
    263273           
    264274           
Note: See TracChangeset for help on using the changeset viewer.