/*********************************************************************/
/* */
/* Copyright 2022-2023 RĂ©mi Synave - remi.synave@univ-littoral.fr */
/* */
/* This file is part of DSL. */
/* This software uses Qt to build the Graphical User Interface */
/* https://www.qt.io/ */
/* */
/* DSL is free software: you can redistribute it and/or modify */
/* it under the terms of the GNU General Public License as published */
/* by the Free Software Foundation, either version 3 of the License, */
/* or (at your option) any later version. */
/* */
/* DSL is distributed in the hope that it will be useful, */
/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
/* GNU General Public License for more details. */
/* */
/* You should have received a copy of the GNU General Public License */
/* along with DSL. If not, see . */
/* */
/*********************************************************************/
#ifndef WORKAREA_HPP
#define WORKAREA_HPP
#include
#include
#include
#include
#include
#include
#include
#include "StrengthLine.hpp"
class WorkArea: public QWidget
{
Q_OBJECT
private:
const int taillePoint = 10;
const int epaisseurLigne = 3;
unsigned int screenSizeX, screenSizeY;
bool readOnly;
bool modificationInProgress;
QImage *original;
QImage *img;
double resizeFactor;
QList < QPoint * >liste_points;
int indexPointClicked;
int maxLines;
protected:
void paintEvent (QPaintEvent * event) override;
void mousePressEvent (QMouseEvent * event);
void mouseMoveEvent (QMouseEvent * event);
void mouseReleaseEvent (QMouseEvent * event);
public:
WorkArea (int screenSizeX, int screenSizeY, QWidget * parent = nullptr);
WorkArea (int screenSizeX, int screenSizeY, const std::string & filename, QWidget * parent = nullptr);
WorkArea (int screenSizeX, int screenSizeY, const std::string & imageFilename, const std::string & SLFilename, bool readOnly, QWidget * parent = nullptr);
~WorkArea ();
void paint (QPainter & painter);
void loadImage (const std::string & filename);
void loadSL (const std::string & filename);
void saveStrengthLine (const std::string & filename);
void exportPNG (const std::string & filename);
void setReadOnly(bool readOnly);
bool getReadOnly();
QImage* getOriginalImage() const;
QImage* getResizedImage() const;
void setModificationInProgress(bool mip);
bool getModificationInProgress();
int getNumberOfLines() const;
void addSL(const StrengthLine *sl);
void addRandomSL();
signals:
void click();
};
#endif