Skip to content
Snippets Groups Projects
Commit 9f2ad553 authored by Laurent Knoll's avatar Laurent Knoll
Browse files

Export de la boite de petri par points et non par segments incurvés. Closes #5

parent c7df6505
No related branches found
No related tags found
No related merge requests found
......@@ -15,7 +15,21 @@ export class DataExporter {
/**
* Transforme un Path en CSV
*/
public exportPathAsXYCsv(coords : Coords, close : boolean) : string {
public exportPathPointsAsXYCsv(coords : Coords, close : boolean) : string {
const path = coords.toRemovedPath();
let data = "";
for (let i = 0; i < path.length; i++) {
let point = path.getPointAt(i);
data += Math.round(point.x) + "\t" + Math.round(point.y) + "\n";
}
return data;
}
/**
* Transforme un Path en CSV par segments
*/
public exportPathSegmentsAsXYCsv(coords : Coords, close : boolean) : string {
const path = coords.toRemovedPath();
let data = "";
for (let i = 0; i < path.segments.length; i++) {
......
......
......@@ -75,7 +75,7 @@ export class DownloadStep extends Step<DownloadStepState> {
* Téléchargement des données de la boîte de Petri
*/
private downloadPetriDishData() : void {
let data = this.dataExporter.exportPathAsXYCsv(this.props.lab.data.petriDishCoords, true);
let data = this.dataExporter.exportPathPointsAsXYCsv(this.props.lab.data.petriDishCoords, true);
IoUtils.downloadData(this.state.petriDishDataFilename, "text/plain;charset=UTF-8", data);
}
......@@ -83,7 +83,7 @@ export class DownloadStep extends Step<DownloadStepState> {
* Téléchargement des données du mask
*/
private downloadBlobMaskData() : void {
let data = this.dataExporter.exportPathAsXYCsv(this.props.lab.data.blobMaskCoords, true);
let data = this.dataExporter.exportPathSegmentsAsXYCsv(this.props.lab.data.blobMaskCoords, true);
IoUtils.downloadData(this.state.blobMaskDataFilename, "text/plain;charset=UTF-8", data);
}
......
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment