1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283 |
- /*********************************************************************/
- /* */
- /* 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>
- class WorkArea: public QWidget
- {
-
- Q_OBJECT
-
- private:
- const int taillePoint = 10;
- const int epaisseurLigne = 3;
-
- unsigned int screenSizeX, screenSizeY;
- bool readOnly;
- bool modificationInProgress;
-
- 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 setReadOnly(bool readOnly);
- bool getReadOnly();
- void setModificationInProgress(bool mip);
- bool getModificationInProgress();
- };
- #endif
|