@Override public SpatialRelation relate(Shape other) { // ** NOTE ** the overall order of logic is kept consistent here with simple.PointImpl. if (isEmpty() || other.isEmpty()) return SpatialRelation.DISJOINT; if (other instanceof org.locationtech.spatial4j.shape.Point) return this.equals(other) ? SpatialRelation.INTERSECTS : SpatialRelation.DISJOINT; return other.relate(this).transpose(); }
@Override public SpatialRelation relate(Shape other) { if (other instanceof Point) return relate((Point)other); else if (other instanceof Rectangle) return relate((Rectangle) other); else if (other instanceof Circle) return relate((Circle) other); else if (other instanceof JtsGeometry) return relate((JtsGeometry) other); else if (other instanceof BufferedLineString) throw new UnsupportedOperationException("Can't use BufferedLineString with JtsGeometry"); return other.relate(this).transpose(); }
@Override public SpatialRelation relate(Shape other) { if (isEmpty() || other.isEmpty()) return SpatialRelation.DISJOINT; if (other instanceof Point) return this.equals(other) ? SpatialRelation.INTERSECTS : SpatialRelation.DISJOINT; return other.relate(this).transpose(); }
@Override public SpatialRelation relate(Shape other) { if (isEmpty() || other.isEmpty()) return SpatialRelation.DISJOINT; if (other instanceof Point) { return relate((Point) other); } if (other instanceof Rectangle) { return relate((Rectangle) other); } return other.relate(this).transpose(); }
@Override public SpatialRelation relate(Shape other) { //This shortcut was problematic in testing due to distinctions of CONTAINS/WITHIN for no-area shapes (lines, points). // if (distance == 0) { // return point.relate(other,ctx).intersects() ? SpatialRelation.WITHIN : SpatialRelation.DISJOINT; // } if (isEmpty() || other.isEmpty()) return SpatialRelation.DISJOINT; if (other instanceof Point) { return relate((Point) other); } if (other instanceof Rectangle) { return relate((Rectangle) other); } if (other instanceof Circle) { return relate((Circle) other); } return other.relate(this).transpose(); }
@Override public SpatialRelation relate(Shape shape) { // if (shape instanceof UnitNRShape) // return relate((UnitNRShape)shape); if (shape instanceof SpanUnitsNRShape) return relate((SpanUnitsNRShape) shape); return shape.relate(this).transpose();//probably a UnitNRShape }
protected void checkBattenberg(byte quad, double cx, double cy, int level, List<Cell> matches, long term, Shape shape, int maxLevel) { // short-circuit if we find a match for the point (no need to continue recursion) if (shape instanceof Point && !matches.isEmpty()) return; double w = levelW[level] / 2; double h = levelH[level] / 2; SpatialRelation v = shape.relate(ctx.makeRectangle(cx - w, cx + w, cy - h, cy + h)); if (SpatialRelation.DISJOINT == v) { return; } // set bits for next level term |= (((long)(quad))<<(64-(++level<<1))); // increment level term = ((term>>>1)+1)<<1; if (SpatialRelation.CONTAINS == v || (level >= maxLevel)) { matches.add(new PackedQuadCell(term, v.transpose())); } else {// SpatialRelation.WITHIN, SpatialRelation.INTERSECTS build(cx, cy, level, matches, term, shape, maxLevel); } }
@Override public SpatialRelation relate(Shape shape) { assertDecoded(); if (shape == iterFilter && cellShapeRel != null) return cellShapeRel; if (shape instanceof UnitNRShape) return relate((UnitNRShape)shape); if (shape instanceof SpanUnitsNRShape) return relate((SpanUnitsNRShape)shape); return shape.relate(this).transpose(); }
str.bytes[str.length++] = (byte)c;//append matches.add(new QuadCell(BytesRef.deepCopyOf(str), v.transpose())); } else if (SpatialRelation.DISJOINT == v) { if (nextLevel >= maxLevel) { matches.add(new QuadCell(BytesRef.deepCopyOf(str), v.transpose())); } else { build(cx, cy, nextLevel, matches, str, shape, maxLevel);