Compare commits
3 Commits
Ben8Avril
...
08.04.26-1
| Author | SHA1 | Date | |
|---|---|---|---|
| c40271a3af | |||
| 3785ab31b2 | |||
| c0fa3ec263 |
@@ -18,5 +18,5 @@ Les fichiers de tests se trouvent dans le dossier ``tests``.
|
|||||||
Actuellement, nous avons terminé la complétion/nettoyage par Moyenne/Régression Linéaire.
|
Actuellement, nous avons terminé la complétion/nettoyage par Moyenne/Régression Linéaire.
|
||||||
Nous allons donc voir pour l'interface graphique.
|
Nous allons donc voir pour l'interface graphique.
|
||||||
|
|
||||||
Le fichier qui permet de tester l'ouverture du fichier Test3 pour l'évaluation est le fichier ``ecoparasite.LectureEval``.
|
Le fichier qui permet de tester l'ouverture du fichier Test2 pour l'évaluation est le fichier ``ecoparasite.LectureEvaltest2``.
|
||||||
Ce fichier a été réalisé par Benjamin THOREL.
|
Ce fichier a été réalisé par Sébastien BOUSQUET.
|
||||||
@@ -77,6 +77,13 @@ public class Poisson{
|
|||||||
this.infestation = infestation;
|
this.infestation = infestation;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Setter de l'attribut length
|
||||||
|
* @param length le Double de la nouvelle valeur de length
|
||||||
|
*/
|
||||||
|
public void setLength(Double length) {
|
||||||
|
this.length = length;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Setter de l'attribut des parties de poisson.
|
* Setter de l'attribut des parties de poisson.
|
||||||
|
|||||||
4
src/ecoparasite/representation/ValeurXY.java
Normal file
4
src/ecoparasite/representation/ValeurXY.java
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
package ecoparasite.representation;
|
||||||
|
|
||||||
|
public class ValeurXY {
|
||||||
|
}
|
||||||
111
src/ecoparasite/svg/SVGFactory/SVGFactory.java
Normal file
111
src/ecoparasite/svg/SVGFactory/SVGFactory.java
Normal file
@@ -0,0 +1,111 @@
|
|||||||
|
package ecoparasite.svg.SVGFactory;
|
||||||
|
|
||||||
|
import ecoparasite.representation.ValeurXY;
|
||||||
|
import ecoparasite.svg.elements.Element;
|
||||||
|
|
||||||
|
import java.io.FileWriter;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashSet;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Classe Définissant de manière static les méthodes pour créer un fichier SVG de nos graphiques
|
||||||
|
*/
|
||||||
|
public class SVGFactory {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Chemin d'export et Extension du fichier
|
||||||
|
*/
|
||||||
|
static final private String EXPORT_PATH = "export/";
|
||||||
|
static final private String EXTENSION = ".svg";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Fonction createSVG permettant de créer le fichier SVG dans le dossier du chemin d'export.
|
||||||
|
* Le nom du fichier est defini automatiquement.
|
||||||
|
* @param mesElements tableau composé des différents éléments de notre graphique
|
||||||
|
* @return True si la fonction a réussi à créer le fichier, False sinon
|
||||||
|
*/
|
||||||
|
public static boolean createSVG(HashSet<Element> mesElements){
|
||||||
|
|
||||||
|
String code = createSVGCode(mesElements);
|
||||||
|
|
||||||
|
try {
|
||||||
|
createFile(code);
|
||||||
|
} catch (Exception e) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Fonction createSVG permettant de créer le fichier SVG dans le dossier du chemin d'export.
|
||||||
|
* @param mesElements tableau composé des différents éléments de notre graphique
|
||||||
|
* @param filename String contenant le nom du fichier voulu
|
||||||
|
* @return True si la fonction a réussi à créer le fichier, False sinon
|
||||||
|
*/
|
||||||
|
public static boolean createSVG(HashSet<Element> mesElements, String filename) {
|
||||||
|
|
||||||
|
String code = createSVGCode(mesElements);
|
||||||
|
|
||||||
|
try {
|
||||||
|
createFile(code,filename);
|
||||||
|
} catch (Exception e) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Permet la création du code de notre SVG
|
||||||
|
* @param mesElements tableau d'élement de notre graphiques
|
||||||
|
* @return une String contenant le code complet de notre SVG
|
||||||
|
*/
|
||||||
|
public static String createSVGCode(HashSet<Element> mesElements){
|
||||||
|
|
||||||
|
String code = "<svg height=\"800\" width=\"800\" >";
|
||||||
|
|
||||||
|
for (Element e : mesElements){
|
||||||
|
|
||||||
|
code += e.toSVG();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
code += "</svg>";
|
||||||
|
|
||||||
|
return code;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Permet de lancer la création du fichier. Cette version ne prend pas de filename mais à la place créer un UUID random pour.
|
||||||
|
* @param data String contenant le code de notre SVG
|
||||||
|
* @throws IOException C'est une création de fichier, il peut y avoir des erreurs
|
||||||
|
*/
|
||||||
|
public static void createFile(String data) throws IOException {
|
||||||
|
String id = UUID.randomUUID().toString();
|
||||||
|
createFile(data,id);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Permet de créer un fichier SVG contenant notre graphique
|
||||||
|
* @param data String contenant le code de notre SVG
|
||||||
|
* @param filename String contenant le nom de notre fichier
|
||||||
|
* @throws IOException
|
||||||
|
*/
|
||||||
|
public static void createFile(String data, String filename) throws IOException {
|
||||||
|
|
||||||
|
// create a FileWriter object with the file name
|
||||||
|
FileWriter writer = new FileWriter(EXPORT_PATH + filename + EXTENSION);
|
||||||
|
|
||||||
|
// write the string to the file
|
||||||
|
writer.write(data);
|
||||||
|
|
||||||
|
// close the writer
|
||||||
|
writer.close();
|
||||||
|
|
||||||
|
System.out.println("Successfully wrote text to file.");
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
12
src/ecoparasite/svg/elements/Element.java
Normal file
12
src/ecoparasite/svg/elements/Element.java
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
package ecoparasite.svg.elements;
|
||||||
|
|
||||||
|
public class Element {
|
||||||
|
|
||||||
|
public Element() {
|
||||||
|
System.out.println("Un Element... Non implémenter encore");
|
||||||
|
}
|
||||||
|
|
||||||
|
public String toSVG() {
|
||||||
|
return "une string";
|
||||||
|
}
|
||||||
|
}
|
||||||
23
tests/ecoparasite/poisson/MackerelSerraTest.java
Normal file
23
tests/ecoparasite/poisson/MackerelSerraTest.java
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
package ecoparasite.poisson;
|
||||||
|
|
||||||
|
import ecoparasite.input.InputFactory;
|
||||||
|
import ecoparasite.input.InputFileException;
|
||||||
|
import ecoparasite.input.RawData;
|
||||||
|
import ecoparasite.input.RawDataOverflow;
|
||||||
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
|
import java.util.HashSet;
|
||||||
|
|
||||||
|
import static org.junit.jupiter.api.Assertions.*;
|
||||||
|
|
||||||
|
class MackerelSerraTest {
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void parse() throws InputFileException, RawDataOverflow {
|
||||||
|
RawData test = InputFactory.readData("test2.csv", ",");
|
||||||
|
|
||||||
|
HashSet<Poisson> testp = MackerelSerra.parse(test);
|
||||||
|
|
||||||
|
System.out.println(testp);
|
||||||
|
}
|
||||||
|
}
|
||||||
25
tests/ecoparasite/svg/SVGFactory/SVGFactoryTest.java
Normal file
25
tests/ecoparasite/svg/SVGFactory/SVGFactoryTest.java
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
package ecoparasite.svg.SVGFactory;
|
||||||
|
|
||||||
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
|
import static org.junit.jupiter.api.Assertions.*;
|
||||||
|
|
||||||
|
class SVGFactoryTest {
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void createSVGCode() {
|
||||||
|
|
||||||
|
//String ret = SVGFactory.createSVGCode();
|
||||||
|
|
||||||
|
//System.out.println(ret);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void testCreateFile() {
|
||||||
|
|
||||||
|
//String ret = SVGFactory.createSVGCode();
|
||||||
|
|
||||||
|
//SVGFactory.createFile(ret);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user