Documentation

This commit is contained in:
Mienek
2019-12-19 12:05:31 +01:00
parent c6151b1bbf
commit 1de2f55e85
2 changed files with 48 additions and 4 deletions

View File

@@ -1,6 +1,5 @@
#include "IntelliToolPolygon.h"
#include "Layer/PaintingArea.h"
#include "IntelliHelper/IntelliHelper.h"
#include <QDebug>
#include <QCursor>
@@ -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<Triangle> 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);

View File

@@ -2,12 +2,20 @@
#define INTELLITOOLPOLYGON_H
#include "IntelliTool.h"
#include "IntelliHelper/IntelliHelper.h"
#include <vector>
#include <QPoint>
/*!
* \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<QPoint> QPointList;
/*!
* \brief Triangles Transformed QPointList into triangulated Form of the Polygon
*/
std::vector<Triangle> Triangles;
};