Search in sources :

Example 16 with TimeInstantType

use of org.geotoolkit.gml.xml.v321.TimeInstantType in project geotoolkit by Geomatys.

the class TimePeriodTypeTest method getTime2Test.

@Test
public void getTime2Test() throws Exception {
    TimePositionType tn = null;
    TimePositionType tb = new TimePositionType("2008-11-01T02:00:00");
    TimePositionType te = new TimePositionType("2008-11-01T02:01:00");
    TimePeriodType tp = new TimePeriodType(new TimeInstantType(tb), new TimeInstantType(te));
    assertEquals(60000, tp.getTime());
    tb = new TimePositionType("2008-11-01T01:00:00");
    te = new TimePositionType("2008-11-01T02:00:00");
    tp = new TimePeriodType(new TimeInstantType(tb), new TimeInstantType(te));
    assertEquals(3600000, tp.getTime());
    tp = new TimePeriodType(new TimeInstantType(tb), new TimeInstantType(tn));
    assertEquals(-1, tp.getTime());
    tb = null;
    tp = new TimePeriodType(new TimeInstantType(tb), new TimeInstantType(te));
    assertEquals(-1, tp.getTime());
    tb = null;
    te = null;
    tp = new TimePeriodType(new TimeInstantType(tb), new TimeInstantType(te));
    assertEquals(-1, tp.getTime());
}
Also used : TimeInstantType(org.geotoolkit.gml.xml.v311.TimeInstantType) TimePeriodType(org.geotoolkit.gml.xml.v311.TimePeriodType) TimePositionType(org.geotoolkit.gml.xml.v311.TimePositionType)

Example 17 with TimeInstantType

use of org.geotoolkit.gml.xml.v321.TimeInstantType in project geotoolkit by Geomatys.

the class TimePeriodTypeTest method getTime3Test.

@Test
public void getTime3Test() throws Exception {
    final String id = "id-1";
    String snull = null;
    TimeInstantType tb = new TimeInstantType(new TimePositionType("2008-11-01T02:00:00"));
    TimeInstantType te = new TimeInstantType(new TimePositionType("2008-11-01T02:01:00"));
    TimePeriodType tp = new TimePeriodType(id, snull);
    tp.setBegin(new TimeInstantPropertyType(tb));
    tp.setEnd(new TimeInstantPropertyType(te));
    assertEquals(60000, tp.getTime());
    tb = new TimeInstantType(new TimePositionType("2008-11-01T01:00:00"));
    te = new TimeInstantType(new TimePositionType("2008-11-01T02:00:00"));
    tp = new TimePeriodType(id, snull);
    tp.setBegin(new TimeInstantPropertyType(tb));
    tp.setEnd(new TimeInstantPropertyType(te));
    assertEquals(3600000, tp.getTime());
    tp = new TimePeriodType(id, snull);
    tp.setBegin(new TimeInstantPropertyType(tb));
    assertEquals(-1, tp.getTime());
    tp = new TimePeriodType(id, snull);
    tp.setEnd(new TimeInstantPropertyType(te));
    assertEquals(-1, tp.getTime());
    tp = new TimePeriodType(id, snull);
    assertEquals(-1, tp.getTime());
}
Also used : TimeInstantType(org.geotoolkit.gml.xml.v321.TimeInstantType) TimePeriodType(org.geotoolkit.gml.xml.v321.TimePeriodType) TimeInstantPropertyType(org.geotoolkit.gml.xml.v321.TimeInstantPropertyType) TimePositionType(org.geotoolkit.gml.xml.v321.TimePositionType)

Aggregations

TimeInstantType (net.opengis.gml.v_3_2_1.TimeInstantType)10 BinaryTemporalOpType (net.opengis.filter.v_2_0_0.BinaryTemporalOpType)9 FilterType (net.opengis.filter.v_2_0_0.FilterType)9 Date (java.util.Date)7 TimePositionType (net.opengis.gml.v_3_2_1.TimePositionType)7 Test (org.junit.Test)6 ArrayList (java.util.ArrayList)5 JAXBElement (javax.xml.bind.JAXBElement)3 TimePeriodType (net.opengis.gml.v_3_2_1.TimePeriodType)3 TimeInstantType (org.geotoolkit.gml.xml.v311.TimeInstantType)3 TimePeriodType (org.geotoolkit.gml.xml.v311.TimePeriodType)3 TimePositionType (org.geotoolkit.gml.xml.v311.TimePositionType)3 TimeInstantType (org.geotoolkit.gml.xml.v321.TimeInstantType)3 StringReader (java.io.StringReader)2 Method (java.lang.reflect.Method)2 FilterCapabilities (net.opengis.filter.v_2_0_0.FilterCapabilities)2 DirectPositionType (org.geotoolkit.gml.xml.v311.DirectPositionType)2 EnvelopeType (org.geotoolkit.gml.xml.v311.EnvelopeType)2 FilterType (org.geotoolkit.ogc.xml.v110.FilterType)2 ObjectFactory (org.geotoolkit.ogc.xml.v110.ObjectFactory)2