private void drawCrosses(Graphics g, List<Node> nodes, Rectangle clip) { Graphics2D g2 = (Graphics2D) g; Stroke oldStroke = g2.getStroke(); Stroke stroke = new BasicStroke(DefaultRenderConstants.DEFAULT_RED_CROSS_WIDTH); g2.setStroke(stroke); Paint oldPaint = g2.getPaint(); g2.setColor(Color.RED); for (Node node : nodes) { Rectangle r = node.getBounds(); if (!clip.intersects(r)) continue; g2.drawLine(r.x, r.y, r.x + r.width, r.y + r.height); g2.drawLine(r.x, r.y + r.height, r.x + r.width, r.y); } g2.setStroke(oldStroke); g2.setPaint(oldPaint); }
private void drawComponents( Graphics g, List<Renderable> comps, Rectangle clip, boolean drawEdgeFirst) { List<HyperEdge> edges = new ArrayList<HyperEdge>(); for (Renderable obj : comps) { if (obj instanceof HyperEdge) edges.add((HyperEdge) obj); } if (drawEdgeFirst) { // Draw HyperEdges for (HyperEdge reaction : edges) { // Have to validate connect nodes first in case empty bounds List<Node> nodes = reaction.getConnectedNodes(); for (Node node : nodes) node.validateBounds(g); reaction.validateConnectInfo(); if (clip.intersects(reaction.getBounds())) reaction.render(g); } } // Draw complexes now drawComplexes(comps, clip, g); for (Renderable obj : comps) { if (obj instanceof RenderableCompartment || obj instanceof RenderableComplex || obj instanceof RenderablePathway) continue; // Escape it. It should be drawn earlier. if (obj instanceof Node) { Node node = (Node) obj; if (getHidePrivateNote() && (node instanceof Note) && ((Note) node).isPrivate()) continue; node.validateBounds(g); if (clip.intersects(node.getBounds())) node.render(g); } } if (!drawEdgeFirst) { // Draw HyperEdges for (HyperEdge reaction : edges) { reaction.validateConnectInfo(); if (clip.intersects(reaction.getBounds())) reaction.render(g); } } }