Example usage for java.awt.geom Rectangle2D getWidth

List of usage examples for java.awt.geom Rectangle2D getWidth

Introduction

In this page you can find the example usage for java.awt.geom Rectangle2D getWidth.

Prototype

public abstract double getWidth();

Source Link

Document

Returns the width of the framing rectangle in double precision.

Usage

From source file:net.java.sip.communicator.gui.AuthenticationSplash.java

private void registrationEqualizeButtonSizes() {

    JButton[] buttons = new JButton[] { cancelButton, registerButton };

    String[] labels = new String[buttons.length];
    for (int i = 0; i < labels.length; i++) {
        labels[i] = buttons[i].getText();
    }/*from  ww w  .j a  v a 2  s  . c  o m*/

    // Get the largest width and height
    int i = 0;
    Dimension maxSize = new Dimension(0, 0);
    Rectangle2D textBounds = null;
    Dimension textSize = null;
    FontMetrics metrics = buttons[0].getFontMetrics(buttons[0].getFont());
    Graphics g = getGraphics();
    for (i = 0; i < labels.length; ++i) {
        textBounds = metrics.getStringBounds(labels[i], g);
        maxSize.width = Math.max(maxSize.width, (int) textBounds.getWidth());
        maxSize.height = Math.max(maxSize.height, (int) textBounds.getHeight());
    }

    Insets insets = buttons[0].getBorder().getBorderInsets(buttons[0]);
    maxSize.width += insets.left + insets.right;
    maxSize.height += insets.top + insets.bottom;

    // reset preferred and maximum size since BoxLayout takes both
    // into account
    for (i = 0; i < buttons.length; ++i) {
        buttons[i].setPreferredSize((Dimension) maxSize.clone());
        buttons[i].setMaximumSize((Dimension) maxSize.clone());
    }
}

From source file:net.java.sip.communicator.gui.AuthenticationSplash.java

/**
 * Sets the buttons along the bottom of the dialog to be the
 * same size. This is done dynamically by setting each button's
 * preferred and maximum sizes after the buttons are created.
 * This way, the layout automatically adjusts to the locale-
 * specific strings.//from   ww w.j a  v  a  2 s .c o m
 */
private void equalizeButtonSizes() {

    JButton[] buttons = new JButton[] { loginButton, cancelButton, registerButton };

    String[] labels = new String[buttons.length];
    for (int i = 0; i < labels.length; i++) {
        labels[i] = buttons[i].getText();
    }

    // Get the largest width and height
    int i = 0;
    Dimension maxSize = new Dimension(0, 0);
    Rectangle2D textBounds = null;
    Dimension textSize = null;
    FontMetrics metrics = buttons[0].getFontMetrics(buttons[0].getFont());
    Graphics g = getGraphics();
    for (i = 0; i < labels.length; ++i) {
        textBounds = metrics.getStringBounds(labels[i], g);
        maxSize.width = Math.max(maxSize.width, (int) textBounds.getWidth());
        maxSize.height = Math.max(maxSize.height, (int) textBounds.getHeight());
    }

    Insets insets = buttons[0].getBorder().getBorderInsets(buttons[0]);
    maxSize.width += insets.left + insets.right;
    maxSize.height += insets.top + insets.bottom;

    // reset preferred and maximum size since BoxLayout takes both
    // into account
    for (i = 0; i < buttons.length; ++i) {
        buttons[i].setPreferredSize((Dimension) maxSize.clone());
        buttons[i].setMaximumSize((Dimension) maxSize.clone());
    }
}

From source file:extern.AsymmetricStatisticalBarRenderer.java

/**
 * Draws an item for a plot with a vertical orientation.
 *
 * @param g2  the graphics device.// w ww .jav  a 2  s.com
 * @param state  the renderer state.
 * @param dataArea  the data area.
 * @param plot  the plot.
 * @param domainAxis  the domain axis.
 * @param rangeAxis  the range axis.
 * @param dataset  the data.
 * @param visibleRow  the visible row index.
 * @param row  the row index (zero-based).
 * @param column  the column index (zero-based).
 */
