Java Code Examples for java.awt.Rectangle#grow()

The following examples show how to use java.awt.Rectangle#grow() . 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: SlurInspector.java    From libreveris with GNU Lesser General Public License v3.0 6 votes vote down vote up
/**
 * Detect any section which is too far from the other ones.
 *
 * @param seedSection the initial seed section
 * @param collected   the sections collected, including seed section
 * @return the collection of isolated sections found
 */
private List<Section> detectIsolatedSections (Section seedSection,
                                              List<Section> collected)
{
    final List<Section> isolated = new ArrayList<>(collected);
    final Rectangle slurBox = seedSection.getBounds();
    boolean makingProgress;

    do {
        makingProgress = false;

        for (Iterator<Section> it = isolated.iterator(); it.hasNext();) {
            Section section = it.next();
            Rectangle sectBox = section.getBounds();
            sectBox.grow(params.slurBoxDx, params.slurBoxDy);

            if (sectBox.intersects(slurBox)) {
                slurBox.add(sectBox);
                it.remove();
                makingProgress = true;
            }
        }
    } while (makingProgress);

    return isolated;
}
 
Example 2
Source File: PontoDeLinha.java    From brModelo with GNU General Public License v3.0 6 votes vote down vote up
/**
 * Liga uma linha a um objeto manualmente (sem o uso do mouse).
 *
 * @param res
 * @return
 */
public boolean LigarA(Elementar res) {
    boolean sn = false;
    if (res instanceof Forma) {
        setEm((Forma) res);
        if (getEm() != null) {
            getEm().PosicionePonto(this);
            getDono().OrganizeLinha();
            sn = true;
        }
    }
    getDono().reSetBounds();
    ReenquadreLinha();
    Rectangle rec = getBounds();
    rec.grow(5, 5);
    InvalidateArea(rec);
    //ProcessaOverDraw(true);
    return sn;
}
 
Example 3
Source File: SigPainter.java    From audiveris with GNU Affero General Public License v3.0 6 votes vote down vote up
public void process (SIGraph sig)
{
    final int bracketGrowth = 2 * sig.getSystem().getSheet().getInterline();

    // Use a COPY of vertices, to reduce risks of concurrent modifications (but not all...)
    Set<Inter> copy = new LinkedHashSet<>(sig.vertexSet());

    for (Inter inter : copy) {
        if (!inter.isRemoved()) {
            Rectangle bounds = inter.getBounds();

            if (bounds != null) {
                // Dirty hack to make sure bracket serifs are fully painted
                // (despite the fact that bracket serif is not included in their bounds)
                if (inter.getShape() == Shape.BRACKET) {
                    bounds.grow(bracketGrowth, bracketGrowth);
                }

                if ((clip == null) || clip.intersects(bounds)) {
                    inter.accept(this);
                }
            }
        }
    }
}
 
Example 4
Source File: HeaderlessColumnResizer.java    From orbit-image-analysis with GNU General Public License v3.0 6 votes vote down vote up
private TableColumn getResizingColumn(Point p, int column) {
  if (column == -1) {
    return null;
  }
  int row = table.rowAtPoint(p);
  Rectangle r = table.getCellRect(row, column, true);
  r.grow(-3, 0);
  if (r.contains(p)) {
    return null;
  }
  int midPoint = r.x + r.width / 2;
  int columnIndex;
  if (table.getTableHeader().getComponentOrientation().isLeftToRight()) {
    columnIndex = (p.x < midPoint) ? column - 1 : column;
  } else {
    columnIndex = (p.x < midPoint) ? column : column - 1;
  }
  if (columnIndex == -1) {
    return null;
  }
  return table.getTableHeader().getColumnModel().getColumn(columnIndex);
}
 
Example 5
Source File: XChartSelectionOverlay.java    From netbeans with Apache License 2.0 5 votes vote down vote up
private void paintRect(int x, int y, int w, int h, int t) {
    if (w != 0 && h != 0) {
        Rectangle rect = new Rectangle(x, y, w, h);
        rect.grow(t, t);
        paintImmediately(rect);
    }
}
 
Example 6
Source File: BrokenLine.java    From audiveris with GNU Affero General Public License v3.0 5 votes vote down vote up
/**
 * Find the first point of the current sequence which is close to the provided point
 * (less than sticky distance).
 *
 * @param point the provided point
 * @return the point found, or null if not found
 */
