123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899 |
- /*********************************************************************/
- /* */
- /* 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 <http://www.gnu.org/licenses/>. */
- /* */
- /*********************************************************************/
- #ifndef WORKAREA_HPP
- #define WORKAREA_HPP
- #include <string>
- #include <QWidget>
- #include <QPainter>
- #include <QMouseEvent>
- #include <QPoint>
- #include <QImage>
- #include <QImageReader>
- #include "StrengthLine.hpp"
- class WorkArea: public QWidget
- {
-
- Q_OBJECT
-
- private:
- const int taillePoint = 10;
- const int epaisseurLigne = 6;
-
- 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 exportJPG (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
|