Go to the documentation of this file.
4 #include <QInputDialog>
10 isPointNearStart =
false;
11 drawingOfPolygon =
false;
13 this->isSettingPolygon = isSettingPolygon;
14 if(isSettingPolygon) {
21 if(drawingOfPolygon) {
36 if(isSettingPolygon) {
44 if(isInside && !drawingOfPolygon) {
46 QPoint drawingPoint = QPoint(x,y);
48 drawingOfPolygon =
true;
49 QPointList.push_back(drawingPoint);
52 if(!isSettingPolygon) {
56 else if(drawingOfPolygon && QPointList.size() > 0 && isNearStart(x,y,QPointList.front())) {
57 if(QPointList.size() > 2) {
58 isPointNearStart =
true;
60 if(!isSettingPolygon) {
66 drawingOfPolygon =
false;
73 else if(drawingOfPolygon) {
74 QPoint drawingPoint(x,y);
75 QPointList.push_back(drawingPoint);
77 if(!isSettingPolygon) {
84 drawingOfPolygon =
false;
86 isPointNearStart =
false;
92 if(isPointNearStart) {
94 isPointNearStart =
false;
95 drawingOfPolygon =
false;
96 if(!isSettingPolygon) {
109 for(
int i = 0; i<static_cast<int>(QPointList.size()); i++) {
110 int next =
static_cast<int>((i +
static_cast<int>(1)) %
static_cast<int>(QPointList.size()));
129 if(!isSettingPolygon) {
138 if(!isSettingPolygon) {
143 bool IntelliToolPolygon::isNearStart(
int x,
int y, QPoint Startpoint){
144 int StartX = Startpoint.x();
145 int StartY = Startpoint.y();
148 float euklid = sqrt(pow(
static_cast<float>(StartX - x),2.f) + pow(
static_cast<float>(StartY - y),2.f));
150 return static_cast<int>(euklid)<valueToNear;
virtual void drawLine(const QPoint &p1, const QPoint &p2, const QColor &color, const int &penWidth)
A function that draws a line between two given points in a given color.
virtual void drawPixel(const QPoint &p1, const QColor &color)
A funtcion used to draw a pixel on the Image with the given Color.
std::vector< Triangle > calculateTriangles(std::vector< QPoint > polyPoints)
A function to split a polygon in its spanning traingles by using Meisters Theorem of graph theory by ...
QColor getSecondColor()
A function to read the secondary selected color.
The PaintingArea class manages the methods and stores information about the current painting area,...
virtual void drawPoint(const QPoint &p1, const QColor &color, const int &penWidth)
A function that draws a point between on a given point in a given color.
IntelliImage::ImageType getTypeOfImageRealLayer()
int width
width - Stores the width of a layer in pixels.
virtual void setImageData(const QImage &newData)
setImageData overwrites the old imageData the new imageData.
QColor getFirstColor()
A function to read the primary selected color.
int height
height - Stores the height of a layer in pixels.
QImage getImageDataOfActiveLayer()
getImageDataOfActiveLayer used to get the currents active imageData (if there isn't any active layer ...
The IntelliColorPicker manages the selected colors for one whole project.
IntelliImage * image
image - Stores the imageData of the current LayerObject.
std::vector< QPoint > getPolygonDataOfRealLayer()
virtual void calculateVisiblity()=0
An abstract function that calculates the visiblity of the Image data if needed.
bool isInPolygon(const std::vector< Triangle > &triangles, QPoint &point)
A function to check if a point lies in a polygon by checking its spanning triangles.
virtual void setPolygon(const std::vector< QPoint > &polygonData)=0
An abstract function that sets the data of the visible Polygon, if needed.