diff --git a/src/Tool/IntelliToolPolygon.cpp b/src/Tool/IntelliToolPolygon.cpp index 9088d31..d075529 100644 --- a/src/Tool/IntelliToolPolygon.cpp +++ b/src/Tool/IntelliToolPolygon.cpp @@ -1,6 +1,5 @@ #include "IntelliToolPolygon.h" #include "Layer/PaintingArea.h" -#include "IntelliHelper/IntelliHelper.h" #include #include @@ -11,6 +10,8 @@ IntelliToolPolygon::IntelliToolPolygon(PaintingArea* Area, IntelliColorPicker* c PointIsNearStart = false; drawingPoint.setX(0); drawingPoint.setY(0); + Point.setX(0); + Point.setY(0); } void IntelliToolPolygon::onMouseLeftPressed(int x, int y){ @@ -54,8 +55,7 @@ void IntelliToolPolygon::onMouseLeftReleased(int x, int y){ this->Canvas->image->calculateVisiblity(); PointIsNearStart = false; isDrawing = false; - std::vector Triangles = IntelliHelper::calculateTriangles(QPointList); - QPoint Point(0,0); + Triangles = IntelliHelper::calculateTriangles(QPointList); for(int i = 0; i < width; i++){ for(int j = 0; j < height; j++){ Point.setX(i); diff --git a/src/Tool/IntelliToolPolygon.h b/src/Tool/IntelliToolPolygon.h index fc51ec6..da9fa7c 100644 --- a/src/Tool/IntelliToolPolygon.h +++ b/src/Tool/IntelliToolPolygon.h @@ -2,12 +2,20 @@ #define INTELLITOOLPOLYGON_H #include "IntelliTool.h" +#include "IntelliHelper/IntelliHelper.h" #include #include - +/*! + * \brief The IntelliToolPolygon managed the Drawing of Polygonforms + */ class IntelliToolPolygon : public IntelliTool { public: + /*! + * \brief IntelliToolPolygon Constructor Define the Tool-intern Parameters + * \param Area + * \param colorPicker + */ IntelliToolPolygon(PaintingArea* Area, IntelliColorPicker* colorPicker); virtual void onMouseLeftPressed(int x, int y) override; @@ -20,15 +28,51 @@ public: virtual void onMouseMoved(int x, int y) override; private: + /*! + * \brief isNearStart + * \param x + * \param y + * \param Startpoint + * \return true : Near Startpoint, else false + */ bool isNearStart(int x, int y, QPoint Startpoint); + /*! + * \brief lineWidth of the Drawing Polygon + */ int lineWidth; + /*! + * \brief width of the active Layer + */ int width; + /*! + * \brief height of the active Layer + */ int height; + /*! + * \brief isDrawing true while drawing, else false + */ bool isDrawing; + /*! + * \brief PointIsNearStart true, when last click near Startpoint, else false + */ bool PointIsNearStart; + /*! + * \brief drawingPoint Current Point after Left-Click + */ QPoint drawingPoint; + /*! + * \brief Point Needed to look, if Point is in Polygon + */ + QPoint Point; + /*! + * \brief QPointList List of all Points of the Polygon + */ std::vector QPointList; + /*! + * \brief Triangles Transformed QPointList into triangulated Form of the Polygon + */ + std::vector Triangles; };