use of org.geotoolkit.gml.xml.v321.DirectPositionType in project geotoolkit by Geomatys.
the class OGC200toGTTransformer method visitEnv.
public Expression visitEnv(final EnvelopeType entry) throws FactoryException {
final String srs = entry.getSrsName();
final DirectPositionType lower = entry.getLowerCorner();
final DirectPositionType upper = entry.getUpperCorner();
GeneralEnvelope genv = new GeneralEnvelope(CRS.forCode(srs));
genv.setRange(0, lower.getOrdinate(0), upper.getOrdinate(0));
genv.setRange(1, lower.getOrdinate(1), upper.getOrdinate(1));
return filterFactory.literal(genv);
}
use of org.geotoolkit.gml.xml.v321.DirectPositionType in project geotoolkit by Geomatys.
the class VectorType method getGeometry.
@Override
public AbstractGeometry getGeometry(final URI crs) {
final org.geotoolkit.swe.xml.v100.CoordinateType lat = getLatitude();
final org.geotoolkit.swe.xml.v100.CoordinateType lon = getLongitude();
if (lat != null && lon != null) {
final DirectPositionType dp = new DirectPositionType(lat.getQuantity().getValue(), lon.getQuantity().getValue());
final PointType pt = new PointType(dp);
if (crs != null) {
pt.setSrsName(crs.toString());
}
return pt;
}
return null;
}
use of org.geotoolkit.gml.xml.v321.DirectPositionType in project geotoolkit by Geomatys.
the class WmtsXmlBindingTest method marshallingTest.
/**
* Test simple Record Marshalling.
*
* @throws java.lang.Exception
*/
@Test
public void marshallingTest() throws Exception {
PointType pt = new PointType("p1", new DirectPositionType(-90.080000, 29.982000));
TileMatrix matrix = new TileMatrix(new CodeType("16d"), 55218.001386, 256, 256, 3, 3);
StringWriter sw = new StringWriter();
marshaller.marshal(matrix, sw);
String result = sw.toString();
// System.out.println("RESULT:" + result);
String expResult = "<TileMatrix xmlns=\"http://www.opengis.net/wmts/1.0\" xmlns:ows=\"http://www.opengis.net/ows/1.1\">" + '\n' + " <ows:Identifier>16d</ows:Identifier>" + '\n' + " <ScaleDenominator>55218.001386</ScaleDenominator>" + '\n' + " <TileWidth>256</TileWidth>" + '\n' + " <TileHeight>256</TileHeight>" + '\n' + " <MatrixWidth>3</MatrixWidth>" + '\n' + " <MatrixHeight>3</MatrixHeight>" + '\n' + "</TileMatrix>" + '\n';
assertXmlEquals(expResult, result, "xmlns:*");
}
use of org.geotoolkit.gml.xml.v321.DirectPositionType in project geotoolkit by Geomatys.
the class GmlXMLBindingTest method marshallingTest.
/**
* Test simple Record Marshalling.
*
* @throws JAXBException
*/
@Test
public void marshallingTest() throws Exception {
DirectPositionType lower = new DirectPositionType(-30.711, 134.196);
DirectPositionType upper = new DirectPositionType(-30.702, 134.205);
EnvelopeType env = new EnvelopeType("bound-1", lower, upper, "urn:ogc:def:crs:EPSG:6.8:4283");
StringWriter sw = new StringWriter();
marshaller.marshal(FACTORY.createEnvelope(env), sw);
String result = sw.toString();
// we remove the first line
result = result.substring(result.indexOf("?>") + 2).trim();
String expResult = "<gml:Envelope xmlns:gml=\"" + GML + '"' + " srsName=\"urn:ogc:def:crs:EPSG:6.8:4283\">" + '\n' + " <gml:lowerCorner>-30.711 134.196</gml:lowerCorner>" + '\n' + " <gml:upperCorner>-30.702 134.205</gml:upperCorner>" + '\n' + "</gml:Envelope>" + '\n';
assertXmlEquals(expResult, result, "xmlns:*");
Duration d1 = javax.xml.datatype.DatatypeFactory.newInstance().newDuration("P2D");
TimePeriodType tp = new TimePeriodType(d1);
marshaller.marshal(FACTORY.createTimePeriod(tp), sw);
TimePositionType tpos = new TimePositionType("2002-08-15");
tp = new TimePeriodType(tpos);
marshaller.marshal(FACTORY.createTimePeriod(tp), sw);
// System.out.println(sw.toString());
LineStringSegmentType ls = new LineStringSegmentType();
DirectPositionListType posList = new DirectPositionListType();
posList.setValue(Arrays.asList(1.0, 1.1, 1.2));
ls.setPosList(posList);
sw = new StringWriter();
marshaller.marshal(FACTORY.createLineStringSegment(ls), sw);
result = sw.toString();
// we remove the first line
result = result.substring(result.indexOf("?>") + 2).trim();
expResult = "<gml:LineStringSegment xmlns:gml=\"" + GML + "\">\n" + " <gml:posList>1.0 1.1 1.2</gml:posList>" + '\n' + "</gml:LineStringSegment>" + '\n';
assertXmlEquals(expResult, result, "xmlns:*");
ls = new LineStringSegmentType();
DirectPositionType pos1 = new DirectPositionType(Arrays.asList(1.1, 1.2));
DirectPositionType pos2 = new DirectPositionType(Arrays.asList(2.3, 48.1));
ls.getPos().add(pos1);
ls.getPos().add(pos2);
sw = new StringWriter();
marshaller.marshal(FACTORY.createLineStringSegment(ls), sw);
result = sw.toString();
// we remove the first line
result = result.substring(result.indexOf("?>") + 2).trim();
expResult = "<gml:LineStringSegment xmlns:gml=\"" + GML + "\">\n" + " <gml:pos>1.1 1.2</gml:pos>" + '\n' + " <gml:pos>2.3 48.1</gml:pos>" + '\n' + "</gml:LineStringSegment>" + '\n';
assertXmlEquals(expResult, result, "xmlns:*");
}
use of org.geotoolkit.gml.xml.v321.DirectPositionType in project geotoolkit by Geomatys.
the class GeometrytoJTSTest method gmlPointToJTSTest3D.
@Test
public void gmlPointToJTSTest3D() throws Exception {
Point expected = GF.createPoint(new Coordinate(0, 1, 1));
expected.setSRID(2154);
PointType gml = new PointType(new DirectPositionType(0.0, 1.0, 1.0));
final Geometry result = GeometrytoJTS.toJTS(gml);
Assert.assertEquals(expected, result);
}
Aggregations