use of org.cytoscape.ding.impl.strokes.WidthStroke in project cytoscape-impl by cytoscape.
the class DEdgeDetails method getStroke.
@Override
public Stroke getStroke(final CyEdge edge) {
Stroke stroke = null;
final DEdgeView dev = dGraphView.getDEdgeView(edge);
if (dev == null)
return null;
if (dev.isValueLocked(EDGE_LINE_TYPE) || dev.isValueLocked(EDGE_WIDTH)) {
// If one of these properties are locked, the stroke has to be recreated
final LineType lineType = dev.getVisualProperty(EDGE_LINE_TYPE);
stroke = DLineType.getDLineType(lineType).getStroke(getWidth(edge));
// We need to handle animated edges with some care...
if (stroke instanceof AnimatedStroke) {
Stroke oldStroke = m_strokes.get(edge);
if (oldStroke != null && oldStroke.getClass().equals(stroke.getClass()))
stroke = ((WidthStroke) oldStroke).newInstanceForWidth(getWidth(edge));
}
} else {
stroke = m_strokes.get(edge);
if (stroke == null) {
if (m_strokeDefault == null)
stroke = super.getStroke(edge);
else
stroke = m_strokeDefault;
}
}
if (stroke instanceof AnimatedStroke)
dGraphView.addAnimatedEdge(dev);
else
dGraphView.removeAnimatedEdge(dev);
return stroke;
}
Aggregations