public Point findPoint (Point point)
{
    Rectangle window = new Rectangle(point);
    window.grow(getStickyDistance(), getStickyDistance());

    for (Point pt : points) {
        if (window.contains(pt)) {
            return pt;
        }
    }

    return null;
}
 
Example 7
Source File: PontoDeLinha.java    From brModelo with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void mouseExited(MouseEvent e) {
    super.mouseExited(e); //To change body of generated methods, choose Tools | Templates.
    entrou = false;
    Rectangle r = getBounds();
    int x = r.width / 2;
    int y = r.height / 2;
    //r = new Rectangle(r.x - x, r.y - y, r.width * 2, r.height * 2);
    r.grow(x + 2, y + 2);
    InvalidateArea(r);
}
 
Example 8
Source File: ScoreChecker.java    From libreveris with GNU Lesser General Public License v3.0 5 votes vote down vote up
/**
 * Check that note heads do not appear on both stem head and tail.
 * On tail we can have nothing or beams or flags, but no heads
 *
 * @param chord the chord to check
 */
private void checkHeadLocations (Chord chord)
{
    // This test applies only to chords with stem
    Glyph stem = chord.getStem();
    if (stem == null) {
        return;
    }

    Rectangle tailBox = new Rectangle(chord.getTailLocation());
    int halfTailBoxSide = chord.getScale().toPixels(constants.halfTailBoxSide);
    tailBox.grow(halfTailBoxSide, halfTailBoxSide);

    for (TreeNode node : chord.getNotes()) {
        Note note = (Note) node;

        // If note is close to tail, it can't be a note
        if (note.getBox().intersects(tailBox)) {
            for (Glyph glyph : note.getGlyphs()) {
                if (logger.isDebugEnabled() || glyph.isVip()) {
                    logger.info("Note {} too close to tail of stem {}",
                            note, stem);
                }
                glyph.setShape(null);
            }
            modified.set(true);
        }
    }
}
 
Example 9
Source File: BorderBuilder.java    From libreveris with GNU Lesser General Public License v3.0 5 votes vote down vote up
private void grow (int h,
                   int v)
{
    for (Rectangle rect : boxes) {
        rect.grow(h, v);
    }
}
 
Example 10
Source File: BBoxSelectionPainter.java    From importer-exporter with Apache License 2.0 5 votes vote down vote up
private void checkOutOfBounds(Point point) {
	Rectangle bounds = map.getBounds();
	bounds.grow(-shrinkViewPort, -shrinkViewPort);

	outOfBounds = !bounds.contains(point);
	if (outOfBounds)
		outOfBoundsPoint = point;
}
 
Example 11
Source File: FilamentsFactory.java    From libreveris with GNU Lesser General Public License v3.0 4 votes vote down vote up
/**
 * Detect if the provided section is a thick one.
 * (as seen in the context of the factory orientation)
 *
 * @param section the section to check
 * @return true if fat
 */
public boolean isSectionFat (Section section)
{
    if (section.isFat() == null) {
        try {
            if (section.getMeanThickness(orientation) <= 1) {
                section.setFat(false);

                return section.isFat();
            }

            // Check global slimness
            if (section.getMeanAspect(orientation) < params.minSectionAspect) {
                section.setFat(true);

                return section.isFat();
            }

            // Check thickness
            Rectangle bounds = orientation.oriented(section.getBounds());
            Line line = orientation.switchRef(
                    section.getAbsoluteLine());

            if (Math.abs(line.getSlope()) < (Math.PI / 4)) {
                // Measure mean thickness on each half
                int startCoord = bounds.x + (bounds.width / 4);
                int startPos = line.yAtX(startCoord);
                int stopCoord = bounds.x + ((3 * bounds.width) / 4);
                int stopPos = line.yAtX(stopCoord);

                // Start side
                Rectangle oRoi = new Rectangle(startCoord, startPos, 0, 0);
                final int halfWidth = Math.min(
                        params.probeWidth / 2,
                        bounds.width / 4);
                oRoi.grow(halfWidth, params.maxSectionThickness);

                PointsCollector collector = new PointsCollector(
                        orientation.absolute(oRoi));
                section.cumulate(collector);

                int startThickness = (int) Math.rint(
                        (double) collector.getSize() / oRoi.width);

                // Stop side
                oRoi.translate(stopCoord - startCoord, stopPos - startPos);
                collector = new PointsCollector(orientation.absolute(oRoi));
                section.cumulate(collector);

                int stopThickness = (int) Math.rint(
                        (double) collector.getSize() / oRoi.width);

                section.setFat(
                        (startThickness > params.maxSectionThickness)
                        || (stopThickness > params.maxSectionThickness));
            } else {
                section.setFat(bounds.height > params.maxSectionThickness);
            }
        } catch (Exception ex) {
            logger.warn("Error in checking fatness of " + section, ex);
            section.setFat(true);
        }
    }

    return section.isFat();
}
 