protected void drawVerticalItem(Graphics2D g2, CategoryItemRendererState state, Rectangle2D dataArea,
        CategoryPlot plot, CategoryAxis domainAxis, ValueAxis rangeAxis,
        AsymmetricStatisticalCategoryDataset dataset, int visibleRow, int row, int column) {

    RectangleEdge xAxisLocation = plot.getDomainAxisEdge();

    // BAR X
    double rectX = domainAxis.getCategoryStart(column, getColumnCount(), dataArea, xAxisLocation);

    int seriesCount = state.getVisibleSeriesCount() >= 0 ? state.getVisibleSeriesCount() : getRowCount();
    int categoryCount = getColumnCount();
    if (seriesCount > 1) {
        double seriesGap = dataArea.getWidth() * getItemMargin() / (categoryCount * (seriesCount - 1));
        rectX = rectX + visibleRow * (state.getBarWidth() + seriesGap);
    } else {
        rectX = rectX + visibleRow * state.getBarWidth();
    }

    // BAR Y
    Number meanValue = dataset.getMeanValue(row, column);
    if (meanValue == null) {
        return;
    }

    double value = meanValue.doubleValue();
    double base = 0.0;
    double lclip = getLowerClip();
    double uclip = getUpperClip();

    if (uclip <= 0.0) { // cases 1, 2, 3 and 4
        if (value >= uclip) {
            return; // bar is not visible
        }
        base = uclip;
        if (value <= lclip) {
            value = lclip;
        }
    } else if (lclip <= 0.0) { // cases 5, 6, 7 and 8
        if (value >= uclip) {
            value = uclip;
        } else {
            if (value <= lclip) {
                value = lclip;
            }
        }
    } else { // cases 9, 10, 11 and 12
        if (value <= lclip) {
            return; // bar is not visible
        }
        base = getLowerClip();
        if (value >= uclip) {
            value = uclip;
        }
    }

    RectangleEdge yAxisLocation = plot.getRangeAxisEdge();
    double transY1 = rangeAxis.valueToJava2D(base, dataArea, yAxisLocation);
    double transY2 = rangeAxis.valueToJava2D(value, dataArea, yAxisLocation);
    double rectY = Math.min(transY2, transY1);

    double rectWidth = state.getBarWidth();
    double rectHeight = Math.abs(transY2 - transY1);

    Rectangle2D bar = new Rectangle2D.Double(rectX, rectY, rectWidth, rectHeight);
    Paint itemPaint = getItemPaint(row, column);
    GradientPaintTransformer t = getGradientPaintTransformer();
    if (t != null && itemPaint instanceof GradientPaint) {
        itemPaint = t.transform((GradientPaint) itemPaint, bar);
    }
    g2.setPaint(itemPaint);
    g2.fill(bar);
    // draw the outline...
    if (isDrawBarOutline() && state.getBarWidth() > BAR_OUTLINE_WIDTH_THRESHOLD) {
        Stroke stroke = getItemOutlineStroke(row, column);
        Paint paint = getItemOutlinePaint(row, column);
        if (stroke != null && paint != null) {
            g2.setStroke(stroke);
            g2.setPaint(paint);
            g2.draw(bar);
        }
    }

    // CI lines      
    Number n = dataset.getUpperValue(row, column);
    Number m = dataset.getLowerValue(row, column);

    if (n != null && m != null) {
        double valueUpperDelta = n.doubleValue();
        double valueLowerDelta = m.doubleValue();

        if (valueLowerDelta > meanValue.doubleValue()) {
            double temp = valueLowerDelta - meanValue.doubleValue();
            valueLowerDelta = meanValue.doubleValue() - temp;
        }

        if (valueUpperDelta < meanValue.doubleValue()) {
            double temp = meanValue.doubleValue() - valueUpperDelta;
            valueUpperDelta = temp;
        }

        double highVal = rangeAxis.valueToJava2D(valueUpperDelta, dataArea, yAxisLocation);
        double lowVal = rangeAxis.valueToJava2D(valueLowerDelta, dataArea, yAxisLocation);

        if (this.errorIndicatorPaint != null) {
            g2.setPaint(this.errorIndicatorPaint);
        } else {
            g2.setPaint(getItemOutlinePaint(row, column));
        }
        if (this.errorIndicatorStroke != null) {
            g2.setStroke(this.errorIndicatorStroke);
        } else {
            g2.setStroke(getItemOutlineStroke(row, column));
        }

        Line2D line = null;
        line = new Line2D.Double(rectX + rectWidth / 2.0d, lowVal, rectX + rectWidth / 2.0d, highVal);
        g2.draw(line);
        line = new Line2D.Double(rectX + rectWidth / 2.0d - 5.0d, highVal, rectX + rectWidth / 2.0d + 5.0d,
                highVal);
        g2.draw(line);
        line = new Line2D.Double(rectX + rectWidth / 2.0d - 5.0d, lowVal, rectX + rectWidth / 2.0d + 5.0d,
                lowVal);
        g2.draw(line);
    }

    CategoryItemLabelGenerator generator = getItemLabelGenerator(row, column);
    if (generator != null && isItemLabelVisible(row, column)) {
        drawItemLabel(g2, dataset, row, column, plot, generator, bar, (value < 0.0));
    }

    // add an item entity, if this information is being collected
    EntityCollection entities = state.getEntityCollection();
    if (entities != null) {
        addItemEntity(entities, dataset, row, column, bar);
    }
}

