Esempio n. 1
0
  private void drawFolder(
      UGraphic ug, double width, double height, Dimension2D dimTitle, boolean shadowing) {

    final double wtitle;
    if (dimTitle.getWidth() == 0) {
      wtitle = Math.max(30, width / 4);
    } else {
      wtitle = dimTitle.getWidth() + marginTitleX1 + marginTitleX2;
    }
    final double htitle = getHTitle(dimTitle);

    final UPolygon shape = new UPolygon();
    shape.addPoint(0, 0);
    shape.addPoint(wtitle, 0);

    shape.addPoint(wtitle + marginTitleX3, htitle);
    shape.addPoint(width, htitle);
    shape.addPoint(width, height);
    shape.addPoint(0, height);
    shape.addPoint(0, 0);
    if (shadowing) {
      shape.setDeltaShadow(3.0);
    }
    ug.draw(shape);
    ug.apply(new UTranslate(0, htitle)).draw(new ULine(wtitle + marginTitleX3, 0));
  }
Esempio n. 2
0
 public void drawU(UGraphic ug) {
   for (GTile tile : tiles) {
     tile.drawU(ug);
     final Dimension2D dim = tile.calculateDimension(ug.getStringBounder());
     ug = ug.apply(new UTranslate(0, dim.getHeight() + space));
   }
 }
 public void drawU(UGraphic ug) {
   ug.apply(new UChangeBackColor(ug.getParam().getColor())).draw(polygon);
   ug.apply(new UStroke(1.5))
       .apply(new UChangeBackColor(HtmlColorUtils.WHITE))
       .apply(new UTranslate(dest.getX() - radius, dest.getY() - radius))
       .draw(new UEllipse(radius * 2, radius * 2));
 }
Esempio n. 4
0
  public void drawU(UGraphic ug, Skin skin, ISkinParam skinParam) {
    final StringBounder stringBounder = ug.getStringBounder();

    final double atX = ug.getTranslateX();
    final double atY = ug.getTranslateY();

    ug.translate(getStartingX(stringBounder), 0);

    for (int i = 0; i < events.size(); i++) {
      ComponentType type = ComponentType.ALIVE_BOX_CLOSE_OPEN;
      for (final Iterator<SegmentColored> it = getSegmentsCutted(stringBounder, i).iterator();
          it.hasNext(); ) {
        final SegmentColored seg = it.next();
        final ISkinParam skinParam2 =
            new SkinParamBackcolored(skinParam, seg.getSpecificBackColor());
        if (it.hasNext() == false) {
          type =
              type == ComponentType.ALIVE_BOX_CLOSE_OPEN
                  ? ComponentType.ALIVE_BOX_CLOSE_CLOSE
                  : ComponentType.ALIVE_BOX_OPEN_CLOSE;
        }
        final Component comp = skin.createComponent(type, skinParam2, null);
        type = ComponentType.ALIVE_BOX_OPEN_OPEN;
        final int currentLevel = getLevel(seg.getSegment().getPos1());
        seg.drawU(ug, comp, currentLevel);
      }
    }

    ug.setTranslate(atX, atY);
  }
Esempio n. 5
0
 public void drawU(UGraphic ug, double x, double y) {
   if (fill) {
     ug.getParam().setBackcolor(ug.getParam().getColor());
   }
   ug.draw(x, y, polygon);
   ug.getParam().setBackcolor(null);
 }
Esempio n. 6
0
  public final void drawU(UGraphic ug) {
    final StringBounder stringBounder = ug.getStringBounder();
    final TextBlockInEllipse ellipse = new TextBlockInEllipse(desc, stringBounder);
    if (getSkinParam().shadowing()) {
      ellipse.setDeltaShadow(3);
    }

    if (url != null) {
      ug.startUrl(url);
    }

    ug =
        ug.apply(stroke)
            .apply(
                new UChangeColor(
                    SkinParamUtils.getColor(
                        getSkinParam(), ColorParam.usecaseBorder, getStereo())));
    HtmlColor backcolor = getEntity().getSpecificBackColor();
    if (backcolor == null) {
      backcolor =
          SkinParamUtils.getColor(getSkinParam(), ColorParam.usecaseBackground, getStereo());
    }
    ug = ug.apply(new UChangeBackColor(backcolor));
    final UGraphic ug2 = new MyUGraphicEllipse(ug, 0, 0, ellipse.getUEllipse());

    ellipse.drawU(ug2);

    if (url != null) {
      ug.closeAction();
    }
  }
 @Override
 protected void drawInternalU(UGraphic ug, Dimension2D dimensionToUse) {
   stroke(ug, 2, 2);
   ug.getParam().setColor(groupBorder);
   ug.draw(0, 1, new ULine(dimensionToUse.getWidth(), 0));
   ug.getParam().setStroke(new UStroke());
   getTextBlock().drawU(ug, getMarginX1(), getMarginY());
 }
