// Path: demo/JavaFxTest/src/main/java/com/orange/dgil/trail/app/fxdrawertest/curves/Curves.java
// public class Curves implements LinearWindowFilterListener, VectoFilterListener {
// 
//   private boolean rawCurveEnabled;
//   private boolean linearFilterCurveEnabled;
//   private boolean vectoCurveEnabled;
//   private boolean quadCurveEnabled;
// 
//   private List<Point2D> rawCurvePoints = new ArrayList<Point2D>();
//   private List<Point2D> linearFilterCurvePoints = new ArrayList<Point2D>();
//   private List<Point2D> vectoCurvePoints = new ArrayList<Point2D>();
//   private List<Point2D> quadCurvePoints = new ArrayList<Point2D>();
// 
//   private final LinearWindowFilter linearWindowFilter = new LinearWindowFilter(this);
//   private final VectoFilter vectoFilter = new VectoFilter(this);
//   private final QuadCurve quadCurve = new QuadCurve(true);
// 
//   public void clear() {
//     rawCurvePoints.clear();
//     linearFilterCurvePoints.clear();
//     vectoCurvePoints.clear();
//     quadCurvePoints.clear();
//     linearWindowFilter.reset();
//     vectoFilter.reset();
//     quadCurve.reset();
//   }
// 
//   public void end() {
//     TrailPoint lastPoint = linearWindowFilter.getLastPoint();
//     linearFilterCurvePoints.add(new Point2D(lastPoint.getX(), lastPoint.getY()));
//     endVecto();
//     endQuadCurve();
//   }
// 
//   private void endVecto() {
//     vectoFilter.epilogue();
//   }
// 
//   private void endQuadCurve() {
//     quadCurve.epilogue();
//     fillQuadCurve();
//   }
// 
// 
//   public void addPoint(double x, double y) {
//     rawCurvePoints.add(new Point2D(x, y));
//     addPointToLinearFilter(x, y);
//     addPointToVecto(x, y);
//     addPointToQuadCurve(x, y);
//   }
// 
//   private void addPointToLinearFilter(double x, double y) {
//     linearWindowFilter.addPoint(new TrailPoint((int)x, (int)y));
//   }
// 
//   private void addPointToVecto(double x, double y) {
//     vectoFilter.addPoint((int)x, (int)y);
//   }
// 
//   private void addPointToQuadCurve(double x, double y) {
//     quadCurve.addPoint((int)x, (int)y);
//     fillQuadCurve();
//   }
// 
//   private void fillQuadCurve() {
//     QuadCurveArray quadCurveArray = quadCurve.getQuadCurveArray();
//     for (int i = quadCurvePoints.size(); i <= quadCurveArray.getLastPointIndex(); i++) {
//       TrailPoint p = quadCurveArray.get(i);
//       quadCurvePoints.add(new Point2D(p.getX(), p.getY()));
//     }
//   }
// 
//   public boolean isRawCurveEnabled() {
//     return rawCurveEnabled;
//   }
//   public void setRawCurveEnabled(boolean rawCurveEnabled) {
//     this.rawCurveEnabled = rawCurveEnabled;
//   }
// 
//   public boolean isLinearFilterCurveEnabled() {
//     return linearFilterCurveEnabled;
//   }
//   public void setLinearFilterCurveEnabled(boolean linearFilterCurveEnabled) {
//     this.linearFilterCurveEnabled = linearFilterCurveEnabled;
//   }
// 
//   public boolean isVectoCurveEnabled() {
//     return vectoCurveEnabled;
//   }
//   public void setVectoCurveEnabled(boolean vectoCurveEnabled) {
//     this.vectoCurveEnabled = vectoCurveEnabled;
//   }
// 
//   public boolean isQuadCurveEnabled() {
//     return quadCurveEnabled;
//   }
//   public void setQuadCurveEnabled(boolean quadCurveEnabled) {
//     this.quadCurveEnabled = quadCurveEnabled;
//   }
// 
//   public List<Point2D> getRawCurvePoints() {
//     return rawCurvePoints;
//   }
// 
//   public List<Point2D> getLinearFilterCurvePoints() {
//     return linearFilterCurvePoints;
//   }
// 
//   public List<Point2D> getVectoCurvePoints() {
//     return vectoCurvePoints;
//   }
// 
//   public List<Point2D> getQuadCurvePoints() {
//     return quadCurvePoints;
//   }
// 
//   public void setVectoErrorPixels(int error) {
//     vectoFilter.getVectoSettings().setVectorsHeightThreshold(error);
//   }
//   public void setVectoWindowSize(int windowSize) {
//     vectoFilter.getVectoSettings().setWindowSize(windowSize);
//   }
// 
//   @Override
//   public void onNewFilteredPointAvailable(int x, int y) {
//     linearFilterCurvePoints.add(new Point2D(x, y));
//   }
// 
//   @Override
//   public void onNewVectoPointAvailable(int x, int y) {
//     vectoCurvePoints.add(new Point2D(x, y));
//   }
//   @Override
//   public void onLastVectoPointAvailable(int x, int y) {
//     onNewVectoPointAvailable(x, y);
//   }
// }