From source file:nl.strohalm.cyclos.utils.jfreeAsymmetric.AsymmetricStatisticalBarRenderer.java

/**
 * Draws an item for a plot with a vertical orientation.
 * /*from  w  ww  .  ja v a2  s.  c  o  m*/
 * @param g2 the graphics device.
 * @param state the renderer state.
 * @param dataArea the data area.
 * @param plot the plot.
 * @param domainAxis the domain axis.
 * @param rangeAxis the range axis.
 * @param dataset the data.
 * @param row the row index (zero-based).
 * @param column the column index (zero-based).
 */
protected void drawVerticalItem(final Graphics2D g2, final CategoryItemRendererState state,
        final Rectangle2D dataArea, final CategoryPlot plot, final CategoryAxis domainAxis,
        final ValueAxis rangeAxis, final StatisticalCategoryDataset dataset, final int row, final int column) {
    // nothing is drawn for null... //ADDED THIS BLOCK, RINKE
    final Number v = dataset.getValue(row, column);
    if (v == null) {
        return;
    }

    final RectangleEdge xAxisLocation = plot.getDomainAxisEdge();

    // BAR X
    double rectX = domainAxis.getCategoryStart(column, getColumnCount(), dataArea, xAxisLocation);

    final int seriesCount = getRowCount();
    final int categoryCount = getColumnCount();
    if (seriesCount > 1) {
        final double seriesGap = dataArea.getWidth() * getItemMargin() / (categoryCount * (seriesCount - 1));
        rectX = rectX + row * (state.getBarWidth() + seriesGap);
    } else {
        rectX = rectX + row * state.getBarWidth();
    }

    // BAR Y
    final Number meanValue = dataset.getMeanValue(row, column);

    double value = meanValue.doubleValue();
    double base = 0.0;
    final double lclip = getLowerClip();
    final double uclip = getUpperClip();

    if (uclip <= 0.0) { // cases 1, 2, 3 and 4
        if (value >= uclip) {
            return; // bar is not visible
        }
        base = uclip;
        if (value <= lclip) {
            value = lclip;
        }
    } else if (lclip <= 0.0) { // cases 5, 6, 7 and 8
        if (value >= uclip) {
            value = uclip;
        } else {
            if (value <= lclip) {
                value = lclip;
            }
        }
    } else { // cases 9, 10, 11 and 12
        if (value <= lclip) {
            return; // bar is not visible
        }
        base = getLowerClip();
        if (value >= uclip) {
            value = uclip;
        }
    }

    final RectangleEdge yAxisLocation = plot.getRangeAxisEdge();
    final double transY1 = rangeAxis.valueToJava2D(base, dataArea, yAxisLocation);
    final double transY2 = rangeAxis.valueToJava2D(value, dataArea, yAxisLocation);
    final double rectY = Math.min(transY2, transY1);

    final double rectWidth = state.getBarWidth();
    final double rectHeight = Math.abs(transY2 - transY1);

    final Rectangle2D bar = new Rectangle2D.Double(rectX, rectY, rectWidth, rectHeight);
    final Paint seriesPaint = getItemPaint(row, column);
    g2.setPaint(seriesPaint);
    g2.fill(bar);
    if (state.getBarWidth() > 3) {
        g2.setStroke(getItemStroke(row, column));
        g2.setPaint(getItemOutlinePaint(row, column));
        g2.draw(bar);
    }

    // standard deviation lines
    final AsymmetricStatisticalCategoryDataset asymmDataset = (AsymmetricStatisticalCategoryDataset) dataset;
    final Number highValRaw = asymmDataset.getUpperValue(row, column);
    final Number lowValRaw = asymmDataset.getLowerValue(row, column);
    // only draw if both error bars items are not null
    if (highValRaw != null && lowValRaw != null) { // ADDED THIS IF, RINKE
        final double highVal = rangeAxis.valueToJava2D(highValRaw.doubleValue(), dataArea, yAxisLocation);
        final double lowVal = rangeAxis.valueToJava2D(lowValRaw.doubleValue(), dataArea, yAxisLocation);

        if (getErrorIndicatorPaint() != null) {
            g2.setPaint(getErrorIndicatorPaint());
        } else {
            g2.setPaint(getItemOutlinePaint(row, column));
        }
        Line2D line = null;
        line = new Line2D.Double(rectX + rectWidth / 2.0d, lowVal, rectX + rectWidth / 2.0d, highVal);
        g2.draw(line);
        line = new Line2D.Double(rectX + rectWidth / 2.0d - 5.0d, highVal, rectX + rectWidth / 2.0d + 5.0d,
                highVal);
        g2.draw(line);
        line = new Line2D.Double(rectX + rectWidth / 2.0d - 5.0d, lowVal, rectX + rectWidth / 2.0d + 5.0d,
                lowVal);
        g2.draw(line);
    }

    final CategoryItemLabelGenerator generator = getItemLabelGenerator(row, column);
    if (generator != null && isItemLabelVisible(row, column)) {
        drawItemLabel(g2, dataset, row, column, plot, generator, bar, (value < 0.0));
    }

    // add an item entity, if this information is being collected
    final EntityCollection entities = state.getEntityCollection();
    if (entities != null) {
        addItemEntity(entities, dataset, row, column, bar);
    }
}