Esempio n. 8
0
 public void drawU(UGraphic ug) {
   final StringBounder stringBounder = ug.getStringBounder();
   final Dimension2D cell = getMaxCellDimension(stringBounder);
   for (Layer layer : distribution.getLayers()) {
     drawLayer(ug, layer, cell.getWidth(), cell.getHeight());
     ug = ug.apply(new UTranslate(0, cell.getHeight()));
   }
 }
Esempio n. 9
0
 @Override
 protected void drawBackgroundInternalU(UGraphic ug, Area area) {
   final Dimension2D dimensionToUse = area.getDimensionToUse();
   ug = symbolContext.apply(ug);
   ug.draw(new URectangle(dimensionToUse.getWidth(), dimensionToUse.getHeight()));
   final double xpos = (dimensionToUse.getWidth() - getPureTextWidth(ug.getStringBounder())) / 2;
   getTextBlock().drawU(ug.apply(new UTranslate(xpos, 0)));
 }
Esempio n. 10
0
 public void drawU(UGraphic ug, double x, double y, int zIndex, Dimension2D dimToUse) {
   if (background != null) {
     final Dimension2D dim = getPreferredDimension(ug.getStringBounder(), x, y);
     ug.getParam().setBackcolor(background);
     ug.draw(x, y, new URectangle(dim.getWidth(), dim.getHeight()));
     ug.getParam().setBackcolor(null);
   }
   block.drawU(ug, x, y);
 }
Esempio n. 11
0
 public void drawU(
     UGraphic ug,
     double xTheoricalPosition,
     double yTheoricalPosition,
     double marginWidth,
     double marginHeight) {
   ug = ug.apply(new UTranslate(xTheoricalPosition, yTheoricalPosition));
   comp.drawU(ug, new Area(getDimension(ug.getStringBounder())), new SimpleContext2D(false));
 }
Esempio n. 12
0
  public void drawU(UGraphic ug) {
    ug = ug.apply(new UStroke(1.5)).apply(new UChangeBackColor(HtmlColorUtils.WHITE));
    ug.apply(new UTranslate(dest.getX() - radius, dest.getY() - radius))
        .draw(new UEllipse(radius * 2, radius * 2));

    final double deg = -ortho * 180 / Math.PI + 90 - 45;
    final UEllipse arc1 = new UEllipse(2 * radius2, 2 * radius2, deg, 90);
    ug.apply(new UTranslate(dest.getX() - radius2, dest.getY() - radius2)).draw(arc1);
  }
Esempio n. 13
0
 public void drawU(UGraphic ug, double x, double y, int zIndex, Dimension2D dimToUse) {
   if (zIndex != 0) {
     return;
   }
   final HtmlColor old = ug.getParam().getColor();
   ug.getParam().setColor(HtmlColorUtils.getColorIfValid("#AAAAAA"));
   ug.draw(x, y, new ULine(dimToUse.getWidth(), 0));
   ug.getParam().setColor(old);
 }
  public void drawU(UGraphic ug) {
    final StringBounder stringBounder = ug.getStringBounder();
    final Component comp = getComponent(stringBounder);
    final Dimension2D dim = comp.getPreferredDimension(stringBounder);
    final Area area = new Area(dim.getWidth(), dim.getHeight());
    tile.drawU(ug);
    final Real p = getNotePosition(stringBounder);

    comp.drawU(ug.apply(new UTranslate(p.getCurrentValue(), 0)), area, (Context2D) ug);
  }
Esempio n. 15
0
 private void drawLayer(UGraphic ug, Layer layer, double w, double h) {
   for (IEntity ent : layer.entities()) {
     final IEntityImage image = computeImage((ILeaf) ent);
     final int longitude = layer.getLongitude(ent);
     final Dimension2D dimImage = image.calculateDimension(ug.getStringBounder());
     final double diffx = w - dimImage.getWidth();
     final double diffy = h - dimImage.getHeight();
     image.drawU(ug.apply(new UTranslate(w * longitude / 2 + diffx / 2, diffy / 2)));
   }
 }