import com.orange.dgil.trail.app.fxdrawertest.curves.Curves;
import java.util.List;
import javafx.geometry.Point2D;
import javafx.scene.canvas.Canvas;
import javafx.scene.canvas.GraphicsContext;
import javafx.scene.paint.Color;
  private int plumeCurveIndex;

  public GraphicContextDrawer(GraphicsContext graphicsContext) {
    this.graphicsContext = graphicsContext;
    initDrawer();
  }

  private void initDrawer() {
    graphicsContext.setLineWidth(1);
  }

  private void initColor(Color color) {
    graphicsContext.setFill(color);
  }

  public void drawCircle(double x, double y) {
    graphicsContext.fillOval(x, y, CIRCLE_RADIUS, CIRCLE_RADIUS);
  }

  public void clear() {
    plumeCurveIndex = 0;
    Canvas canvas = graphicsContext.getCanvas();
    graphicsContext.clearRect(0, 0, canvas.getWidth(), canvas.getHeight());
  }

  public void setOffsets(int xOffset, int yOffset) {
    this.xOffset = xOffset;
    this.yOffset = yOffset;
  }

// Path: demo/JavaFxTest/src/main/java/com/orange/dgil/trail/app/fxdrawertest/curves/Curves.java
// public class Curves implements LinearWindowFilterListener, VectoFilterListener {
// 
//   private boolean rawCurveEnabled;
//   private boolean linearFilterCurveEnabled;
//   private boolean vectoCurveEnabled;
//   private boolean quadCurveEnabled;
// 
//   private List<Point2D> rawCurvePoints = new ArrayList<Point2D>();
//   private List<Point2D> linearFilterCurvePoints = new ArrayList<Point2D>();
//   private List<Point2D> vectoCurvePoints = new ArrayList<Point2D>();
//   private List<Point2D> quadCurvePoints = new ArrayList<Point2D>();
// 
//   private final LinearWindowFilter linearWindowFilter = new LinearWindowFilter(this);
//   private final VectoFilter vectoFilter = new VectoFilter(this);
//   private final QuadCurve quadCurve = new QuadCurve(true);
// 
//   public void clear() {
//     rawCurvePoints.clear();
//     linearFilterCurvePoints.clear();
//     vectoCurvePoints.clear();
//     quadCurvePoints.clear();
//     linearWindowFilter.reset();
//     vectoFilter.reset();
//     quadCurve.reset();
//   }
// 
//   public void end() {
//     TrailPoint lastPoint = linearWindowFilter.getLastPoint();
//     linearFilterCurvePoints.add(new Point2D(lastPoint.getX(), lastPoint.getY()));
//     endVecto();
//     endQuadCurve();
//   }
// 
//   private void endVecto() {
//     vectoFilter.epilogue();
//   }
// 
//   private void endQuadCurve() {
//     quadCurve.epilogue();
//     fillQuadCurve();
//   }
// 
// 
//   public void addPoint(double x, double y) {
//     rawCurvePoints.add(new Point2D(x, y));
//     addPointToLinearFilter(x, y);
//     addPointToVecto(x, y);
//     addPointToQuadCurve(x, y);
//   }
// 
//   private void addPointToLinearFilter(double x, double y) {
//     linearWindowFilter.addPoint(new TrailPoint((int)x, (int)y));
//   }
// 
//   private void addPointToVecto(double x, double y) {
//     vectoFilter.addPoint((int)x, (int)y);
//   }
// 
//   private void addPointToQuadCurve(double x, double y) {
//     quadCurve.addPoint((int)x, (int)y);
//     fillQuadCurve();
//   }
// 
//   private void fillQuadCurve() {
//     QuadCurveArray quadCurveArray = quadCurve.getQuadCurveArray();
//     for (int i = quadCurvePoints.size(); i <= quadCurveArray.getLastPointIndex(); i++) {
//       TrailPoint p = quadCurveArray.get(i);
//       quadCurvePoints.add(new Point2D(p.getX(), p.getY()));
//     }
//   }
// 
//   public boolean isRawCurveEnabled() {
//     return rawCurveEnabled;
//   }
//   public void setRawCurveEnabled(boolean rawCurveEnabled) {
//     this.rawCurveEnabled = rawCurveEnabled;
//   }
// 
//   public boolean isLinearFilterCurveEnabled() {
//     return linearFilterCurveEnabled;
//   }
//   public void setLinearFilterCurveEnabled(boolean linearFilterCurveEnabled) {
//     this.linearFilterCurveEnabled = linearFilterCurveEnabled;
//   }
// 
//   public boolean isVectoCurveEnabled() {
//     return vectoCurveEnabled;
//   }
//   public void setVectoCurveEnabled(boolean vectoCurveEnabled) {
//     this.vectoCurveEnabled = vectoCurveEnabled;
//   }
// 
//   public boolean isQuadCurveEnabled() {
//     return quadCurveEnabled;
//   }
//   public void setQuadCurveEnabled(boolean quadCurveEnabled) {
//     this.quadCurveEnabled = quadCurveEnabled;
//   }
// 
//   public List<Point2D> getRawCurvePoints() {
//     return rawCurvePoints;
//   }
// 
//   public List<Point2D> getLinearFilterCurvePoints() {
//     return linearFilterCurvePoints;
//   }
// 
//   public List<Point2D> getVectoCurvePoints() {
//     return vectoCurvePoints;
//   }
// 
//   public List<Point2D> getQuadCurvePoints() {
//     return quadCurvePoints;
//   }
// 
//   public void setVectoErrorPixels(int error) {
//     vectoFilter.getVectoSettings().setVectorsHeightThreshold(error);
//   }
//   public void setVectoWindowSize(int windowSize) {
//     vectoFilter.getVectoSettings().setWindowSize(windowSize);
//   }
// 
//   @Override
//   public void onNewFilteredPointAvailable(int x, int y) {
//     linearFilterCurvePoints.add(new Point2D(x, y));
//   }
// 
//   @Override
//   public void onNewVectoPointAvailable(int x, int y) {
//     vectoCurvePoints.add(new Point2D(x, y));
//   }
//   @Override
//   public void onLastVectoPointAvailable(int x, int y) {
//     onNewVectoPointAvailable(x, y);
//   }
// }


