当前位置: 首页>>代码示例>>Java>>正文


Java RectangularShape.getWidth方法代码示例

本文整理汇总了Java中java.awt.geom.RectangularShape.getWidth方法的典型用法代码示例。如果您正苦于以下问题:Java RectangularShape.getWidth方法的具体用法?Java RectangularShape.getWidth怎么用?Java RectangularShape.getWidth使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在java.awt.geom.RectangularShape的用法示例。


在下文中一共展示了RectangularShape.getWidth方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: splitHorizontalBar

import java.awt.geom.RectangularShape; //导入方法依赖的package包/类
/**
 * Splits a bar into subregions (elsewhere, these subregions will have
 * different gradients applied to them).
 *
 * @param bar  the bar shape.
 * @param a  the first division.
 * @param b  the second division.
 * @param c  the third division.
 *
 * @return An array containing four subregions.
 */
private Rectangle2D[] splitHorizontalBar(RectangularShape bar, double a,
        double b, double c) {
    Rectangle2D[] result = new Rectangle2D[4];
    double y0 = bar.getMinY();
    double y1 = Math.rint(y0 + (bar.getHeight() * a));
    double y2 = Math.rint(y0 + (bar.getHeight() * b));
    double y3 = Math.rint(y0 + (bar.getHeight() * c));
    result[0] = new Rectangle2D.Double(bar.getMinX(), bar.getMinY(),
            bar.getWidth(), y1 - y0);
    result[1] = new Rectangle2D.Double(bar.getMinX(), y1, bar.getWidth(),
            y2 - y1);
    result[2] = new Rectangle2D.Double(bar.getMinX(), y2, bar.getWidth(),
            y3 - y2);
    result[3] = new Rectangle2D.Double(bar.getMinX(), y3, bar.getWidth(),
            bar.getMaxY() - y3);
    return result;
}
 
开发者ID:mdzio,项目名称:ccu-historian,代码行数:29,代码来源:GradientXYBarPainter.java

示例2: paint

import java.awt.geom.RectangularShape; //导入方法依赖的package包/类
@Override
public void paint(final Graphics2D g, final double zoom,
    final RectangularShape bbox, final DataInfo di,
    final NodeFeature feature, final boolean isSelected) {
  PaintUtil.addPaddingInplace(bbox, -1);
  final double maxRad = bbox.getWidth() * 0.5;
  final double extend = 360.0 / di.getSortedFeaturesSelections().size();
  double angle = 90;
  g.setColor(isSelected ? Color.RED : Color.BLACK);
  for(final FeatureSelectionNode fs : di.getSortedFeaturesSelections()) {
    final double rad = maxRad - maxRad * radius(fs.getRank(feature), di.getMaxRank());
    final double x = bbox.getCenterX() + Math.sin(Math.toRadians(angle)) * rad;
    final double y = bbox.getCenterY() + Math.cos(Math.toRadians(angle)) * rad;
    final Line2D line = new Line2D.Double(bbox.getCenterX(), bbox.getCenterY(), x, y);
    g.draw(line);
    angle += extend;
  }
}
 
开发者ID:nyuvis,项目名称:infuse-java,代码行数:19,代码来源:StarGlyph.java

示例3: calcRemainingDrawingArea

import java.awt.geom.RectangularShape; //导入方法依赖的package包/类
/**
 * Calculates the remaining drawing area.
 * 
 * @param available  the available area.
 * @param horizontal  horizontal?
 * @param inverted  inverted?
 * @param legendArea  the legend area.
 * 
 * @return The remaining drawing area.
 */
private Rectangle2D calcRemainingDrawingArea(Rectangle2D available, 
        boolean horizontal, boolean inverted, RectangularShape legendArea) {
    if (horizontal) {
        // The remaining drawing area bounding box will have the same
        // x origin, width and height independent of the anchor's
        // location. The variable is the y coordinate. If the anchor is
        // SOUTH, the y coordinate is simply the original y coordinate
        // of the available area. If it is NORTH, we adjust original y
        // by the total height of the legend and the initial gap.
        double yy = available.getY();
        double yloc = (inverted) ? yy
            : yy + legendArea.getHeight()
            + getOuterGap().getBottomSpace(available.getHeight());

        // return the remaining available drawing area
        return new Rectangle2D.Double(available.getX(), yloc, available.getWidth(),
            available.getHeight() - legendArea.getHeight()
            - getOuterGap().getTopSpace(available.getHeight())
            - getOuterGap().getBottomSpace(available.getHeight()));
    }
    else {
        // The remaining drawing area bounding box will have the same
        // y  origin, width and height independent of the anchor's
        // location. The variable is the x coordinate. If the anchor is
        // EAST, the x coordinate is simply the original x coordinate
        // of the available area. If it is WEST, we adjust original x
        // by the total width of the legend and the initial gap.
        double xloc = (inverted) ? available.getX()
            : available.getX()
            + legendArea.getWidth()
            + getOuterGap().getLeftSpace(available.getWidth())
            + getOuterGap().getRightSpace(available.getWidth());


        // return the remaining available drawing area
        return new Rectangle2D.Double(xloc, available.getY(),
            available.getWidth() - legendArea.getWidth()
            - getOuterGap().getLeftSpace(available.getWidth())
            - getOuterGap().getRightSpace(available.getWidth()),
            available.getHeight());
    }
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:53,代码来源:StandardLegend.java

示例4: selectionShape

import java.awt.geom.RectangularShape; //导入方法依赖的package包/类
@Override
public Shape selectionShape(final RectangularShape bbox,
    final double offX, final double offY) {
  return new Ellipse2D.Double(bbox.getX() + offX, bbox.getY() + offY,
      bbox.getWidth(), bbox.getHeight());
}
 
开发者ID:nyuvis,项目名称:infuse-java,代码行数:7,代码来源:StarGlyph.java

示例5: selectionShape

import java.awt.geom.RectangularShape; //导入方法依赖的package包/类
@Override
public Shape selectionShape(final RectangularShape bbox,
    final double offX, final double offY) {
  return new Rectangle2D.Double(bbox.getX() + offX, bbox.getY() + offY,
      bbox.getWidth(), bbox.getHeight());
}
 
开发者ID:nyuvis,项目名称:infuse-java,代码行数:7,代码来源:MatrixGlyph.java


注:本文中的java.awt.geom.RectangularShape.getWidth方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。