Search in sources :

Example 11 with CodeWithAuthority

use of org.n52.shetland.ogc.gml.CodeWithAuthority in project arctic-sea by 52North.

the class TrajectoryObservation method cloneTemplate.

@Override
public OmObservation cloneTemplate() {
    SamplingFeature sf = new SamplingFeature(new CodeWithAuthority(""));
    sf.setFeatureType(SfConstants.SAMPLING_FEAT_TYPE_SF_SAMPLING_CURVE);
    getObservationConstellation().setFeatureOfInterest(sf);
    if (isSetSpatialFilteringProfileParameter()) {
        removeSpatialFilteringProfileParameter();
    }
    return cloneTemplate(new TrajectoryObservation());
}
Also used : SamplingFeature(org.n52.shetland.ogc.om.features.samplingFeatures.SamplingFeature) AbstractSamplingFeature(org.n52.shetland.ogc.om.features.samplingFeatures.AbstractSamplingFeature) CodeWithAuthority(org.n52.shetland.ogc.gml.CodeWithAuthority)

Example 12 with CodeWithAuthority

use of org.n52.shetland.ogc.gml.CodeWithAuthority in project arctic-sea by 52North.

the class FeatureCollectionTest method should_remove_member_from_feature_collection.

@Test
public final void should_remove_member_from_feature_collection() {
    final FeatureCollection features = new FeatureCollection();
    final String feature1Id = "feature-1";
    final SamplingFeature feature1 = new SamplingFeature(new CodeWithAuthority(feature1Id));
    features.addMember(feature1);
    final String feature2Id = "feature-2";
    final SamplingFeature feature2 = new SamplingFeature(new CodeWithAuthority(feature2Id));
    features.addMember(feature2);
    final SamplingFeature removedFeature = (SamplingFeature) features.removeMember(feature2Id);
    assertThat(removedFeature, is(equalTo(feature2)));
    assertThat(features.getMembers().size(), is(1));
    assertThat(features.getMembers().containsKey(feature2Id), is(FALSE));
    assertThat(features.getMembers().containsValue(feature2), is(FALSE));
    assertThat(features.getMembers().containsKey(feature1Id), is(TRUE));
    assertThat(features.getMembers().containsValue(feature1), is(TRUE));
}
Also used : SamplingFeature(org.n52.shetland.ogc.om.features.samplingFeatures.SamplingFeature) CodeWithAuthority(org.n52.shetland.ogc.gml.CodeWithAuthority) Test(org.junit.Test)

Example 13 with CodeWithAuthority

use of org.n52.shetland.ogc.gml.CodeWithAuthority in project arctic-sea by 52North.

the class SamplingFeatureComplexTest method should_set_role_correct.

@Test
public void should_set_role_correct() {
    final String role = "test-role";
    final SamplingFeatureComplex sfc = new SamplingFeatureComplex(role, new SamplingFeature(new CodeWithAuthority("test-feature")));
    assertThat(sfc.getRelatedSamplingFeatureRole(), is(role));
}
Also used : SamplingFeatureComplex(org.n52.shetland.ogc.om.features.samplingFeatures.SamplingFeatureComplex) SamplingFeature(org.n52.shetland.ogc.om.features.samplingFeatures.SamplingFeature) CodeWithAuthority(org.n52.shetland.ogc.gml.CodeWithAuthority) Test(org.junit.Test)

Example 14 with CodeWithAuthority

use of org.n52.shetland.ogc.gml.CodeWithAuthority in project arctic-sea by 52North.

the class SamplingFeatureTest method isSetRelatedSamplingFeatures_should_return_false_if_not_set.

