Rotated labels

Both the point label descriptor and the polyline label descriptor can be used if the rectangular label has a rotation that depends on its position.
These descriptors work only if the labeling model attached to the Annealing Label Layout implements the interface IlvLabelingModelWithRotation. (The labeling model IlvDefaultLabelingModel implements this interface.)
Example
of a Label Layout with rotated labels
Rectangular label rotation dependent on position
In Java™ code, the label descriptor must describe how the rotation of a label depends on its position. For example, a label associated with a line can always have the rotation of the line. You must create a label descriptor whose method getRotation returns the corresponding rotation. See Label descriptor that returns the corresponding rotation.
Label descriptor that returns the corresponding rotation
layout.setLabelDescriptor(label,
    new IlvAnnealingPolylineLabelDescriptor(label, line,
            IlvAnnealingPolylineLabelDescriptor.FREE,
            IlvDirection.Left, IlvDirection.TopLeft,
            IlvAnnealingPolylineLabelDescriptor.GLOBAL) {

        public double getRotation(IlvLabelingModel model, 
                IlvRect labelRect) {
            IlvLine line = (IlvLine)getRelatedObstacle();
            IlvPoint p1 = line.getFrom();
            IlvPoint p2 = line.getTo();
            double angle = Math.atan2(p2.y-p1.y, p2.x-p1.x);
            return Math.toDegrees(angle);
        }
    });
If the method getRotation is not overridden, it will query the labeling model for the rotation. Therefore, as an alternative to overriding the method getRotation at the label descriptor, it is also possible to override the method getRotation of the default labeling model (more specifically of the IlvLabelingModelWithRotation interface).
In CSS, it is not necessary to specify the rotation of the label. Rotated labels are only supported for IlvGeneralLink. CSS automatically uses polyline label descriptors that return the appropriate rotation for labels of IlvGeneralLink .