本文整理汇总了Java中java.awt.geom.Area.contains方法的典型用法代码示例。如果您正苦于以下问题:Java Area.contains方法的具体用法?Java Area.contains怎么用?Java Area.contains使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类java.awt.geom.Area
的用法示例。
在下文中一共展示了Area.contains方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: containingInters
import java.awt.geom.Area; //导入方法依赖的package包/类
/**
* Lookup the sig collection of interpretations for those which contain the provided
* point.
*
* @param point provided point
* @return the containing interpretations
*/
public List<Inter> containingInters (Point point)
{
List<Inter> found = new ArrayList<Inter>();
for (Inter inter : vertexSet()) {
Rectangle bounds = inter.getBounds();
if ((bounds != null) && bounds.contains(point)) {
// More precise test if we know inter area
Area area = inter.getArea();
if ((area == null) || area.contains(point)) {
found.add(inter);
}
}
}
return found;
}
示例2: 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;
}
示例3: getStavesOf
import java.awt.geom.Area; //导入方法依赖的package包/类
/**
* Report the staves whose area contains the provided point.
*
* @param point the provided pixel point
* @param theStaves the list of staves to check
* @return the containing staves
*/
public static List<Staff> getStavesOf (Point2D point,
List<Staff> theStaves)
{
List<Staff> found = new ArrayList<Staff>();
for (Staff staff : theStaves) {
Area area = staff.getArea();
if ((area != null) && area.contains(point)) {
found.add(staff);
}
}
return found;
}
示例4: containingSystems
import java.awt.geom.Area; //导入方法依赖的package包/类
/**
* Report the systems that contain the provided rectangle
*
* @param rect the provided rectangle
* @param found (output) list to be populated (allocated if null)
* @return the containing systems info, perhaps empty but not null
*/
public List<SystemInfo> containingSystems (Rectangle2D rect,
List<SystemInfo> found)
{
if (found != null) {
found.clear();
} else {
found = new ArrayList<SystemInfo>();
}
for (SystemInfo system : systems) {
Area area = system.getArea();
if ((area != null) && area.contains(rect)) {
found.add(system);
}
}
return found;
}
示例5: getSystemsOf
import java.awt.geom.Area; //导入方法依赖的package包/类
/**
* Report the systems that contain the provided point
*
* @param point the provided pixel point
* @param found (output) list to be populated (allocated if null)
* @return the containing systems info, perhaps empty but not null
*/
public List<SystemInfo> getSystemsOf (Point2D point,
List<SystemInfo> found)
{
if (found != null) {
found.clear();
} else {
found = new ArrayList<SystemInfo>();
}
for (SystemInfo system : systems) {
Area area = system.getArea();
if ((area != null) && area.contains(point)) {
found.add(system);
}
}
return found;
}
示例6: computeRelevantPoints
import java.awt.geom.Area; //导入方法依赖的package包/类
private Table.UnsignedByte computeRelevantPoints (Area area)
{
Table.UnsignedByte table = new Table.UnsignedByte(rect.width, rect.height);
Point loc = rect.getLocation();
table.fill(PixelFilter.BACKGROUND);
for (int y = 0; y < rect.height; y++) {
int ay = y + loc.y; // Absolute ordinate
for (int x = 0; x < rect.width; x++) {
int ax = x + loc.x; // Absolute abscissa
if (area.contains(ax, ay)) {
table.setValue(x, y, 0);
pointCount++;
}
}
}
return table;
}
示例7: processTextPosition
import java.awt.geom.Area; //导入方法依赖的package包/类
@Override
protected void processTextPosition(TextPosition text) {
Matrix textMatrix = text.getTextMatrix();
Vector start = textMatrix.transform(new Vector(0, 0));
Vector end = new Vector(start.getX() + text.getWidth(), start.getY());
PDGraphicsState gs = getGraphicsState();
Area area = gs.getCurrentClippingPath();
if (area == null ||
(area.contains(lowerLeftX + start.getX(), lowerLeftY + start.getY()) &&
((!checkEndPointToo) || area.contains(lowerLeftX + end.getX(), lowerLeftY + end.getY()))))
super.processTextPosition(text);
}
示例8: mouseClick
import java.awt.geom.Area; //导入方法依赖的package包/类
@Override
public void mouseClick(MouseEvent me, ViwnGraphViewUI ui) {
Point p = absToVertexRel(me.getPoint(), this,
ui.getVisualizationViewer());
for (NodeDirection rel : NodeDirection.values()) {
Collection<ViwnEdgeSynset> edges = getRelation(rel);
if (edges.size() > 0) {
Area ar = new Area(getButtonArea(rel));
if (ar.contains(p)) {
switch (getState(rel)) {
case EXPANDED:
ui.setSelectedNode(this);
ui.hideRelation(this, rel);
ui.recreateLayout();
break;
case SEMI_EXPANDED:
ui.showRelation(this, new NodeDirection[]{rel});
ui.recreateLayout();
break;
case NOT_EXPANDED:
ui.showRelation(this, new NodeDirection[]{rel});
ui.recreateLayout();
break;
}
}
}
}
}
示例9: mouseClick
import java.awt.geom.Area; //导入方法依赖的package包/类
@Override
public void mouseClick(MouseEvent me, ViwnGraphViewUI ui) {
Point p = absToVertexRel(me.getPoint(), this,
ui.getVisualizationViewer());
for (NodeDirection rel : NodeDirection.values()) {
Collection<ViwnEdgeSynset> edges = getRelation(rel);
if (edges.size() > 0) {
Area ar = new Area(getButtonArea(rel));
if (ar.contains(p)) {
switch (getState(rel)) {
case EXPANDED:
ui.setSelectedNode(this);
ui.hideRelation(this, rel);
ui.recreateLayout();
break;
case SEMI_EXPANDED:
case NOT_EXPANDED:
ui.showRelation(this, new NodeDirection[]{rel});
// ui.recreateLayout();
break;
}
}
}
}
}
示例10: 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);
}
}
}
}
示例11: 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));
}
}
}
}
示例12: 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;
}
示例13: isSideInSystem
import java.awt.geom.Area; //导入方法依赖的package包/类
/**
* Check whether the (beam) side designated by provided point and height values
* lies fully in the current system
*
* @param pt side point on median
* @param height beam height
* @return true if side is fully within current system, false otherwise
*/
boolean isSideInSystem (Point2D pt,
double height)
{
Area area = system.getArea();
// Check top and bottom points of the beam side
for (int dir : new int[]{-1, +1}) {
if (!area.contains(pt.getX(), pt.getY() + (dir * (height / 2)))) {
return false;
}
}
return true;
}
示例14: isRectangleVisibleAtScreen
import java.awt.geom.Area; //导入方法依赖的package包/类
/**
* Returns <code>true</code> if the given rectangle is fully visible at screen.
*/
public static boolean isRectangleVisibleAtScreen(Rectangle rectangle)
{
Area devicesArea = new Area();
GraphicsEnvironment environment = GraphicsEnvironment.getLocalGraphicsEnvironment();
for (GraphicsDevice device : environment.getScreenDevices())
{
devicesArea.add(new Area(device.getDefaultConfiguration().getBounds()));
}
return devicesArea.contains(rectangle);
}
示例15: combineROIs
import java.awt.geom.Area; //导入方法依赖的package包/类
public static PathShape combineROIs(PathShape shape1, PathShape shape2, CombineOp op, double flatness) {
// Check we can combine
if (!ROIHelpers.sameImagePlane(shape1, shape2))
throw new IllegalArgumentException("Cannot combine - shapes " + shape1 + " and " + shape2 + " do not share the same image plane");
Area area1 = getArea(shape1);
Area area2 = getArea(shape2);
// Do a quick check to see if a combination might be avoided
if (op == CombineOp.INTERSECT) {
if (area1.contains(area2.getBounds2D()))
return shape2;
if (area2.contains(area1.getBounds2D()))
return shape1;
} else if (op == CombineOp.ADD) {
if (area1.contains(area2.getBounds2D()))
return shape1;
if (area2.contains(area1.getBounds2D()))
return shape2;
}
combineAreas(area1, area2, op);
// I realise the following looks redundant... however direct use of the areas with the
// brush tool led to strange artefacts appearing & disappearing... performing an additional
// conversion seems to help
// area1 = new Area(new Path2D.Float(area1));
// Return simplest ROI that works - prefer a rectangle or polygon over an area
return getShapeROI(area1, shape1.getC(), shape1.getZ(), shape1.getT(), flatness);
}