From source file:org.apache.pdfbox.contentstream.PDFStreamEngine.java

/**
 * Process the given annotation with the specified appearance stream.
 *
 * @param annotation The annotation containing the appearance stream to process.
 * @param appearance The appearance stream to process.
 *//*from  w  ww  .  j  a  v a2s . com*/
protected void processAnnotation(PDAnnotation annotation, PDAppearanceStream appearance) throws IOException {
    PDResources parent = pushResources(appearance);
    Stack<PDGraphicsState> savedStack = saveGraphicsStack();

    PDRectangle bbox = appearance.getBBox();
    PDRectangle rect = annotation.getRectangle();
    Matrix matrix = appearance.getMatrix();

    // zero-sized rectangles are not valid
    if (rect.getWidth() > 0 && rect.getHeight() > 0) {
        // transformed appearance box  fixme: may be an arbitrary shape
        Rectangle2D transformedBox = bbox.transform(matrix).getBounds2D();

        // compute a matrix which scales and translates the transformed appearance box to align
        // with the edges of the annotation's rectangle
        Matrix a = Matrix.getTranslateInstance(rect.getLowerLeftX(), rect.getLowerLeftY());
        a.concatenate(Matrix.getScaleInstance((float) (rect.getWidth() / transformedBox.getWidth()),
                (float) (rect.getHeight() / transformedBox.getHeight())));
        a.concatenate(
                Matrix.getTranslateInstance((float) -transformedBox.getX(), (float) -transformedBox.getY()));

        // Matrix shall be concatenated with A to form a matrix AA that maps from the appearance's
        // coordinate system to the annotation's rectangle in default user space
        Matrix aa = Matrix.concatenate(matrix, a);

        // make matrix AA the CTM
        getGraphicsState().setCurrentTransformationMatrix(aa);

        // clip to bounding box
        clipToRect(bbox);

        processStreamOperators(appearance);
    }

    restoreGraphicsStack(savedStack);
    popResources(parent);
}

