org.opengis.filter.temporal.Begins Java Examples

The following examples show how to use org.opengis.filter.temporal.Begins. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ElasticFilterTest.java    From elasticgeo with GNU General Public License v3.0 6 votes vote down vote up
@Test
public void testBegins() throws ParseException {
    Date date1 = dateFormat.parse("1970-07-19T01:02:03.456Z");
    Instant temporalInstant = new DefaultInstant(new DefaultPosition(date1));
    Date date2 = dateFormat.parse("1970-07-19T07:08:09.101Z");
    Instant temporalInstant2 = new DefaultInstant(new DefaultPosition(date2));
    Period period = new DefaultPeriod(temporalInstant, temporalInstant2);

    Begins filter = ff.begins(ff.property("dateAttr"), ff.literal(period));
    Map<String,Object> expected = ImmutableMap.of("term",
            ImmutableMap.of("dateAttr", "1970-07-19T01:02:03.456Z"));

    builder.visit(filter, null);
    assertTrue(builder.createCapabilities().fullySupports(filter));
    assertEquals(expected, builder.getQueryBuilder());
}
 
Example #2
Source File: ExtractTimeFilterVisitor.java    From geowave with Apache License 2.0 6 votes vote down vote up
@Override
public Object visit(final Begins begins, final Object data) {
  final TemporalConstraints leftResult =
      (TemporalConstraints) begins.getExpression1().accept(this, data);

  final TemporalConstraints rightResult =
      (TemporalConstraints) begins.getExpression2().accept(this, data);

  if (leftResult.isEmpty() || rightResult.isEmpty()) {
    return new TemporalConstraints();
  }

  // property begins value
  if (leftResult instanceof ParameterTimeConstraint) {
    return new ParameterTimeConstraint(rightResult.getRanges(), leftResult.getName());
  } else if (rightResult instanceof ParameterTimeConstraint) {
    return new ParameterTimeConstraint(
        new TemporalRange(
            leftResult.getMinOr(TemporalRange.START_TIME, 0),
            TemporalRange.END_TIME),
        rightResult.getName());
  }
  // property begins property
  return new TemporalConstraints();
}
 
Example #3
Source File: ElasticCapabilities.java    From elasticgeo with GNU General Public License v3.0 5 votes vote down vote up
public ElasticCapabilities() {
    super(new ElasticFilterCapabilities());

    addAll(LOGICAL_OPENGIS);
    addAll(SIMPLE_COMPARISONS_OPENGIS);
    addType(PropertyIsNull.class);
    addType(PropertyIsBetween.class);
    addType(Id.class);
    addType(IncludeFilter.class);
    addType(ExcludeFilter.class);
    addType(PropertyIsLike.class);

    // spatial filters
    addType(BBOX.class);
    addType(Contains.class);
    //addType(Crosses.class);
    addType(Disjoint.class);
    //addType(Equals.class);
    addType(Intersects.class);
    //addType(Overlaps.class);
    //addType(Touches.class);
    addType(Within.class);
    addType(DWithin.class);
    addType(Beyond.class);

    //temporal filters
    addType(After.class);
    addType(Before.class);
    addType(Begins.class);
    addType(BegunBy.class);
    addType(During.class);
    addType(Ends.class);
    addType(EndedBy.class);
    addType(TContains.class);
    addType(TEquals.class);
}
 
Example #4
Source File: ElasticFilterTest.java    From elasticgeo with GNU General Public License v3.0 5 votes vote down vote up
@Test(expected=IllegalArgumentException.class)
public void testBeginsWithSwap() throws ParseException {
    Date date1 = dateFormat.parse("1970-07-19T01:02:03.456Z");
    Instant temporalInstant = new DefaultInstant(new DefaultPosition(date1));
    Date date2 = dateFormat.parse("1970-07-19T07:08:09.101Z");
    Instant temporalInstant2 = new DefaultInstant(new DefaultPosition(date2));
    Period period = new DefaultPeriod(temporalInstant, temporalInstant2);

    Begins filter = ff.begins(ff.literal(period), ff.property("dateAttr"));

    builder.visit(filter, null);
}
 
Example #5
Source File: PropertyIgnoringFilterVisitor.java    From geowave with Apache License 2.0 5 votes vote down vote up
@Override
public Object visit(final Begins begins, final Object extraData) {
  if (!usesProperty(begins)) {
    return Filter.INCLUDE;
  }
  return super.visit(begins, extraData);
}
 
Example #6
Source File: PropertyIgnoringFilterVisitor.java    From geowave with Apache License 2.0 5 votes vote down vote up
@Override
public Object visit(final Begins begins, final Object extraData) {
  if (!usesProperty(begins)) {
    return Filter.INCLUDE;
  }
  return super.visit(begins, extraData);
}
 
Example #7
Source File: FilterToElastic.java    From elasticgeo with GNU General Public License v3.0 4 votes vote down vote up
public Object visit(Begins begins, Object extraData) {
    return visitBinaryTemporalOperator(begins, extraData);
}
 
Example #8
Source File: ElasticFilterTest.java    From elasticgeo with GNU General Public License v3.0 4 votes vote down vote up
@Test(expected=IllegalArgumentException.class)
public void testBeginsWithMissingPeriod() throws ParseException {
    Date date1 = dateFormat.parse("1970-07-19T01:02:03.456Z");
    Begins filter = ff.begins(ff.property("dateAttr"), ff.literal(date1));
    builder.visit(filter, null);
}
 
Example #9
Source File: CriteriaVisitor.java    From geomajas-project-server with GNU Affero General Public License v3.0 4 votes vote down vote up
/** {@inheritDoc} */
@Override
public Object visit(Begins begins, Object extraData) {
	throw new UnsupportedOperationException("visit(Object userData)");
}