final BursaWolfParameters[] bursaWolf = ((DefaultGeodeticDatum) target).bursaWolf;
if (bursaWolf != null) {
for (int i=0; i<bursaWolf.length; i++) {
final BursaWolfParameters transformation = bursaWolf[i];
if (equals(source, transformation.targetDatum, false)) {
final XMatrix matrix = transformation.getAffineTransform();
matrix.invert();
return matrix;
}
}
}
}
/*
* No direct tranformation found. Search for a path through some intermediate datum.
* First, search if there is some BursaWolfParameters for the same target in both
* 'source' and 'target' datum. If such an intermediate is found, ask for a path
* as below:
*
* source --> [common datum] --> target
*/
if (source instanceof DefaultGeodeticDatum && target instanceof DefaultGeodeticDatum) {
final BursaWolfParameters[] sourceParam = ((DefaultGeodeticDatum) source).bursaWolf;
final BursaWolfParameters[] targetParam = ((DefaultGeodeticDatum) target).bursaWolf;
if (sourceParam!=null && targetParam!=null) {
GeodeticDatum sourceStep;
GeodeticDatum targetStep;
for (int i=0; i<sourceParam.length; i++) {
sourceStep = sourceParam[i].targetDatum;
for (int j=0; j<targetParam.length; j++) {
targetStep = targetParam[j].targetDatum;
if (equals(sourceStep, targetStep, false)) {
final XMatrix step1, step2;
if (exclusion == null) {
exclusion = new HashSet<GeodeticDatum>();
}
if (exclusion.add(source)) {
if (exclusion.add(target)) {