@Test
public final void isSetRelatedSamplingFeatures_should_return_false_if_not_set() {
    final SamplingFeature feature = new SamplingFeature(null);
    assertThat(feature.isSetRelatedSamplingFeatures(), is(FALSE));
    feature.addRelatedSamplingFeature(new SamplingFeatureComplex("test-role", new SamplingFeature(new CodeWithAuthority("test-feature"))));
    assertThat(feature.isSetRelatedSamplingFeatures(), is(TRUE));
    feature.setRelatedSamplingFeatures(null);
    assertThat(feature.isSetRelatedSamplingFeatures(), is(FALSE));
    feature.setRelatedSamplingFeatures(Lists.<SamplingFeatureComplex>newArrayList());
    assertThat(feature.isSetRelatedSamplingFeatures(), is(FALSE));
}
Also used : SamplingFeatureComplex(org.n52.shetland.ogc.om.features.samplingFeatures.SamplingFeatureComplex) SamplingFeature(org.n52.shetland.ogc.om.features.samplingFeatures.SamplingFeature) CodeWithAuthority(org.n52.shetland.ogc.gml.CodeWithAuthority) Test(org.junit.Test)

Example 15 with CodeWithAuthority

use of org.n52.shetland.ogc.gml.CodeWithAuthority in project arctic-sea by 52North.

the class SamplingFeatureTest method setRelatedSamplingFeatures_should_set_all_elements_and_reset_if_set_before.

@Test
public final void setRelatedSamplingFeatures_should_set_all_elements_and_reset_if_set_before() {
    final SamplingFeature feature = new SamplingFeature(null);
    final SamplingFeatureComplex relatedSamplingFeature = new SamplingFeatureComplex("test-role", new SamplingFeature(new CodeWithAuthority("test-feature")));
    final SamplingFeatureComplex relatedSamplingFeature2 = new SamplingFeatureComplex("test-role", new SamplingFeature(new CodeWithAuthority("test-feature-2")));
    List<SamplingFeatureComplex> list = Lists.newArrayList(relatedSamplingFeature, relatedSamplingFeature2);
    feature.setRelatedSamplingFeatures(list);
    validate(feature, relatedSamplingFeature, relatedSamplingFeature2);
    final SamplingFeatureComplex relatedSamplingFeature3 = new SamplingFeatureComplex("test-role", new SamplingFeature(new CodeWithAuthority("test-feature-3")));
    final SamplingFeatureComplex relatedSamplingFeature4 = new SamplingFeatureComplex("test-role", new SamplingFeature(new CodeWithAuthority("test-feature-4")));
    list = Lists.newArrayList(relatedSamplingFeature3, relatedSamplingFeature4);
    feature.setRelatedSamplingFeatures(list);
    validate(feature, relatedSamplingFeature3, relatedSamplingFeature4);
}
Also used : SamplingFeatureComplex(org.n52.shetland.ogc.om.features.samplingFeatures.SamplingFeatureComplex) SamplingFeature(org.n52.shetland.ogc.om.features.samplingFeatures.SamplingFeature) CodeWithAuthority(org.n52.shetland.ogc.gml.CodeWithAuthority) Test(org.junit.Test)

Aggregations

CodeWithAuthority (org.n52.shetland.ogc.gml.CodeWithAuthority)28 SamplingFeature (org.n52.shetland.ogc.om.features.samplingFeatures.SamplingFeature)17 Test (org.junit.Test)9 CodeType (org.n52.shetland.ogc.gml.CodeType)7 XmlObject (org.apache.xmlbeans.XmlObject)6 OmObservation (org.n52.shetland.ogc.om.OmObservation)6 SamplingFeatureComplex (org.n52.shetland.ogc.om.features.samplingFeatures.SamplingFeatureComplex)6 OmObservableProperty (org.n52.shetland.ogc.om.OmObservableProperty)5 OmObservationConstellation (org.n52.shetland.ogc.om.OmObservationConstellation)5 AbstractFeature (org.n52.shetland.ogc.gml.AbstractFeature)4 EncodingException (org.n52.svalbard.encode.exception.EncodingException)4 ArrayList (java.util.ArrayList)3 DateTime (org.joda.time.DateTime)3 TimeInstant (org.n52.shetland.ogc.gml.time.TimeInstant)3 AbstractSamplingFeature (org.n52.shetland.ogc.om.features.samplingFeatures.AbstractSamplingFeature)3 XmlException (org.apache.xmlbeans.XmlException)2 XmlOptions (org.apache.xmlbeans.XmlOptions)2 Before (org.junit.Before)2 ObservationStream (org.n52.shetland.ogc.om.ObservationStream)2 QuantityValue (org.n52.shetland.ogc.om.values.QuantityValue)2