Search in sources :

Example 31 with TimePeriodType

use of org.geotoolkit.gml.xml.v311.TimePeriodType 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

TimePeriodType (net.opengis.gml.v_3_2_1.TimePeriodType)14 BinaryTemporalOpType (net.opengis.filter.v_2_0_0.BinaryTemporalOpType)13 FilterType (net.opengis.filter.v_2_0_0.FilterType)13 Test (org.junit.Test)12 TimePeriodType (org.geotoolkit.gml.xml.v311.TimePeriodType)11 ArrayList (java.util.ArrayList)10 Date (java.util.Date)10 TimePositionType (net.opengis.gml.v_3_2_1.TimePositionType)9 TimePositionType (org.geotoolkit.gml.xml.v311.TimePositionType)7 FilterCapabilities (net.opengis.filter.v_2_0_0.FilterCapabilities)6 JAXBElement (javax.xml.bind.JAXBElement)5 TimePeriodType (org.geotoolkit.gml.xml.v321.TimePeriodType)5 StringWriter (java.io.StringWriter)4 TimePositionType (org.geotoolkit.gml.xml.v321.TimePositionType)4 DateTime (org.joda.time.DateTime)4 StringReader (java.io.StringReader)3 List (java.util.List)3 TimeInstantType (net.opengis.gml.v_3_2_1.TimeInstantType)3 DirectPositionType (org.geotoolkit.gml.xml.v311.DirectPositionType)3 TimeInstantType (org.geotoolkit.gml.xml.v311.TimeInstantType)3