Search in sources :

Example 1 with ExportToImage

use of org.freeplane.features.export.mindmapmode.ExportToImage in project freeplane by freeplane.

the class PresentationPngExporter method exportSlide.

private void exportSlide(File presentationDirectory, Slide slide) {
    final NodeModel placedNode = slide.getCurrentPlacedNode();
    if (placedNode != null)
        slide.apply(presentationZoomFactor);
    else
        slide.apply(1f);
    mapViewComponent.validate();
    mapViewComponent.setSize(mapViewComponent.getPreferredSize());
    File exportFile = new File(presentationDirectory, FileUtils.validFileNameOf(slide.getName()) + ".png");
    final ExportToImage exporter = ExportToImage.toPNG();
    final Controller controller = Controller.getCurrentController();
    final MapModel map = controller.getMap();
    if (placedNode != null) {
        final Dimension slideSize;
        if (ResourceController.getResourceController().getBooleanProperty(SWITCH_TO_FULL_SCREEN_PROPERTY))
            slideSize = mapViewComponent.getGraphicsConfiguration().getBounds().getSize();
        else
            slideSize = SwingUtilities.getWindowAncestor(mapViewComponent).getSize();
        exporter.export(map, slideSize, placedNode, slide.getPlacedNodePosition(), exportFile);
    } else
        exporter.export(map, exportFile);
}
Also used : NodeModel(org.freeplane.features.map.NodeModel) ExportToImage(org.freeplane.features.export.mindmapmode.ExportToImage) MapModel(org.freeplane.features.map.MapModel) Dimension(java.awt.Dimension) Controller(org.freeplane.features.mode.Controller) ModeController(org.freeplane.features.mode.ModeController) ResourceController(org.freeplane.core.resources.ResourceController) File(java.io.File)

Aggregations

Dimension (java.awt.Dimension)1 File (java.io.File)1 ResourceController (org.freeplane.core.resources.ResourceController)1 ExportToImage (org.freeplane.features.export.mindmapmode.ExportToImage)1 MapModel (org.freeplane.features.map.MapModel)1 NodeModel (org.freeplane.features.map.NodeModel)1 Controller (org.freeplane.features.mode.Controller)1 ModeController (org.freeplane.features.mode.ModeController)1