Esempio n. 16
0
  public void drawU(UGraphic ug) {

    final double suppY1 = north.calculateDimension(ug.getStringBounder()).getHeight();
    ug = ug.apply(new UTranslate(0, suppY1));
    ug.apply(new UChangeColor(borderColor))
        .apply(getThickness())
        .apply(new UChangeBackColor(backColor))
        .draw(Diamond.asPolygon(skinParam().shadowing()));
    // final Dimension2D dimNorth = north.calculateDimension(ug.getStringBounder());
    north.drawU(ug.apply(new UTranslate(Diamond.diamondHalfSize * 1.5, -suppY1)));

    // final Dimension2D dimSouth = south.calculateDimension(ug.getStringBounder());
    south.drawU(
        ug.apply(new UTranslate(Diamond.diamondHalfSize * 1.5, 2 * Diamond.diamondHalfSize)));
    // south.drawU(ug.apply(new UTranslate(-(dimSouth.getWidth() - 2 * Diamond.diamondHalfSize) / 2,
    // 2 * Diamond.diamondHalfSize)));

    final Dimension2D dimWeat1 = west1.calculateDimension(ug.getStringBounder());
    west1.drawU(
        ug.apply(
            new UTranslate(-dimWeat1.getWidth(), -dimWeat1.getHeight() + Diamond.diamondHalfSize)));

    final Dimension2D dimEast1 = east1.calculateDimension(ug.getStringBounder());
    east1.drawU(
        ug.apply(
            new UTranslate(
                Diamond.diamondHalfSize * 2, -dimEast1.getHeight() + Diamond.diamondHalfSize)));
  }
Esempio n. 17
0
 private UGraphic drawOctagon(UGraphic ug) {
   final Shape shape = bibliotekon.getShape(getEntity());
   final Shadowable octagon = shape.getOctagon();
   if (getSkinParam().shadowing()) {
     octagon.setDeltaShadow(4);
   }
   ug = applyColors(ug);
   ug.apply(new UStroke(1.5)).draw(octagon);
   desc.drawU(ug.apply(new UTranslate(MARGIN, MARGIN)));
   return ug;
 }
Esempio n. 18
0
 private void manage(UGraphic ug, double x, double y, int n, String last, double pendingX) {
   final double width = n * dayWidth - pendingX;
   ug.apply(new UTranslate(x + pendingX, y)).draw(new URectangle(width, getHeight()));
   final TextBlock b =
       Display.create(last)
           .create(fontConfig, HorizontalAlignment.LEFT, new SpriteContainerEmpty());
   final Dimension2D dimText = b.calculateDimension(ug.getStringBounder());
   final double diffX = width - dimText.getWidth();
   final double diffY = getHeight() - dimText.getHeight();
   b.drawU(ug.apply(new UTranslate((x + pendingX + diffX / 2), (y + diffY / 2))));
 }
Esempio n. 19
0
 private void manage(UGraphic ug, double x, double y, int n, String last, double pendingX) {
   final double width = n * dayWidth - pendingX;
   ug.draw(x + pendingX, y, new URectangle(width, getHeight()));
   final TextBlock b =
       TextBlockUtils.create(
           Arrays.asList(last), fontConfig, HorizontalAlignement.LEFT, new SpriteContainerEmpty());
   final Dimension2D dimText = b.calculateDimension(ug.getStringBounder());
   final double diffX = width - dimText.getWidth();
   final double diffY = getHeight() - dimText.getHeight();
   b.drawU(ug, x + pendingX + diffX / 2, y + diffY / 2);
 }
Esempio n. 20
0
 public void drawU(UGraphic ug, int zIndex, Dimension2D dimToUse) {
   if (zIndex != 0) {
     return;
   }
   final Dimension2D dim = getPreferredDimension(ug.getStringBounder(), 0, 0);
   ug = ug.apply(new UStroke(stroke));
   ug.apply(new UChangeBackColor(HtmlColorSet.getInstance().getColorIfValid("#EEEEEE")))
       .apply(new UTranslate(stroke, stroke))
       .draw(new URectangle(dim.getWidth() - 2 * stroke, dim.getHeight() - 2 * stroke, 10, 10));
   final Dimension2D dimPureText = getPureTextDimension(ug.getStringBounder());
   drawText(ug, (dim.getWidth() - dimPureText.getWidth()) / 2, stroke + marginY);
 }
