Since the application developed in this project is a command line tool, we want to integrate it into the existing GuiSvgPlot tool. For this purpose, we will work on a GuiSvgPlot project fork. There the brailleplot app will be presented as selectable output device, enabling the direct creation of braille diagrams via the GUI. Additionally to listing it as available output device, some extending changes to GuiSvgPlot are required. Here is an overview of the integration doals:
list brailleplot as output device
show brailleplot svg exporter output in preview
Diagram creation in GuiSvgPlot
The original current approach to build a svg diagram via SvgPlot looks like this:
String tempPath = this.guiSvgOptions.getCsvPath();File tempCSV = new File(tempPath);File newCsv = new File(file.getAbsolutePath().replaceAll(".svg", ".csv"));if (tempCSV.exists()) Files.copy(tempCSV.toPath(), newCsv.toPath(), StandardCopyOption.REPLACE_EXISTING);this.guiSvgOptions.setOutput(file.getAbsolutePath());this.svgOptionsService.buildSVG(guiSvgOptions.getOptions());this.popOver_infos.hide();this.popOver_warnings.hide();GuiSvgPlott.getInstance().closeWizard(true);
The guiSvgOptions variable holds an instance of GuiSvgOptions which is GuiSvgPlots own model class holding all data and properties of the chart. Essentially it wraps an instance of SvgPlotOptions, which comes directly from the tud.tangram.svgplot.options package.
This data which was accumulated during the plot creation process in the graphical user interface is then passed to the buildSvg() method of the SvgOptionsService, which is a controller class doing the invokation of SvgPlot.
Extending the current approach
A minor problem which presents itself at this point is, that the integration of the brailleplot integration cannot simply happen by adding it as a normal output device option, just as the other options (Standard, TigerEmbosser, Screen, PinDevice, ...), since these are just options handed over to SvgPlot, which then essentially treats them as different modes of operation.
Our brailleplot application however is completely indepented from SvgPlot and rather serves as alternative plot generation process. So it will be necessary to extend the GuiSvgPlot structure to portray this relation.
This will be done by extending the current SvgOptionsService controller with a method buildBraillePlot() and deciding which of both methods to use based on the selected output device in the GuiSvgOptions container.
The limitations of the braille plot usecase however will also limit the available options significantly, when brailleplot is used as output device. Only a subset of the defined options can be passed to the application. This limitation of the controller must of course be represented in the view. The resulting changes which were made to the GUI to achieve this are discussed in another section: GUI changes
To use the options contained in the wrapped SvgPlotOptions object options, it must first be understood how its members are structured:
size :Point = describes the paper format
xUnit :String = information that the user entered as x-axis caption
yUnit :String = information that the user entered as y-axis caption
title :String = diagram title
output :File = selected diagram output file (in our usecase maybe the svg export)
csvPath :String = path of the diagram data csv
csvType :CsvType = csv data alignment type enum
csvOrientation :String = csv data orientation enum
Invokation of the brailleplot application
As discussed before, the SvgOptionsService controller class will be equipped with an additional method for brailleplot creation. This is the code used for this purpose: