Exemple #1
0
 public void drawInternal(UGraphic ug) {
   if (color.size() > 1) {
     drawRainbow(ug);
   } else {
     worm.drawInternalOneColor(
         ug, color.getColors().get(0), 1.5, emphasizeDirection, endDecoration);
     drawInternalLabel(ug);
   }
 }
Exemple #2
0
 private void drawRainbow(UGraphic ug) {
   final List<HtmlColorAndStyle> colors = color.getColors();
   final int colorArrowSeparationSpace = color.getColorArrowSeparationSpace();
   final double move = 2 + colorArrowSeparationSpace;
   final WormMutation mutation = WormMutation.create(worm, move);
   final double globalMove = -1.0 * (colors.size() - 1) / 2.0;
   Worm current = worm.moveFirstPoint(mutation.getFirst().multiplyBy(globalMove));
   if (mutation.size() > 2) {
     current = current.moveLastPoint(mutation.getLast().multiplyBy(globalMove));
   }
   for (int i = 0; i < colors.size(); i++) {
     double stroke = 1.5;
     if (colorArrowSeparationSpace == 0) {
       stroke = i == colors.size() - 1 ? 2.0 : 3.0;
     }
     current.drawInternalOneColor(ug, colors.get(i), stroke, emphasizeDirection, endDecoration);
     current = mutation.mute(current);
   }
   final UTranslate textTranslate = mutation.getTextTranslate(colors.size());
   drawInternalLabel(ug.apply(textTranslate));
 }