formatter.newLine();
formatter.indent(isWKT1 ? 0 : +1);
formatter.append(toFormattable(datum.getPrimeMeridian()));
formatter.indent(isWKT1 ? 0 : -1);
formatter.newLine();
CoordinateSystem cs = super.getCoordinateSystem();
if (isWKT1) { // WKT 1 writes unit before axes, while WKT 2 writes them after axes.
formatter.append(unit);
if (unit == null) {
formatter.setInvalidWKT(this, null);
}
/*
* Replaces the given coordinate system by an instance conform to the conventions used in WKT 1.
* Note that we can not delegate this task to subclasses, because XML unmarshalling of a geodetic
* CRS will NOT create an instance of a subclass (because the distinction between geographic and
* geocentric CRS is not anymore in ISO 19111:2007).
*/
if (!(cs instanceof EllipsoidalCS)) { // Tested first because this is the most common case.
if (cs instanceof CartesianCS) {
cs = Legacy.forGeocentricCRS((CartesianCS) cs, true);
} else {
formatter.setInvalidWKT(cs, null);
}
}
} else {
formatter.append(toFormattable(cs)); // The concept of CoordinateSystem was not explicit in WKT 1.
formatter.indent(+1);
}
final int dimension = cs.getDimension();
for (int i=0; i<dimension; i++) {
formatter.newLine();
formatter.append(toFormattable(cs.getAxis(i)));
}
if (!isWKT1) { // WKT 2 writes unit after axes, while WKT 1 wrote them before axes.
formatter.newLine();
formatter.append(unit);
formatter.indent(-1);