当前位置: 首页>>代码示例>>Java>>正文


Java Area.getBounds方法代码示例

本文整理汇总了Java中java.awt.geom.Area.getBounds方法的典型用法代码示例。如果您正苦于以下问题:Java Area.getBounds方法的具体用法?Java Area.getBounds怎么用?Java Area.getBounds使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在java.awt.geom.Area的用法示例。


在下文中一共展示了Area.getBounds方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getAreaSections

import java.awt.geom.Area; //导入方法依赖的package包/类
private List<Section> getAreaSections (Area area,
                                       List<Section> allSections)
{
    final Rectangle areaBox = area.getBounds();
    final int xBreak = areaBox.x + areaBox.width;
    final List<Section> sections = new ArrayList<Section>();

    for (Section section : allSections) {
        final Rectangle sectionBox = section.getBounds();

        if (area.contains(sectionBox)) {
            sections.add(section);
        } else if (sectionBox.x >= xBreak) {
            break; // Since allSections are sorted by abscissa
        }
    }

    return sections;
}
 
开发者ID:Audiveris,项目名称:audiveris,代码行数:20,代码来源:BarsRetriever.java

示例2: maskedMergeOnto

import java.awt.geom.Area; //导入方法依赖的package包/类
/**
 * Like mergeOnto, but will only copy the area specified.
 *
 * @see TileLayer#mergeOnto(MapLayer)
 * @param other
 * @param mask
 */
@Override
public void maskedMergeOnto(MapLayer other, Area mask) {
    Rectangle boundBox = mask.getBounds();

    for (int y = boundBox.y; y < boundBox.y + boundBox.height; y++) {
        for (int x = boundBox.x; x < boundBox.x + boundBox.width; x++) {
            Tile tile = ((TileLayer) other).getTileAt(x, y);
            if (mask.contains(x, y) && tile != null) {
                setTileAt(x, y, tile);
            }
        }
    }
}
 
开发者ID:Pheelbert,项目名称:chatterino,代码行数:21,代码来源:TileLayer.java

示例3: maskedCopyFrom

import java.awt.geom.Area; //导入方法依赖的package包/类
/**
 * Like copyFrom, but will only copy the area specified.
 *
 * @see TileLayer#copyFrom(MapLayer)
 * @param other
 * @param mask
 */
@Override
public void maskedCopyFrom(MapLayer other, Area mask) {
    Rectangle boundBox = mask.getBounds();

    for (int y = boundBox.y; y < boundBox.y + boundBox.height; y++) {
        for (int x = boundBox.x; x < boundBox.x + boundBox.width; x++) {
            if (mask.contains(x,y)) {
                setTileAt(x, y, ((TileLayer) other).getTileAt(x, y));
            }
        }
    }
}
 
开发者ID:Pheelbert,项目名称:chatterino,代码行数:20,代码来源:TileLayer.java

示例4: findReachableArcs

import java.awt.geom.Area; //导入方法依赖的package包/类
/**
 * Retrieve all arcs within reach from curve end (over some white gap)
 *
 * @param ext extension (on 'reverse' side)
 * @return the set of (new) reachable arcs
 */
private Set<ArcView> findReachableArcs (Extension ext)
{
    final Set<ArcView> reachableArcs = new LinkedHashSet<ArcView>();
    final Area area = defineExtArea(ext.curve);

    if (area != null) {
        // Check for reachable arcs in the extension area
        final Rectangle box = area.getBounds();
        final int xMax = (box.x + box.width) - 1;

        // Look for free-standing end points (with no junction point)
        for (Point end : skeleton.arcsEnds) {
            if (area.contains(end)) {
                final Arc arc = skeleton.arcsMap.get(end);

                if (!arc.isAssigned() && !ext.browsed.contains(arc)) {
                    // Check for lack of junction point
                    ArcView arcView = ext.curve.getArcView(arc, reverse);
                    Point pivot = arcView.getJunction(!reverse);

                    if (pivot == null) {
                        reachableArcs.add(arcView);
                        ext.browsed.add(arc);
                    }
                }
            } else if (end.x > xMax) {
                break; // Since list arcsEnds is sorted
            }
        }
    }

    return reachableArcs;
}
 
