Search in sources :

Example 1 with EnvelopeType

use of org.geosdi.geoplatform.xml.gml.v311.EnvelopeType in project ddf by codice.

the class RegistryPackageWebConverterTest method getFirstExtrinsicObject.

private ExtrinsicObjectType getFirstExtrinsicObject() {
    ExtrinsicObjectType extrinsicObject = RIM_FACTORY.createExtrinsicObjectType();
    // set default values
    extrinsicObject.setMimeType(extrinsicObject.getMimeType());
    extrinsicObject.setIsOpaque(extrinsicObject.isIsOpaque());
    extrinsicObject.setId("urn:registry:node");
    extrinsicObject.setObjectType("urn:registry:federation:node");
    extrinsicObject.getSlot().add(stHelper.create("liveDate", "2015-11-01T06:15:30-07:00", "xs:dateTime"));
    extrinsicObject.getSlot().add(stHelper.create("dataStartDate", "2015-11-01T13:15:30Z", "xs:dateTime"));
    extrinsicObject.getSlot().add(stHelper.create("dataEndDate", "2015-12-01T23:01:40Z", "xs:dateTime"));
    extrinsicObject.getSlot().add(stHelper.create("lastUpdated", "2016-01-26T17:16:34.996Z", "xs:dateTime"));
    extrinsicObject.getSlot().add(stHelper.create("links", "https://some/link/to/my/repo", "xs:string"));
    SlotType1 locationSlot = stHelper.create("location", (String) null, "urn:ogc:def:dataType:ISO-19107:2003:GM_Point");
    PointType point = GML_FACTORY.createPointType();
    point.setSrsDimension(BigInteger.valueOf(2));
    point.setSrsName("urn:ogc:def:crs:EPSG::4326");
    DirectPositionType directPosition = GML_FACTORY.createDirectPositionType();
    directPosition.getValue().add(112.267472);
    directPosition.getValue().add(33.467944);
    point.setPos(directPosition);
    ValueListType valueList = WRS_FACTORY.createValueListType();
    AnyValueType anyValue = WRS_FACTORY.createAnyValueType();
    anyValue.getContent().add(GML_FACTORY.createPoint(point));
    valueList.getAnyValue().add(anyValue);
    locationSlot.setValueList(RIM_FACTORY.createValueList(valueList));
    extrinsicObject.getSlot().add(locationSlot);
    SlotType1 boundsSlot = stHelper.create("bounds", (String) null, "urn:ogc:def:dataType:ISO-19107:2003:GM_Envelope");
    EnvelopeType bounds = GML_FACTORY.createEnvelopeType();
    bounds.setSrsName("urn:ogc:def:crs:EPSG::4326");
    directPosition = GML_FACTORY.createDirectPositionType();
    directPosition.getValue().add(112.267472);
    directPosition.getValue().add(33.467944);
    bounds.setUpperCorner(directPosition);
    directPosition = GML_FACTORY.createDirectPositionType();
    directPosition.getValue().add(110.267472);
    directPosition.getValue().add(30.467944);
    bounds.setLowerCorner(directPosition);
    valueList = WRS_FACTORY.createValueListType();
    anyValue = WRS_FACTORY.createAnyValueType();
    anyValue.getContent().add(GML_FACTORY.createEnvelope(bounds));
    valueList.getAnyValue().add(anyValue);
    boundsSlot.setValueList(RIM_FACTORY.createValueList(valueList));
    extrinsicObject.getSlot().add(boundsSlot);
    extrinsicObject.getSlot().add(stHelper.create("region", "USA", "urn:ogc:def:ebRIM-ClassificationScheme:UNSD:GlobalRegions"));
    List<String> values = new ArrayList<>();
    values.add("youtube");
    values.add("myCamera");
    extrinsicObject.getSlot().add(stHelper.create("inputDataSources", values, "xs:string"));
    values = new ArrayList<>();
    values.add("video");
    values.add("sensor");
    extrinsicObject.getSlot().add(stHelper.create("dataTypes", values, "xs:string"));
    extrinsicObject.getSlot().add(stHelper.create("securityLevel", "role=guest", "xs:string"));
    extrinsicObject.setName(istHelper.create("Node Name"));
    extrinsicObject.setDescription(istHelper.create("A little something describing this node in less than 1024 characters"));
    extrinsicObject.setVersionInfo(getVersionInfo("2.9.x"));
    ClassificationType classification = RIM_FACTORY.createClassificationType();
    classification.setId("urn:classification:id0");
    classification.setClassifiedObject("classifiedObjectId");
    extrinsicObject.getClassification().add(classification);
    return extrinsicObject;
}
Also used : EnvelopeType(net.opengis.gml.v_3_1_1.EnvelopeType) SlotType1(oasis.names.tc.ebxml_regrep.xsd.rim._3.SlotType1) DirectPositionType(net.opengis.gml.v_3_1_1.DirectPositionType) ValueListType(net.opengis.cat.wrs.v_1_0_2.ValueListType) ArrayList(java.util.ArrayList) ExtrinsicObjectType(oasis.names.tc.ebxml_regrep.xsd.rim._3.ExtrinsicObjectType) PointType(net.opengis.gml.v_3_1_1.PointType) AnyValueType(net.opengis.cat.wrs.v_1_0_2.AnyValueType) ClassificationType(oasis.names.tc.ebxml_regrep.xsd.rim._3.ClassificationType)