From source file:edu.uci.ics.jung.visualization.PluggableRenderer.java

/**
 * Labels the specified vertex with the specified label.  
 * Uses the font specified by this instance's 
 * <code>VertexFontFunction</code>.  (If the font is unspecified, the existing
 * font for the graphics context is used.)  If vertex label centering
 * is active, the label is centered on the position of the vertex; otherwise
 * the label is offset slightly.//from   ww  w.  j  a va2  s  .  com
 */
protected void labelVertex(Graphics g, Vertex v, String label, int x, int y) {
    Component component = prepareRenderer(graphLabelRenderer, label, isPicked(v), v);

    Dimension d = component.getPreferredSize();

    int h_offset;
    int v_offset;
    if (centerVertexLabel) {
        h_offset = -d.width / 2;
        v_offset = -d.height / 2;

    } else {
        Rectangle2D bounds = vertexShapeFunction.getShape(v).getBounds2D();
        h_offset = (int) (bounds.getWidth() / 2) + 5;
        v_offset = (int) (bounds.getHeight() / 2) + 5 - d.height;
    }

    rendererPane.paintComponent(g, component, screenDevice, x + h_offset, y + v_offset, d.width, d.height,
            true);

}

From source file:com.rapidminer.gui.new_plotter.engine.jfreechart.link_and_brush.LinkAndBrushChartPanel.java