开发者ID:Audiveris,项目名称:audiveris,代码行数:40,代码来源:CurvesBuilder.java

示例5: Mask

import java.awt.geom.Area; //导入方法依赖的package包/类
/**
 * Creates a new Mask object.
 *
 * @param area definition of the relevant area
 */
public Mask (Area area)
{
    this.area = area;

    rect = area.getBounds();
    bitmap = computeRelevantPoints(area);
}
 
开发者ID:Audiveris,项目名称:audiveris,代码行数:13,代码来源:Mask.java

示例6: determineBoundsInternal

import java.awt.geom.Area; //导入方法依赖的package包/类
private Rectangle determineBoundsInternal() {
    if ( arrow1 != null && arrowsEnabled ) {
        Area a = new Area( arrow1.getShape() );
        a.add( new Area( arrow2.getShape() ) );
        a.add( new Area( energyLevelShape ) );
        return a.getBounds();
    }
    else {
        return energyLevelShape.getBounds();
    }
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:12,代码来源:EnergyLevelGraphic.java

示例7: provideDrawArea

import java.awt.geom.Area; //导入方法依赖的package包/类
/**
 * Provide an drawing area on the given Graphics for the given VisualizationMethod (only
 * when {@link VisualizationMethod#isUseProvidedArea()})
 * @param m the VisualizationMethod to provide the area for
 * @param g the Graphics on which the area is created
 * @return A {@link Shape} object that contains the area in which the
 * VisualizationPlugin can draw its visualization
 */
public Area provideDrawArea(VisualizationMethod m, Graphics g) {
	if(!m.isUseProvidedArea())
		throw new IllegalArgumentException("useProvidedArea set to false for this plug-in");

	//Determine number of active plugins that to reserve a region
	int nrRes = 0;
	int index = 0;
	for(VisualizationMethod vm : getMethods()) {
		nrRes += (vm.isUseProvidedArea()) ? 1 : 0;
	}
	Area area = g.createVisualizationRegion();
	//Distribute space over plugins
	Rectangle bounds = area.getBounds();

	if(nrRes == 0) {
		return area;
	}

	//Adjust width so we can divide into equal rectangles
	bounds.width += bounds.width % nrRes;
	int w = bounds.width / nrRes;
	bounds.x += w * index;
	bounds.width = w;
	bounds.height -= 1;

	Area barea = new Area(bounds);
	area.intersect(barea);

	return area;
}
 
开发者ID:PathVisio,项目名称:pathvisio,代码行数:39,代码来源:Visualization.java

示例8: createBubbleImage

import java.awt.geom.Area; //导入方法依赖的package包/类
private void createBubbleImage() {

    final BufferedImage img = ImageProcessing.getCompatibleImage(500, 500);
    final Graphics2D g = img.createGraphics();
    g.setFont(this.font);
    final int stringWidth = g.getFontMetrics().stringWidth(this.currentText);
    if (stringWidth < this.textBoxWidth) {
      this.textBoxWidth = stringWidth;
    }

    final FontRenderContext frc = g.getFontRenderContext();
    final AttributedString styledText = new AttributedString(this.currentText);
    styledText.addAttribute(TextAttribute.FONT, this.font);
    final AttributedCharacterIterator iterator = styledText.getIterator();
    final LineBreakMeasurer measurer = new LineBreakMeasurer(iterator, frc);
    measurer.setPosition(0);
    float y = 0;
    while (measurer.getPosition() < this.currentText.length()) {
      final TextLayout layout = measurer.nextLayout(this.textBoxWidth);
      y += layout.getAscent() + layout.getLeading() + 0.2;
    }

    final RoundRectangle2D bounds = new RoundRectangle2D.Double(0, 0, this.textBoxWidth + 2 * PADDING, y + 2 * PADDING, PADDING, PADDING);

    // Build a path
    final GeneralPath path = new GeneralPath();
    path.moveTo(bounds.getWidth() / 2.0 - TRIANGLE_SIZE / 2.0, bounds.getHeight());
    path.lineTo(bounds.getWidth() / 2.0, bounds.getHeight() + TRIANGLE_SIZE);
    path.lineTo(bounds.getWidth() / 2.0 + TRIANGLE_SIZE / 2.0, bounds.getHeight());
    path.closePath();

    final Area ar = new Area(bounds);
    ar.add(new Area(path));

    int width = ar.getBounds().width;
    this.height = ar.getBounds().height;
    g.setColor(SPEAK_BACKGROUNDCOLOR);
    g.fill(ar);

    g.setColor(SPEAK_BORDERCOLOR);
    g.draw(ar);
    g.dispose();

    this.bubble = ImageProcessing.crop(img, ImageProcessing.CROP_ALIGN_LEFT, ImageProcessing.CROP_VALIGN_TOP, width + 1, this.height + 1);
  }
 
开发者ID:gurkenlabs,项目名称:litiengine,代码行数:46,代码来源:SpeechBubble.java

示例9: detect

import java.awt.geom.Area; //导入方法依赖的package包/类
private void detect (SystemInfo aboveSystem,
                     SystemInfo belowSystem)
{
    // Gutter area
    final Area gutter = new Area(aboveSystem.getArea());
    gutter.intersect(belowSystem.getArea());

    final Rectangle gutterBounds = gutter.getBounds();

    // Build lists of candidates for above and for below
    Predicate<Inter> predicate = new Predicate<Inter>()
    {
        @Override
        public boolean check (Inter inter)
        {
            if (inter instanceof SentenceInter) {
                return false;
            }

            final Point center = inter.getCenter();

            return gutterBounds.contains(center) && gutter.contains(center);
        }
    };

    List<Inter> aboveInters = aboveSystem.getSig().inters(predicate);

    if (aboveInters.isEmpty()) {
        return;
    }

    List<Inter> belowInters = belowSystem.getSig().inters(predicate);

    if (belowInters.isEmpty()) {
        return;
    }

    // Cross exclusions
    logger.debug(
            "Cross detection between {}: {} inters and {}: {} inters",
            aboveSystem,
            aboveInters.size(),
            belowSystem,
            belowInters.size());
    detectCrossOverlaps(aboveInters, belowInters);
}
 
开发者ID:Audiveris,项目名称:audiveris,代码行数:47,代码来源:CrossDetector.java

示例10: intersectedInters

import java.awt.geom.Area; //导入方法依赖的package包/类
/**
 * Lookup the provided list of interpretations for those whose related glyph
 * intersect the given area.
 *
 * @param inters the list of interpretations to search for
 * @param order  if the list is already sorted by some order, this may speedup the search
 * @param area   the intersecting area
 * @return the intersected interpretations found
 */
public static List<Inter> intersectedInters (List<Inter> inters,
                                             GeoOrder order,
                                             Area area)
{
    List<Inter> found = new ArrayList<Inter>();
    Rectangle bounds = area.getBounds();
    double xMax = bounds.getMaxX();
    double yMax = bounds.getMaxY();

    for (Inter inter : inters) {
        if (inter.isDeleted()) {
            continue;
        }

        Rectangle iBox = inter.getBounds();

        if (area.intersects(iBox)) {
            found.add(inter);
        } else {
            switch (order) {
            case BY_ABSCISSA:

                if (iBox.x > xMax) {
                    return found;
                }

                break;

            case BY_ORDINATE:

                if (iBox.y > yMax) {
                    return found;
                }

                break;

            case NONE:
            }
        }
    }

    return found;
}
 
开发者ID:Audiveris,项目名称:audiveris,代码行数:53,代码来源:SIGraph.java

示例11: retrieveLines

import java.awt.geom.Area; //导入方法依赖的package包/类
/**
 * Retrieve the system-relevant lines, among all the lines OCR'ed at sheet level.
 *
 * @param buffer     the pixel buffer
 * @param sheetLines the sheet raw OCR lines
 */
public void retrieveLines (ByteProcessor buffer,
                           List<TextLine> sheetLines)
{
    StopWatch watch = new StopWatch("Texts retrieveLines system#" + system.getId());
    watch.start("Pickup system lines");

    List<TextLine> systemLines = new ArrayList<TextLine>();

    // We pick up the words that are contained by system area
    // Beware: a text located between two systems must be deep copied to each system!
    final Area area = system.getArea();
    final Rectangle areaBounds = area.getBounds();

    for (TextLine sheetLine : sheetLines) {
        if (areaBounds.intersects(sheetLine.getBounds())) {
            TextLine line = new TextLine();

            for (TextWord sheetWord : sheetLine.getWords()) {
                final Rectangle wordBox = sheetWord.getBounds();

                if (area.contains(wordBox)) {
                    TextWord word = sheetWord.copy();
                    line.appendWord(word);
                }
            }

            if (!line.getWords().isEmpty()) {
                systemLines.add(line);
            }
        }
    }

    Collections.sort(systemLines, TextLine.byOrdinate(skew));

    watch.start("recomposeLines");
    systemLines = recomposeLines(systemLines);

    // Retrieve candidate sections and map words to glyphs
    watch.start("getSections");

    // Brand new sections (not the horizontal or vertical sheet sections)
    List<Section> allSections = getSections(buffer, systemLines);
    watch.start("mapGlyphs");
    mapGlyphs(systemLines, allSections, sheet.getStub().getLanguageParam().getActual());

    // Allocate corresponding inters based on role (Sentences or LyricLines of LyricItems)
    watch.start("createInters");
    createInters();

    watch.start("numberLyricLines()");
    numberLyricLines();

    if (constants.printWatch.isSet()) {
        watch.print();
    }

    if (logger.isDebugEnabled()) {
        dump("Retrieved lines", systemLines);
    }
}
 
开发者ID:Audiveris,项目名称:audiveris,代码行数:67,代码来源:TextBuilder.java

示例12: AreaMask

import java.awt.geom.Area; //导入方法依赖的package包/类
/**
 * Creates a new AreaMask object.
 *
 * @param area the defining absolute area
 */
public AreaMask (Area area)
{
    this.area = area;
    rect = area.getBounds();
}
 
开发者ID:Audiveris,项目名称:audiveris,代码行数:11,代码来源:AreaMask.java

示例13: getBounds

import java.awt.geom.Area; //导入方法依赖的package包/类
public Rectangle getBounds() {
    Area totalArea = getArea();
    return totalArea.getBounds();
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:5,代码来源:Capacitor3DShapeSet.java

示例14: paintSelectedArrow

import java.awt.geom.Area; //导入方法依赖的package包/类
protected void paintSelectedArrow(Graphics2D g, int labelLeft, int labelRight, int labelTop, int labelBottom) {
	
	if(toRange != null && toRange.first != null) {

		Area area = files.getAreaForTokenRange(toRange);
		if(area != null) {
			Rectangle tokens = area.getBounds();

			g.setColor(relationship.getColor(true));

			// Outline the tokens
			files.outline(g, toRange);
		
			// Get the boundaries of the selection.
			int tokenLeft = (int)tokens.getMinX();
			int tokenRight = (int) tokens.getMaxX();
			int tokenTop = (int) tokens.getMinY();
			int tokenBottom = (int) tokens.getMaxY();
			
			int labelX = tokenRight < (labelLeft + labelRight) / 2  ? labelLeft : labelRight;
			int labelY = labelBottom - descent;
			
			Line2D line = Util.getLineBetweenRectangleEdges(
					labelX, labelX + 1,
					labelY, labelY + 1,
					tokenLeft, tokenRight,
					tokenTop, tokenBottom
			);

			int xOff = 0;
			int yOff = 0;

			Util.drawQuadraticCurveArrow(g, (int)line.getX1(), (int)line.getY1(), (int)line.getX2(), (int)line.getY2(), xOff, yOff, true, relationship.getStroke(true));

			g.drawLine(labelLeft, labelY, labelRight, labelY);
			
		}
		
	}
	
}
 
开发者ID:andyjko,项目名称:whyline,代码行数:42,代码来源:FileControlArrow.java


注:本文中的java.awt.geom.Area.getBounds方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。