Example 2 with EnvelopeType

use of org.geosdi.geoplatform.xml.gml.v311.EnvelopeType in project geotoolkit by Geomatys.

the class GetCoverageType method getEnvelope.

/**
 * {@inheritDoc}
 */
@Override
public Envelope getEnvelope() throws FactoryException {
    if (domainSubset == null || domainSubset.getSpatialSubSet() == null || domainSubset.getSpatialSubSet().getEnvelope() == null) {
        return null;
    }
    final EnvelopeType env = domainSubset.getSpatialSubSet().getEnvelope();
    final List<DirectPositionType> positions = env.getPos();
    if (positions == null || positions.isEmpty()) {
        return null;
    }
    final DirectPositionType lows = positions.get(0);
    final DirectPositionType highs = positions.get(1);
    final CoordinateReferenceSystem crs = getCRS();
    final GeneralEnvelope objEnv = new GeneralEnvelope(crs);
    objEnv.setRange(0, lows.getValue().get(0), highs.getValue().get(0));
    objEnv.setRange(1, lows.getValue().get(1), highs.getValue().get(1));
    // If the CRS has a vertical part, then the envelope to return should be a 3D one.
    if (CRS.getVerticalComponent(crs, true) != null) {
        objEnv.setRange(2, lows.getValue().get(2), highs.getValue().get(2));
    }
    return objEnv;
}
Also used : EnvelopeType(org.geotoolkit.gml.xml.v311.EnvelopeType) GridEnvelopeType(org.geotoolkit.gml.xml.v311.GridEnvelopeType) DirectPositionType(org.geotoolkit.gml.xml.v311.DirectPositionType) CoordinateReferenceSystem(org.opengis.referencing.crs.CoordinateReferenceSystem) GeneralEnvelope(org.apache.sis.geometry.GeneralEnvelope)

Example 3 with EnvelopeType

use of org.geosdi.geoplatform.xml.gml.v311.EnvelopeType in project geotoolkit by Geomatys.

the class OwcXmlIO method write.

