File indexing completed on 2024-05-19 03:53:36

0001 /*************************************************************************
0002  *  Copyright (C) 2020 by Caio Jordão Carvalho <caiojcarvalho@gmail.com> *
0003  *                                                                       *
0004  *  This program is free software; you can redistribute it and/or        *
0005  *  modify it under the terms of the GNU General Public License as       *
0006  *  published by the Free Software Foundation; either version 3 of       *
0007  *  the License, or (at your option) any later version.                  *
0008  *                                                                       *
0009  *  This program is distributed in the hope that it will be useful,      *
0010  *  but WITHOUT ANY WARRANTY; without even the implied warranty of       *
0011  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the        *
0012  *  GNU General Public License for more details.                         *
0013  *                                                                       *
0014  *  You should have received a copy of the GNU General Public License    *
0015  *  along with this program.  If not, see <http://www.gnu.org/licenses/>.*
0016  *************************************************************************/
0017 
0018 #ifndef POLYGON_H
0019 #define POLYGON_H
0020 
0021 #include "core/markedclass.h"
0022 #include "core/markedobject.h"
0023 
0024 #include <QPolygonF>
0025 
0026 /** Class that represent the annotated data of image annotation. */
0027 class Polygon : public MarkedObject, public QPolygonF
0028 {
0029 public:
0030     /** Create a Polygon, if given MarkedClass, assign it.
0031      * @param objClass - MarkedClass instance to assign.
0032      */
0033     explicit Polygon(MarkedClass* objClass = nullptr);
0034 
0035     /** Create a Polygon copying pol.
0036      * @param pol - Polygon to copy.
0037      */
0038     Polygon(const Polygon* pol);
0039 
0040     /** Create a Polygon with given MarkedClass and copying given polygon.
0041      * @param objClass - MarkedClass instance to assign.
0042      * @param values - Polygon to copy from.
0043      */
0044     Polygon(MarkedClass* objClass, const QPolygonF& polygon);
0045 
0046     void clear() override;
0047     QString unitName() const override;
0048     MarkedObject::Type type() override;
0049     void scale(const QPointF offset, const qreal scaleW, const qreal scaleH);
0050     void unscale(const QPointF offset, const qreal scaleW, const qreal scaleH);
0051 };
0052 
0053 #endif // POLYGON_H