* VERTICAL CRS
* ---------------------------------------------------------------------- */
else if (type.equalsIgnoreCase("vertical")) {
final String csCode = getString(result, 7, code);
final String dmCode = getString(result, 8, code);
final VerticalCS cs = createVerticalCS (csCode);
final VerticalDatum datum = createVerticalDatum(dmCode);
final Map<String,Object> properties = generateProperties(name, epsg, area, scope, remarks);
crs = factory.createVerticalCRS(properties, datum, cs);
}
/* ----------------------------------------------------------------------
* COMPOUND CRS
*
* NOTE: This method invokes itself recursively.
* Consequently, we can't use 'result' anymore.
* ---------------------------------------------------------------------- */
else if (type.equalsIgnoreCase("compound")) {
final String code1 = getString(result, 11, code);
final String code2 = getString(result, 12, code);
result.close();
result = null;
final CoordinateReferenceSystem crs1, crs2;
if (!safetyGuard.add(epsg)) {
throw recursiveCall(CompoundCRS.class, epsg);
} try {
crs1 = createCoordinateReferenceSystem(code1);
crs2 = createCoordinateReferenceSystem(code2);
} finally {
safetyGuard.remove(epsg);
}
// Note: Don't invoke 'generateProperties' sooner.
final Map<String,Object> properties = generateProperties(name, epsg, area, scope, remarks);
crs = factory.createCompoundCRS(properties,
new CoordinateReferenceSystem[] {crs1, crs2});
}
/* ----------------------------------------------------------------------
* GEOCENTRIC CRS
* ---------------------------------------------------------------------- */
else if (type.equalsIgnoreCase("geocentric")) {
final String csCode = getString(result, 7, code);
final String dmCode = getString(result, 8, code);
final CoordinateSystem cs = createCoordinateSystem(csCode);
final GeodeticDatum datum = createGeodeticDatum (dmCode);
final Map<String,Object> properties = generateProperties(name, epsg, area, scope, remarks);
if (cs instanceof CartesianCS) {
crs = factory.createGeocentricCRS(properties, datum, (CartesianCS) cs);
} else if (cs instanceof SphericalCS) {
crs = factory.createGeocentricCRS(properties, datum, (SphericalCS) cs);
} else {
result.close();
throw new FactoryException(Errors.format(
ErrorKeys.ILLEGAL_COORDINATE_SYSTEM_FOR_CRS_$2,
cs.getClass(), GeocentricCRS.class));
}
}
/* ----------------------------------------------------------------------
* ENGINEERING CRS
* ---------------------------------------------------------------------- */