Beispiel #1
0
 def __init__(self, theFig, theLineNum):
     super(SVGTreeNodeMain, self).__init__(theFig, theLineNum)
     # PpTokenCount object for my children only, set on finalise
     self._tokenCounterChildren = PpTokenCount.PpTokenCount()
     ## PpTokenCount object for me and my my children , set on finalise
     #self._tokenCounterTotal = PpTokenCount.PpTokenCount()
     # Total number of significant tokens in all children
     self._numChildSigTokens = 0
     # Mandatory override of the bounding box object
     self._bb = PlotNode.PlotNodeBboxBoxy()
     if theFig is None:
         # Root node, children only
         self._dataMap = None
     else:
         self._dataMap = {}
         # Take a copy of the include graph data
         self._dataMap['numToks'] = theFig.numTokens
         self._dataMap['condComp'] = theFig.condComp
         # A PpTokenCount.PpTokenCount() object for this node only.
         self._dataMap['tokenCntr'] = theFig.tokenCounter
         self._dataMap['findLogic'] = theFig.findLogic
     # A list of tuples of (Coord.Pt, Cooord.Box, attributes) that are to be
     # written last as <rect class="invis" ...
     self._triggerS = []
     # We have two passes
     self._numPassesToPlotSelf = 2
Beispiel #2
0
 def setUp(self):
     self._pnbcObj = PlotNode.PlotNodeBboxBoxy()
     self._pnbcObj.width = Coord.Dim(12, 'mm')
     self._pnbcObj.depth = Coord.Dim(8, 'mm')
     #print '\nTRACE self._pnbcObj', self._pnbcObj
     self._pnbcObj.bbSelfPadding = Coord.Pad(
         Coord.Dim(1, 'mm'),  # prev
         Coord.Dim(3, 'mm'),  # next
         Coord.Dim(5, 'mm'),  # parent
         Coord.Dim(7, 'mm'),  # child
     )
     self._pnbcObj.bbSpaceChildren = Coord.Dim(16, 'mm')
     self.assertEqual(True, self._pnbcObj.bbChildrenWidth is None)
     self.assertEqual(True, self._pnbcObj.bbChildrenDepth is None)
     self.assertEqual(0, self._pnbcObj.numChildren)
     self._pnbcObj.extendChildBbox(
         Coord.Box(
             Coord.Dim(15, 'mm'),
             Coord.Dim(7, 'mm'),
         ))
     # Child box now w:15, d:7
     self.assertEqual(1, self._pnbcObj.numChildren)
     self.assertEqual(self._pnbcObj.bbChildrenWidth, Coord.Dim(15, 'mm'))
     self.assertEqual(self._pnbcObj.bbChildrenDepth, Coord.Dim(7, 'mm'))
     self._pnbcObj.extendChildBbox(
         Coord.Box(
             Coord.Dim(31, 'mm'),
             Coord.Dim(29, 'mm'),
         ))
     # Child box now w:15+31=46, d:max(7,29)=29
     self.assertEqual(2, self._pnbcObj.numChildren)
     self.assertEqual(self._pnbcObj.bbChildrenWidth, Coord.Dim(46, 'mm'))
     self.assertEqual(self._pnbcObj.bbChildrenDepth, Coord.Dim(29, 'mm'))
     self._pnbcObj.extendChildBbox(
         Coord.Box(
             Coord.Dim(11, 'mm'),
             Coord.Dim(9, 'mm'),
         ))
     # Child box now w:46+11=57, d:max(29,9)=29
     self.assertEqual(3, self._pnbcObj.numChildren)
     self.assertEqual(self._pnbcObj.bbChildrenWidth, Coord.Dim(57, 'mm'))
     self.assertEqual(self._pnbcObj.bbChildrenDepth, Coord.Dim(29, 'mm'))
     # Logical datum
     self._logicalDatum = Coord.Pt(
         Coord.Dim(21, 'mm'),
         Coord.Dim(180, 'mm'),
     )
Beispiel #3
0
 def setUp(self):
     self._pnbcObj = PlotNode.PlotNodeBboxBoxy()
     self._pnbcObj.width = Coord.Dim(12, 'mm')
     self._pnbcObj.depth = Coord.Dim(8, 'mm')
     #print '\nTRACE self._pnbcObj', self._pnbcObj
     self._pnbcObj.bbSelfPadding = Coord.Pad(
         Coord.Dim(1, 'mm'),  # prev
         Coord.Dim(3, 'mm'),  # next
         Coord.Dim(5, 'mm'),  # parent
         Coord.Dim(7, 'mm'),  # child
     )
     self._pnbcObj.bbSpaceChildren = Coord.Dim(16, 'mm')
     self.assertEqual(True, self._pnbcObj.bbChildrenWidth is None)
     self.assertEqual(True, self._pnbcObj.bbChildrenDepth is None)
     self.assertEqual(0, self._pnbcObj.numChildren)
     # Logical datum
     self._logicalDatum = Coord.Pt(
         Coord.Dim(21, 'mm'),
         Coord.Dim(180, 'mm'),
     )