@Test public void testBoundsSeparateOrIntersect() throws FactoryException { BBOX bbox1 = FF.bbox(FF.property(""), -10, -10, 10, 10, CRS); BBOX bbox2 = FF.bbox(FF.property(""), 50, -10, 70, 10, CRS); BBOX bbox3 = FF.bbox(FF.property(""), 0, -10, 60, 10, CRS); List<Envelope> bounds = ExtractMultiBoundsFilterVisitor.getBounds(FF.and(bbox3, FF.or(bbox1, bbox2))); assertThat( bounds, Matchers.containsInAnyOrder( new Envelope(0, 10, -10, 10), new Envelope(50, 60, -10, 10))); }
public static List<Envelope> getBounds(Filter filter) { Object result = filter.accept(INSTANCE, null); if (result instanceof List) { return (List<Envelope>) result; } else if (result instanceof Envelope) { return Collections.singletonList((Envelope) result); } else { return Collections.emptyList(); } }
ExtractMultiBoundsFilterVisitor extends ExtractBoundsFilterVisitor { public static List<Envelope> getBounds(Filter filter) { Object result = filter.accept(INSTANCE, null); if (result instanceof List) { return (List<Envelope>) result; } else if (result instanceof Envelope) { return Collections.singletonList((Envelope) result); } else { return Collections.emptyList(); } } }
ExtractMultiBoundsFilterVisitor extends ExtractBoundsFilterVisitor { public static List<Envelope> getBounds(Filter filter) { Object result = filter.accept(INSTANCE, null); if (result instanceof List) { return (List<Envelope>) result; } else if (result instanceof Envelope) { return Collections.singletonList((Envelope) result); } else { return Collections.emptyList(); } }  }
ExtractMultiBoundsFilterVisitor extends ExtractBoundsFilterVisitor { public static List<Envelope> getBounds(Filter filter) { Object result = filter.accept(INSTANCE, null); if (result instanceof List) { return (List<Envelope>) result; } else if (result instanceof Envelope) { return Collections.singletonList((Envelope) result); } else { return Collections.emptyList(); } }  static List<Envelope> getBounds(Filter filter); @Override Object visit(And filter, Object data); @Override Object visit(Or filter, Object data); }
ExtractMultiBoundsFilterVisitor extends ExtractBoundsFilterVisitor { public static List<Envelope> getBounds(Filter filter) { Object result = filter.accept(INSTANCE, null); if (result instanceof List) { return (List<Envelope>) result; } else if (result instanceof Envelope) { return Collections.singletonList((Envelope) result); } else { return Collections.emptyList(); } }  static List<Envelope> getBounds(Filter filter); @Override Object visit(And filter, Object data); @Override Object visit(Or filter, Object data);  }