use of mpicbg.models.TransformList in project TrakEM2 by trakem2.
the class TMLHandler method makeCoordinateTransform.
private final void makeCoordinateTransform(String type, final HashMap<String, String> ht_attributes) {
try {
type = type.toLowerCase();
if (type.equals("ict_transform")) {
final CoordinateTransform ct = (CoordinateTransform) Class.forName(ht_attributes.get("class")).newInstance();
ct.init(ht_attributes.get("data"));
if (ct_list_stack.isEmpty()) {
if (last_patch != null)
last_ct = ct;
} else {
ct_list_stack.get(ct_list_stack.size() - 1).add(ct);
}
} else if (type.equals("iict_transform")) {
final InvertibleCoordinateTransform ict = (InvertibleCoordinateTransform) Class.forName(ht_attributes.get("class")).newInstance();
ict.init(ht_attributes.get("data"));
if (ct_list_stack.isEmpty()) {
if (last_patch != null)
last_ct = ict;
else if (last_stack != null)
last_ict = ict;
} else {
ct_list_stack.get(ct_list_stack.size() - 1).add(ict);
}
} else if (type.equals("ict_transform_list")) {
final CoordinateTransformList<CoordinateTransform> ctl = new CoordinateTransformList<CoordinateTransform>();
if (ct_list_stack.isEmpty()) {
if (last_patch != null)
last_ct = ctl;
} else
ct_list_stack.get(ct_list_stack.size() - 1).add(ctl);
ct_list_stack.add((TransformList) ctl);
} else if (type.equals("iict_transform_list")) {
final InvertibleCoordinateTransformList<InvertibleCoordinateTransform> ictl = new InvertibleCoordinateTransformList<InvertibleCoordinateTransform>();
if (ct_list_stack.isEmpty()) {
if (last_patch != null)
last_ct = ictl;
else if (last_stack != null)
last_ict = ictl;
} else
ct_list_stack.get(ct_list_stack.size() - 1).add(ictl);
ct_list_stack.add((TransformList) ictl);
}
} catch (Exception e) {
IJError.print(e);
}
}
Aggregations