com.ait.lienzo.client.core.shape.Text.getBoundingBox()方法的使用及代码示例

x33g5p2x  于2022-01-30 转载在 其他  
字(8.9k)|赞(0)|评价(0)|浏览(143)

本文整理了Java中com.ait.lienzo.client.core.shape.Text.getBoundingBox()方法的一些代码示例,展示了Text.getBoundingBox()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Text.getBoundingBox()方法的具体详情如下:
包路径:com.ait.lienzo.client.core.shape.Text
类名称:Text
方法名:getBoundingBox

Text.getBoundingBox介绍

暂无

代码示例

代码示例来源:origin: stackoverflow.com

List<? extends Text> textComponents = mText.getComponents();
 for (Text currentText : textComponents) {
   RectF rect = new RectF(currentText.getBoundingBox());
   rect.left = translateX(rect.left);
   rect.top = translateY(rect.top);
   rect.right = translateX(rect.right);
   rect.bottom = translateY(rect.bottom);
   canvas.drawRect(rect, sRectPaint);

代码示例来源:origin: com.ahome-it/lienzo-charts

public double getLabelHeight()
{
  return label.getBoundingBox().getHeight();
}

代码示例来源:origin: org.dashbuilder/dashbuilder-lienzo-charts

protected double getLegendEntryWidth(Text entry) {
  if (entry != null) return entry.getBoundingBox().getWidth() + LEGEND_RECTANGLE_WIDTH + LEGEND_WIDTH_SEPARATION;
  return 0;
}

代码示例来源:origin: com.ahome-it/lienzo-charts

protected double getLegendEntryWidth(Text entry)
{
  if (entry != null) return entry.getBoundingBox().getWidth() + LEGEND_RECTANGLE_WIDTH + LEGEND_WIDTH_SEPARATION;
  return 0;
}

代码示例来源:origin: com.ahome-it/lienzo-charts

public double getLabelWidth()
{
  return label.getBoundingBox().getWidth();
}

代码示例来源:origin: org.dashbuilder/dashbuilder-lienzo-charts

public double getLabelWidth() {
  return label.getBoundingBox().getWidth();        
}

代码示例来源:origin: org.dashbuilder/dashbuilder-lienzo-charts

public double getLabelHeight() {
  return label.getBoundingBox().getHeight();
}

代码示例来源:origin: org.dashbuilder/dashbuilder-lienzo-charts

private double checkRotation(double maxWidth) {
  if (labels != null && !labels.isEmpty()) {
    for (BarChartLabel label : labels) {
      if (label.getLabel().getBoundingBox().getWidth() > maxWidth) return -45;
    }
  }
  return 0;        
}

代码示例来源:origin: com.ahome-it/lienzo-charts

private double checkRotation(double maxWidth)
{
  if (labels != null && !labels.isEmpty())
  {
    for (XYChartLabel label : labels)
    {
      if (label.getLabel().getBoundingBox().getWidth() > maxWidth) return -45;
    }
  }
  return 0;
}

代码示例来源:origin: org.dashbuilder/dashbuilder-lienzo-charts

private void cutLabelText(BarChartLabel label, double maxWidth, double maxHeight, double rotation) {
  String text = label.getLabel().getText();
  if (text != null && text.length() > 1 && label.getLabel().getBoundingBox().getWidth() > maxWidth) {
    int cutLength = text.length() - 2;
    String cuttedText = text.substring(0, cutLength);
    label.getLabel().setText(cuttedText);
    cutLabelText(label, maxWidth, maxHeight, rotation);
  }
  if (text != null && rotation > 0  && text.length() > 1 && label.getLabel().getBoundingBox().getHeight() > maxHeight) {
    int cutLength = text.length() - 2;
    String cuttedText = text.substring(0, cutLength);
    label.getLabel().setText(cuttedText);
    cutLabelText(label, maxWidth, maxHeight, rotation);
  }
}

代码示例来源:origin: com.ahome-it/lienzo-charts

private static void showSizeText(final Text text, final double w, final double h)
{
  final String _t = buildSizeText(w, h);
  text.setText(_t);
  final double tw = text.getBoundingBox().getWidth();
  final double th = text.getBoundingBox().getHeight();
  final double tx = w / 2 - tw / 2;
  final double ty = h / 2 - th / 2;
  text.setX(tx).setY(ty).moveToTop();
}

代码示例来源:origin: com.ahome-it/lienzo-charts

private void cutLabelText(XYChartLabel label, double maxWidth, double maxHeight, double rotation)
{
  String text = label.getLabel().getText();
  if (text != null && text.length() > 1 && label.getLabel().getBoundingBox().getWidth() > maxWidth)
  {
    int cutLength = text.length() - 2;
    String cuttedText = text.substring(0, cutLength);
    label.getLabel().setText(cuttedText);
    cutLabelText(label, maxWidth, maxHeight, rotation);
  }
  if (text != null && rotation > 0 && text.length() > 1 && label.getLabel().getBoundingBox().getHeight() > maxHeight)
  {
    int cutLength = text.length() - 2;
    String cuttedText = text.substring(0, cutLength);
    label.getLabel().setText(cuttedText);
    cutLabelText(label, maxWidth, maxHeight, rotation);
  }
}

代码示例来源:origin: org.dashbuilder/dashbuilder-lienzo-core

@Override
public BoundingBox getBoundingBox()
{
  return getBoundingBox(getText(), getFontSize(), getFontStyle(), getFontFamily(), getTextUnit(), getTextBaseLine(), getTextAlign());
}

代码示例来源:origin: org.dashbuilder/dashbuilder-lienzo-charts

public void show(String categoriesText, String valuesText) {
  setVisible(true);
  this.categoriesText.setText(categoriesText);
  double ctw = this.categoriesText.getBoundingBox().getWidth();
  double cth = this.categoriesText.getBoundingBox().getHeight();
  this.valuesText.setText(valuesText);
  double vtw = this.valuesText.getBoundingBox().getWidth();
  double vth = this.valuesText.getBoundingBox().getHeight();
  double rw = ctw > vtw ? ctw : vtw;
  rw += TOOLTIP_PADDING_WIDTH;
  double rh = cth + vth;
  rh += TOOLTIP_PADDING_HEIGHT;
  rectangle.setWidth(rw).setHeight(rh);
  double rx = rectangle.getX();
  double ry = rectangle.getY();
  triangle.setPoints(new Point2D(rx + rw/2 - TRIANGLE_SIZE, ry + rh),new Point2D(rx + rw/2, rh + TRIANGLE_SIZE),new Point2D(rx + rw/2 + TRIANGLE_SIZE, ry + rh));
  double vtx = rw/2 - vtw/2;
  double ctx = rw/2 - ctw/2;
  double vty = rh /2 - vth/2;
  double cty = vty + cth + 1;
  this.categoriesText.setX(ctx).setY(cty);
  this.valuesText.setX(vtx).setY(vty);
  setX(getX() - rw / 2);
  setY(getY() - rh);
  moveToTop();
  redraw();
}

代码示例来源:origin: org.dashbuilder/dashbuilder-lienzo-charts

public void show(String categoriesText, String valuesText) {
  setVisible(true);
  this.categoriesText.setText(categoriesText);
  double ctw = this.categoriesText.getBoundingBox().getWidth();
  double cth = this.categoriesText.getBoundingBox().getHeight();
  this.valuesText.setText(valuesText);
  double vtw = this.valuesText.getBoundingBox().getWidth();
  double vth = this.valuesText.getBoundingBox().getHeight();
  double rw = ctw > vtw ? ctw : vtw;
  rw += TOOLTIP_PADDING_WIDTH;
  double rh = cth + vth;
  rh += TOOLTIP_PADDING_HEIGHT;
  rectangle.setWidth(rw).setHeight(rh);
  double rx = rectangle.getX();
  double ry = rectangle.getY();
  triangle.setPoints(new Point2D(rx + rw/2 - TRIANGLE_SIZE, ry + rh),new Point2D(rx + rw/2, rh + TRIANGLE_SIZE),new Point2D(rx + rw/2 + TRIANGLE_SIZE, ry + rh));
  double vtx = rw/2 - vtw/2;
  double ctx = rw/2 - ctw/2;
  double vty = rh /2 - vth/2;
  double cty = vty + cth + 1;
  this.categoriesText.setX(ctx).setY(cty);
  this.valuesText.setX(vtx).setY(vty);
  setX(getX() - rw / 2);
  setY(getY() - rh);
  moveToTop();
  redraw();
}

代码示例来源:origin: com.ahome-it/lienzo-charts

public PieChartTooltip show(final double x, final double y)
{
  this.categoriesText.setText(_categoriesText);
  BoundingBox bb = categoriesText.getBoundingBox();
  final double ctw = bb.getWidth();
  final double cth = bb.getHeight();
  this.valuesText.setText(_valuesText);
  bb = valuesText.getBoundingBox();
  final double vtw = bb.getWidth();
  final double vth = bb.getHeight();
  final double rw = (ctw > vtw ? ctw : vtw) + TOOLTIP_PADDING_WIDTH;
  final double rh = (cth + vth) + TOOLTIP_PADDING_HEIGHT;
  rectangle.setWidth(rw).setHeight(rh).setCornerRadius(5);
  final double rx = rectangle.getX();
  final double ry = rectangle.getY();
  triangle.setPoints(new Point2D(rx + rw / 2 - TRIANGLE_SIZE, ry + rh), new Point2D(rx + rw / 2, rh + TRIANGLE_SIZE), new Point2D(rx + rw / 2 + TRIANGLE_SIZE, ry + rh));
  tmasking.setPoints(new Point2D(rx + rw / 2 - TRIANGLE_SIZE - 3, ry + rh - 3), new Point2D(rx + rw / 2, rh + TRIANGLE_SIZE - 3), new Point2D(rx + rw / 2 + TRIANGLE_SIZE + 3, ry + rh - 3));
  final double vtx = rw / 2 - vtw / 2;
  final double ctx = rw / 2 - ctw / 2;
  final double vty = rh / 2 - vth / 2;
  final double cty = vty + cth + 1;
  this.categoriesText.setX(ctx).setY(cty);
  this.valuesText.setX(vtx).setY(vty);
  setX(x - rw / 2);
  setY(y - rh);
  moveToTop();
  setVisible(true);
  getLayer().batch();
  return this;
}

代码示例来源:origin: com.ahome-it/lienzo-charts

public XYChartTooltip show(String _categoriesText, String _valuesText)
{
  this.categoriesText.setText(_categoriesText);
  BoundingBox bb = categoriesText.getBoundingBox();
  final double ctw = bb.getWidth();
  final double cth = bb.getHeight();
  this.valuesText.setText(_valuesText);
  bb = valuesText.getBoundingBox();
  final double vtw = bb.getWidth();
  final double vth = bb.getHeight();
  final double rw = (ctw > vtw ? ctw : vtw) + TOOLTIP_PADDING_WIDTH;
  final double rh = (cth + vth) + TOOLTIP_PADDING_HEIGHT;
  rectangle.setWidth(rw).setHeight(rh).setCornerRadius(5);
  final double rx = rectangle.getX();
  final double ry = rectangle.getY();
  triangle.setPoints(new Point2D(rx + rw / 2 - TRIANGLE_SIZE, ry + rh), new Point2D(rx + rw / 2, rh + TRIANGLE_SIZE), new Point2D(rx + rw / 2 + TRIANGLE_SIZE, ry + rh));
  tmasking.setPoints(new Point2D(rx + rw / 2 - TRIANGLE_SIZE - 3, ry + rh - 3), new Point2D(rx + rw / 2, rh + TRIANGLE_SIZE - 3), new Point2D(rx + rw / 2 + TRIANGLE_SIZE + 3, ry + rh - 3));
  final double vtx = rw / 2 - vtw / 2;
  final double ctx = rw / 2 - ctw / 2;
  final double vty = rh / 2 - vth / 2;
  final double cty = vty + cth + 1;
  this.categoriesText.setX(ctx).setY(cty);
  this.valuesText.setX(vtx).setY(vty);
  setX(getX() - rw / 2);
  setY(getY() - rh);
  moveToTop();
  setVisible(true);
  getLayer().batch();
  return this;
}

代码示例来源:origin: com.ahome-it/lienzo-core

final BoundingBox bb = m_text.getBoundingBox();
final BoundingBox bb = m_labl.getBoundingBox();

代码示例来源:origin: org.kie.workbench.stunner/kie-wb-common-stunner-lienzo-extensions

.setStrokeColor(TEXT_COLOR)
    .setStrokeAlpha(1);
final BoundingBox descTextBB = descText.getBoundingBox();
final double descTextBbW = descTextBB.getWidth();
final double descTextBbH = descTextBB.getHeight();

代码示例来源:origin: org.kie.workbench.stunner/kie-wb-common-stunner-lienzo-extensions

final BoundingBox textBB = text.getBoundingBox();
final double tw = textBB.getWidth();
final double th = textBB.getHeight();

相关文章