use of org.opengis.referencing.cs.AffineCS in project sis by apache.
the class DefaultImageCRSTest method testXML.
/**
* Implementation of {@link #testCartesianXML()} and {@link #testAffineXML()}.
*/
private void testXML(final boolean cartesian) throws JAXBException {
String expected = "<gml:ImageCRS xmlns:gml=\"" + Namespaces.GML + "\">\n" + " <gml:name>An image CRS</gml:name>\n" + " <gml:cartesianCS>\n" + " <gml:CartesianCS gml:id=\"Grid\">\n" + " <gml:name>Grid</gml:name>\n" + " <gml:axis>\n" + " <gml:CoordinateSystemAxis uom=\"urn:ogc:def:uom:EPSG::9201\" gml:id=\"Column\">\n" + " <gml:name>Column</gml:name>\n" + " <gml:axisAbbrev>i</gml:axisAbbrev>\n" + " <gml:axisDirection codeSpace=\"EPSG\">columnPositive</gml:axisDirection>\n" + " </gml:CoordinateSystemAxis>\n" + " </gml:axis>\n" + " <gml:axis>\n" + " <gml:CoordinateSystemAxis uom=\"urn:ogc:def:uom:EPSG::9201\" gml:id=\"Row\">\n" + " <gml:name>Row</gml:name>\n" + " <gml:axisAbbrev>j</gml:axisAbbrev>\n" + " <gml:axisDirection codeSpace=\"EPSG\">rowPositive</gml:axisDirection>\n" + " </gml:CoordinateSystemAxis>\n" + " </gml:axis>\n" + " </gml:CartesianCS>\n" + " </gml:cartesianCS>\n" + " <gml:imageDatum>\n" + " <gml:ImageDatum gml:id=\"C1\">\n" + " <gml:name>C1</gml:name>\n" + " <gml:pixelInCell>cell center</gml:pixelInCell>\n" + " </gml:ImageDatum>\n" + " </gml:imageDatum>\n" + "</gml:ImageCRS>";
if (!cartesian) {
expected = expected.replace("CartesianCS", "AffineCS").replace("cartesianCS", "affineCS");
}
final String xml = marshal(create(cartesian));
assertXmlEquals(expected, xml, "xmlns:*");
final DefaultImageCRS crs = unmarshal(DefaultImageCRS.class, xml);
assertEquals("name", "An image CRS", crs.getName().getCode());
assertEquals("datum.name", "C1", crs.getDatum().getName().getCode());
final CoordinateSystem cs = crs.getCoordinateSystem();
assertInstanceOf("coordinateSystem", cartesian ? CartesianCS.class : AffineCS.class, cs);
assertEquals("cs.isCartesian", cartesian, cs instanceof CartesianCS);
assertEquals("cs.name", "Grid", cs.getName().getCode());
assertEquals("cs.dimension", 2, cs.getDimension());
assertAxisDirectionsEqual("cartesianCS", cs, AxisDirection.COLUMN_POSITIVE, AxisDirection.ROW_POSITIVE);
assertEquals("cs.axis[0].name", "Column", cs.getAxis(0).getName().getCode());
assertEquals("cs.axis[1].name", "Row", cs.getAxis(1).getName().getCode());
assertEquals("cs.axis[0].abbreviation", "i", cs.getAxis(0).getAbbreviation());
assertEquals("cs.axis[1].abbreviation", "j", cs.getAxis(1).getAbbreviation());
}
Aggregations