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)); }
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(); } }
public final void drawU(UGraphic ug) { final UEllipse circle = new UEllipse(SIZE, SIZE); if (getSkinParam().shadowing()) { circle.setDeltaShadow(4); } ug = ug.apply( new UChangeBackColor( SkinParamUtils.getColor( getSkinParam(), ColorParam.classBackground, getStereo()))) .apply( new UChangeColor( SkinParamUtils.getColor(getSkinParam(), ColorParam.classBorder, getStereo()))); if (url != null) { ug.startUrl(url); } ug.apply(new UStroke(1.5)).draw(circle); final Dimension2D dimDesc = desc.calculateDimension(ug.getStringBounder()); final double widthDesc = dimDesc.getWidth(); // final double totalWidth = Math.max(widthDesc, SIZE); final double x = SIZE / 2 - widthDesc / 2; final double y = SIZE; desc.drawU(ug.apply(new UTranslate(x, y))); if (url != null) { ug.closeAction(); } }
public void drawU(UGraphic ug) { final StringBounder stringBounder = ug.getStringBounder(); final Dimension2D dimLabel = label.calculateDimension(stringBounder); final Dimension2D dimTotal = calculateDimensionAlone(stringBounder); ug = ug.apply(new UChangeColor(borderColor)) .apply(new UStroke(1.5)) .apply(new UChangeBackColor(backColor)); ug.draw(Diamond.asPolygon(shadowing(), dimTotal.getWidth(), dimTotal.getHeight())); north.drawU(ug.apply(new UTranslate(4 + dimTotal.getWidth() / 2, dimTotal.getHeight()))); south.drawU(ug.apply(new UTranslate(4 + dimTotal.getWidth() / 2, dimTotal.getHeight()))); final double lx = (dimTotal.getWidth() - dimLabel.getWidth()) / 2; final double ly = (dimTotal.getHeight() - dimLabel.getHeight()) / 2; label.drawU(ug.apply(new UTranslate(lx, ly))); final Dimension2D dimWeat = west.calculateDimension(stringBounder); west.drawU( ug.apply( new UTranslate(-dimWeat.getWidth(), -dimWeat.getHeight() + dimTotal.getHeight() / 2))); final Dimension2D dimEast = east.calculateDimension(stringBounder); east.drawU( ug.apply( new UTranslate(dimTotal.getWidth(), -dimEast.getHeight() + dimTotal.getHeight() / 2))); }
@Override protected void drawBackgroundInternalU(UGraphic ug, Area area) { final Dimension2D dimensionToUse = area.getDimensionToUse(); ug = ug.apply(new UChangeBackColor(backColor)).apply(new UChangeColor(borderColor)); 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))); }
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); }
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; }
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)))); }
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); }
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); }
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; }
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))); }
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)); } }
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)); }
@Override protected void drawInternalU(UGraphic ug, Area area) { final TextBlock textBlock = getTextBlock(); final StringBounder stringBounder = ug.getStringBounder(); final Dimension2D dimStickman = stickman.calculateDimension(stringBounder); final double delta = (getPreferredWidth(stringBounder) - dimStickman.getWidth()) / 2; if (head) { textBlock.drawU( ug.apply(new UTranslate(getTextMiddlePostion(stringBounder), dimStickman.getHeight()))); ug = ug.apply(new UTranslate(delta, 0)); } else { textBlock.drawU(ug.apply(new UTranslate(getTextMiddlePostion(stringBounder), 0))); ug = ug.apply(new UTranslate(delta, getTextHeight(stringBounder))); } stickman.drawU(ug); }
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; }
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())); } }
public void drawU(UGraphic ug) { ug.apply(new UChangeBackColor(ug.getParam().getColor())) .apply(new UTranslate(-radius * Math.cos(angle), -radius * Math.sin(angle))) .draw(polygon); ug = ug.apply(new UChangeBackColor(HtmlColorUtils.WHITE)); ug.apply(new UStroke(1.5)) .apply(new UTranslate(dest.getX() - radius, dest.getY() - radius)) .draw(new UEllipse(radius * 2, radius * 2)); drawLine( ug, getPointOnCircle(dest.getX(), dest.getY(), Math.PI / 4), getPointOnCircle(dest.getX(), dest.getY(), Math.PI + Math.PI / 4)); drawLine( ug, getPointOnCircle(dest.getX(), dest.getY(), -Math.PI / 4), getPointOnCircle(dest.getX(), dest.getY(), Math.PI - Math.PI / 4)); }
public final void drawU(UGraphic ug) { ug = ug.apply( new UChangeColor( SkinParamUtils.getColor(getSkinParam(), ColorParam.classBorder, getStereo()))); ug = ug.apply( new UChangeBackColor( SkinParamUtils.getColor(getSkinParam(), ColorParam.classBackground, getStereo()))); if (url != null) { ug.startUrl(url); } final double sizeSmall = 14; final double diff = (SIZE - sizeSmall) / 2; final UEllipse circle1 = new UEllipse(sizeSmall, sizeSmall); if (getSkinParam().shadowing()) { // circle.setDeltaShadow(4); } ug.apply(new UStroke(1.5)).apply(new UTranslate(diff, diff)).draw(circle1); ug = ug.apply(new UChangeBackColor(null)); Point2D pos = bibliotekon.getShape(getEntity()).getPosition(); final List<Line> lines = bibliotekon.getAllLineConnectedTo(getEntity()); final UTranslate reverse = new UTranslate(pos).reverse(); final ConnectedCircle connectedCircle = new ConnectedCircle(SIZE / 2); for (Line line : lines) { Point2D pt = line.getMyPoint(getEntity()); pt = reverse.getTranslated(pt); connectedCircle.addSecondaryConnection(pt); } // connectedCircle.drawU(ug.apply(new UStroke(1.5))); connectedCircle.drawU(ug); // // final Dimension2D dimDesc = desc.calculateDimension(ug.getStringBounder()); // final double widthDesc = dimDesc.getWidth(); // // final double totalWidth = Math.max(widthDesc, SIZE); // // final double x = SIZE / 2 - widthDesc / 2; // final double y = SIZE; // desc.drawU(ug.apply(new UTranslate(x, y))); if (url != null) { ug.closeAction(); } }
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)); }
public void draw(UGraphic ug, double x, double y) { final StringBounder stringBounder = ug.getStringBounder(); ug = ug.apply(new UChangeColor(HtmlColorUtils.BLACK)); ug.apply(new UTranslate(x, y)) .draw(new URectangle(getWidth(stringBounder), getHeight(stringBounder))); for (Item it : project.getValidItems()) { final TextBlock b = Display.create("" + it.getCode()) .create(fontConfig, HorizontalAlignment.LEFT, new SpriteContainerEmpty()); final Dimension2D dim = b.calculateDimension(stringBounder); b.drawU(ug.apply(new UTranslate(x, y))); y += dim.getHeight(); ug.apply(new UTranslate(x, y)).draw(new ULine(getWidth(stringBounder), 0)); } }
@Override protected void drawInternalU(UGraphic ug, Area area) { final Dimension2D dimensionToUse = area.getDimensionToUse(); final StringBounder stringBounder = ug.getStringBounder(); final int textHeaderWidth = (int) (getHeaderWidth(stringBounder)); final int textHeaderHeight = (int) (getHeaderHeight(stringBounder)); final URectangle rect = new URectangle( dimensionToUse.getWidth() - xMargin * 2 - symbolContext.getDeltaShadow(), dimensionToUse.getHeight() - heightFooter); rect.setDeltaShadow(symbolContext.getDeltaShadow()); ug = symbolContext.withBackColor(background).apply(ug); ug.apply(new UTranslate(xMargin, 0)).draw(rect); final UPolygon polygon = new UPolygon(); polygon.addPoint(0, 0); polygon.addPoint(textHeaderWidth, 0); polygon.addPoint(textHeaderWidth, textHeaderHeight - cornersize); polygon.addPoint(textHeaderWidth - cornersize, textHeaderHeight); polygon.addPoint(0, textHeaderHeight); polygon.addPoint(0, 0); ug = symbolContext.apply(ug); ug.apply(new UTranslate(xMargin, 0)).draw(polygon); ug = ug.apply(new UStroke()); textHeader.drawU(ug.apply(new UTranslate(15, 2))); final double textPos; if (position == HorizontalAlignment.CENTER) { final double textWidth = getTextBlock().calculateDimension(stringBounder).getWidth(); textPos = (dimensionToUse.getWidth() - textWidth) / 2; } else if (position == HorizontalAlignment.RIGHT) { final double textWidth = getTextBlock().calculateDimension(stringBounder).getWidth(); textPos = dimensionToUse.getWidth() - textWidth - getMarginX2() - xMargin; } else { textPos = getMarginX1() + xMargin; } getTextBlock().drawU(ug.apply(new UTranslate(textPos, (getMarginY() + textHeaderHeight)))); }
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))); } }
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); }
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))); }
public void drawU(UGraphic ug) { int n = 0; String last = null; double pendingX = -1; for (Day d = start; d.compareTo(end) <= 0; d = (Day) timeline.next(d)) { final String text = "" + d.getMonth().name(); if (pendingX == -1) { pendingX = n * dayWidth; last = text; } ug = ug.apply(new UChangeColor(HtmlColorUtils.BLACK)); ug = ug.apply(new UChangeBackColor(HtmlColorUtils.WHITE)); if (text.equals(last) == false) { manage(ug, 0, 0, n, last, pendingX); pendingX = n * dayWidth; } last = text; n++; } manage(ug, 0, 0, n, last, pendingX); }
public void draw(UGraphic ug, final double x, double y) { final StringBounder stringBounder = ug.getStringBounder(); final double monthHeight = getMonthHeight(stringBounder); final double caseWidth = getCaseWidth(stringBounder); final double caseHeight = getCaseHeight(stringBounder); final int nb = getNbCase(); ug = ug.apply(new UChangeColor(HtmlColorUtils.BLACK)); ug.apply(new UTranslate(x, y)).draw(new URectangle(nb * caseWidth, monthHeight)); final Instant end = project.getEnd(); Month printed = null; double curx = x; for (Instant cur = project.getStart(); cur.compareTo(end) <= 0; cur = cur.next(project.getDayClose())) { final Day d = cur.getDay(); if (printed == null || d.getMonth() != printed) { ug.apply(new UTranslate(curx, y)).draw(new ULine(0, monthHeight)); printed = d.getMonth(); final TextBlock b = Display.create(printed.name()) .create(fontConfig, HorizontalAlignment.LEFT, new SpriteContainerEmpty()); final Dimension2D dim = b.calculateDimension(stringBounder); b.drawU(ug.apply(new UTranslate(curx, (y + (monthHeight - dim.getHeight()) / 2)))); } curx += caseWidth; } curx = x; y += monthHeight; ug.apply(new UTranslate(x, y)).draw(new URectangle(nb * caseWidth, caseHeight)); for (Instant cur = project.getStart(); cur.compareTo(end) <= 0; cur = cur.next(project.getDayClose())) { final Day d = cur.getDay(); final TextBlock b = Display.create("" + d.getNumDay()) .create(fontConfig, HorizontalAlignment.LEFT, new SpriteContainerEmpty()); final Dimension2D dim = b.calculateDimension(stringBounder); b.drawU( ug.apply( new UTranslate( (curx + (caseWidth - dim.getWidth()) / 2), (y + (caseHeight - dim.getHeight()) / 2)))); curx += caseWidth; ug.apply(new UTranslate(curx, y)).draw(new ULine(0, caseHeight)); } }
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)); } }
@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(); } }
public void drawU(UGraphic ug) { final double deg = -ortho * 180 / Math.PI + 90 - ang; // final Point2D other = new Point2D.Double(contact.getX() + 10 * Math.cos(deg), contact.getY() // + 10 // * Math.sin(deg)); // final ULine line = new ULine(1, 1); // ug.apply(new UChangeColor(HtmlColorUtils.GREEN)).apply(new UTranslate(contact.getX(), // contact.getY())) // .draw(line); // ug.apply(new UChangeColor(HtmlColorUtils.BLACK)).apply(new UTranslate(center.getX(), // center.getY())).draw(line); // // final UEllipse arc1 = new UEllipse(2 * radius2, 2 * radius2, deg, 2 * ang); // // ug.apply(new UStroke(1.5)).apply(new UTranslate(dest.getX() - radius2, dest.getY() - // radius2)).draw(arc1); // final double size = Math.round(contact.distance(center)); // System.err.println("size=" + size); final UEllipse circle = new UEllipse(size * 2, size * 2, deg, 2 * ang); ug.apply(new UTranslate(center.getX() - size, center.getY() - size)).draw(circle); }