Example 12
Source File: SourceClippingBlitTest.java    From openjdk-8 with GNU General Public License v2.0 4 votes vote down vote up
public void runTests() {
        GraphicsConfiguration gc = getGraphicsConfiguration();
        for (Image srcIm :
            new Image[] {
                getBufferedImage(gc, IMAGEW, IMAGEH,
                        BufferedImage.TYPE_INT_RGB, true),
                getBufferedImage(gc, IMAGEW, IMAGEH,
                        BufferedImage.TYPE_INT_RGB, false),
                // commented out due to 6593406
//                getBMImage(gc, IMAGEW, IMAGEH),
//                getBufferedImage(gc, IMAGEW, IMAGEH,
//                        BufferedImage.TYPE_INT_ARGB, true),
//                getBufferedImage(gc, IMAGEW, IMAGEH,
//                        BufferedImage.TYPE_INT_ARGB, false),
                getVImage(gc, IMAGEW, IMAGEH),
            })
        {
            System.out.println("Testing source: " + srcIm);
            // wiggle the source and dest rectangles
            try {
                for (int locationVar = -10; locationVar < 20; locationVar += 10)
                {
                    for (int sizeVar = -10; sizeVar < 20; sizeVar += 10) {
                        Rectangle srcRect = (Rectangle)IMAGE_BOUNDS.clone();
                        srcRect.translate(locationVar, locationVar);
                        srcRect.grow(sizeVar, sizeVar);

                        Rectangle dstRect =
                                new Rectangle(sizeVar, sizeVar,
                                srcRect.width, srcRect.height);
                        System.out.println("testing blit rect src: " + srcRect);
                        System.out.println("                  dst: " + dstRect);
                        render(getGraphics(), srcIm, srcRect, dstRect);
                        test(srcRect, dstRect);
                    }
                }
                System.out.println("Test passed.");
            } finally {
                synchronized (lock) {
                    done = true;
                    lock.notifyAll();
                }
            }
        }
    }
 
Example 13
Source File: SourceClippingBlitTest.java    From jdk8u60 with GNU General Public License v2.0 4 votes vote down vote up
public void runTests() {
        GraphicsConfiguration gc = getGraphicsConfiguration();
        for (Image srcIm :
            new Image[] {
                getBufferedImage(gc, IMAGEW, IMAGEH,
                        BufferedImage.TYPE_INT_RGB, true),
                getBufferedImage(gc, IMAGEW, IMAGEH,
                        BufferedImage.TYPE_INT_RGB, false),
                // commented out due to 6593406
//                getBMImage(gc, IMAGEW, IMAGEH),
//                getBufferedImage(gc, IMAGEW, IMAGEH,
//                        BufferedImage.TYPE_INT_ARGB, true),
//                getBufferedImage(gc, IMAGEW, IMAGEH,
//                        BufferedImage.TYPE_INT_ARGB, false),
                getVImage(gc, IMAGEW, IMAGEH),
            })
        {
            System.out.println("Testing source: " + srcIm);
            // wiggle the source and dest rectangles
            try {
                for (int locationVar = -10; locationVar < 20; locationVar += 10)
                {
                    for (int sizeVar = -10; sizeVar < 20; sizeVar += 10) {
                        Rectangle srcRect = (Rectangle)IMAGE_BOUNDS.clone();
                        srcRect.translate(locationVar, locationVar);
                        srcRect.grow(sizeVar, sizeVar);

                        Rectangle dstRect =
                                new Rectangle(sizeVar, sizeVar,
                                srcRect.width, srcRect.height);
                        System.out.println("testing blit rect src: " + srcRect);
                        System.out.println("                  dst: " + dstRect);
                        render(getGraphics(), srcIm, srcRect, dstRect);
                        test(srcRect, dstRect);
                    }
                }
                System.out.println("Test passed.");
            } finally {
                synchronized (lock) {
                    done = true;
                    lock.notifyAll();
                }
            }
        }
    }
 
