The legend area; positionCode should be TOP_LEFT, TOP_RIGHT, etc.
(int positionCode, int width, int height, int frameThickness)
| 4106 | |
| 4107 | /** The legend area; positionCode should be TOP_LEFT, TOP_RIGHT, etc. */ |
| 4108 | Rectangle legendRect(int positionCode, int width, int height, int frameThickness) { |
| 4109 | boolean leftPosition = positionCode == TOP_LEFT || positionCode == BOTTOM_LEFT; |
| 4110 | boolean topPosition = positionCode == TOP_LEFT || positionCode == TOP_RIGHT; |
| 4111 | int x0 = (leftPosition) ? |
| 4112 | leftMargin + sc(2*LEGEND_PADDING) + frameThickness/2 : |
| 4113 | leftMargin + frameWidth - width - sc(2*LEGEND_PADDING) - frameThickness/2; |
| 4114 | int y0 = (topPosition) ? |
| 4115 | topMargin + sc(LEGEND_PADDING) + frameThickness/2 : |
| 4116 | topMargin + frameHeight - height - sc(LEGEND_PADDING) + frameThickness/2; |
| 4117 | if (hasFlag(Y_TICKS)) |
| 4118 | x0 += (leftPosition ? 1 : -1) * sc(tickLength - LEGEND_PADDING); |
| 4119 | if (hasFlag(X_TICKS)) |
| 4120 | y0 += (topPosition ? 1 : -1) * sc(tickLength - LEGEND_PADDING/2); |
| 4121 | return new Rectangle(x0, y0, width, height); |
| 4122 | } |
| 4123 | |
| 4124 | /** The position code of the legend position where the smallest amount of foreground pixels is covered */ |
| 4125 | int autoLegendPosition(int width, int height, int frameThickness) { |
no test coverage detected