@Override
public void zoom(Rectangle2D selection) {
    // get the origin of the zoom selection in the Java2D space used for
    // drawing the chart (that is, before any scaling to fit the panel)
    Point2D selectOrigin = translateScreenToJava2D(
            new Point((int) Math.ceil(selection.getX()), (int) Math.ceil(selection.getY())));
    PlotRenderingInfo plotInfo = getChartRenderingInfo().getPlotInfo();
    Rectangle2D scaledDataArea = getScreenDataArea((int) selection.getCenterX(), (int) selection.getCenterY());
    if ((selection.getHeight() > 0) && (selection.getWidth() > 0)) {

        double hLower = (selection.getMinX() - scaledDataArea.getMinX()) / scaledDataArea.getWidth();
        double hUpper = (selection.getMaxX() - scaledDataArea.getMinX()) / scaledDataArea.getWidth();
        double vLower = (scaledDataArea.getMaxY() - selection.getMaxY()) / scaledDataArea.getHeight();
        double vUpper = (scaledDataArea.getMaxY() - selection.getMinY()) / scaledDataArea.getHeight();

        Plot p = getChart().getPlot();//from   ww w .j a  v a  2  s  . c  o m
        if (p instanceof LinkAndBrushPlot) {

            PlotOrientation orientation = null;
            if (p instanceof XYPlot) {
                XYPlot xyPlot = (XYPlot) p;
                orientation = xyPlot.getOrientation();
            }
            if (p instanceof CategoryPlot) {
                CategoryPlot categoryPlot = (CategoryPlot) p;
                orientation = categoryPlot.getOrientation();
            }

            // here we tweak the notify flag on the plot so that only
            // one notification happens even though we update multiple
            // axes...

            boolean savedNotify = p.isNotify();
            p.setNotify(false);
            LinkAndBrushPlot LABPlot = (LinkAndBrushPlot) p;

            List<Pair<Integer, Range>> zoomedDomainAxisRanges = new LinkedList<Pair<Integer, Range>>();
            List<Pair<Integer, Range>> zoomedRangeAxisRanges = new LinkedList<Pair<Integer, Range>>();

            if (orientation == PlotOrientation.HORIZONTAL) {
                zoomedDomainAxisRanges
                        .addAll(LABPlot.calculateDomainAxesZoom(vLower, vUpper, zoomOnLinkAndBrushSelection));
                zoomedRangeAxisRanges.addAll(LABPlot.calculateRangeAxesZoom(hLower, hUpper, plotInfo,
                        selectOrigin, zoomOnLinkAndBrushSelection));
            } else {
                zoomedDomainAxisRanges
                        .addAll(LABPlot.calculateDomainAxesZoom(hLower, hUpper, zoomOnLinkAndBrushSelection));
                zoomedRangeAxisRanges.addAll(LABPlot.calculateRangeAxesZoom(vLower, vUpper, plotInfo,
                        selectOrigin, zoomOnLinkAndBrushSelection));
            }
            p.setNotify(savedNotify);

            if (zoomOnLinkAndBrushSelection) {
                informLinkAndBrushSelectionListeners(new LinkAndBrushSelection(SelectionType.ZOOM_IN,
                        zoomedDomainAxisRanges, zoomedRangeAxisRanges));
            } else {
                informLinkAndBrushSelectionListeners(new LinkAndBrushSelection(SelectionType.SELECTION,
                        zoomedDomainAxisRanges, zoomedRangeAxisRanges));
            }

        } else {
            super.zoom(selection);
        }
    }
}

From source file:edu.dlnu.liuwenpeng.render.BarRenderer.java

/**    
* Calculates the coordinate of the first "side" of a bar.  This will be    
* the minimum x-coordinate for a vertical bar, and the minimum    
* y-coordinate for a horizontal bar.    
*    //from w w w . ja va  2  s  .c o m
* @param plot  the plot.    
* @param orientation  the plot orientation.    
* @param dataArea  the data area.    
* @param domainAxis  the domain axis.    
* @param state  the renderer state (has the bar width precalculated).    
* @param row  the row index.    
* @param column  the column index.    
*    
* @return The coordinate.    
*/
protected double calculateBarW0(CategoryPlot plot, PlotOrientation orientation, Rectangle2D dataArea,
        CategoryAxis domainAxis, CategoryItemRendererState state, int row, int column) {
    // calculate bar width...    
    double space = 0.0;
    if (orientation == PlotOrientation.HORIZONTAL) {
        space = dataArea.getHeight();
    } else {
        space = dataArea.getWidth();
    }
    double barW0 = domainAxis.getCategoryStart(column, getColumnCount(), dataArea, plot.getDomainAxisEdge());
    int seriesCount = getRowCount();

    int categoryCount = getColumnCount();

    if (seriesCount > 1) {
        double seriesGap = space * getItemMargin() / (categoryCount * (seriesCount - 1));
        double seriesW = calculateSeriesWidth(space, domainAxis, categoryCount, seriesCount);
        barW0 = barW0 + row * (seriesW + seriesGap) + (seriesW / 2.0) - (state.getBarWidth() / 2.0);

    } else {
        barW0 = domainAxis.getCategoryMiddle(column, getColumnCount(), dataArea, plot.getDomainAxisEdge())
                - state.getBarWidth() / 2.0;
    }
    return barW0;
}