Esempio n. 21
0
 private UGraphic applyColors(UGraphic ug) {
   ug =
       ug.apply(
           new UChangeColor(
               SkinParamUtils.getColor(getSkinParam(), ColorParam.activityBorder, getStereo())));
   HtmlColor backcolor = getEntity().getColors(getSkinParam()).getColor(ColorType.BACK);
   if (backcolor == null) {
     backcolor =
         SkinParamUtils.getColor(getSkinParam(), ColorParam.activityBackground, getStereo());
   }
   ug = ug.apply(new UChangeBackColor(backcolor));
   return ug;
 }
Esempio n. 22
0
 public void drawU(UGraphic ug) {
   double x = 0;
   double y = 0;
   x += margin;
   y += margin;
   ug =
       ug.apply(new UStroke(thickness))
           .apply(new UChangeBackColor(backgroundColor))
           .apply(new UChangeColor(foregroundColor));
   final UEllipse circle = new UEllipse(radius * 2, radius * 2);
   circle.setDeltaShadow(deltaShadow);
   ug.apply(new UTranslate(x, y)).draw(circle);
 }
Esempio n. 23
0
  public void drawU(UGraphic ug, Area area, Context2D context) {
    final Dimension2D dimensionToUse = area.getDimensionToUse();
    final HtmlColor lineColor = rose.getHtmlColor(skinParam, ColorParam.packageBorder);
    ug.getParam().setColor(lineColor);
    ug.getParam().setBackcolor(null);
    ug.getParam().setStroke(new UStroke(1.4));
    ug.draw(0, 0, new URectangle(dimensionToUse.getWidth(), dimensionToUse.getHeight()));
    ug.getParam().setStroke(new UStroke());

    final TextBlock textBlock = createTextBloc();
    textBlock.drawU(ug, 2, 2);

    final Dimension2D textDim = getTextDim(ug.getStringBounder());
    final double x = textDim.getWidth() + 6;
    final double y = textDim.getHeight() + 6;
    final UPolygon poly = new UPolygon();
    poly.addPoint(x, 0);
    poly.addPoint(x, y - 6);
    poly.addPoint(x - 6, y);
    poly.addPoint(0, y);
    poly.addPoint(0, 0);
    ug.getParam().setColor(lineColor);
    ug.getParam().setStroke(new UStroke(1.4));
    ug.draw(0, 0, poly);
    ug.getParam().setStroke(new UStroke());
  }
Esempio n. 24
0
 public final void drawU(UGraphic ug) {
   if (url != null) {
     ug.startUrl(url);
   }
   if (getShapeType() == ShapeType.ROUND_RECTANGLE) {
     ug = drawNormal(ug);
   } else if (getShapeType() == ShapeType.OCTAGON) {
     ug = drawOctagon(ug);
   } else {
     throw new UnsupportedOperationException();
   }
   if (url != null) {
     ug.closeAction();
   }
 }
Esempio n. 25
0
	public void draw(UGraphic ug, double x, double y) {

		final TextBlock timeHeader = project.getTimeHeader(dayWith);
		final Row row = getMainRow();
		final TextBlock headers = row.header();

		final double deltaX = headers.calculateDimension(ug.getStringBounder()).getWidth();
		final double deltaY = timeHeader.calculateDimension(ug.getStringBounder()).getHeight();

		headers.drawU(ug.apply(new UTranslate(x, (y + deltaY))));
		final TextBlock tbRow = row.asTextBloc(project.getTimeConverter(dayWith));
		tbRow.drawU(ug.apply(new UTranslate((x + deltaX), (y + deltaY))));

		timeHeader.drawU(ug.apply(new UTranslate((x + deltaX), y)));
	}
