Ejemplo n.º 1
0
 def getColor(self, item):
     vis = self.getVisualization()
     if vis.isInGroup(item, Visualization.FOCUS_ITEMS):
         return ColorLib.rgb(50, 50, 255)                
     elif vis.isInGroup(item, Visualization.SEARCH_ITEMS):
         return ColorLib.rgb(220, 220, 255)
     else:
         return ColorLib.rgba(255, 255, 255, 0)                
Ejemplo n.º 2
0
def createVisualization(tree):
    vis = Visualization()
    vis.add('tree', tree)
    
    labelRenderer = LabelRenderer('title')
    labelRenderer.setRenderType(AbstractShapeRenderer.RENDER_TYPE_DRAW_AND_FILL)
    labelRenderer.setHorizontalAlignment(Constants.LEFT)
    labelRenderer.setRoundedCorner(8, 8)
    labelRenderer.setVerticalPadding(1)
    labelRenderer.setHorizontalPadding(4)
    edgeRenderer = EdgeRenderer()    
    edgeRenderer = EdgeRenderer(Constants.EDGE_TYPE_CURVE)

    edgeRenderer.setHorizontalAlignment1(Constants.RIGHT)
    edgeRenderer.setHorizontalAlignment2(Constants.LEFT)    
    edgeRenderer.setVerticalAlignment1(Constants.CENTER)
    edgeRenderer.setVerticalAlignment2(Constants.CENTER)        

    rendererFactory = DefaultRendererFactory(labelRenderer)
    rendererFactory.add(InGroupPredicate('tree.edges'), edgeRenderer)
    vis.setRendererFactory(rendererFactory)

    nodeFillColor = NodeFillColorAction('tree.nodes')
    nodeStrokeColor = NodeStrokeColorAction('tree.nodes')
    textColor = TextColorAction('tree.nodes')
    vis.putAction("textColor", textColor)
        
    edgeColor = ColorAction('tree.edges',
                            VisualItem.STROKECOLOR, ColorLib.rgb(200,200,200))

    vis.setInteractive('tree.edges', None, 0)
        
    repaint = ActionList()
    repaint.add(nodeFillColor)
    repaint.add(nodeStrokeColor)
    repaint.add(RepaintAction())
    vis.putAction('repaint', repaint)

    fullPaint = ActionList()
    fullPaint.add(nodeFillColor)
    fullPaint.add(nodeStrokeColor)    
    vis.putAction('fullPaint', fullPaint)

    animatePaint = ActionList(400)
    animatePaint.add(ColorAnimator('tree.nodes'))
    animatePaint.add(RepaintAction())
    vis.putAction('animatePaint', animatePaint)
    treeLayout = NodeLinkTreeLayout('tree', Constants.ORIENT_LEFT_RIGHT, 50, 2, 8)
    treeLayout.setLayoutAnchor(Point2D.Double(25, 300))
    vis.putAction('treeLayout', treeLayout)

    resize = ActionList(1000)
    z = ZoomToFitAction(vis)
    resize.add(z)
    vis.putAction('resize', resize)

    subLayout = CollapsedSubtreeLayout('tree', Constants.ORIENT_LEFT_RIGHT)
    vis.putAction('subLayout', subLayout)

    autoPan = AutoPanAction()
    filter = ActionList()
    
    fisheye = FisheyeTreeFilter('tree', 1)
    filter.add(fisheye)

    filter.add(FontAction('tree.nodes', FontLib.getFont('Tahoma', 12)))
    filter.add(nodeFillColor)
    filter.add(nodeStrokeColor)    
    filter.add(treeLayout)
    filter.add(subLayout)
    filter.add(textColor)
    filter.add(edgeColor)
    vis.putAction('filter', filter)

    animate = ActionList(500)
    animate.setPacingFunction(SlowInSlowOutPacer())
    animate.add(autoPan)
    animate.add(QualityControlAnimator())
    animate.add(VisibilityAnimator('tree'))
    animate.add(LocationAnimator('tree.nodes'))
    animate.add(ColorAnimator('tree.nodes'))
    animate.add(RepaintAction())
    vis.putAction('animate', animate)
    vis.alwaysRunAfter('filter', 'animate')
    return (vis, fisheye)
Ejemplo n.º 3
0
 def getColor(self, item):
     vis = self.getVisualization()
     if item.getInt('child_count') > 0:
         return ColorLib.rgb(50, 50, 50)
     else:
         return ColorLib.rgba(255, 255, 255, 0)
Ejemplo n.º 4
0
 def getColor(self, item):
     vis = self.getVisualization()
     if vis.isInGroup(item, Visualization.FOCUS_ITEMS):
         return ColorLib.rgb(255, 255, 255)
     else:
         return ColorLib.rgb(0, 0, 0)