From source file:de.iteratec.iteraplan.businesslogic.exchange.visio.informationflow.VisioInformationFlowExport.java

/**
 * Adjusts the page size to the containing shapes, with a margin, and also moves all shapes on the page
 * so their positions are actually within the page bounds. 
 *///  w w  w.  j a va  2  s. co  m
private Point2D adjustPage(Rectangle2D graphAreaBounds, Shape title, List<Shape> queryInfo,
        Rectangle2D legendsBox) {
    double pageWidth = graphAreaBounds.getWidth() + 3 * MARGIN_IN + legendsBox.getWidth();
    double graphAreaPlusTitleHeight = graphAreaBounds.getHeight() + title.getHeight()
            + getQueryInfoHeight(queryInfo) + MARGIN_IN;
    double pageHeight = Math.max(graphAreaPlusTitleHeight, legendsBox.getHeight()) + 2 * MARGIN_IN;
    getTargetPage().setSize(pageWidth, pageHeight);

    double deltaY = pageHeight - graphAreaPlusTitleHeight - MARGIN_IN;
    for (Shape shape : getTargetPage().getShapes()) {
        shape.setPosition(shape.getPinX() + MARGIN_IN, shape.getPinY() + deltaY);
    }

    return new Point2D.Double(MARGIN_IN, deltaY);
}

From source file:de.iteratec.iteraplan.businesslogic.exchange.visio.informationflow.VisioInformationFlowExport.java

private Rectangle2D createLegends(Rectangle2D bounds) throws MasterNotFoundException {
    Page page = getTargetPage();/*from  w  ww . ja va 2 s .c o m*/
    double legendsBlockLeftX = bounds.getWidth() + MARGIN_IN;
    double legendsBlockTopY = bounds.getY() + bounds.getHeight() + MARGIN_IN;

    Coordinates position = new Coordinates(legendsBlockLeftX, legendsBlockTopY);

    Shape descriptionLegend = createDescriptionLegend(informationFlowOptions, page, position);
    double legendsBlockWidth = descriptionLegend.getWidth();
    double legendsBlockHeight = descriptionLegend.getHeight();

    position.incX(InchConverter.cmToInches(LEGEND_DESCRIPTION_WIDTH_CM - LEGEND_STANDARD_CELL_WIDTH_CM));
    position.incY(-(MARGIN_IN + descriptionLegend.getHeight()));
    legendsBlockHeight += MARGIN_IN;

    ColorDimensionOptionsBean colorsBean = informationFlowOptions.getColorOptionsBean();
    if (GraphicalExportBaseOptions.NOTHING_SELECTED != colorsBean.getDimensionAttributeId().intValue()) {
        double colorLegendHeight = createColorLegend(colorsBean, page, position,
                VISIO_SHAPE_NAME_COLOR_INDEX_SQUARE, getFieldValueFromDimension(getColorDimension()),
                TypeOfBuildingBlock.INFORMATIONSYSTEMRELEASE);
        position.incY(-(MARGIN_IN + colorLegendHeight));
        legendsBlockHeight += colorLegendHeight + MARGIN_IN;
    }

    LineDimensionOptionsBean lineTypeBean = informationFlowOptions.getLineOptionsBean();
    if (GraphicalExportBaseOptions.NOTHING_SELECTED != lineTypeBean.getDimensionAttributeId().intValue()) {
        legendsBlockHeight += createLineTypeLegend(lineTypeBean, page, position, VISIO_SHAPE_NAME_LINE_FIELD,
                getFieldValueFromDimension(lineDimension), TypeOfBuildingBlock.INFORMATIONSYSTEMRELEASE);
    }
    return new Rectangle2D.Double(legendsBlockLeftX, legendsBlockTopY, legendsBlockWidth, legendsBlockHeight);
}