Search in sources :

Example 1 with PointType

use of org.geotoolkit.kml.xml.v220.PointType 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 PointType

use of org.geotoolkit.kml.xml.v220.PointType in project ddf by codice.

the class TestWfs10JTStoGML200Converter method testGMLToPointType.

@Test
public void testGMLToPointType() throws JAXBException, SAXException, IOException, ParseException, NullPointerException {
    String pointGML = Wfs10JTStoGML200Converter.convertGeometryToGML(getGeometryFromWkt(POINT)).replaceAll("\n", "");
    PointType pointType = (PointType) Wfs10JTStoGML200Converter.convertGMLToGeometryType(pointGML, Wfs10Constants.POINT);
    assertThat(Wfs10Constants.POINT.getLocalPart().equals(pointType.getJAXBElementName().getLocalPart()), is(Boolean.TRUE));
    String coords = pointType.getCoordinates().getValue().replaceAll("\n", "").trim();
    assertThat(POINT_COORDS.equals(coords), is(Boolean.TRUE));
}
Also used : PointType(ogc.schema.opengis.gml.v_2_1_2.PointType) MultiPointType(ogc.schema.opengis.gml.v_2_1_2.MultiPointType) LineString(com.vividsolutions.jts.geom.LineString) MultiLineString(com.vividsolutions.jts.geom.MultiLineString) Test(org.junit.Test)

Example 3 with PointType

use of org.geotoolkit.kml.xml.v220.PointType in project ddf by codice.

the class TestWfs10JTStoGML200Converter method testPointTypeToJAXB.

@Test
public void testPointTypeToJAXB() throws JAXBException, SAXException, IOException, ParseException, NullPointerException {
    String pointGML = Wfs10JTStoGML200Converter.convertGeometryToGML(getGeometryFromWkt(POINT));
    PointType pointType = (PointType) Wfs10JTStoGML200Converter.convertGMLToGeometryType(pointGML, Wfs10Constants.POINT);
    JAXBElement<PointType> pointTypeJAXBElement = (JAXBElement<PointType>) Wfs10JTStoGML200Converter.convertGeometryTypeToJAXB(pointType);
    JAXB.marshal(pointTypeJAXBElement, writer);
    String xml = writer.toString();
    Diff diff = XMLUnit.compareXML(xml, POINT_GML);
    assertTrue(XMLUNIT_SIMILAR, diff.similar());
    assertThat(diff.similar(), is(Boolean.TRUE));
    assertThat(diff.identical(), is(Boolean.FALSE));
}
Also used : Diff(org.custommonkey.xmlunit.Diff) PointType(ogc.schema.opengis.gml.v_2_1_2.PointType) MultiPointType(ogc.schema.opengis.gml.v_2_1_2.MultiPointType) LineString(com.vividsolutions.jts.geom.LineString) MultiLineString(com.vividsolutions.jts.geom.MultiLineString) JAXBElement(javax.xml.bind.JAXBElement) Test(org.junit.Test)

Example 4 with PointType

use of org.geotoolkit.kml.xml.v220.PointType in project ddf by codice.

the class SlotTypeConverter method getPoint.

private Optional<PointType> getPoint(Map<String, Object> pointMap) {
    Optional<PointType> optionalPoint = Optional.empty();
    if (MapUtils.isEmpty(pointMap)) {
        return optionalPoint;
    }
    BigInteger dimension = getBigIntFromMap(SRS_DIMENSION, pointMap);
    if (dimension != null) {
        if (!optionalPoint.isPresent()) {
            optionalPoint = Optional.of(GML_FACTORY.createPointType());
        }
        optionalPoint.get().setSrsDimension(dimension);
    }
    String valueToPopulate = MapUtils.getString(pointMap, SRS_NAME);
    if (StringUtils.isNotBlank(valueToPopulate)) {
        if (!optionalPoint.isPresent()) {
            optionalPoint = Optional.of(GML_FACTORY.createPointType());
        }
        optionalPoint.get().setSrsName(valueToPopulate);
    }
    valueToPopulate = MapUtils.getString(pointMap, POSITION);
    if (StringUtils.isNotBlank(valueToPopulate)) {
        String[] values = StringUtils.split(valueToPopulate);
        DirectPositionType directPosition = GML_FACTORY.createDirectPositionType();
        for (String value : values) {
            directPosition.getValue().add(Double.valueOf(value));
        }
        if (!optionalPoint.isPresent()) {
            optionalPoint = Optional.of(GML_FACTORY.createPointType());
        }
        optionalPoint.get().setPos(directPosition);
    }
    return optionalPoint;
}
Also used : DirectPositionType(net.opengis.gml.v_3_1_1.DirectPositionType) PointType(net.opengis.gml.v_3_1_1.PointType) BigInteger(java.math.BigInteger)

Example 5 with PointType

use of org.geotoolkit.kml.xml.v220.PointType in project ddf by codice.

the class WfsFilterDelegate method createPoint.

private JAXBElement<PointType> createPoint(String wkt) {
    Coordinate[] coordinates = getCoordinatesFromWkt(wkt);
    if (coordinates != null && coordinates.length > 0) {
        StringBuilder coordString = new StringBuilder();
        coordString.append(coordinates[0].x).append(",").append(coordinates[0].y);
        CoordinatesType coordinatesType = new CoordinatesType();
        coordinatesType.setValue(coordString.toString());
        PointType point = new PointType();
        point.setSrsName(srsName);
        point.setCoordinates(coordinatesType);
        return gmlObjectFactory.createPoint(point);
    } else {
        throw new IllegalArgumentException("Unable to parse Point coordinates from WKT String");
    }
}
Also used : Coordinate(com.vividsolutions.jts.geom.Coordinate) PointType(ogc.schema.opengis.gml.v_2_1_2.PointType) MultiPointType(ogc.schema.opengis.gml.v_2_1_2.MultiPointType) CoordinatesType(ogc.schema.opengis.gml.v_2_1_2.CoordinatesType)

Aggregations

PointType (org.geotoolkit.gml.xml.v311.PointType)15 ArrayList (java.util.ArrayList)14 DirectPositionType (org.geotoolkit.gml.xml.v311.DirectPositionType)14 Test (org.junit.Test)13 StringWriter (java.io.StringWriter)9 JAXBElement (javax.xml.bind.JAXBElement)9 PointType (net.opengis.gml.v_3_1_1.PointType)9 PointType (org.geotoolkit.gml.xml.v321.PointType)8 Geometry (org.locationtech.jts.geom.Geometry)8 Coordinate (org.locationtech.jts.geom.Coordinate)7 Point (org.locationtech.jts.geom.Point)6 StringReader (java.io.StringReader)5 List (java.util.List)5 DistanceBufferType (net.opengis.filter.v_1_1_0.DistanceBufferType)4 FeaturePropertyType (org.geotoolkit.gml.xml.v311.FeaturePropertyType)4 SamplingPointType (org.geotoolkit.sampling.xml.v100.SamplingPointType)4 LineString (org.locationtech.jts.geom.LineString)4 LineString (com.vividsolutions.jts.geom.LineString)3 MultiLineString (com.vividsolutions.jts.geom.MultiLineString)3 QName (javax.xml.namespace.QName)3