nodeLabel = nodeLabel + String.valueOf(node.bootstrap);
}
- if (node.hasLabel())
++
++ boolean showColouredLinesForSSProviders = true;
++
+ //Display secondary structure providers as labels only if:
+ // ~ node has Label assigned (Secondary structure providers)
+ // ~ node count is greater than 3
+ // ~ showSecondaryStructureProvider option is set to true by the user
- if ( node.hasLabel() && showSecondaryStructureProvider && node.count > 3)
++ if ( node.hasLabel() && showSecondaryStructureProvider && showColouredLinesForSSProviders)
{
++
+ drawLinesAndLabelsForSecondaryStructureProvider(g, node, xstart, xend, ypos, nodeLabel);
+
+ int labelWidth = 20;
+ int labelHeight = fm.getHeight();
+
+ // Calculate the bounding box of the string
+ int xLabelPos = xstart + 2;
+ int yLabelPos = ypos - 2;
+ Rectangle labelBounds = new Rectangle(xLabelPos, yLabelPos - labelHeight, labelWidth, labelHeight);
+
+ // Add the bounding box to the map for this node (list allows multiple bounding boxes)
- labelBoundsMap.computeIfAbsent(node, k -> new ArrayList<>()).add(labelBounds);
++ labelBoundsMap.computeIfAbsent(node, k -> new ArrayList<>()).add(labelBounds);
+
+ }
++ else if ( node.hasLabel() && showSecondaryStructureProvider && node.count > 3)
++ {
++
+ String label = node.getLabel();
+
+ if(label.length() > labelLengthThreshold) {
+
+ //label = AlignmentUtils.reduceLabelLength(label);
+ }
+
+ nodeLabel = label + " | " + nodeLabel;
+
+ // Split the nodeLabel by "|"
+ String[] lines = nodeLabel.split("\\|");
+
+ // Iterate over the lines and draw each string separately
+ String longestLabelString = "";
+ int i = 0;
+ for (i = 0; i < lines.length; i++) {
+ g.drawString(lines[i].trim(), xstart + 2, ypos - 2 - (i * fm.getHeight()));
+ if(longestLabelString.length() < lines[i].trim().length()) {
+ longestLabelString = lines[i].trim();
+ }
+ }
+
+ int labelWidth = fm.stringWidth(longestLabelString);
+ int labelHeight = fm.getHeight() * (i-1);
+
+ // Calculate the bounding box of the string
+ int xLabelPos = xstart + 2;
+ int yLabelPos = ypos - 2;
+ Rectangle labelBounds = new Rectangle(xLabelPos, yLabelPos - labelHeight, labelWidth, labelHeight);
+ // Add the bounding box to the map for this node (list allows multiple bounding boxes)
+ labelBoundsMap.computeIfAbsent(node, k -> new ArrayList<>()).add(labelBounds);
+ }
-
else if (!nodeLabel.equals(""))
{
g.drawString(nodeLabel, xstart + 2, ypos - 2);