private static FeedType write(final MapLayers context) throws FactoryException {
    final FeedType feed = ATOM_FACTORY.createFeedType();
    final LinkType link = ATOM_FACTORY.createLinkType();
    link.setRel("profile");
    link.setHref("http://www.opengis.net/spec/owc-atom/1.0/req/core");
    link.setTitle(context.getIdentifier() == null ? "" : context.getIdentifier());
    feed.getAuthorOrCategoryOrContributor().add(ATOM_FACTORY.createFeedTypeLink(link));
    final TextType title = ATOM_FACTORY.createTextType();
    title.getContent().add(context.getIdentifier() == null ? "" : context.getIdentifier());
    feed.getAuthorOrCategoryOrContributor().add(ATOM_FACTORY.createFeedTypeTitle(title));
    final Envelope aoi = context.getAreaOfInterest();
    if (aoi != null) {
        final String ogc = IdentifiedObjects.lookupURN(aoi.getCoordinateReferenceSystem(), null);
        final WhereType where = GEORSS_FACTORY.createWhereType();
        final DirectPositionType lowerCorner = new DirectPositionType(aoi.getLowerCorner());
        final DirectPositionType upperCorner = new DirectPositionType(aoi.getUpperCorner());
        final EnvelopeType envelopeType = new EnvelopeType(null, lowerCorner, upperCorner, ogc);
        envelopeType.setSrsDimension(2);
        where.setEnvelope(envelopeType);
        feed.getAuthorOrCategoryOrContributor().add(GEORSS_FACTORY.createWhere(where));
    }
    for (final MapItem mapItem : context.getComponents()) {
        toEntry(null, mapItem, feed.getAuthorOrCategoryOrContributor());
    }
    return feed;
}
Also used : WhereType(org.geotoolkit.georss.xml.v100.WhereType) FeedType(org.w3._2005.atom.FeedType) EnvelopeType(org.geotoolkit.gml.xml.v311.EnvelopeType) DirectPositionType(org.geotoolkit.gml.xml.v311.DirectPositionType) LinkType(org.w3._2005.atom.LinkType) Envelope(org.opengis.geometry.Envelope) MapItem(org.apache.sis.portrayal.MapItem) TextType(org.w3._2005.atom.TextType)

Example 4 with EnvelopeType

use of org.geosdi.geoplatform.xml.gml.v311.EnvelopeType in project geotoolkit by Geomatys.

the class OWCTest method owcMarshallTest.

@Test
public void owcMarshallTest() throws JAXBException, IOException, ParserConfigurationException, SAXException {
    final FeedType feed = new FeedType();
    final List<Object> entriesToSet = feed.getAuthorOrCategoryOrContributor();
    final IdType idFeed = new IdType();
    idFeed.setValue("Test id");
    entriesToSet.add(OBJ_ATOM_FACT.createEntryTypeId(idFeed));
    final TextType title = new TextType();
    title.getContent().add("Test");
    entriesToSet.add(OBJ_ATOM_FACT.createEntryTypeTitle(title));
    final String layerName = "testlayer";
    final String url = "http://myhost.com/constellation/WS/wms/test";
    final DirectPositionType lowerCorner = new DirectPositionType(-180.0, -90.0);
    final DirectPositionType upperCorner = new DirectPositionType(180.0, 90.0);
    final EnvelopeType envelope = new EnvelopeType(null, lowerCorner, upperCorner, "CRS:84");
    final WhereType where = new WhereType();
    where.setEnvelope(envelope);
    entriesToSet.add(OBJ_GEORSS_FACT.createWhere(where));
    final EntryType newEntry = new EntryType();
    final List<Object> entryThings = newEntry.getAuthorOrCategoryOrContent();
    final IdType idNewEntry = new IdType();
    idNewEntry.setValue("Web Map Service Layer");
    entryThings.add(OBJ_ATOM_FACT.createEntryTypeId(idNewEntry));
    final TextType titleNewEntry = new TextType();
    titleNewEntry.getContent().add(layerName);
    entryThings.add(OBJ_ATOM_FACT.createEntryTypeTitle(title));
    final org.w3._2005.atom.ContentType content = new org.w3._2005.atom.ContentType();
    content.setType("html");
    entryThings.add(OBJ_ATOM_FACT.createEntryTypeContent(content));
    final CategoryType category = new CategoryType();
    category.setScheme("http://www.opengis.net/spec/owc/active");
    category.setTerm("true");
    entryThings.add(OBJ_ATOM_FACT.createEntryTypeCategory(category));
    final OfferingType offering = new OfferingType();
    offering.setCode("http://www.opengis.net/spec/owc-atom/1.0/req/wms");
    final OperationType opCaps = new OperationType();
    opCaps.setCode("GetCapabilities");
    opCaps.setMethod(MethodCodeType.GET);
    final StringBuilder capsUrl = new StringBuilder();
    capsUrl.append(url).append("?REQUEST=GetCapabilities&SERVICE=WMS");
    opCaps.setHref(capsUrl.toString());
    offering.getOperationOrContentOrStyleSet().add(OBJ_OWC_FACT.createOfferingTypeOperation(opCaps));
    final OperationType opGetMap = new OperationType();
    opGetMap.setCode("GetMap");
    opGetMap.setMethod(MethodCodeType.GET);
    final String defStyle = "default";
    final StringBuilder getMapUrl = new StringBuilder();
    getMapUrl.append(url).append("?REQUEST=GetMap&SERVICE=WMS&FORMAT=image/png&TRANSPARENT=true&WIDTH=1024&HEIGHT=768&CRS=CRS:84&BBOX=").append("-5,40,15,60").append("&LAYERS=").append(layerName).append("&STYLES=").append(defStyle);
    opGetMap.setHref(getMapUrl.toString());
    offering.getOperationOrContentOrStyleSet().add(OBJ_OWC_FACT.createOfferingTypeOperation(opGetMap));
    entryThings.add(OBJ_OWC_FACT.createOffering(offering));
    entriesToSet.add(OBJ_ATOM_FACT.createEntry(newEntry));
    final Marshaller marsh = OwcMarshallerPool.getPool().acquireMarshaller();
    final StringWriter sw = new StringWriter();
    marsh.marshal(feed, sw);
    OwcMarshallerPool.getPool().recycle(marsh);
    assertXmlEquals(EXP_RESULT, sw.toString(), "xmlns:*");
}
Also used : EnvelopeType(org.geotoolkit.gml.xml.v311.EnvelopeType) Marshaller(javax.xml.bind.Marshaller) DirectPositionType(org.geotoolkit.gml.xml.v311.DirectPositionType) WhereType(org.geotoolkit.georss.xml.v100.WhereType) StringWriter(java.io.StringWriter) org.w3._2005.atom(org.w3._2005.atom) Test(org.junit.Test)