Example 14
Source File: OverlayRenderer.java    From runelite with BSD 2-Clause "Simplified" License 4 votes vote down vote up
@Override
public MouseEvent mouseMoved(MouseEvent mouseEvent)
{
	if (!inOverlayManagingMode)
	{
		return mouseEvent;
	}

	final Point mousePoint = mouseEvent.getPoint();
	mousePosition.setLocation(mousePoint);

	if (!inOverlayResizingMode && !inOverlayDraggingMode)
	{
		currentManagedOverlay = null;

		synchronized (overlayManager)
		{
			for (Overlay overlay : overlayManager.getOverlays())
			{
				final Rectangle bounds = overlay.getBounds();
				if (bounds.contains(mousePoint))
				{
					currentManagedOverlay = overlay;
					break;
				}
			}
		}
	}

	if (currentManagedOverlay == null || !currentManagedOverlay.isResizable())
	{
		clientUI.setCursor(clientUI.getDefaultCursor());
		return mouseEvent;
	}

	final Rectangle toleranceRect = new Rectangle(currentManagedOverlay.getBounds());
	toleranceRect.grow(-OVERLAY_RESIZE_TOLERANCE, -OVERLAY_RESIZE_TOLERANCE);
	final int outcode = toleranceRect.outcode(mouseEvent.getPoint());

	switch (outcode)
	{
		case Rectangle.OUT_TOP:
			clientUI.setCursor(Cursor.getPredefinedCursor(Cursor.N_RESIZE_CURSOR));
			break;
		case Rectangle.OUT_TOP | Rectangle.OUT_LEFT:
			clientUI.setCursor(Cursor.getPredefinedCursor(Cursor.NW_RESIZE_CURSOR));
			break;
		case Rectangle.OUT_LEFT:
			clientUI.setCursor(Cursor.getPredefinedCursor(Cursor.W_RESIZE_CURSOR));
			break;
		case Rectangle.OUT_LEFT | Rectangle.OUT_BOTTOM:
			clientUI.setCursor(Cursor.getPredefinedCursor(Cursor.SW_RESIZE_CURSOR));
			break;
		case Rectangle.OUT_BOTTOM:
			clientUI.setCursor(Cursor.getPredefinedCursor(Cursor.S_RESIZE_CURSOR));
			break;
		case Rectangle.OUT_BOTTOM | Rectangle.OUT_RIGHT:
			clientUI.setCursor(Cursor.getPredefinedCursor(Cursor.SE_RESIZE_CURSOR));
			break;
		case Rectangle.OUT_RIGHT:
			clientUI.setCursor(Cursor.getPredefinedCursor(Cursor.E_RESIZE_CURSOR));
			break;
		case Rectangle.OUT_RIGHT | Rectangle.OUT_TOP:
			clientUI.setCursor(Cursor.getPredefinedCursor(Cursor.NE_RESIZE_CURSOR));
			break;
		default:
			// center
			clientUI.setCursor(clientUI.getDefaultCursor());
	}

	return mouseEvent;
}
 
Example 15
Source File: SourceClippingBlitTest.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
public void runTests() {
        GraphicsConfiguration gc = getGraphicsConfiguration();
        for (Image srcIm :
            new Image[] {
                getBufferedImage(gc, IMAGEW, IMAGEH,
                        BufferedImage.TYPE_INT_RGB, true),
                getBufferedImage(gc, IMAGEW, IMAGEH,
                        BufferedImage.TYPE_INT_RGB, false),
                // commented out due to 6593406
//                getBMImage(gc, IMAGEW, IMAGEH),
//                getBufferedImage(gc, IMAGEW, IMAGEH,
//                        BufferedImage.TYPE_INT_ARGB, true),
//                getBufferedImage(gc, IMAGEW, IMAGEH,
//                        BufferedImage.TYPE_INT_ARGB, false),
                getVImage(gc, IMAGEW, IMAGEH),
            })
        {
            System.out.println("Testing source: " + srcIm);
            // wiggle the source and dest rectangles
            try {
                for (int locationVar = -10; locationVar < 20; locationVar += 10)
                {
                    for (int sizeVar = -10; sizeVar < 20; sizeVar += 10) {
                        Rectangle srcRect = (Rectangle)IMAGE_BOUNDS.clone();
                        srcRect.translate(locationVar, locationVar);
                        srcRect.grow(sizeVar, sizeVar);

                        Rectangle dstRect =
                                new Rectangle(sizeVar, sizeVar,
                                srcRect.width, srcRect.height);
                        System.out.println("testing blit rect src: " + srcRect);
                        System.out.println("                  dst: " + dstRect);
                        render(getGraphics(), srcIm, srcRect, dstRect);
                        test(srcRect, dstRect);
                    }
                }
                System.out.println("Test passed.");
            } finally {
                synchronized (lock) {
                    done = true;
                    lock.notifyAll();
                }
            }
        }
    }
 
