2 Commits

Author SHA1 Message Date
9c006f94fb Merge remote-tracking branch 'origin/27.04.26-2' into 27.04.26-2 2026-04-29 09:23:25 +02:00
d0a5315ca2 Fix Nettoyage longueur 2026-04-29 09:23:17 +02:00
3 changed files with 21 additions and 9 deletions

View File

@@ -28,15 +28,26 @@ public class Application {
HashSet<Poisson> mackerelSet = MackerelSerra.parse(rawMackerel); HashSet<Poisson> mackerelSet = MackerelSerra.parse(rawMackerel);
System.out.println( "Avant nettoyage et complétion" );
System.out.println( mackerelSet ); System.out.println( mackerelSet );
Function<Poisson,Double> getLength = Poisson::getLength; Function<Poisson,Double> getLength = Poisson::getLength;
Function<Poisson,Double> getInfes = Poisson::getInfestation; Function<Poisson,Double> getInfes = Poisson::getInfestation;
BiConsumer<Poisson,Double> setInfes = Poisson::setInfestation; BiConsumer<Poisson,Double> setInfes = Poisson::setInfestation;
mackerelSet = Nettoyage.nettoieColumns( mackerelSet, Poisson::getLength, Poisson::setLength, false );
mackerelSet = Completion.completeColumnsMoyenne( mackerelSet, Poisson::getLength, Poisson::setLength );
System.out.println( "Après Nettoyage et complétion de la longueur du poisson." );
System.out.println( mackerelSet );
mackerelSet = Nettoyage.nettoieColumns( mackerelSet, getInfes, setInfes, false ); mackerelSet = Nettoyage.nettoieColumns( mackerelSet, getInfes, setInfes, false );
mackerelSet = Completion.completeColumnsLinear( mackerelSet, getLength, getInfes, setInfes ); mackerelSet = Completion.completeColumnsLinear( mackerelSet, getLength, getInfes, setInfes );
System.out.println( "Après Nettoyage et complétion du taux d'infestation des poissons" );
System.out.println( mackerelSet );
// Conversion des valeurs.
HashSet<ValeursXY> mackerelXY = ValeursXY.convertToXY( mackerelSet, getLength, getInfes ); HashSet<ValeursXY> mackerelXY = ValeursXY.convertToXY( mackerelSet, getLength, getInfes );
HashMap<String, ArrayList<Double>> axes = SVGBuilder.calcPointAxes( mackerelXY ); HashMap<String, ArrayList<Double>> axes = SVGBuilder.calcPointAxes( mackerelXY );
System.out.println( axes ); System.out.println( axes );
@@ -52,7 +63,7 @@ public class Application {
// Sauvegarde pour plus tard. // Sauvegarde pour plus tard.
double[] ABCoef = Completion.getLinearCoef(mackerelSet, getLength, getInfes); double[] ABCoef = Completion.getLinearCoef(mackerelSet, getLength, getInfes);
ArrayList<Element> SVGElements = axesInstance.buildAll( "Length", "Infestation", mackerelXY, ABCoef[0], ABCoef[1] ); ArrayList<Element> SVGElements = axesInstance.buildAll( "Length (mm)", "Taux d'infestation", mackerelXY, ABCoef[0], ABCoef[1] );
SVGFactory.createSVG( SVGElements ); SVGFactory.createSVG( SVGElements );
} }

View File

@@ -98,17 +98,17 @@ public class SVGBuilder {
Coordonnees right = getResizer().resize( maxPointsX, beginAxeY ); Coordonnees right = getResizer().resize( maxPointsX, beginAxeY );
// Axes // Axes
elements.add( new Line( bottom, top, ElementsFactory.COLOR_BLACK, 2 ) ); elements.add( new Line( bottom, top, ElementsFactory.COLOR_WHITE, 2 ) );
elements.add( new Line( left, right, ElementsFactory.COLOR_BLACK, 2 ) ); elements.add( new Line( left, right, ElementsFactory.COLOR_WHITE, 2 ) );
// Labels. // Labels.
elements.add( new Text( elements.add( new Text(
new Coordonnees( right.getX() + OFFSET_TEXT_AXISX_X, right.getY() + OFFSET_TEXT_AXISX_Y ), new Coordonnees( right.getX() + OFFSET_TEXT_AXISX_X, right.getY() + OFFSET_TEXT_AXISX_Y ),
XLabel, ElementsFactory.COLOR_BLACK, ElementsFactory.AXES_TEXT_SIZE XLabel, ElementsFactory.COLOR_WHITE, ElementsFactory.AXES_TEXT_SIZE
) ); ) );
elements.add( new Text( elements.add( new Text(
new Coordonnees( top.getX() + OFFSET_TEXT_AXISY_X, top.getY() + OFFSET_TEXT_AXISY_Y ), new Coordonnees( top.getX() + OFFSET_TEXT_AXISY_X, top.getY() + OFFSET_TEXT_AXISY_Y ),
YLabel, ElementsFactory.COLOR_BLACK, ElementsFactory.AXES_TEXT_SIZE YLabel, ElementsFactory.COLOR_WHITE, ElementsFactory.AXES_TEXT_SIZE
)); ));
return elements; return elements;
@@ -130,12 +130,12 @@ public class SVGBuilder {
elements.add(new Line( elements.add(new Line(
coords, coords,
new Coordonnees( coords.getX(), coords.getY() + OFFSET_TICK ), new Coordonnees( coords.getX(), coords.getY() + OFFSET_TICK ),
ElementsFactory.COLOR_BLACK, 1 ElementsFactory.COLOR_WHITE, 1
)); ));
elements.add(new Text( elements.add(new Text(
new Coordonnees( coords.getX() + OFFSET_TEXT_X, coords.getY() + OFFSET_TEXT_Y ), new Coordonnees( coords.getX() + OFFSET_TEXT_X, coords.getY() + OFFSET_TEXT_Y ),
X.toString(), X.toString(),
ElementsFactory.COLOR_BLACK, ElementsFactory.COLOR_WHITE,
SIZE_TICK_TEXT SIZE_TICK_TEXT
)); ));
} }
@@ -158,12 +158,12 @@ public class SVGBuilder {
elements.add(new Line( elements.add(new Line(
new Coordonnees(coords.getX() + OFFSET_TICK, coords.getY() ), new Coordonnees(coords.getX() + OFFSET_TICK, coords.getY() ),
coords, coords,
ElementsFactory.COLOR_BLACK, 1 ElementsFactory.COLOR_WHITE, 1
)); ));
elements.add(new Text( elements.add(new Text(
new Coordonnees( coords.getX() + OFFSET_TEXT_X, coords.getY() + OFFSET_TEXT_Y ), new Coordonnees( coords.getX() + OFFSET_TEXT_X, coords.getY() + OFFSET_TEXT_Y ),
Y.toString(), Y.toString(),
ElementsFactory.COLOR_BLACK, ElementsFactory.COLOR_WHITE,
SIZE_TICK_TEXT SIZE_TICK_TEXT
)); ));
} }

View File

@@ -12,6 +12,7 @@ public class ElementsFactory {
final public static int AXES_TEXT_SIZE = 10; final public static int AXES_TEXT_SIZE = 10;
final public static String COLOR_WHITE = "white";
final public static String COLOR_RED = "red"; final public static String COLOR_RED = "red";
final public static String COLOR_BLUE = "blue"; final public static String COLOR_BLUE = "blue";
final public static String COLOR_BLACK = "black"; final public static String COLOR_BLACK = "black";