Example 5 with EnvelopeType

use of org.geosdi.geoplatform.xml.gml.v311.EnvelopeType in project geotoolkit by Geomatys.

the class FilterXMLBindingTest method filterMarshalingTest.

/**
 * Test simple Record Marshalling.
 *
 * @throws JAXBException
 */
@Test
public void filterMarshalingTest() throws JAXBException, IOException, ParserConfigurationException, SAXException {
    /*
         * Test marshalling spatial filter
         */
    DirectPositionType lowerCorner = new DirectPositionType(10.0, 11.0);
    DirectPositionType upperCorner = new DirectPositionType(10.0, 11.0);
    EnvelopeType envelope = new EnvelopeType(lowerCorner, upperCorner, "EPSG:4326");
    OverlapsType filterElement = new OverlapsType(new PropertyNameType("boundingBox"), envelope);
    FilterType filter = new FilterType(filterElement);
    StringWriter sw = new StringWriter();
    marshaller.marshal(filter, sw);
    String result = sw.toString();
    String expResult = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>" + '\n' + "<ogc:Filter xmlns:ogc=\"http://www.opengis.net/ogc\" xmlns:gml=\"http://www.opengis.net/gml\">" + '\n' + "    <ogc:Overlaps>" + '\n' + "        <ogc:PropertyName>boundingBox</ogc:PropertyName>" + '\n' + "        <gml:Envelope srsName=\"EPSG:4326\">" + '\n' + "            <gml:lowerCorner>10.0 11.0</gml:lowerCorner>" + '\n' + "            <gml:upperCorner>10.0 11.0</gml:upperCorner>" + '\n' + "        </gml:Envelope>" + '\n' + "    </ogc:Overlaps>" + '\n' + "</ogc:Filter>" + '\n';
    LOGGER.log(Level.FINER, "result: {0}", result);
    LOGGER.log(Level.FINER, "expected: {0}", expResult);
    assertXmlEquals(expResult, result, "xmlns:*");
    ObjectFactory factory = new ObjectFactory();
    final BBOXType bbox = new BBOXType("propName", envelope);
    org.geotoolkit.ogc.xml.v200.FilterType filter2 = new org.geotoolkit.ogc.xml.v200.FilterType(bbox);
    sw = new StringWriter();
    marshaller.marshal(filter2, sw);
    result = sw.toString();
    expResult = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n" + "<fes:Filter xmlns:fes=\"http://www.opengis.net/fes/2.0\" xmlns:ns8=\"http://www.opengis.net/gml\">\n" + "  <fes:BBOX>\n" + "    <fes:ValueReference>propName</fes:ValueReference>\n" + "    <ns8:Envelope srsName=\"EPSG:4326\">\n" + "      <ns8:lowerCorner>10.0 11.0</ns8:lowerCorner>\n" + "      <ns8:upperCorner>10.0 11.0</ns8:upperCorner>\n" + "    </ns8:Envelope>\n" + "  </fes:BBOX>\n" + "</fes:Filter>";
    assertXmlEquals(expResult, result, "xmlns:*");
    /*--------------------------------------------*/
    /*- --------------- DEBUG --------------------*/
    /*--------------------------------------------*/
    String[] arr = new String[2];
    arr[0] = "boby";
    arr[1] = "DESC";
    SortPropertyType sp = new SortPropertyType(arr[0], SortOrderType.valueOf(arr[1]));
    SortByType sort = new SortByType(Arrays.asList(sp));
    JAXBElement<SortByType> jbSort = factory.createSortBy(sort);
    // marshaller.marshal(jbSort, System.out);
    sp = new SortPropertyType(arr[0], FilterUtilities.sortOrder(arr[1]));
    sort = new SortByType(Arrays.asList(sp));
    jbSort = factory.createSortBy(sort);
    // marshaller.marshal(jbSort, System.out);
    BBOXType filterBox = new BBOXType("boundingBox", "$test");
    org.geotoolkit.ogc.xml.v200.FilterType filter3 = new org.geotoolkit.ogc.xml.v200.FilterType(filterBox);
    sw = new StringWriter();
    marshaller.marshal(filter3, sw);
    result = sw.toString();
    expResult = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n" + "<fes:Filter xmlns:fes=\"http://www.opengis.net/fes/2.0\">\n" + "  <fes:BBOX>\n" + "    <fes:ValueReference>boundingBox</fes:ValueReference>$test</fes:BBOX>\n" + "</fes:Filter>";
    assertXmlEquals(expResult, result, "xmlns:*");
    TimeAfterType filterAfter = new TimeAfterType("boundingBox", "$test");
    org.geotoolkit.ogc.xml.v200.FilterType filter4 = new org.geotoolkit.ogc.xml.v200.FilterType(filterAfter);
    sw = new StringWriter();
    marshaller.marshal(filter4, sw);
    result = sw.toString();
    expResult = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n" + "<fes:Filter xmlns:fes=\"http://www.opengis.net/fes/2.0\">\n" + "  <fes:After>\n" + "    <fes:ValueReference>boundingBox</fes:ValueReference>$test</fes:After>\n" + "</fes:Filter>";
    assertXmlEquals(expResult, result, "xmlns:*");
    final org.geotoolkit.gml.xml.v321.ObjectFactory gmlFactory = new org.geotoolkit.gml.xml.v321.ObjectFactory();
    final org.geotoolkit.ogc.xml.v200.ObjectFactory fesFactory = new org.geotoolkit.ogc.xml.v200.ObjectFactory();
    PropertyIsBetweenType pes = new PropertyIsBetweenType();
    pes.setExpression(fesFactory.createValueReference((String) "prop"));
    final LowerBoundaryType lower = new LowerBoundaryType();
    final TimeInstantType ti = new TimeInstantType("2002");
    final LiteralType lowlit = new LiteralType(gmlFactory.createTimeInstant(ti));
    lower.setExpression(fesFactory.createLiteral(lowlit));
    pes.setLowerBoundary(lower);
    final UpperBoundaryType upper = new UpperBoundaryType();
    final TimeInstantType ti2 = new TimeInstantType("2004");
    final LiteralType upplit = new LiteralType(gmlFactory.createTimeInstant(ti2));
    upper.setExpression(fesFactory.createLiteral(upplit));
    pes.setUpperBoundary(upper);
    org.geotoolkit.ogc.xml.v200.FilterType filter5 = new org.geotoolkit.ogc.xml.v200.FilterType(pes);
    sw = new StringWriter();
    marshaller.marshal(filter5, sw);
    result = sw.toString();
    expResult = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n" + "<fes:Filter xmlns:gml=\"http://www.opengis.net/gml/3.2\" xmlns:fes=\"http://www.opengis.net/fes/2.0\">\n" + "  <fes:PropertyIsBetween>\n" + "    <fes:ValueReference>prop</fes:ValueReference>\n" + "    <fes:LowerBoundary>\n" + "      <fes:Literal>\n" + "        <gml:TimeInstant>\n" + "          <gml:timePosition>2002</gml:timePosition>\n" + "        </gml:TimeInstant>\n" + "      </fes:Literal>\n" + "    </fes:LowerBoundary>\n" + "    <fes:UpperBoundary>\n" + "      <fes:Literal>\n" + "        <gml:TimeInstant>\n" + "          <gml:timePosition>2004</gml:timePosition>\n" + "        </gml:TimeInstant>\n" + "      </fes:Literal>\n" + "    </fes:UpperBoundary>\n" + "  </fes:PropertyIsBetween>\n" + "</fes:Filter>";
    assertXmlEquals(expResult, result, "xmlns:*");
}
Also used : OverlapsType(org.geotoolkit.ogc.xml.v110.OverlapsType) DirectPositionType(org.geotoolkit.gml.xml.v311.DirectPositionType) SortByType(org.geotoolkit.ogc.xml.v110.SortByType) TimeInstantType(org.geotoolkit.gml.xml.v321.TimeInstantType) StringWriter(java.io.StringWriter) ObjectFactory(org.geotoolkit.ogc.xml.v110.ObjectFactory) SortPropertyType(org.geotoolkit.ogc.xml.v110.SortPropertyType) PropertyIsBetweenType(org.geotoolkit.ogc.xml.v200.PropertyIsBetweenType) PropertyNameType(org.geotoolkit.ogc.xml.v110.PropertyNameType) EnvelopeType(org.geotoolkit.gml.xml.v311.EnvelopeType) LiteralType(org.geotoolkit.ogc.xml.v200.LiteralType) TimeAfterType(org.geotoolkit.ogc.xml.v200.TimeAfterType) UpperBoundaryType(org.geotoolkit.ogc.xml.v200.UpperBoundaryType) FilterType(org.geotoolkit.ogc.xml.v110.FilterType) BBOXType(org.geotoolkit.ogc.xml.v200.BBOXType) LowerBoundaryType(org.geotoolkit.ogc.xml.v200.LowerBoundaryType)

