From a2719342b9918ca73f13e8da119c058c615f112d Mon Sep 17 00:00:00 2001
From: ctrebeau <ctrebeau@pasteur.fr>
Date: Tue, 1 Apr 2025 18:48:44 +0200
Subject: [PATCH] code cleanup

---
 .../zellige/gui/model/ConstructionModel.java  | 61 ++-----------------
 1 file changed, 5 insertions(+), 56 deletions(-)

diff --git a/src/main/java/fr/pasteur/ida/zellige/gui/model/ConstructionModel.java b/src/main/java/fr/pasteur/ida/zellige/gui/model/ConstructionModel.java
index 0a2c2b1..6054403 100644
--- a/src/main/java/fr/pasteur/ida/zellige/gui/model/ConstructionModel.java
+++ b/src/main/java/fr/pasteur/ida/zellige/gui/model/ConstructionModel.java
@@ -31,12 +31,6 @@ package fr.pasteur.ida.zellige.gui.model;
 import fr.pasteur.ida.zellige.element.ReferenceSurface;
 import fr.pasteur.ida.zellige.element.Surface;
 import fr.pasteur.ida.zellige.gui.ZDoubleProperty;
-import fr.pasteur.ida.zellige.gui.controller.MainController;
-import fr.pasteur.ida.zellige.gui.task.AbstractTask;
-import fr.pasteur.ida.zellige.gui.task.RunFirstConstructionTask;
-import fr.pasteur.ida.zellige.gui.task.RunSecondConstructionTask;
-import fr.pasteur.ida.zellige.steps.construction.exception.FirstRoundConstructionException;
-import fr.pasteur.ida.zellige.steps.construction.exception.SecondRoundConstructionException;
 import javafx.beans.property.IntegerProperty;
 import javafx.beans.property.SimpleBooleanProperty;
 import javafx.beans.property.SimpleIntegerProperty;
@@ -53,8 +47,6 @@ import org.slf4j.LoggerFactory;
 
 import java.util.ArrayList;
 
-import static fr.pasteur.ida.zellige.gui.MainAppFrame.GUI_MARKER;
-
 public class ConstructionModel< T extends RealType< T > & NativeType< T > >
 {
 
@@ -91,54 +83,6 @@ public class ConstructionModel< T extends RealType< T > & NativeType< T > >
         surfaceSize = new ZDoubleProperty();
     }
 
-    public void firstRound()
-    {
-        LOGGER.info(GUI_MARKER, "Computing first round construction..." );
-        AbstractTask< ArrayList< Surface > > firstRoundTask = new RunFirstConstructionTask( maximums.getValue(), st1.doubleValue(), r1.intValue(), c1.doubleValue(), surfaceSize.doubleValue() / 100.0 );
-        firstRoundTask.setOnSucceeded( workerStateEvent ->
-        {
-            firstRoundSurfaces.setValue( firstRoundTask.getValue() );
-            if ( firstRoundTask.getValue() == null )
-            {
-                LOGGER.info( "" ); //TODO write right message
-                MainController.showError( new FirstRoundConstructionException() );
-            }
-        } );
-        LOGGER.info( GUI_MARKER,"First round construction done." );
-        firstRoundTask.start();
-    }
-
-
-    public void secondRound()
-    {
-        LOGGER.info( GUI_MARKER,"Computing second round construction..." );
-        AbstractTask< ArrayList< Surface > > secondRoundTask = new RunSecondConstructionTask( firstRoundSurfacesProperty().getValue(), st2.getValue(), r2.intValue(), c2.doubleValue(), surfaceSize.doubleValue() / 100.0 );
-        secondRoundTask.setOnSucceeded( workerStateEvent ->
-        {
-            secondRoundSurfacesProperty().setValue( secondRoundTask.getValue() );
-            if ( secondRoundTask.getValue() == null )
-            {
-                LOGGER.info( "" ); //TODO write right message
-                MainController.showError( new SecondRoundConstructionException() );
-            }
-        } );
-        LOGGER.info( GUI_MARKER,"Second round construction done." );
-        secondRoundTask.start();
-    }
-
-    public void runConstruction()
-    {
-        LOGGER.debug( "Run construction" );
-        if ( firstRoundSurfacesProperty().getValue() == null )
-        {
-            firstRound();
-        }
-        else if ( secondRoundSurfaces.getValue() == null )
-        {
-            secondRound();
-        }
-    }
-
 
     public IntegerProperty getBin()
     {
@@ -229,4 +173,9 @@ public class ConstructionModel< T extends RealType< T > & NativeType< T > >
     {
         return disableGUI;
     }
+
+    public int getSurfaceMax()
+    {
+        return ( int ) (input.get().dimension( 0 )* input.get().dimension( 1 )/ (bin.get() * bin.get()));
+    }
 }
-- 
GitLab