// Path: demo/JavaFxTest/src/main/java/com/orange/dgil/trail/app/fxdrawertest/drawer/GraphicContextDrawer.java
import com.orange.dgil.trail.app.fxdrawertest.curves.Curves;
import java.util.List;
import javafx.geometry.Point2D;
import javafx.scene.canvas.Canvas;
import javafx.scene.canvas.GraphicsContext;
import javafx.scene.paint.Color;

  private int plumeCurveIndex;

  public GraphicContextDrawer(GraphicsContext graphicsContext) {
    this.graphicsContext = graphicsContext;
    initDrawer();
  }

  private void initDrawer() {
    graphicsContext.setLineWidth(1);
  }

  private void initColor(Color color) {
    graphicsContext.setFill(color);
  }

  public void drawCircle(double x, double y) {
    graphicsContext.fillOval(x, y, CIRCLE_RADIUS, CIRCLE_RADIUS);
  }

  public void clear() {
    plumeCurveIndex = 0;
    Canvas canvas = graphicsContext.getCanvas();
    graphicsContext.clearRect(0, 0, canvas.getWidth(), canvas.getHeight());
  }

  public void setOffsets(int xOffset, int yOffset) {
    this.xOffset = xOffset;
    this.yOffset = yOffset;
  }

  public void draw(Curves curves) {