Aggregations

EnvelopeType (net.opengis.gml.v_3_1_1.EnvelopeType)11 EnvelopeType (org.geotoolkit.gml.xml.v311.EnvelopeType)11 DirectPositionType (org.geotoolkit.gml.xml.v311.DirectPositionType)9 JAXBElement (javax.xml.bind.JAXBElement)8 DirectPositionType (net.opengis.gml.v_3_1_1.DirectPositionType)8 BBOXType (net.opengis.filter.v_1_1_0.BBOXType)6 Test (org.junit.Test)6 Envelope (org.locationtech.jts.geom.Envelope)6 ArrayList (java.util.ArrayList)5 EnvelopeType (org.geosdi.geoplatform.xml.gml.v311.EnvelopeType)5 StringWriter (java.io.StringWriter)4 List (java.util.List)4 FilterType (net.opengis.filter.v_1_1_0.FilterType)4 AnyValueType (net.opengis.cat.wrs.v_1_0_2.AnyValueType)3 PointType (net.opengis.gml.v_3_1_1.PointType)3 EnvelopeType (net.opengis.swe.x101.EnvelopeType)3 EnvelopeType (org.geotoolkit.gml.xml.v321.EnvelopeType)3 OverlapsType (org.geotoolkit.ogc.xml.v110.OverlapsType)3 PropertyNameType (org.geotoolkit.ogc.xml.v110.PropertyNameType)3 Geometry (org.locationtech.jts.geom.Geometry)3