Go to the documentation of this file.
4 #include <QInputDialog>
9 isPointNearStart =
false;
10 drawingOfPolygon =
false;
12 this->isSettingPolygon = isSettingPolygon;
13 if(isSettingPolygon) {
20 if(drawingOfPolygon) {
35 if(isSettingPolygon) {
43 if(isInside && !drawingOfPolygon) {
45 QPoint drawingPoint = QPoint(x,y);
47 drawingOfPolygon =
true;
48 QPointList.push_back(drawingPoint);
51 if(!isSettingPolygon) {
55 else if(drawingOfPolygon && QPointList.size() > 0 && isNearStart(x,y,QPointList.front())) {
56 if(QPointList.size() > 2) {
57 isPointNearStart =
true;
59 if(!isSettingPolygon) {
65 drawingOfPolygon =
false;
72 else if(drawingOfPolygon) {
73 QPoint drawingPoint(x,y);
74 QPointList.push_back(drawingPoint);
76 if(!isSettingPolygon) {
83 drawingOfPolygon =
false;
85 isPointNearStart =
false;
91 if(isPointNearStart) {
93 isPointNearStart =
false;
94 drawingOfPolygon =
false;
95 if(!isSettingPolygon) {
108 for(
int i = 0; i<static_cast<int>(QPointList.size()); i++) {
109 int next =
static_cast<int>((i +
static_cast<int>(1)) %
static_cast<int>(QPointList.size()));
128 if(!isSettingPolygon) {
137 if(!isSettingPolygon) {
142 bool IntelliToolPolygon::isNearStart(
int x,
int y, QPoint Startpoint){
143 int StartX = Startpoint.x();
144 int StartY = Startpoint.y();
147 float euklid = sqrt(pow(
static_cast<float>(StartX-x),2.f)+pow(
static_cast<float>(StartY-y),2.f));
149 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.
bool isInPolygon(std::vector< Triangle > &triangles, QPoint &point)
A function to check if a point lies in a polygon by checking its spanning triangles.
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.
virtual void setPolygon(const std::vector< QPoint > &polygonData)=0
An abstract function that sets the data of the visible Polygon, if needed.