The IlvLabelingModelWithRotation Interface

The methods of the IlvLabelingModel class are designed to support upright rectangular labels. If rotated rectangular labels occur in your application, the labeling model must additionally implement the interface IlvLabelingModelWithRotation.
In IlvLabelingModelWithRotation , all labels are considered rectangles that can be rotated around the center of the label. Hence, the method boundingBox of the labeling model returns the bounding box of the unrotated label, not the bounding box of the rotated label.
The IlvLabelingModelWithRotation interface assumes that the rotation of the label depends on the position of the label. For example, if the label is placed close to link segments, the label should be rotated according to the link segments.

Rotations

You can retrieve the rotation of the label with the method:
double getRotation(Object label, IlvRect positionRectangle) 
You can set the rotation of the label with the method:
void setRotation(Object label, double angle) 
The angles are in degrees.
The method setRotation(Object label, double angle) is called by the Annealing Label Layout at the end of layout to inform the label about the final rotation calculated by the layout. If the label is attached to a link and always follows the rotation of the link automatically, it will not be necessary to inform the label about the final rotation. Therefore, setRotation( Object label, double angle ) can be empty, but getRotation( Object label, IlvRect positionRectangle ) must return the rotation of the link segment when the label is placed at positionRectangle .

Overlap calculations

The IlvLabelingModelWithRotation interface offers methods for calculating the overlaps of rotated labels. These methods have as additional parameter an angle for the label parameters:
Methods for Calculating Overlaps of Rotated Labels
   double getLabelOverlap(Object label1, IlvRect rect1, 
       double angle1, Object label2, IlvRect rect2, 
       double angle2, float minDist);

   double getObstacleOverlap(
       Object label, IlvRect labelRect, double angle,
       Object obstacle, IlvRect obstacleBBox, float minDist);

   double getPolylineObstacleOverlap(
       Object label, IlvRect labelRect, double angle,
       Object polylineObstacle, IlvPoint[] pts, 
       float lineWidth, float minDist);
For each label parameter, an unrotated rectangle ( labelRect ) is passed, which defines the speculative position of the label and a rotation angle.
The meaning of the returned value is the overlap penalty if the label were placed at labelRect and rotated by the angle and if the obstacle were placed at obstacleBBox . The penalty 0 means that the objects do not overlap.