public Paint apply(E e) { if (gradient_level == GRADIENT_NONE) { return defaultFunc.apply(e); } else { return super.apply(e); } }
public Paint apply(E e) { EndpointPair<N> endpoints = graph.incidentNodes(e); N b = endpoints.nodeU(); N f = endpoints.nodeV(); Point pb = layoutModel.apply(b); Point pf = layoutModel.apply(f); Point2D p2db = transformer.transform(pb.x, pb.y); Point2D p2df = transformer.transform(pf.x, pf.y); float xB = (float) p2db.getX(); float yB = (float) p2db.getY(); float xF = (float) p2df.getX(); float yF = (float) p2df.getY(); if (!graph.isDirected()) { xF = (xF + xB) / 2; yF = (yF + yB) / 2; } if (isSelfLoop(endpoints)) { yF += 50; xF += 50; } return new GradientPaint(xB, yB, getColor1(e), xF, yF, getColor2(e), true); }