/** * Places the given end label of the given edge starting at the given node. * * @param node source node of the edge. * @param edge the edge whose end label to place. * @param label the end label to place. * @param labelSpacing space between objects and labels. */ private void placeEndLabel( final LNode node, final LEdge edge, final LLabel label, final double labelSpacing) { // Get the nearest port (source port for tail labels, target port for head labels) LPort port = null; if (label.getProperty(LayeredOptions.EDGE_LABELS_PLACEMENT) == EdgeLabelPlacement.TAIL) { port = edge.getSource(); } else if (label.getProperty(LayeredOptions.EDGE_LABELS_PLACEMENT) == EdgeLabelPlacement.HEAD) { port = edge.getTarget(); } // Initialize offset with zero if no offset was present if (!northOffset.containsKey(port.getNode())) { northOffset.put(port.getNode(), 0.0); } if (!southOffset.containsKey(port.getNode())) { southOffset.put(port.getNode(), 0.0); } if (!portLabelOffsetHint.containsKey(port)) { portLabelOffsetHint.put(port, 0.0); } // Calculate end label position based on side choice // Port side undefined can be left out, because there would be no reasonable // way of handling them if (label.getProperty(InternalProperties.LABEL_SIDE) == LabelSide.ABOVE) { placeEndLabelUpwards(node, label, port, labelSpacing); } else { placeEndLabelDownwards(node, label, port, labelSpacing); } }