/** * Tests whether this <code>IntersectionMatrix</code> is * T*****FF*. * *@return <code>true</code> if the first <code>Geometry</code> contains the * second */ public boolean isContains() { return isTrue(matrix[Location.INTERIOR][Location.INTERIOR]) && matrix[Location.EXTERIOR][Location.INTERIOR] == Dimension.FALSE && matrix[Location.EXTERIOR][Location.BOUNDARY] == Dimension.FALSE; }
/** * Tests whether this <code>IntersectionMatrix</code> is * T*F**F***. * *@return <code>true</code> if the first <code>Geometry</code> is within * the second */ public boolean isWithin() { return isTrue(matrix[Location.INTERIOR][Location.INTERIOR]) && matrix[Location.INTERIOR][Location.EXTERIOR] == Dimension.FALSE && matrix[Location.BOUNDARY][Location.EXTERIOR] == Dimension.FALSE; }
/** * Returns <code>true</code> if this <code>IntersectionMatrix</code> is * <code>T*F**F***</code> * or <code>*TF**F***</code> * or <code>**FT*F***</code> * or <code>**F*TF***</code> * *@return <code>true</code> if the first <code>Geometry</code> * is covered by the second */ public boolean isCoveredBy() { boolean hasPointInCommon = isTrue(matrix[Location.INTERIOR][Location.INTERIOR]) || isTrue(matrix[Location.INTERIOR][Location.BOUNDARY]) || isTrue(matrix[Location.BOUNDARY][Location.INTERIOR]) || isTrue(matrix[Location.BOUNDARY][Location.BOUNDARY]); return hasPointInCommon && matrix[Location.INTERIOR][Location.EXTERIOR] == Dimension.FALSE && matrix[Location.BOUNDARY][Location.EXTERIOR] == Dimension.FALSE; }
/** * Returns <code>true</code> if this <code>IntersectionMatrix</code> is * <code>T*****FF*</code> * or <code>*T****FF*</code> * or <code>***T**FF*</code> * or <code>****T*FF*</code> * *@return <code>true</code> if the first <code>Geometry</code> covers the * second */ public boolean isCovers() { boolean hasPointInCommon = isTrue(matrix[Location.INTERIOR][Location.INTERIOR]) || isTrue(matrix[Location.INTERIOR][Location.BOUNDARY]) || isTrue(matrix[Location.BOUNDARY][Location.INTERIOR]) || isTrue(matrix[Location.BOUNDARY][Location.BOUNDARY]); return hasPointInCommon && matrix[Location.EXTERIOR][Location.INTERIOR] == Dimension.FALSE && matrix[Location.EXTERIOR][Location.BOUNDARY] == Dimension.FALSE; }
/** * Tests whether the argument dimensions are equal and * this <code>IntersectionMatrix</code> matches * the pattern <tt>T*F**FFF*</tt>. * <p> * <b>Note:</b> This pattern differs from the one stated in * <i>Simple feature access - Part 1: Common architecture</i>. * That document states the pattern as <tt>TFFFTFFFT</tt>. This would * specify that * two identical <tt>POINT</tt>s are not equal, which is not desirable behaviour. * The pattern used here has been corrected to compute equality in this situation. * *@param dimensionOfGeometryA the dimension of the first <code>Geometry</code> *@param dimensionOfGeometryB the dimension of the second <code>Geometry</code> *@return <code>true</code> if the two <code>Geometry</code>s * related by this <code>IntersectionMatrix</code> are equal; the * <code>Geometry</code>s must have the same dimension to be equal */ public boolean isEquals(int dimensionOfGeometryA, int dimensionOfGeometryB) { if (dimensionOfGeometryA != dimensionOfGeometryB) { return false; } return isTrue(matrix[Location.INTERIOR][Location.INTERIOR]) && matrix[Location.INTERIOR][Location.EXTERIOR] == Dimension.FALSE && matrix[Location.BOUNDARY][Location.EXTERIOR] == Dimension.FALSE && matrix[Location.EXTERIOR][Location.INTERIOR] == Dimension.FALSE && matrix[Location.EXTERIOR][Location.BOUNDARY] == Dimension.FALSE; }
/** * Returns <code>true</code> if this <code>IntersectionMatrix</code> is * <UL> * <LI> T*T***T** (for two points or two surfaces) * <LI> 1*T***T** (for two curves) * </UL>. * *@param dimensionOfGeometryA the dimension of the first <code>Geometry</code> *@param dimensionOfGeometryB the dimension of the second <code>Geometry</code> *@return <code>true</code> if the two <code>Geometry</code>s * related by this <code>IntersectionMatrix</code> overlap. For this * function to return <code>true</code>, the <code>Geometry</code>s must * be two points, two curves or two surfaces. */ public boolean isOverlaps(int dimensionOfGeometryA, int dimensionOfGeometryB) { if ((dimensionOfGeometryA == Dimension.P && dimensionOfGeometryB == Dimension.P) || (dimensionOfGeometryA == Dimension.A && dimensionOfGeometryB == Dimension.A)) { return isTrue(matrix[Location.INTERIOR][Location.INTERIOR]) && isTrue(matrix[Location.INTERIOR][Location.EXTERIOR]) && isTrue(matrix[Location.EXTERIOR][Location.INTERIOR]); } if (dimensionOfGeometryA == Dimension.L && dimensionOfGeometryB == Dimension.L) { return matrix[Location.INTERIOR][Location.INTERIOR] == 1 && isTrue(matrix[Location.INTERIOR][Location.EXTERIOR]) && isTrue(matrix[Location.EXTERIOR][Location.INTERIOR]); } return false; }
(dimensionOfGeometryA == Dimension.P && dimensionOfGeometryB == Dimension.A) || (dimensionOfGeometryA == Dimension.L && dimensionOfGeometryB == Dimension.A)) { return isTrue(matrix[Location.INTERIOR][Location.INTERIOR]) && isTrue(matrix[Location.INTERIOR][Location.EXTERIOR]); return isTrue(matrix[Location.INTERIOR][Location.INTERIOR]) && isTrue(matrix[Location.EXTERIOR][Location.INTERIOR]);
/** * Returns <code>true</code> if this <code>IntersectionMatrix</code> is * FT*******, F**T***** or F***T****. * *@param dimensionOfGeometryA the dimension of the first <code>Geometry</code> *@param dimensionOfGeometryB the dimension of the second <code>Geometry</code> *@return <code>true</code> if the two <code>Geometry</code> * s related by this <code>IntersectionMatrix</code> touch; Returns false * if both <code>Geometry</code>s are points. */ public boolean isTouches(int dimensionOfGeometryA, int dimensionOfGeometryB) { if (dimensionOfGeometryA > dimensionOfGeometryB) { //no need to get transpose because pattern matrix is symmetrical return isTouches(dimensionOfGeometryB, dimensionOfGeometryA); } if ((dimensionOfGeometryA == Dimension.A && dimensionOfGeometryB == Dimension.A) || (dimensionOfGeometryA == Dimension.L && dimensionOfGeometryB == Dimension.L) || (dimensionOfGeometryA == Dimension.L && dimensionOfGeometryB == Dimension.A) || (dimensionOfGeometryA == Dimension.P && dimensionOfGeometryB == Dimension.A) || (dimensionOfGeometryA == Dimension.P && dimensionOfGeometryB == Dimension.L)) { return matrix[Location.INTERIOR][Location.INTERIOR] == Dimension.FALSE && (isTrue(matrix[Location.INTERIOR][Location.BOUNDARY]) || isTrue(matrix[Location.BOUNDARY][Location.INTERIOR]) || isTrue(matrix[Location.BOUNDARY][Location.BOUNDARY])); } return false; }