本文整理汇总了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;
}
示例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;
}
}
示例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());
}
}
示例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());
}
示例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());
}