예제 #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);
   }
 }
예제 #2
0
 public Snake(Rainbow color, UPolygon endDecoration) {
   if (color == null) {
     throw new IllegalArgumentException();
   }
   if (color.size() == 0) {
     throw new IllegalArgumentException();
   }
   this.endDecoration = endDecoration;
   this.color = color;
 }
예제 #3
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));
 }
예제 #4
0
 public CommandExecutionResult executeNow(ActivityDiagram3 diagram, BlocLines lines) {
   lines = lines.removeEmptyColumns();
   final RegexResult line0 = getStartingPattern().matcher(StringUtils.trim(lines.getFirst499()));
   // final HtmlColor color =
   // diagram.getSkinParam().getIHtmlColorSet().getColorIfValid(line0.get("COLOR", 0));
   // diagram.setColorNextArrow(HtmlColorAndStyle.fromColor(color));
   final String colorString = line0.get("COLOR", 0);
   if (colorString != null) {
     Rainbow rainbow =
         Rainbow.build(
             diagram.getSkinParam(),
             colorString,
             diagram.getSkinParam().colorArrowSeparationSpace());
     diagram.setColorNextArrow(rainbow);
   }
   lines = lines.removeStartingAndEnding2(line0.get("LABEL", 0));
   diagram.setLabelNextArrow(lines.toDisplay());
   return CommandExecutionResult.ok();
 }