src/Tools/Graphview/shapes.scala
changeset 59293 305e79989d48
parent 59292 fef652c88263
child 59294 126293918a37
equal deleted inserted replaced
59292:fef652c88263 59293:305e79989d48
    24     def shape(visualizer: Visualizer, node: Graph_Display.Node): Rectangle2D.Double =
    24     def shape(visualizer: Visualizer, node: Graph_Display.Node): Rectangle2D.Double =
    25     {
    25     {
    26       val metrics = visualizer.metrics
    26       val metrics = visualizer.metrics
    27       val p = visualizer.Coordinates.get_node(node)
    27       val p = visualizer.Coordinates.get_node(node)
    28       val bounds = metrics.string_bounds(node.toString)
    28       val bounds = metrics.string_bounds(node.toString)
    29       val w = bounds.getWidth + metrics.pad
    29       val w = bounds.getWidth + metrics.pad_x
    30       val h = bounds.getHeight + metrics.pad
    30       val h = bounds.getHeight + metrics.pad_y
    31       new Rectangle2D.Double((p.x - (w / 2)).floor, (p.y - (h / 2)).floor, w.ceil, h.ceil)
    31       new Rectangle2D.Double((p.x - (w / 2)).floor, (p.y - (h / 2)).floor, w.ceil, h.ceil)
    32     }
    32     }
    33 
    33 
    34     def paint(gfx: Graphics2D, visualizer: Visualizer, node: Graph_Display.Node)
    34     def paint(gfx: Graphics2D, visualizer: Visualizer, node: Graph_Display.Node)
    35     {
    35     {
    56   object Dummy
    56   object Dummy
    57   {
    57   {
    58     def shape(visualizer: Visualizer, d: Layout.Point): Rectangle2D.Double =
    58     def shape(visualizer: Visualizer, d: Layout.Point): Rectangle2D.Double =
    59     {
    59     {
    60       val metrics = visualizer.metrics
    60       val metrics = visualizer.metrics
    61       val w = metrics.space_width
    61       val w = metrics.pad_x
    62       new Rectangle2D.Double((d.x - (w / 2)).floor, (d.y - (w / 2)).floor, w.ceil, w.ceil)
    62       new Rectangle2D.Double((d.x - (w / 2)).floor, (d.y - (w / 2)).floor, w.ceil, w.ceil)
    63     }
    63     }
    64 
    64 
    65     def paint(gfx: Graphics2D, visualizer: Visualizer, d: Layout.Point)
    65     def paint(gfx: Graphics2D, visualizer: Visualizer, d: Layout.Point)
    66     {
    66     {