Esempio n. 26
0
  public void drawU(
      UGraphic ug,
      double xTheoricalPosition,
      double yTheoricalPosition,
      double marginWidth,
      double marginHeight) {
    final Dimension2D dim = getDimension(ug.getStringBounder());

    final double widthTotal = dim.getWidth() + 2 * marginWidth;
    final double heightTotal = dim.getHeight() + 2 * marginHeight;
    final URectangle rect = new URectangle(widthTotal, heightTotal);

    // if (entity.getParent() == null) {
    if (entity.getType() != EntityType.GROUP) {
      ug.getParam().setBackcolor(rose.getHtmlColor(param, ColorParam.classBackground));
      ug.getParam().setColor(rose.getHtmlColor(param, ColorParam.classBorder));
      ug.draw(xTheoricalPosition - marginWidth, yTheoricalPosition - marginHeight, rect);
      // name.drawU(ug, xTheoricalPosition + margin, yTheoricalPosition + margin);
      name.drawU(ug, xTheoricalPosition + 0, yTheoricalPosition + 0);
    } else {
      // final Frame frame = new Frame(StringUtils.getWithNewlines(entity.getDisplay()),
      // Color.BLACK, param
      // .getFont(FontParam.CLASS), rose.getHtmlColor(param, ColorParam.classBorder).getColor());
      final Frame frame = new Frame(entity.getDisplay2(), param);

      ug.getParam().setBackcolor(rose.getHtmlColor(param, ColorParam.background));
      ug.getParam().setColor(null);
      ug.draw(xTheoricalPosition - marginWidth, yTheoricalPosition - marginWidth, rect);

      final double oldX = ug.getTranslateX();
      final double oldY = ug.getTranslateY();
      ug.translate(xTheoricalPosition - marginWidth, yTheoricalPosition - marginHeight);
      frame.drawU(ug, new Area(new Dimension2DDouble(widthTotal, heightTotal)), null);
      // ug.translate(-xTheoricalPosition + marginWidth,
      // -yTheoricalPosition + marginHeight);
      ug.setTranslate(oldX, oldY);

      // playField.drawInternal(UGraphicUtils.translate(ug, xTheoricalPosition + margin,
      // yTheoricalPosition +
      // margin
      // + frame.getPreferredHeight(ug.getStringBounder())));
      playField.drawInternal(
          UGraphicUtils.translate(
              ug,
              xTheoricalPosition + 0,
              yTheoricalPosition + 0 + frame.getPreferredHeight(ug.getStringBounder())));
    }
  }
Esempio n. 27
0
 public void drawU(UGraphic ug) {
   final UEllipse circle = new UEllipse(2 * radius, 2 * radius);
   // ug.draw(circle);
   for (Double angle : angles) {
     final double delta = 30;
     final UEllipse part = new UEllipse(2 * radius, 2 * radius, angle - delta, 2 * delta);
     ug.draw(part);
   }
   ug =
       ug.apply(new UChangeColor(HtmlColorUtils.GREEN))
           .apply(new UChangeBackColor(HtmlColorUtils.GREEN));
   for (Point2D pt : points) {
     final UTranslate tr = new UTranslate(pt);
     // ug.apply(tr).draw(new UEllipse(2, 2));
   }
 }
  public void drawTranslate(UGraphic ug, UTranslate translate1, UTranslate translate2) {
    final Snake snake = new Snake(color, true);
    final Point2D mp1a = translate1.getTranslated(p1);
    final Point2D mp2b = translate2.getTranslated(p2);
    final double middle = (mp1a.getY() + mp2b.getY()) / 2.0;
    snake.addPoint(mp1a);
    snake.addPoint(mp1a.getX(), middle);
    snake.addPoint(mp2b.getX(), middle);
    // snake.addPoint(mp2b);
    ug.draw(snake);

    final Snake small = new Snake(color, Arrows.asToDown());
    small.addPoint(mp2b.getX(), middle);
    small.addPoint(mp2b);
    ug.draw(small);
  }
Esempio n. 29
0
 @Override
 protected void drawInternalU(UGraphic ug, double maxX, Context2D context) {
   final StringBounder stringBounder = ug.getStringBounder();
   final double xStart = getStartingX(stringBounder);
   ug = ug.apply(new UTranslate(xStart, getStartingY()));
   final Dimension2D dimensionToUse =
       new Dimension2DDouble(
           getPreferredWidth(stringBounder), comp.getPreferredHeight(stringBounder));
   if (url != null) {
     ug.startUrl(url);
   }
   comp.drawU(ug, new Area(dimensionToUse), context);
   if (url != null) {
     ug.closeAction();
   }
 }
Esempio n. 30
0
  private UGraphic drawNormal(UGraphic ug) {
    final StringBounder stringBounder = ug.getStringBounder();
    final Dimension2D dimTotal = calculateDimension(stringBounder);

    final double widthTotal = dimTotal.getWidth();
    final double heightTotal = dimTotal.getHeight();
    final Shadowable rect = new URectangle(widthTotal, heightTotal, CORNER, CORNER);
    if (getSkinParam().shadowing()) {
      rect.setDeltaShadow(4);
    }

    ug = applyColors(ug);
    ug.apply(new UStroke(1.5)).draw(rect);

    desc.drawU(ug.apply(new UTranslate(MARGIN, MARGIN)));
    return ug;
  }