Search in sources :

Example 1 with TransformList

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);
    }
}
Also used : InvertibleCoordinateTransformList(mpicbg.trakem2.transform.InvertibleCoordinateTransformList) InvertibleCoordinateTransform(mpicbg.trakem2.transform.InvertibleCoordinateTransform) InvertibleCoordinateTransformList(mpicbg.trakem2.transform.InvertibleCoordinateTransformList) CoordinateTransformList(mpicbg.trakem2.transform.CoordinateTransformList) InvertibleCoordinateTransformList(mpicbg.trakem2.transform.InvertibleCoordinateTransformList) TransformList(mpicbg.models.TransformList) CoordinateTransformList(mpicbg.trakem2.transform.CoordinateTransformList) CoordinateTransform(mpicbg.trakem2.transform.CoordinateTransform) InvertibleCoordinateTransform(mpicbg.trakem2.transform.InvertibleCoordinateTransform) SAXException(org.xml.sax.SAXException) SAXParseException(org.xml.sax.SAXParseException)

Aggregations

TransformList (mpicbg.models.TransformList)1 CoordinateTransform (mpicbg.trakem2.transform.CoordinateTransform)1 CoordinateTransformList (mpicbg.trakem2.transform.CoordinateTransformList)1 InvertibleCoordinateTransform (mpicbg.trakem2.transform.InvertibleCoordinateTransform)1 InvertibleCoordinateTransformList (mpicbg.trakem2.transform.InvertibleCoordinateTransformList)1 SAXException (org.xml.sax.SAXException)1 SAXParseException (org.xml.sax.SAXParseException)1