Example 16
Source File: FilamentFactory.java    From audiveris with GNU Affero General Public License v3.0 4 votes vote down vote up
/**
 * Detect if the provided section is a thick one.
 * (as seen in the context of the factory orientation)
 *
 * @param section the section to check
 * @return true if fat
 */
public boolean isSectionFat (Section section)
{
    final Boolean fat = fatSections.get(section);

    if (fat != null) {
        return fat;
    }

    try {
        if (section.getMeanThickness(orientation) <= 1) {
            return setFat(section, false);
        }

        // Check global slimness
        if (section.getMeanAspect(orientation) < params.minSectionAspect) {
            return setFat(section, true);
        }

        // Check thickness
        Rectangle bounds = orientation.oriented(section.getBounds());
        Line line = orientation.switchRef(section.getAbsoluteLine());

        if (Math.abs(line.getSlope()) < (Math.PI / 4)) {
            // Measure mean thickness on each half
            int startCoord = bounds.x + (bounds.width / 4);
            int startPos = line.yAtX(startCoord);
            int stopCoord = bounds.x + ((3 * bounds.width) / 4);
            int stopPos = line.yAtX(stopCoord);

            // Start side
            Rectangle oRoi = new Rectangle(startCoord, startPos, 0, 0);
            final int halfWidth = Math.min(params.probeWidth / 2, bounds.width / 4);
            oRoi.grow(halfWidth, params.maxThickness);

            PointsCollector collector = new PointsCollector(orientation.absolute(oRoi));
            section.cumulate(collector);

            int startThickness = (int) Math.rint((double) collector.getSize() / oRoi.width);

            // Stop side
            oRoi.translate(stopCoord - startCoord, stopPos - startPos);
            collector = new PointsCollector(orientation.absolute(oRoi));
            section.cumulate(collector);

            int stopThickness = (int) Math.rint((double) collector.getSize() / oRoi.width);

            return setFat(
                    section,
                    (startThickness > params.maxThickness)
                            || (stopThickness > params.maxThickness));
        } else {
            return setFat(section, bounds.height > params.maxThickness);
        }
    } catch (Exception ex) {
        logger.warn("Error in checking fatness of " + section, ex);

        return setFat(section, true);
    }
}
 
Example 17
Source File: LinesRetriever.java    From audiveris with GNU Affero General Public License v3.0 4 votes vote down vote up
/**
 * Last attempt to include discarded (and sloped) filaments to retrieved staff lines.
 */
private void includeDiscardedFilaments ()
{
    List<StaffFilament> candidates = new ArrayList<>();
    candidates.addAll(discardedFilaments);
    candidates.addAll(slopedFilaments);

    // Sort candidates filaments by top ordinate
    Collections.sort(candidates, Filament.topComparator);

    final int iMax = candidates.size() - 1;

    for (SystemInfo system : sheet.getSystems()) {
        // Systems may be side by side, so restart from top
        int iMin = 0;

        for (Staff staff : system.getStaves()) {
            for (LineInfo line : staff.getLines()) {
                final StaffFilament filament = (StaffFilament) line;
                final Point2D startPt = filament.getStartPoint();
                final Point2D stopPt = filament.getStopPoint();
                final double minX = startPt.getX();
                final double maxX = stopPt.getX();
                final Rectangle lineBox = filament.getBounds();
                lineBox.grow(0, scale.getFore());

                final int minY = lineBox.y;
                final int maxY = lineBox.y + lineBox.height;
                boolean filamentModified = false;

                // Browse discarded filaments
                for (int i = iMin; i <= iMax; i++) {
                    Filament fil = candidates.get(i);

                    if (fil.getPartOf() != null) {
                        continue;
                    }

                    int firstPos = fil.getBounds().y;

                    if (firstPos < minY) {
                        iMin = i;

                        continue;
                    }

                    if (firstPos > maxY) {
                        break;
                    }

                    Point center = fil.getCentroid();

                    if ((center.x >= minX) && (center.x <= maxX)) {
                        if (canIncludeFilament(filament, fil)) {
                            filament.stealSections(fil);
                            filamentModified = true;
                        }
                    }
                }

                if (filamentModified) {
                    filament.setEndingPoints(startPt, stopPt); // Recompute line
                }
            }
        }
    }
}
 
