Java Code Examples for org.jfree.ui.Size2D#getWidth()
The following examples show how to use
org.jfree.ui.Size2D#getWidth() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TextBlock.java From ccu-historian with GNU General Public License v3.0 | 6 votes |
/** * Returns the bounds of the text block. * * @param g2 the graphics device (<code>null</code> not permitted). * @param anchorX the x-coordinate for the anchor point. * @param anchorY the y-coordinate for the anchor point. * @param anchor the text block anchor (<code>null</code> not permitted). * @param rotateX the x-coordinate for the rotation point. * @param rotateY the y-coordinate for the rotation point. * @param angle the rotation angle. * * @return The bounds. */ public Shape calculateBounds(final Graphics2D g2, final float anchorX, final float anchorY, final TextBlockAnchor anchor, final float rotateX, final float rotateY, final double angle) { final Size2D d = calculateDimensions(g2); final float[] offsets = calculateOffsets( anchor, d.getWidth(), d.getHeight() ); final Rectangle2D bounds = new Rectangle2D.Double( anchorX + offsets[0], anchorY + offsets[1], d.getWidth(), d.getHeight() ); final Shape rotatedBounds = ShapeUtilities.rotateShape( bounds, angle, rotateX, rotateY ); return rotatedBounds; }
Example 2
Source File: TextLine.java From ccu-historian with GNU General Public License v3.0 | 6 votes |
/** * Draws the text line. * * @param g2 the graphics device. * @param anchorX the x-coordinate for the anchor point. * @param anchorY the y-coordinate for the anchor point. * @param anchor the point on the text line that is aligned to the anchor * point. * @param rotateX the x-coordinate for the rotation point. * @param rotateY the y-coordinate for the rotation point. * @param angle the rotation angle (in radians). */ public void draw(Graphics2D g2, float anchorX, float anchorY, TextAnchor anchor, float rotateX, float rotateY, double angle) { Size2D dim = calculateDimensions(g2); float xAdj = 0.0f; if (anchor.isHorizontalCenter()) { xAdj = (float) -dim.getWidth() / 2.0f; } else if (anchor.isRight()) { xAdj = (float) -dim.getWidth(); } float x = anchorX + xAdj; final float yOffset = calculateBaselineOffset(g2, anchor); final Iterator iterator = this.fragments.iterator(); while (iterator.hasNext()) { final TextFragment fragment = (TextFragment) iterator.next(); final Size2D d = fragment.calculateDimensions(g2); fragment.draw(g2, x, anchorY + yOffset, TextAnchor.BASELINE_LEFT, rotateX, rotateY, angle); x = x + (float) d.getWidth(); } }
Example 3
Source File: CategoryAxis.java From opensim-gui with Apache License 2.0 | 6 votes |
/** * A utility method for determining the height of a text block. * * @param block the text block. * @param position the label position. * @param g2 the graphics device. * * @return The height. */ protected double calculateTextBlockHeight(TextBlock block, CategoryLabelPosition position, Graphics2D g2) { RectangleInsets insets = getTickLabelInsets(); Size2D size = block.calculateDimensions(g2); Rectangle2D box = new Rectangle2D.Double( 0.0, 0.0, size.getWidth(), size.getHeight() ); Shape rotatedBox = ShapeUtilities.rotateShape( box, position.getAngle(), 0.0f, 0.0f ); double h = rotatedBox.getBounds2D().getHeight() + insets.getTop() + insets.getBottom(); return h; }
Example 4
Source File: CategoryAxis.java From opensim-gui with Apache License 2.0 | 6 votes |
/** * A utility method for determining the width of a text block. * * @param block the text block. * @param position the position. * @param g2 the graphics device. * * @return The width. */ protected double calculateTextBlockWidth(TextBlock block, CategoryLabelPosition position, Graphics2D g2) { RectangleInsets insets = getTickLabelInsets(); Size2D size = block.calculateDimensions(g2); Rectangle2D box = new Rectangle2D.Double( 0.0, 0.0, size.getWidth(), size.getHeight() ); Shape rotatedBox = ShapeUtilities.rotateShape( box, position.getAngle(), 0.0f, 0.0f ); double w = rotatedBox.getBounds2D().getWidth() + insets.getTop() + insets.getBottom(); return w; }
Example 5
Source File: CategoryAxis.java From SIMVA-SoS with Apache License 2.0 | 5 votes |
/** * A utility method for determining the height of a text block. * * @param block the text block. * @param position the label position. * @param g2 the graphics device. * * @return The height. */ protected double calculateTextBlockHeight(TextBlock block, CategoryLabelPosition position, Graphics2D g2) { RectangleInsets insets = getTickLabelInsets(); Size2D size = block.calculateDimensions(g2); Rectangle2D box = new Rectangle2D.Double(0.0, 0.0, size.getWidth(), size.getHeight()); Shape rotatedBox = ShapeUtilities.rotateShape(box, position.getAngle(), 0.0f, 0.0f); double h = rotatedBox.getBounds2D().getHeight() + insets.getTop() + insets.getBottom(); return h; }
Example 6
Source File: CategoryAxis.java From buffer_bci with GNU General Public License v3.0 | 5 votes |
/** * A utility method for determining the height of a text block. * * @param block the text block. * @param position the label position. * @param g2 the graphics device. * * @return The height. */ protected double calculateTextBlockHeight(TextBlock block, CategoryLabelPosition position, Graphics2D g2) { RectangleInsets insets = getTickLabelInsets(); Size2D size = block.calculateDimensions(g2); Rectangle2D box = new Rectangle2D.Double(0.0, 0.0, size.getWidth(), size.getHeight()); Shape rotatedBox = ShapeUtilities.rotateShape(box, position.getAngle(), 0.0f, 0.0f); double h = rotatedBox.getBounds2D().getHeight() + insets.getTop() + insets.getBottom(); return h; }
Example 7
Source File: CategoryAxis.java From buffer_bci with GNU General Public License v3.0 | 5 votes |
/** * A utility method for determining the width of a text block. * * @param block the text block. * @param position the position. * @param g2 the graphics device. * * @return The width. */ protected double calculateTextBlockWidth(TextBlock block, CategoryLabelPosition position, Graphics2D g2) { RectangleInsets insets = getTickLabelInsets(); Size2D size = block.calculateDimensions(g2); Rectangle2D box = new Rectangle2D.Double(0.0, 0.0, size.getWidth(), size.getHeight()); Shape rotatedBox = ShapeUtilities.rotateShape(box, position.getAngle(), 0.0f, 0.0f); double w = rotatedBox.getBounds2D().getWidth() + insets.getLeft() + insets.getRight(); return w; }
Example 8
Source File: CategoryAxis.java From buffer_bci with GNU General Public License v3.0 | 5 votes |
/** * A utility method for determining the height of a text block. * * @param block the text block. * @param position the label position. * @param g2 the graphics device. * * @return The height. */ protected double calculateTextBlockHeight(TextBlock block, CategoryLabelPosition position, Graphics2D g2) { RectangleInsets insets = getTickLabelInsets(); Size2D size = block.calculateDimensions(g2); Rectangle2D box = new Rectangle2D.Double(0.0, 0.0, size.getWidth(), size.getHeight()); Shape rotatedBox = ShapeUtilities.rotateShape(box, position.getAngle(), 0.0f, 0.0f); double h = rotatedBox.getBounds2D().getHeight() + insets.getTop() + insets.getBottom(); return h; }
Example 9
Source File: CategoryAxis.java From buffer_bci with GNU General Public License v3.0 | 5 votes |
/** * A utility method for determining the width of a text block. * * @param block the text block. * @param position the position. * @param g2 the graphics device. * * @return The width. */ protected double calculateTextBlockWidth(TextBlock block, CategoryLabelPosition position, Graphics2D g2) { RectangleInsets insets = getTickLabelInsets(); Size2D size = block.calculateDimensions(g2); Rectangle2D box = new Rectangle2D.Double(0.0, 0.0, size.getWidth(), size.getHeight()); Shape rotatedBox = ShapeUtilities.rotateShape(box, position.getAngle(), 0.0f, 0.0f); double w = rotatedBox.getBounds2D().getWidth() + insets.getLeft() + insets.getRight(); return w; }
Example 10
Source File: CategoryAxis.java From ECG-Viewer with GNU General Public License v2.0 | 5 votes |
/** * A utility method for determining the height of a text block. * * @param block the text block. * @param position the label position. * @param g2 the graphics device. * * @return The height. */ protected double calculateTextBlockHeight(TextBlock block, CategoryLabelPosition position, Graphics2D g2) { RectangleInsets insets = getTickLabelInsets(); Size2D size = block.calculateDimensions(g2); Rectangle2D box = new Rectangle2D.Double(0.0, 0.0, size.getWidth(), size.getHeight()); Shape rotatedBox = ShapeUtilities.rotateShape(box, position.getAngle(), 0.0f, 0.0f); double h = rotatedBox.getBounds2D().getHeight() + insets.getTop() + insets.getBottom(); return h; }
Example 11
Source File: CategoryAxis.java From ECG-Viewer with GNU General Public License v2.0 | 5 votes |
/** * A utility method for determining the width of a text block. * * @param block the text block. * @param position the position. * @param g2 the graphics device. * * @return The width. */ protected double calculateTextBlockWidth(TextBlock block, CategoryLabelPosition position, Graphics2D g2) { RectangleInsets insets = getTickLabelInsets(); Size2D size = block.calculateDimensions(g2); Rectangle2D box = new Rectangle2D.Double(0.0, 0.0, size.getWidth(), size.getHeight()); Shape rotatedBox = ShapeUtilities.rotateShape(box, position.getAngle(), 0.0f, 0.0f); double w = rotatedBox.getBounds2D().getWidth() + insets.getLeft() + insets.getRight(); return w; }
Example 12
Source File: CategoryAxis.java From openstock with GNU General Public License v3.0 | 5 votes |
/** * A utility method for determining the width of a text block. * * @param block the text block. * @param position the position. * @param g2 the graphics device. * * @return The width. */ protected double calculateTextBlockWidth(TextBlock block, CategoryLabelPosition position, Graphics2D g2) { RectangleInsets insets = getTickLabelInsets(); Size2D size = block.calculateDimensions(g2); Rectangle2D box = new Rectangle2D.Double(0.0, 0.0, size.getWidth(), size.getHeight()); Shape rotatedBox = ShapeUtilities.rotateShape(box, position.getAngle(), 0.0f, 0.0f); double w = rotatedBox.getBounds2D().getWidth() + insets.getLeft() + insets.getRight(); return w; }
Example 13
Source File: CategoryAxis.java From SIMVA-SoS with Apache License 2.0 | 5 votes |
/** * A utility method for determining the width of a text block. * * @param block the text block. * @param position the position. * @param g2 the graphics device. * * @return The width. */ protected double calculateTextBlockWidth(TextBlock block, CategoryLabelPosition position, Graphics2D g2) { RectangleInsets insets = getTickLabelInsets(); Size2D size = block.calculateDimensions(g2); Rectangle2D box = new Rectangle2D.Double(0.0, 0.0, size.getWidth(), size.getHeight()); Shape rotatedBox = ShapeUtilities.rotateShape(box, position.getAngle(), 0.0f, 0.0f); double w = rotatedBox.getBounds2D().getWidth() + insets.getLeft() + insets.getRight(); return w; }
Example 14
Source File: TextLine.java From ccu-historian with GNU General Public License v3.0 | 5 votes |
/** * Calculates the width and height of the text line. * * @param g2 the graphics device. * * @return The width and height. */ public Size2D calculateDimensions(final Graphics2D g2) { double width = 0.0; double height = 0.0; final Iterator iterator = this.fragments.iterator(); while (iterator.hasNext()) { final TextFragment fragment = (TextFragment) iterator.next(); final Size2D dimension = fragment.calculateDimensions(g2); width = width + dimension.getWidth(); height = Math.max(height, dimension.getHeight()); } return new Size2D(width, height); }
Example 15
Source File: TextBlock.java From ccu-historian with GNU General Public License v3.0 | 5 votes |
/** * Draws the text block, aligning it with the specified anchor point and * rotating it about the specified rotation point. * * @param g2 the graphics device. * @param anchorX the x-coordinate for the anchor point. * @param anchorY the y-coordinate for the anchor point. * @param anchor the point on the text block that is aligned to the * anchor point. * @param rotateX the x-coordinate for the rotation point. * @param rotateY the x-coordinate for the rotation point. * @param angle the rotation (in radians). */ public void draw(final Graphics2D g2, final float anchorX, final float anchorY, final TextBlockAnchor anchor, final float rotateX, final float rotateY, final double angle) { final Size2D d = calculateDimensions(g2); final float[] offsets = calculateOffsets(anchor, d.getWidth(), d.getHeight()); final Iterator iterator = this.lines.iterator(); float yCursor = 0.0f; while (iterator.hasNext()) { TextLine line = (TextLine) iterator.next(); Size2D dimension = line.calculateDimensions(g2); float lineOffset = 0.0f; if (this.lineAlignment == HorizontalAlignment.CENTER) { lineOffset = (float) (d.getWidth() - dimension.getWidth()) / 2.0f; } else if (this.lineAlignment == HorizontalAlignment.RIGHT) { lineOffset = (float) (d.getWidth() - dimension.getWidth()); } line.draw( g2, anchorX + offsets[0] + lineOffset, anchorY + offsets[1] + yCursor, TextAnchor.TOP_LEFT, rotateX, rotateY, angle ); yCursor = yCursor + (float) dimension.getHeight(); } }
Example 16
Source File: CategoryAxis.java From ccu-historian with GNU General Public License v3.0 | 5 votes |
/** * A utility method for determining the height of a text block. * * @param block the text block. * @param position the label position. * @param g2 the graphics device. * * @return The height. */ protected double calculateTextBlockHeight(TextBlock block, CategoryLabelPosition position, Graphics2D g2) { RectangleInsets insets = getTickLabelInsets(); Size2D size = block.calculateDimensions(g2); Rectangle2D box = new Rectangle2D.Double(0.0, 0.0, size.getWidth(), size.getHeight()); Shape rotatedBox = ShapeUtilities.rotateShape(box, position.getAngle(), 0.0f, 0.0f); double h = rotatedBox.getBounds2D().getHeight() + insets.getTop() + insets.getBottom(); return h; }
Example 17
Source File: CategoryAxis.java From ccu-historian with GNU General Public License v3.0 | 5 votes |
/** * A utility method for determining the width of a text block. * * @param block the text block. * @param position the position. * @param g2 the graphics device. * * @return The width. */ protected double calculateTextBlockWidth(TextBlock block, CategoryLabelPosition position, Graphics2D g2) { RectangleInsets insets = getTickLabelInsets(); Size2D size = block.calculateDimensions(g2); Rectangle2D box = new Rectangle2D.Double(0.0, 0.0, size.getWidth(), size.getHeight()); Shape rotatedBox = ShapeUtilities.rotateShape(box, position.getAngle(), 0.0f, 0.0f); double w = rotatedBox.getBounds2D().getWidth() + insets.getLeft() + insets.getRight(); return w; }
Example 18
Source File: CategoryAxis.java From openstock with GNU General Public License v3.0 | 5 votes |
/** * A utility method for determining the height of a text block. * * @param block the text block. * @param position the label position. * @param g2 the graphics device. * * @return The height. */ protected double calculateTextBlockHeight(TextBlock block, CategoryLabelPosition position, Graphics2D g2) { RectangleInsets insets = getTickLabelInsets(); Size2D size = block.calculateDimensions(g2); Rectangle2D box = new Rectangle2D.Double(0.0, 0.0, size.getWidth(), size.getHeight()); Shape rotatedBox = ShapeUtilities.rotateShape(box, position.getAngle(), 0.0f, 0.0f); double h = rotatedBox.getBounds2D().getHeight() + insets.getTop() + insets.getBottom(); return h; }