Example #1
0
 public void draw(UShape shape) {
   final double x = translate.getDx();
   final double y = translate.getDy();
   if (shape instanceof UText) {
     drawText(x, y, (UText) shape);
   } else if (shape instanceof UHorizontalLine) {
     // Definitively a Horizontal line
   } else if (shape instanceof ULine) {
     // Probably a Horizontal line
   } else if (shape instanceof UImage) {
     drawImage(x, y, (UImage) shape);
   } else {
     throw new UnsupportedOperationException(shape.getClass().toString());
   }
 }
  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);
  }
  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();
    }
  }
Example #4
0
 public UGraphic apply(UChange change) {
   if (change instanceof UTranslate) {
     return new MyUGraphic(all, translate.compose((UTranslate) change));
   } else if (change instanceof UStroke || change instanceof UChangeColor) {
     return new MyUGraphic(all, translate);
   }
   throw new UnsupportedOperationException();
 }
Example #5
0
    private Stencil getStencil2(UTranslate translate) {
      final double dy = translate.getDy();
      return new Stencil() {

        public double getStartingX(StringBounder stringBounder, double y) {
          return getStartingXInternal(y + dy);
        }

        public double getEndingX(StringBounder stringBounder, double y) {
          return getEndingXInternal(y + dy);
        }
      };
    }
  public TriangleCorner(Point2D o, Point2D a, Point2D b) {
    this.o = o;
    this.a = a;
    this.b = b;
    this.translateO = new UTranslate(o);
    this.translateOreverse = translateO.reverse();
    final Point2D a2 = translateOreverse.getTranslated(a);
    final Point2D b2 = translateOreverse.getTranslated((b));

    final Point2D a3, b3;
    if (a2.getX() == 0) {
      a3 = a2;
      b3 = b2;
      this.rotation = RotationZoom.none();
      this.rotationInverse = RotationZoom.none();
    } else {
      this.rotation = RotationZoom.builtRotationOnYaxis(a2);
      this.rotationInverse = rotation.inverse();
      a3 = rotation.getPoint(a2);
      b3 = rotation.getPoint(b2);
    }

    this.simple = new TriangleCornerSimple(a3, b3);
  }
 public Balloon getCenterWithFixedRadius(double radius) {
   final Point2D centerSimple = simple.getCenterWithFixedRadius(radius);
   return new Balloon(rotationInverse.getPoint(translateO.getTranslated(centerSimple)), radius);
 }
Example #8
0
 public Snake translate(UTranslate translate) {
   return move(translate.getDx(), translate.getDy());
 }