Example 18
Source File: DiagramConnectionWidget.java    From openjdk-jdk8u with GNU General Public License v2.0 4 votes vote down vote up
@Override
protected Rectangle calculateClientArea() {
    Rectangle result = new Rectangle(clientArea);
    result.grow(10, 10);
    return result;
}
 
Example 19
Source File: SourceClippingBlitTest.java    From openjdk-jdk8u with GNU General Public License v2.0 4 votes vote down vote up
public void runTests() {
        GraphicsConfiguration gc = getGraphicsConfiguration();
        for (Image srcIm :
            new Image[] {
                getBufferedImage(gc, IMAGEW, IMAGEH,
                        BufferedImage.TYPE_INT_RGB, true),
                getBufferedImage(gc, IMAGEW, IMAGEH,
                        BufferedImage.TYPE_INT_RGB, false),
                // commented out due to 6593406
//                getBMImage(gc, IMAGEW, IMAGEH),
//                getBufferedImage(gc, IMAGEW, IMAGEH,
//                        BufferedImage.TYPE_INT_ARGB, true),
//                getBufferedImage(gc, IMAGEW, IMAGEH,
//                        BufferedImage.TYPE_INT_ARGB, false),
                getVImage(gc, IMAGEW, IMAGEH),
            })
        {
            System.out.println("Testing source: " + srcIm);
            // wiggle the source and dest rectangles
            try {
                for (int locationVar = -10; locationVar < 20; locationVar += 10)
                {
                    for (int sizeVar = -10; sizeVar < 20; sizeVar += 10) {
                        Rectangle srcRect = (Rectangle)IMAGE_BOUNDS.clone();
                        srcRect.translate(locationVar, locationVar);
                        srcRect.grow(sizeVar, sizeVar);

                        Rectangle dstRect =
                                new Rectangle(sizeVar, sizeVar,
                                srcRect.width, srcRect.height);
                        System.out.println("testing blit rect src: " + srcRect);
                        System.out.println("                  dst: " + dstRect);
                        render(getGraphics(), srcIm, srcRect, dstRect);
                        test(srcRect, dstRect);
                    }
                }
                System.out.println("Test passed.");
            } finally {
                synchronized (lock) {
                    done = true;
                    lock.notifyAll();
                }
            }
        }
    }
 
Example 20
Source File: InterController.java    From audiveris with GNU Affero General Public License v3.0 4 votes vote down vote up
private List<Inter> buildStaffBarlineClosure (StaffBarlineInter oneBar)
{
    final Rectangle oneBounds = oneBar.getBounds();
    final Staff staff = oneBar.getStaff();
    final SystemInfo system = staff.getSystem();

    // Include a staffBarline per system staff, properly positioned in abscissa
    final Skew skew = sheet.getSkew();
    final Point center = GeoUtil.centerOf(oneBounds);
    final double slope = skew.getSlope();
    final List<Inter> closure = new ArrayList<>();

    for (Staff st : system.getStaves()) {
        if (st == staff) {
            closure.add(oneBar);
        } else {
            double y1 = st.getFirstLine().yAt(center.getX());
            double y2 = st.getLastLine().yAt(center.getX());
            double y = (y1 + y2) / 2;
            double x = center.x - ((y - center.y) * slope);
            Rectangle box = new Rectangle((int) Math.rint(x), (int) Math.rint(y), 0, 0);
            box.grow(oneBounds.width / 2, oneBounds.height / 2);

            StaffBarlineInter g = new StaffBarlineInter(oneBar.getShape(), 1);
            g.setManual(true);
            g.setStaff(st);
            g.setBounds(box);
            closure.add(g);
        }
    }

    // Display closure staff barlines to user
    sheet.getInterIndex().getEntityService().publish(
            new EntityListEvent<>(
                    this,
                    SelectionHint.ENTITY_INIT,
                    MouseMovement.PRESSING,
                    closure));

    if (OMR.gui.displayConfirmation(
            "Do you confirm whole system-height addition?",
            "Insertion of " + closure.size() + " barline(s)")) {
        return closure;
    } else {
        return Collections.EMPTY_LIST;
    }
}