public boolean equals(final Shape shape) { if (shape != null) if (shape instanceof Region) if (area.equals(((Region)shape).area)) return true; return false; }
@Override public boolean equals(Object o) { if (!(o instanceof BevelCacheKey) || o.hashCode() != hashCode) { return false; } BevelCacheKey b = (BevelCacheKey) o; return width == b.width && height == b.height && area.equals(b.area); }
Area newArea = new Area(newPolygon); Area existingArea = new Area(existingPolygon); Area existingAreaSub = new Area(existingPolygon); existingAreaSub.subtract(newArea); boolean intersects = existingAreaSub.equals(existingArea);
private boolean checkOneSlice(ZonePoint zp, int dir, Area exposedFog) { Shape s = calculator.getFogAreaToCheck(dir); // The resulting Shape is 4x larger than it should be. Use a transform to correct it. AffineTransform af = new AffineTransform(); af.translate(zp.x, zp.y); af.scale(minorRadius / 100, minorRadius / 100); Area transformed = new Area(af.createTransformedShape(s)); // Create an Area based on the pie slice, then calculate the intersection with the exposed area. If the result // is exactly the same as the original pie slice, then the entire slice must have been contained with the // exposed area. That means it's fine for a token to move into the grid cell. Whew. ;-) Area a = new Area(transformed); a.intersect(exposedFog); return a.equals(transformed); }
/** * Determines if a shape interacts with a clipping region. * @param clip Shape defining the clipping region * @param s Shape to be drawn * @return true if code for a clipping region needs to be generated. */ public boolean shouldBeClipped(Shape clip, Shape s) { if (clip == null || s == null) { return false; } if (s instanceof Line2D) { //Line shapes don't work with intersections so always clip return true; } Area as = new Area(s); Area imclip = new Area(clip); imclip.intersect(as); return !imclip.equals(as); }
/** * Check if the clip will change the current state. * A clip is assumed to be used in a situation where it will add * to any clip in the current or parent states. * A clip cannot be cleared, this can only be achieved by going to * a parent level with the correct clip. * If the clip is different then it may start a new state so that * it can return to the previous clip. * * @param cl the clip shape to check * @return true if the clip will change the current clip. */ public boolean checkClip(Shape cl) { Shape clip = getPDFData().clip; if (clip == null) { if (cl != null) { return true; } } else if (!new Area(clip).equals(new Area(cl))) { return true; } //TODO check for clips that are larger than the current return false; }
public static boolean equals(SpatialEntity e1, SpatialEntity e2) { return e1.getArea().equals(e2.getArea()); }
public static boolean contains(SpatialEntity e1, SpatialEntity e2) { if(e1 instanceof Point2D) return false; Area a1 = e1.getArea(); if(e2 instanceof Point2D) return a1.contains((Point2D) e2); Area a2 = e2.getArea(); a1.intersect(a2); return a1.equals(a2); }
if (clip == null || !clip.equals(area)) { clip = new Area(area); shapes.add(new ShapeDrawCmd(area));
area1.equals(null); // Eliminates the warning about "area1 never read locally" from Eclipse
showBounds("xOr", xOr)); if (spaceTestArea.isEmpty() || !spaceTestArea.equals(moveLineArea)) { System.out.println("spaceTestArea.isEmpty()? " + spaceTestArea.isEmpty()); System.out.println("!spaceTestArea.equals(moveLineArea)? " + !spaceTestArea.equals(moveLineArea)); System.out.println("moveLineArea bounds: " + moveLineArea.getBounds()); System.out.println("No move --- a unit is on the way. " potentialTestArea.subtract(uArea); if (spaceTestArea.isEmpty() || !spaceTestArea.equals(moveLineArea) || potentialTestArea.isEmpty() || !potentialTestArea.equals(potentialArea)) { System.out.println("No move --- a unit is on the way. " + "Conflicting point is=" + p + "; for i=" + i);
createGlyphVector(fontRenderContext, text). getOutline()); return area2.equals(area1);
if (!parentGraphicState.clip.equals(clip)) { parentGraphicState.shapes.add(new ShapeDrawCmd(new Area(parentGraphicState.clip))); parentGraphicState.shapes.add(clipDrawCmd);