Java Code Examples for java.awt.Rectangle#union()
The following examples show how to use
java.awt.Rectangle#union() .
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: SystemPart.java From libreveris with GNU Lesser General Public License v3.0 | 6 votes |
@Override protected void computeBox () { // Use the union of staves boxes Rectangle newBox = null; for (TreeNode node : getStaves()) { Staff staff = (Staff) node; if (newBox == null) { newBox = staff.getBox(); } else { newBox = newBox.union(staff.getBox()); } } setBox(newBox); }
Example 2
Source File: PMAreasGroup.java From megamek with GNU General Public License v2.0 | 6 votes |
/** * Returns bounding box which includes all elements in group. */ public Rectangle getBounds() { Rectangle bounds = null; Enumeration<PMElement> iter = gr.elements(); while (iter.hasMoreElements()) { PMElement pme = iter.nextElement(); if ((pme != null) && (pme.getBounds() != null)) { if (bounds == null) { bounds = pme.getBounds(); } else { bounds = bounds.union(pme.getBounds()); } } } return bounds; }
Example 3
Source File: DiagramScene.java From TencentKona-8 with GNU General Public License v2.0 | 6 votes |
public void gotoFigures(final List<Figure> figures) { Rectangle overall = null; showFigures(figures); for (Figure f : figures) { FigureWidget fw = getFigureWidget(f); if (fw != null) { Rectangle r = fw.getBounds(); Point p = fw.getLocation(); Rectangle r2 = new Rectangle(p.x, p.y, r.width, r.height); if (overall == null) { overall = r2; } else { overall = overall.union(r2); } } } if (overall != null) { centerRectangle(overall); } }
Example 4
Source File: BasicGraphicsUtils.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
public static Dimension getPreferredButtonSize(AbstractButton b, int textIconGap) { if(b.getComponentCount() > 0) { return null; } Icon icon = b.getIcon(); String text = b.getText(); Font font = b.getFont(); FontMetrics fm = b.getFontMetrics(font); Rectangle iconR = new Rectangle(); Rectangle textR = new Rectangle(); Rectangle viewR = new Rectangle(Short.MAX_VALUE, Short.MAX_VALUE); SwingUtilities.layoutCompoundLabel( b, fm, text, icon, b.getVerticalAlignment(), b.getHorizontalAlignment(), b.getVerticalTextPosition(), b.getHorizontalTextPosition(), viewR, iconR, textR, (text == null ? 0 : textIconGap) ); /* The preferred size of the button is the size of * the text and icon rectangles plus the buttons insets. */ Rectangle r = iconR.union(textR); Insets insets = b.getInsets(); r.width += insets.left + insets.right; r.height += insets.top + insets.bottom; return r.getSize(); }
Example 5
Source File: BasicGraphicsUtils.java From Java8CN with Apache License 2.0 | 5 votes |
public static Dimension getPreferredButtonSize(AbstractButton b, int textIconGap) { if(b.getComponentCount() > 0) { return null; } Icon icon = b.getIcon(); String text = b.getText(); Font font = b.getFont(); FontMetrics fm = b.getFontMetrics(font); Rectangle iconR = new Rectangle(); Rectangle textR = new Rectangle(); Rectangle viewR = new Rectangle(Short.MAX_VALUE, Short.MAX_VALUE); SwingUtilities.layoutCompoundLabel( b, fm, text, icon, b.getVerticalAlignment(), b.getHorizontalAlignment(), b.getVerticalTextPosition(), b.getHorizontalTextPosition(), viewR, iconR, textR, (text == null ? 0 : textIconGap) ); /* The preferred size of the button is the size of * the text and icon rectangles plus the buttons insets. */ Rectangle r = iconR.union(textR); Insets insets = b.getInsets(); r.width += insets.left + insets.right; r.height += insets.top + insets.bottom; return r.getSize(); }
Example 6
Source File: BasicGraphicsUtils.java From hottub with GNU General Public License v2.0 | 5 votes |
public static Dimension getPreferredButtonSize(AbstractButton b, int textIconGap) { if(b.getComponentCount() > 0) { return null; } Icon icon = b.getIcon(); String text = b.getText(); Font font = b.getFont(); FontMetrics fm = b.getFontMetrics(font); Rectangle iconR = new Rectangle(); Rectangle textR = new Rectangle(); Rectangle viewR = new Rectangle(Short.MAX_VALUE, Short.MAX_VALUE); SwingUtilities.layoutCompoundLabel( b, fm, text, icon, b.getVerticalAlignment(), b.getHorizontalAlignment(), b.getVerticalTextPosition(), b.getHorizontalTextPosition(), viewR, iconR, textR, (text == null ? 0 : textIconGap) ); /* The preferred size of the button is the size of * the text and icon rectangles plus the buttons insets. */ Rectangle r = iconR.union(textR); Insets insets = b.getInsets(); r.width += insets.left + insets.right; r.height += insets.top + insets.bottom; return r.getSize(); }
Example 7
Source File: EditorCaret.java From netbeans with Apache License 2.0 | 5 votes |
private void updateRectangularSelectionPaintRect() { // Repaint current rect JTextComponent c = component; Rectangle repaintRect = rsPaintRect; if (rsDotRect == null || rsMarkRect == null) { return; } Rectangle newRect = new Rectangle(); if (rsDotRect.x < rsMarkRect.x) { // Swap selection to left newRect.x = rsDotRect.x; // -1 to make the visual selection non-empty newRect.width = rsMarkRect.x - newRect.x; } else { // Extend or shrink on right newRect.x = rsMarkRect.x; newRect.width = rsDotRect.x - newRect.x; } if (rsDotRect.y < rsMarkRect.y) { newRect.y = rsDotRect.y; newRect.height = (rsMarkRect.y + rsMarkRect.height) - newRect.y; } else { newRect.y = rsMarkRect.y; newRect.height = (rsDotRect.y + rsDotRect.height) - newRect.y; } if (newRect.width < 2) { newRect.width = 2; } rsPaintRect = newRect; // Repaint merged region with original rect if (repaintRect == null) { repaintRect = rsPaintRect; } else { repaintRect = repaintRect.union(rsPaintRect); } c.repaint(repaintRect); updateRectangularSelectionPositionBlocks(); }
Example 8
Source File: BasicGraphicsUtils.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
public static Dimension getPreferredButtonSize(AbstractButton b, int textIconGap) { if(b.getComponentCount() > 0) { return null; } Icon icon = b.getIcon(); String text = b.getText(); Font font = b.getFont(); FontMetrics fm = b.getFontMetrics(font); Rectangle iconR = new Rectangle(); Rectangle textR = new Rectangle(); Rectangle viewR = new Rectangle(Short.MAX_VALUE, Short.MAX_VALUE); SwingUtilities.layoutCompoundLabel( b, fm, text, icon, b.getVerticalAlignment(), b.getHorizontalAlignment(), b.getVerticalTextPosition(), b.getHorizontalTextPosition(), viewR, iconR, textR, (text == null ? 0 : textIconGap) ); /* The preferred size of the button is the size of * the text and icon rectangles plus the buttons insets. */ Rectangle r = iconR.union(textR); Insets insets = b.getInsets(); r.width += insets.left + insets.right; r.height += insets.top + insets.bottom; return r.getSize(); }
Example 9
Source File: BasicGraphicsUtils.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
public static Dimension getPreferredButtonSize(AbstractButton b, int textIconGap) { if(b.getComponentCount() > 0) { return null; } Icon icon = b.getIcon(); String text = b.getText(); Font font = b.getFont(); FontMetrics fm = b.getFontMetrics(font); Rectangle iconR = new Rectangle(); Rectangle textR = new Rectangle(); Rectangle viewR = new Rectangle(Short.MAX_VALUE, Short.MAX_VALUE); SwingUtilities.layoutCompoundLabel( b, fm, text, icon, b.getVerticalAlignment(), b.getHorizontalAlignment(), b.getVerticalTextPosition(), b.getHorizontalTextPosition(), viewR, iconR, textR, (text == null ? 0 : textIconGap) ); /* The preferred size of the button is the size of * the text and icon rectangles plus the buttons insets. */ Rectangle r = iconR.union(textR); Insets insets = b.getInsets(); r.width += insets.left + insets.right; r.height += insets.top + insets.bottom; return r.getSize(); }
Example 10
Source File: BarFilamentFactory.java From audiveris with GNU Affero General Public License v3.0 | 5 votes |
private boolean canMerge (Filament fil, Rectangle core, Section section) { // A section must always touch one of fil current member sections if (!fil.touches(section)) { return false; } // If this does not increase thickness beyond core, it's OK Rectangle oSct = VERTICAL.oriented(section.getBounds()); return core.union(oSct).height <= core.height; }
Example 11
Source File: BBoxSelectionPainter.java From importer-exporter with Apache License 2.0 | 5 votes |
private Rectangle createDrawArea(Rectangle2D geo, int zoom) { Point2D southWest = map.convertGeoPositionToPoint(new GeoPosition(geo.getMinX(), geo.getMinY()), zoom); Point2D northEast = map.convertGeoPositionToPoint(new GeoPosition(geo.getMaxX(), geo.getMaxY()), zoom); Rectangle drawArea = new Rectangle((int)southWest.getX(), (int)southWest.getY(), 0, 0); return drawArea.union(new Rectangle((int)northEast.getX(), (int)northEast.getY(), 0, 0)); }
Example 12
Source File: WindowsTextUI.java From jdk8u-jdk with GNU General Public License v2.0 | 4 votes |
/** * Paints a highlight. * * @param g the graphics context * @param offs0 the starting model offset >= 0 * @param offs1 the ending model offset >= offs1 * @param bounds the bounding box for the highlight * @param c the editor */ public void paint(Graphics g, int offs0, int offs1, Shape bounds, JTextComponent c) { Rectangle alloc = bounds.getBounds(); try { // --- determine locations --- TextUI mapper = c.getUI(); Rectangle p0 = mapper.modelToView(c, offs0); Rectangle p1 = mapper.modelToView(c, offs1); // --- render --- Color color = getColor(); if (color == null) { g.setColor(c.getSelectionColor()); } else { g.setColor(color); } boolean firstIsDot = false; boolean secondIsDot = false; if (c.isEditable()) { int dot = c.getCaretPosition(); firstIsDot = (offs0 == dot); secondIsDot = (offs1 == dot); } if (p0.y == p1.y) { // same line, render a rectangle Rectangle r = p0.union(p1); if (r.width > 0) { if (firstIsDot) { r.x++; r.width--; } else if (secondIsDot) { r.width--; } } g.fillRect(r.x, r.y, r.width, r.height); } else { // different lines int p0ToMarginWidth = alloc.x + alloc.width - p0.x; if (firstIsDot && p0ToMarginWidth > 0) { p0.x++; p0ToMarginWidth--; } g.fillRect(p0.x, p0.y, p0ToMarginWidth, p0.height); if ((p0.y + p0.height) != p1.y) { g.fillRect(alloc.x, p0.y + p0.height, alloc.width, p1.y - (p0.y + p0.height)); } if (secondIsDot && p1.x > alloc.x) { p1.x--; } g.fillRect(alloc.x, p1.y, (p1.x - alloc.x), p1.height); } } catch (BadLocationException e) { // can't render } }
Example 13
Source File: mxVmlCanvas.java From blog-codes with Apache License 2.0 | 4 votes |
/** * Draws the given lines as segments between all points of the given list * of mxPoints. * * @param pts List of points that define the line. * @param style Style to be used for painting the line. */ public Element drawLine(List<mxPoint> pts, Map<String, Object> style) { String strokeColor = mxUtils.getString(style, mxConstants.STYLE_STROKECOLOR); float strokeWidth = (float) (mxUtils.getFloat(style, mxConstants.STYLE_STROKEWIDTH, 1) * scale); Element elem = document.createElement("v:shape"); if (strokeColor != null && strokeWidth > 0) { mxPoint pt = pts.get(0); Rectangle r = new Rectangle(pt.getPoint()); StringBuilder buf = new StringBuilder("m " + Math.round(pt.getX()) + " " + Math.round(pt.getY())); for (int i = 1; i < pts.size(); i++) { pt = pts.get(i); buf.append(" l " + Math.round(pt.getX()) + " " + Math.round(pt.getY())); r = r.union(new Rectangle(pt.getPoint())); } String d = buf.toString(); elem.setAttribute("path", d); elem.setAttribute("filled", "false"); elem.setAttribute("strokecolor", strokeColor); elem.setAttribute("strokeweight", String.valueOf(strokeWidth) + "px"); String s = "position:absolute;" + "left:" + String.valueOf(r.x) + "px;" + "top:" + String.valueOf(r.y) + "px;" + "width:" + String.valueOf(r.width) + "px;" + "height:" + String.valueOf(r.height) + "px;"; elem.setAttribute("style", s); elem.setAttribute("coordorigin", String.valueOf(r.x) + " " + String.valueOf(r.y)); elem.setAttribute("coordsize", String.valueOf(r.width) + " " + String.valueOf(r.height)); } appendVmlElement(elem); return elem; }
Example 14
Source File: MilStdSymbol.java From mil-sym-java with Apache License 2.0 | 4 votes |
/** * * @return a rectangle of the extent (pixels) of the symbol (not including * modifiers) and null if the shape collections wasn't created. TODO: only * works for single points. need to update for multipoints */ public Rectangle getSymbolExtent() { Rectangle bounds = null; Rectangle temp = null; if (_SymbolShapes != null && _SymbolShapes.size() > 0) { if (SymbolUtilities.isWarfighting(_symbolID)) { for (int i = 0; i < _SymbolShapes.size(); i++) { if (_SymbolShapes.get(i).getShapeType() == ShapeInfo.SHAPE_TYPE_UNIT_FILL || _SymbolShapes.get(i).getShapeType() == ShapeInfo.SHAPE_TYPE_UNIT_FRAME || _SymbolShapes.get(i).getShapeType() == ShapeInfo.SHAPE_TYPE_UNIT_OUTLINE) { if (bounds == null) { bounds = _SymbolShapes.get(i).getBounds(); } else { temp = _SymbolShapes.get(i).getBounds(); bounds = bounds.union(temp); } } } if (bounds == null) { for (int i = 0; i < _SymbolShapes.size(); i++) { if (_SymbolShapes.get(i).getShapeType() == ShapeInfo.SHAPE_TYPE_UNIT_SYMBOL1 || _SymbolShapes.get(i).getShapeType() == ShapeInfo.SHAPE_TYPE_UNIT_SYMBOL2) { if (bounds == null) { bounds = _SymbolShapes.get(i).getBounds(); } else { bounds = bounds.union(_SymbolShapes.get(i).getBounds()); } } } } } else if (SymbolUtilities.isTacticalGraphic(_symbolID)) { //bounds = _SymbolShapes.get(0).getBounds(); for (int i = 0; i < _SymbolShapes.size(); i++) { if (_SymbolShapes.get(i).getShapeType() == ShapeInfo.SHAPE_TYPE_TG_SP_FRAME || _SymbolShapes.get(i).getShapeType() == ShapeInfo.SHAPE_TYPE_TG_SP_FILL || _SymbolShapes.get(i).getShapeType() == ShapeInfo.SHAPE_TYPE_TG_SP_OUTLINE) { if (bounds == null) { bounds = _SymbolShapes.get(i).getBounds(); } else { temp = _SymbolShapes.get(i).getBounds(); bounds = bounds.union(temp); } } } } else { bounds = _SymbolShapes.get(0).getBounds(); } } return bounds; }
Example 15
Source File: WindowsTextUI.java From jdk8u60 with GNU General Public License v2.0 | 4 votes |
/** * Paints a highlight. * * @param g the graphics context * @param offs0 the starting model offset >= 0 * @param offs1 the ending model offset >= offs1 * @param bounds the bounding box for the highlight * @param c the editor */ public void paint(Graphics g, int offs0, int offs1, Shape bounds, JTextComponent c) { Rectangle alloc = bounds.getBounds(); try { // --- determine locations --- TextUI mapper = c.getUI(); Rectangle p0 = mapper.modelToView(c, offs0); Rectangle p1 = mapper.modelToView(c, offs1); // --- render --- Color color = getColor(); if (color == null) { g.setColor(c.getSelectionColor()); } else { g.setColor(color); } boolean firstIsDot = false; boolean secondIsDot = false; if (c.isEditable()) { int dot = c.getCaretPosition(); firstIsDot = (offs0 == dot); secondIsDot = (offs1 == dot); } if (p0.y == p1.y) { // same line, render a rectangle Rectangle r = p0.union(p1); if (r.width > 0) { if (firstIsDot) { r.x++; r.width--; } else if (secondIsDot) { r.width--; } } g.fillRect(r.x, r.y, r.width, r.height); } else { // different lines int p0ToMarginWidth = alloc.x + alloc.width - p0.x; if (firstIsDot && p0ToMarginWidth > 0) { p0.x++; p0ToMarginWidth--; } g.fillRect(p0.x, p0.y, p0ToMarginWidth, p0.height); if ((p0.y + p0.height) != p1.y) { g.fillRect(alloc.x, p0.y + p0.height, alloc.width, p1.y - (p0.y + p0.height)); } if (secondIsDot && p1.x > alloc.x) { p1.x--; } g.fillRect(alloc.x, p1.y, (p1.x - alloc.x), p1.height); } } catch (BadLocationException e) { // can't render } }
Example 16
Source File: WindowsTextUI.java From openjdk-8-source with GNU General Public License v2.0 | 4 votes |
/** * Paints a highlight. * * @param g the graphics context * @param offs0 the starting model offset >= 0 * @param offs1 the ending model offset >= offs1 * @param bounds the bounding box for the highlight * @param c the editor */ public void paint(Graphics g, int offs0, int offs1, Shape bounds, JTextComponent c) { Rectangle alloc = bounds.getBounds(); try { // --- determine locations --- TextUI mapper = c.getUI(); Rectangle p0 = mapper.modelToView(c, offs0); Rectangle p1 = mapper.modelToView(c, offs1); // --- render --- Color color = getColor(); if (color == null) { g.setColor(c.getSelectionColor()); } else { g.setColor(color); } boolean firstIsDot = false; boolean secondIsDot = false; if (c.isEditable()) { int dot = c.getCaretPosition(); firstIsDot = (offs0 == dot); secondIsDot = (offs1 == dot); } if (p0.y == p1.y) { // same line, render a rectangle Rectangle r = p0.union(p1); if (r.width > 0) { if (firstIsDot) { r.x++; r.width--; } else if (secondIsDot) { r.width--; } } g.fillRect(r.x, r.y, r.width, r.height); } else { // different lines int p0ToMarginWidth = alloc.x + alloc.width - p0.x; if (firstIsDot && p0ToMarginWidth > 0) { p0.x++; p0ToMarginWidth--; } g.fillRect(p0.x, p0.y, p0ToMarginWidth, p0.height); if ((p0.y + p0.height) != p1.y) { g.fillRect(alloc.x, p0.y + p0.height, alloc.width, p1.y - (p0.y + p0.height)); } if (secondIsDot && p1.x > alloc.x) { p1.x--; } g.fillRect(alloc.x, p1.y, (p1.x - alloc.x), p1.height); } } catch (BadLocationException e) { // can't render } }
Example 17
Source File: WindowsTextUI.java From TencentKona-8 with GNU General Public License v2.0 | 4 votes |
/** * Paints a highlight. * * @param g the graphics context * @param offs0 the starting model offset >= 0 * @param offs1 the ending model offset >= offs1 * @param bounds the bounding box for the highlight * @param c the editor */ public void paint(Graphics g, int offs0, int offs1, Shape bounds, JTextComponent c) { Rectangle alloc = bounds.getBounds(); try { // --- determine locations --- TextUI mapper = c.getUI(); Rectangle p0 = mapper.modelToView(c, offs0); Rectangle p1 = mapper.modelToView(c, offs1); // --- render --- Color color = getColor(); if (color == null) { g.setColor(c.getSelectionColor()); } else { g.setColor(color); } boolean firstIsDot = false; boolean secondIsDot = false; if (c.isEditable()) { int dot = c.getCaretPosition(); firstIsDot = (offs0 == dot); secondIsDot = (offs1 == dot); } if (p0.y == p1.y) { // same line, render a rectangle Rectangle r = p0.union(p1); if (r.width > 0) { if (firstIsDot) { r.x++; r.width--; } else if (secondIsDot) { r.width--; } } g.fillRect(r.x, r.y, r.width, r.height); } else { // different lines int p0ToMarginWidth = alloc.x + alloc.width - p0.x; if (firstIsDot && p0ToMarginWidth > 0) { p0.x++; p0ToMarginWidth--; } g.fillRect(p0.x, p0.y, p0ToMarginWidth, p0.height); if ((p0.y + p0.height) != p1.y) { g.fillRect(alloc.x, p0.y + p0.height, alloc.width, p1.y - (p0.y + p0.height)); } if (secondIsDot && p1.x > alloc.x) { p1.x--; } g.fillRect(alloc.x, p1.y, (p1.x - alloc.x), p1.height); } } catch (BadLocationException e) { // can't render } }
Example 18
Source File: FlatMenuItemRenderer.java From FlatLaf with Apache License 2.0 | 4 votes |
protected Dimension getPreferredMenuItemSize() { int width = 0; int height = 0; boolean isTopLevelMenu = isTopLevelMenu( menuItem ); Rectangle viewRect = new Rectangle( 0, 0, Integer.MAX_VALUE, Integer.MAX_VALUE ); Rectangle iconRect = new Rectangle(); Rectangle textRect = new Rectangle(); // layout icon and text SwingUtilities.layoutCompoundLabel( menuItem, menuItem.getFontMetrics( menuItem.getFont() ), menuItem.getText(), getIconForLayout(), menuItem.getVerticalAlignment(), menuItem.getHorizontalAlignment(), menuItem.getVerticalTextPosition(), menuItem.getHorizontalTextPosition(), viewRect, iconRect, textRect, scale( menuItem.getIconTextGap() ) ); // union icon and text rectangles Rectangle labelRect = iconRect.union( textRect ); width += labelRect.width; height = Math.max( labelRect.height, height ); // accelerator size String accelText = getAcceleratorText(); if( accelText != null ) { // gap between text and accelerator width += scale( !isTopLevelMenu ? textAcceleratorGap : menuItem.getIconTextGap() ); FontMetrics accelFm = menuItem.getFontMetrics( acceleratorFont ); width += SwingUtilities.computeStringWidth( accelFm, accelText ); height = Math.max( accelFm.getHeight(), height ); } // arrow size if( !isTopLevelMenu && arrowIcon != null ) { // gap between text and arrow if( accelText == null ) width += scale( textNoAcceleratorGap ); // gap between accelerator and arrow width += scale( acceleratorArrowGap ); width += arrowIcon.getIconWidth(); height = Math.max( arrowIcon.getIconHeight(), height ); } // add insets Insets insets = menuItem.getInsets(); width += insets.left + insets.right; height += insets.top + insets.bottom; // minimum width if( !isTopLevelMenu ) { int minimumWidth = FlatUIUtils.minimumWidth( menuItem, this.minimumWidth ); width = Math.max( width, scale( minimumWidth ) ); } return new Dimension( width, height ); }
Example 19
Source File: AnnotationsBuilder.java From audiveris with GNU Affero General Public License v3.0 | 4 votes |
/** * (Try to) generate the symbol for the provided inter. * * @param inter the provided inter */ private void exportInter (Inter inter) { final Class interClass = inter.getClass(); // Excluded class? if (isExcluded(interClass)) { logger.debug("{} class is excluded.", inter); return; } Shape interShape = inter.getShape(); Rectangle interBounds = inter.getBounds(); Staff staff = inter.getStaff(); OmrShape omrShape; // Specific classes if (inter instanceof TimePairInter) { exportTimePair((TimePairInter) inter); return; } else if (inter instanceof BarlineInter) { exportBarlineGroup((BarlineInter) inter); return; } else if (inter instanceof KeyAlterInter) { omrShape = getOmrShape((KeyAlterInter) inter); } else if (inter instanceof ArticulationInter) { omrShape = getOmrShape((ArticulationInter) inter); } else { omrShape = OmrShapeMapping.SHAPE_TO_OMRSHAPE.get(interShape); if (omrShape == null) { logger.info("{} shape is not mapped.", inter); return; } if (inter instanceof LedgerInter) { // Make sure we have no note head centered on this ledger if (ledgerHasHead((LedgerInter) inter)) { return; } } else if (inter instanceof BarlineInter) { // Substitute a barlineDouble when relevant BarlineInter sibling = ((BarlineInter) inter).getSibling(); if (sibling != null) { if (inter.getCenter().x < sibling.getCenter().x) { omrShape = OmrShape.barlineDouble; interBounds = interBounds.union(sibling.getBounds()); } else { return; } } } } if (staff == null) { if (inter instanceof BraceInter) { // Simply pick up the first staff embraced by this brace staff = ((BraceInter) inter).getFirstStaff(); } else if (inter instanceof StemInter) { // Use staff of first head found staff = getStemStaff((StemInter) inter); } else if (inter instanceof PedalInter) { // Use bottom staff of related chord if any staff = getPedalStaff((PedalInter) inter); } } if (omrShape == null) { logger.warn("{} has no OmrShape, ignored.", inter); return; } if (staff == null) { logger.info("{} has no related staff, ignored.", inter); return; } final int interline = staff.getSpecificInterline(); annotations.addSymbol(new SymbolInfo(omrShape, interline, inter.getId(), null, interBounds)); }
Example 20
Source File: CompletionLayoutPopup.java From netbeans with Apache License 2.0 | 4 votes |
public Rectangle unionBounds(Rectangle bounds) { return isVisible() ? bounds.union(getPopupBounds()) : bounds; }