mirror of
https://github.com/ONLYOFFICE/core.git
synced 2026-04-07 13:55:33 +08:00
Add test for negative vertices
This commit is contained in:
committed by
Oleg Korshul
parent
7f13020f2f
commit
57fdf7eed5
@ -94,6 +94,30 @@ MainWindow::MainWindow(QWidget *parent)
|
||||
|
||||
for (std::vector<QObject*>::iterator i = arrBooleanButtons.begin(); i != arrBooleanButtons.end(); i++)
|
||||
connect((QPushButton*)(*i), &QPushButton::clicked, this, &MainWindow::SetCommand);
|
||||
|
||||
// Aggplus::CGraphicsPath *path1 = new Aggplus::CGraphicsPath;
|
||||
// path1->StartFigure();
|
||||
// path1->MoveTo(200.0, 200.0);
|
||||
// path1->LineTo(-200.0, 200.0);
|
||||
// path1->LineTo(-200.0, -200.0);
|
||||
// path1->LineTo(200.0, -200.0);
|
||||
// path1->LineTo(200.0, 200.0);
|
||||
// path1->CloseFigure();
|
||||
// SetCoords(ui->label_4, path1);
|
||||
|
||||
// Aggplus::CGraphicsPath *path2 = new Aggplus::CGraphicsPath;
|
||||
// path2->StartFigure();
|
||||
// path2->MoveTo(-100.0, -100.0);
|
||||
// path2->LineTo(300.0, -100.0);
|
||||
// path2->LineTo(300.0, 300.0);
|
||||
// path2->LineTo(-100.0, 300.0);
|
||||
// path2->LineTo(-100.0, -100.0);
|
||||
// path2->CloseFigure();
|
||||
// SetCoords(ui->label_5, path2);
|
||||
|
||||
// Aggplus::CGraphicsPath *result = Aggplus::CalcBooleanOperation(path1, path2, Aggplus::Intersection);
|
||||
// Draw(result);
|
||||
// SetCoords(ui->label_7, result);
|
||||
}
|
||||
|
||||
void MainWindow::SetFigure()
|
||||
@ -184,20 +208,20 @@ void MainWindow::AddPath(NSGraphics::IGraphicsRenderer* pathRenderer, Aggplus::C
|
||||
|
||||
size_t length = path->GetPointCount();
|
||||
std::vector<Aggplus::PointD> points = path->GetPoints(0, length);
|
||||
pathRenderer->PathCommandMoveTo(points[0].X, points[0].Y);
|
||||
|
||||
for (size_t i = 1; i < length; i++)
|
||||
for (size_t i = 0; i < length; i++)
|
||||
{
|
||||
if (path->IsCurvePoint(i))
|
||||
{
|
||||
pathRenderer->PathCommandCurveTo(points[i].X, points[i].Y, points[i + 1].X,
|
||||
points[i + 1].Y,points[i + 2].X, points[i + 2].Y);
|
||||
pathRenderer->PathCommandCurveTo(points[i].X + NEGATIVE_OFFSET, points[i].Y + NEGATIVE_OFFSET,
|
||||
points[i + 1].X + NEGATIVE_OFFSET, points[i + 1].Y + NEGATIVE_OFFSET,
|
||||
points[i + 2].X + NEGATIVE_OFFSET, points[i + 2].Y + NEGATIVE_OFFSET);
|
||||
i += 2;
|
||||
}
|
||||
else if (path->IsMovePoint(i))
|
||||
pathRenderer->PathCommandMoveTo(points[i].X, points[i].Y);
|
||||
pathRenderer->PathCommandMoveTo(points[i].X + NEGATIVE_OFFSET, points[i].Y + NEGATIVE_OFFSET);
|
||||
else
|
||||
pathRenderer->PathCommandLineTo(points[i].X, points[i].Y);
|
||||
pathRenderer->PathCommandLineTo(points[i].X + NEGATIVE_OFFSET, points[i].Y + NEGATIVE_OFFSET);
|
||||
}
|
||||
|
||||
if (isResult)
|
||||
@ -301,12 +325,12 @@ void MainWindow::CheckMousePress()
|
||||
return;
|
||||
}
|
||||
|
||||
QRectF rect1(RECTANGLE[0] + Offsets[0],
|
||||
RECTANGLE[1] + Offsets[1],
|
||||
QRectF rect1(RECTANGLE[0] + NEGATIVE_OFFSET + Offsets[0],
|
||||
RECTANGLE[1] + NEGATIVE_OFFSET + Offsets[1],
|
||||
Scale[0] * RECTANGLE[2],
|
||||
Scale[0] * RECTANGLE[3]),
|
||||
rect2(RECTANGLE[0] + Offsets[2],
|
||||
RECTANGLE[1] + Offsets[3],
|
||||
rect2(RECTANGLE[0] + NEGATIVE_OFFSET + Offsets[2],
|
||||
RECTANGLE[1] + NEGATIVE_OFFSET + Offsets[3],
|
||||
Scale[1] * RECTANGLE[2],
|
||||
Scale[1] * RECTANGLE[3]);
|
||||
|
||||
|
||||
@ -14,7 +14,8 @@ class MainWindow;
|
||||
}
|
||||
QT_END_NAMESPACE
|
||||
|
||||
const double RECTANGLE[4] = {0.0, 0.0, 200.0, 200.0};
|
||||
const double NEGATIVE_OFFSET= 400.0;
|
||||
const double RECTANGLE[4] = {-400.0, -400.0, 200.0, 200.0};
|
||||
const double TRIANGLE[6] = {100.0, 0.0, 200.0, 200.0, 0.0, 100.0};
|
||||
|
||||
class CustomLabel : public QLabel
|
||||
@ -81,12 +82,9 @@ public:
|
||||
private slots:
|
||||
void CheckMousePress();
|
||||
void Move();
|
||||
|
||||
void SetCommand();
|
||||
void SetFigure();
|
||||
|
||||
void on_horizontalSlider_sliderMoved(int position);
|
||||
|
||||
void on_horizontalSlider_2_sliderMoved(int position);
|
||||
|
||||
public:
|
||||
|
||||
@ -6,8 +6,8 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>1124</width>
|
||||
<height>553</height>
|
||||
<width>1441</width>
|
||||
<height>859</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
@ -19,8 +19,8 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>500</width>
|
||||
<height>500</height>
|
||||
<width>800</width>
|
||||
<height>800</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
@ -30,7 +30,7 @@
|
||||
<widget class="QGroupBox" name="groupBox">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>520</x>
|
||||
<x>810</x>
|
||||
<y>0</y>
|
||||
<width>610</width>
|
||||
<height>500</height>
|
||||
@ -94,7 +94,7 @@
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>270</y>
|
||||
<y>250</y>
|
||||
<width>63</width>
|
||||
<height>20</height>
|
||||
</rect>
|
||||
@ -107,9 +107,9 @@
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>290</y>
|
||||
<y>270</y>
|
||||
<width>170</width>
|
||||
<height>180</height>
|
||||
<height>200</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
@ -141,6 +141,19 @@
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="label_8">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>170</y>
|
||||
<width>63</width>
|
||||
<height>20</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Scale:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</widget>
|
||||
<widget class="QGroupBox" name="groupBox_3">
|
||||
<property name="geometry">
|
||||
@ -197,7 +210,7 @@
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>270</y>
|
||||
<y>250</y>
|
||||
<width>63</width>
|
||||
<height>20</height>
|
||||
</rect>
|
||||
@ -210,9 +223,9 @@
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>290</y>
|
||||
<y>270</y>
|
||||
<width>170</width>
|
||||
<height>180</height>
|
||||
<height>200</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
@ -244,6 +257,19 @@
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="label_9">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>170</y>
|
||||
<width>63</width>
|
||||
<height>20</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Scale:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</widget>
|
||||
<widget class="QGroupBox" name="groupBox_4">
|
||||
<property name="geometry">
|
||||
@ -251,7 +277,7 @@
|
||||
<x>410</x>
|
||||
<y>10</y>
|
||||
<width>191</width>
|
||||
<height>320</height>
|
||||
<height>480</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="title">
|
||||
@ -261,7 +287,7 @@
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>160</y>
|
||||
<y>250</y>
|
||||
<width>63</width>
|
||||
<height>20</height>
|
||||
</rect>
|
||||
@ -274,9 +300,9 @@
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>180</y>
|
||||
<y>270</y>
|
||||
<width>170</width>
|
||||
<height>130</height>
|
||||
<height>200</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
@ -333,7 +359,7 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>1124</width>
|
||||
<width>1441</width>
|
||||
<height>21</height>
|
||||
</rect>
|
||||
</property>
|
||||
|
||||
Reference in New Issue
Block a user