Search in sources :

Example 6 with XMLOptions

use of ini.trakem2.persistence.XMLOptions in project TrakEM2 by trakem2.

the class Project method save.

/**
 * Save the project regardless of what getLoader().hasChanges() reports.
 */
public String save() {
    // let it repaint the log window
    Thread.yield();
    XMLOptions options = new XMLOptions();
    options.overwriteXMLFile = true;
    options.export_images = false;
    options.patches_dir = null;
    options.include_coordinate_transform = true;
    String path = loader.save(this, options);
    if (null != path)
        restartAutosaving();
    return path;
}
Also used : XMLOptions(ini.trakem2.persistence.XMLOptions)

Example 7 with XMLOptions

use of ini.trakem2.persistence.XMLOptions in project TrakEM2 by trakem2.

the class Project method saveAs.

/**
 * This is not the saveAs used from the menus; this one is meant for programmatic access.
 */
public String saveAs(String xml_path, boolean overwrite) throws IllegalArgumentException {
    if (null == xml_path)
        throw new IllegalArgumentException("xml_path cannot be null.");
    XMLOptions options = new XMLOptions();
    options.overwriteXMLFile = overwrite;
    options.export_images = false;
    options.patches_dir = null;
    options.include_coordinate_transform = true;
    String path = loader.saveAs(xml_path, options);
    if (null != path)
        restartAutosaving();
    return path;
}
Also used : XMLOptions(ini.trakem2.persistence.XMLOptions)

Example 8 with XMLOptions

use of ini.trakem2.persistence.XMLOptions in project TrakEM2 by trakem2.

the class Project method exportXML2.

// A separate method to ensure that sb_body instance is garbage collected.
private final void exportXML2(final java.io.Writer writer, final String in, final XMLOptions options) throws Exception {
    final StringBuilder sb_body = new StringBuilder();
    // 2 - the project itself
    sb_body.append(in).append("<project \n").append(in).append("\tid=\"").append(id).append("\"\n").append(in).append("\ttitle=\"").append(title).append("\"\n");
    loader.insertXMLOptions(sb_body, in + "\t");
    // Write properties, with the additional property of the image_resizing_mode
    final HashMap<String, String> props = new HashMap<String, String>(ht_props);
    props.put("image_resizing_mode", Loader.getMipMapModeName(mipmaps_mode));
    props.put("first_mipmap_level_saved", Integer.toString(this.first_mipmap_level_saved));
    for (final Map.Entry<String, String> e : props.entrySet()) {
        sb_body.append(in).append('\t').append(e.getKey()).append("=\"").append(e.getValue()).append("\"\n");
    }
    sb_body.append(in).append(">\n");
    // 3 - export ProjectTree abstract hierarchy (skip the root since it wraps the project itself)
    project_tree.getExpandedStates(options.expanded_states);
    if (null != root_pt.getChildren()) {
        final String in2 = in + "\t";
        for (final ProjectThing pt : root_pt.getChildren()) {
            pt.exportXML(sb_body, in2, options);
        }
    }
    sb_body.append(in).append("</project>\n");
    writer.write(sb_body.toString());
}
Also used : HashMap(java.util.HashMap) Map(java.util.Map) HashMap(java.util.HashMap) TreeMap(java.util.TreeMap) ProjectThing(ini.trakem2.tree.ProjectThing)

Aggregations

XMLOptions (ini.trakem2.persistence.XMLOptions)4 ImagePlus (ij.ImagePlus)1 GenericDialog (ij.gui.GenericDialog)1 Project (ini.trakem2.Project)1 YesNoDialog (ini.trakem2.display.YesNoDialog)1 IFilter (ini.trakem2.imaging.filters.IFilter)1 LayerThing (ini.trakem2.tree.LayerThing)1 ProjectThing (ini.trakem2.tree.ProjectThing)1 Worker (ini.trakem2.utils.Worker)1 NoninvertibleTransformException (java.awt.geom.NoninvertibleTransformException)1 File (java.io.File)1 IOException (java.io.IOException)1 HashMap (java.util.HashMap)1 Map (java.util.Map)1 TreeMap (java.util.TreeMap)1 NoninvertibleModelException (mpicbg.models.NoninvertibleModelException)1