Resolved issue #480. New tool: Midpoint between two points.
--HG-- branch : develop
This commit is contained in:
parent
10d29af2a2
commit
7eaadf1761
|
@ -31,6 +31,7 @@
|
||||||
- [#409] New feature: Export measurement file to Excel .csv.
|
- [#409] New feature: Export measurement file to Excel .csv.
|
||||||
- [#180] New feature: Search field in tape app and dialog Increments.
|
- [#180] New feature: Search field in tape app and dialog Increments.
|
||||||
- [#514] Read only setting not working properly.
|
- [#514] Read only setting not working properly.
|
||||||
|
- [#480] New tool: Midpoint between two points.
|
||||||
|
|
||||||
# Version 0.4.5
|
# Version 0.4.5
|
||||||
- [#435] Valentina doesn't change the cursor.
|
- [#435] Valentina doesn't change the cursor.
|
||||||
|
|
|
@ -75,7 +75,7 @@ void VToolOptionsPropertyBrowser::ClearPropertyBrowser()
|
||||||
void VToolOptionsPropertyBrowser::ShowItemOptions(QGraphicsItem *item)
|
void VToolOptionsPropertyBrowser::ShowItemOptions(QGraphicsItem *item)
|
||||||
{
|
{
|
||||||
// This check helps to find missed tools in the switch
|
// This check helps to find missed tools in the switch
|
||||||
Q_STATIC_ASSERT_X(static_cast<int>(Tool::LAST_ONE_DO_NOT_USE) == 43, "Not all tools was used in switch.");
|
Q_STATIC_ASSERT_X(static_cast<int>(Tool::LAST_ONE_DO_NOT_USE) == 44, "Not all tools was used in switch.");
|
||||||
|
|
||||||
switch (item->type())
|
switch (item->type())
|
||||||
{
|
{
|
||||||
|
@ -199,7 +199,7 @@ void VToolOptionsPropertyBrowser::UpdateOptions()
|
||||||
}
|
}
|
||||||
|
|
||||||
// This check helps to find missed tools in the switch
|
// This check helps to find missed tools in the switch
|
||||||
Q_STATIC_ASSERT_X(static_cast<int>(Tool::LAST_ONE_DO_NOT_USE) == 43, "Not all tools was used in switch.");
|
Q_STATIC_ASSERT_X(static_cast<int>(Tool::LAST_ONE_DO_NOT_USE) == 44, "Not all tools was used in switch.");
|
||||||
|
|
||||||
switch (currentItem->type())
|
switch (currentItem->type())
|
||||||
{
|
{
|
||||||
|
@ -334,7 +334,7 @@ void VToolOptionsPropertyBrowser::userChangedData(VProperty *property)
|
||||||
}
|
}
|
||||||
|
|
||||||
// This check helps to find missed tools in the switch
|
// This check helps to find missed tools in the switch
|
||||||
Q_STATIC_ASSERT_X(static_cast<int>(Tool::LAST_ONE_DO_NOT_USE) == 43, "Not all tools was used in switch.");
|
Q_STATIC_ASSERT_X(static_cast<int>(Tool::LAST_ONE_DO_NOT_USE) == 44, "Not all tools was used in switch.");
|
||||||
|
|
||||||
switch (currentItem->type())
|
switch (currentItem->type())
|
||||||
{
|
{
|
||||||
|
|
|
@ -208,7 +208,7 @@ void DialogHistory::FillTable()
|
||||||
QString DialogHistory::Record(const VToolRecord &tool)
|
QString DialogHistory::Record(const VToolRecord &tool)
|
||||||
{
|
{
|
||||||
// This check helps to find missed tools in the switch
|
// This check helps to find missed tools in the switch
|
||||||
Q_STATIC_ASSERT_X(static_cast<int>(Tool::LAST_ONE_DO_NOT_USE) == 43, "Not all tools was used in history.");
|
Q_STATIC_ASSERT_X(static_cast<int>(Tool::LAST_ONE_DO_NOT_USE) == 44, "Not all tools was used in history.");
|
||||||
|
|
||||||
const QDomElement domElem = doc->elementById(tool.getId());
|
const QDomElement domElem = doc->elementById(tool.getId());
|
||||||
if (domElem.isElement() == false)
|
if (domElem.isElement() == false)
|
||||||
|
@ -226,6 +226,7 @@ QString DialogHistory::Record(const VToolRecord &tool)
|
||||||
case Tool::LinePoint:
|
case Tool::LinePoint:
|
||||||
case Tool::AbstractSpline:
|
case Tool::AbstractSpline:
|
||||||
case Tool::Cut:
|
case Tool::Cut:
|
||||||
|
case Tool::Midpoint:// Same as Tool::AlongLine, but tool will never has such type
|
||||||
case Tool::LAST_ONE_DO_NOT_USE:
|
case Tool::LAST_ONE_DO_NOT_USE:
|
||||||
Q_UNREACHABLE(); //-V501
|
Q_UNREACHABLE(); //-V501
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -610,6 +610,11 @@ void MainWindow::SetToolButtonWithApply(bool checked, Tool t, const QString &cur
|
||||||
helpLabel->setText(toolTip);
|
helpLabel->setText(toolTip);
|
||||||
dialogTool = new Dialog(pattern, NULL_ID, this);
|
dialogTool = new Dialog(pattern, NULL_ID, this);
|
||||||
|
|
||||||
|
if (t == Tool::Midpoint)
|
||||||
|
{
|
||||||
|
dialogTool->Build(t);
|
||||||
|
}
|
||||||
|
|
||||||
VMainGraphicsScene *scene = qobject_cast<VMainGraphicsScene *>(currentScene);
|
VMainGraphicsScene *scene = qobject_cast<VMainGraphicsScene *>(currentScene);
|
||||||
SCASSERT(scene != nullptr);
|
SCASSERT(scene != nullptr);
|
||||||
|
|
||||||
|
@ -750,6 +755,16 @@ void MainWindow::ToolAlongLine(bool checked)
|
||||||
&MainWindow::ApplyDialog<VToolAlongLine>);
|
&MainWindow::ApplyDialog<VToolAlongLine>);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void MainWindow::ToolMidpoint(bool checked)
|
||||||
|
{
|
||||||
|
ToolSelectPointByRelease();
|
||||||
|
// Reuse DialogAlongLine and VToolAlongLine but with different cursor
|
||||||
|
SetToolButtonWithApply<DialogAlongLine>(checked, Tool::Midpoint, ":/cursor/midpoint_cursor.png",
|
||||||
|
tr("Select point"), &MainWindow::ClosedDialogWithApply<VToolAlongLine>,
|
||||||
|
&MainWindow::ApplyDialog<VToolAlongLine>);
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
/**
|
/**
|
||||||
* @brief ToolShoulderPoint handler tool shoulderPoint.
|
* @brief ToolShoulderPoint handler tool shoulderPoint.
|
||||||
|
@ -1750,6 +1765,7 @@ void MainWindow::InitToolButtons()
|
||||||
connect(ui->toolButtonTrueDarts, &QToolButton::clicked, this, &MainWindow::ToolTrueDarts);
|
connect(ui->toolButtonTrueDarts, &QToolButton::clicked, this, &MainWindow::ToolTrueDarts);
|
||||||
connect(ui->toolButtonGroup, &QToolButton::clicked, this, &MainWindow::ToolGroup);
|
connect(ui->toolButtonGroup, &QToolButton::clicked, this, &MainWindow::ToolGroup);
|
||||||
connect(ui->toolButtonRotation, &QToolButton::clicked, this, &MainWindow::ToolRotation);
|
connect(ui->toolButtonRotation, &QToolButton::clicked, this, &MainWindow::ToolRotation);
|
||||||
|
connect(ui->toolButtonMidpoint, &QToolButton::clicked, this, &MainWindow::ToolMidpoint);
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
@ -1790,7 +1806,7 @@ void MainWindow::mouseMove(const QPointF &scenePos)
|
||||||
void MainWindow::CancelTool()
|
void MainWindow::CancelTool()
|
||||||
{
|
{
|
||||||
// This check helps to find missed tools in the switch
|
// This check helps to find missed tools in the switch
|
||||||
Q_STATIC_ASSERT_X(static_cast<int>(Tool::LAST_ONE_DO_NOT_USE) == 43, "Not all tools was handled.");
|
Q_STATIC_ASSERT_X(static_cast<int>(Tool::LAST_ONE_DO_NOT_USE) == 44, "Not all tools was handled.");
|
||||||
|
|
||||||
qCDebug(vMainWindow, "Canceling tool.");
|
qCDebug(vMainWindow, "Canceling tool.");
|
||||||
delete dialogTool;
|
delete dialogTool;
|
||||||
|
@ -1836,6 +1852,9 @@ void MainWindow::CancelTool()
|
||||||
case Tool::AlongLine:
|
case Tool::AlongLine:
|
||||||
ui->toolButtonAlongLine->setChecked(false);
|
ui->toolButtonAlongLine->setChecked(false);
|
||||||
break;
|
break;
|
||||||
|
case Tool::Midpoint:
|
||||||
|
ui->toolButtonMidpoint->setChecked(false);
|
||||||
|
break;
|
||||||
case Tool::ShoulderPoint:
|
case Tool::ShoulderPoint:
|
||||||
ui->toolButtonShoulderPoint->setChecked(false);
|
ui->toolButtonShoulderPoint->setChecked(false);
|
||||||
break;
|
break;
|
||||||
|
@ -3133,6 +3152,7 @@ void MainWindow::SetEnableTool(bool enable)
|
||||||
ui->toolButtonTrueDarts->setEnabled(drawTools);
|
ui->toolButtonTrueDarts->setEnabled(drawTools);
|
||||||
ui->toolButtonGroup->setEnabled(drawTools);
|
ui->toolButtonGroup->setEnabled(drawTools);
|
||||||
ui->toolButtonRotation->setEnabled(drawTools);
|
ui->toolButtonRotation->setEnabled(drawTools);
|
||||||
|
ui->toolButtonMidpoint->setEnabled(drawTools);
|
||||||
|
|
||||||
ui->actionLast_tool->setEnabled(drawTools);
|
ui->actionLast_tool->setEnabled(drawTools);
|
||||||
|
|
||||||
|
@ -3412,7 +3432,7 @@ void MainWindow::CreateMenus()
|
||||||
void MainWindow::LastUsedTool()
|
void MainWindow::LastUsedTool()
|
||||||
{
|
{
|
||||||
// This check helps to find missed tools in the switch
|
// This check helps to find missed tools in the switch
|
||||||
Q_STATIC_ASSERT_X(static_cast<int>(Tool::LAST_ONE_DO_NOT_USE) == 43, "Not all tools was handled.");
|
Q_STATIC_ASSERT_X(static_cast<int>(Tool::LAST_ONE_DO_NOT_USE) == 44, "Not all tools was handled.");
|
||||||
|
|
||||||
if (currentTool == lastUsedTool)
|
if (currentTool == lastUsedTool)
|
||||||
{
|
{
|
||||||
|
@ -3451,6 +3471,10 @@ void MainWindow::LastUsedTool()
|
||||||
ui->toolButtonAlongLine->setChecked(true);
|
ui->toolButtonAlongLine->setChecked(true);
|
||||||
ToolAlongLine(true);
|
ToolAlongLine(true);
|
||||||
break;
|
break;
|
||||||
|
case Tool::Midpoint:
|
||||||
|
ui->toolButtonMidpoint->setChecked(true);
|
||||||
|
ToolMidpoint(true);
|
||||||
|
break;
|
||||||
case Tool::ShoulderPoint:
|
case Tool::ShoulderPoint:
|
||||||
ui->toolButtonShoulderPoint->setChecked(true);
|
ui->toolButtonShoulderPoint->setChecked(true);
|
||||||
ToolShoulderPoint(true);
|
ToolShoulderPoint(true);
|
||||||
|
|
|
@ -104,6 +104,7 @@ public slots:
|
||||||
void ToolEndLine(bool checked);
|
void ToolEndLine(bool checked);
|
||||||
void ToolLine(bool checked);
|
void ToolLine(bool checked);
|
||||||
void ToolAlongLine(bool checked);
|
void ToolAlongLine(bool checked);
|
||||||
|
void ToolMidpoint(bool checked);
|
||||||
void ToolShoulderPoint(bool checked);
|
void ToolShoulderPoint(bool checked);
|
||||||
void ToolNormal(bool checked);
|
void ToolNormal(bool checked);
|
||||||
void ToolBisector(bool checked);
|
void ToolBisector(bool checked);
|
||||||
|
|
|
@ -48,7 +48,7 @@
|
||||||
<string>Tools</string>
|
<string>Tools</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="currentIndex">
|
<property name="currentIndex">
|
||||||
<number>4</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<widget class="QWidget" name="page">
|
<widget class="QWidget" name="page">
|
||||||
<property name="geometry">
|
<property name="geometry">
|
||||||
|
@ -368,6 +368,32 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item row="10" column="1">
|
||||||
|
<widget class="QToolButton" name="toolButtonMidpoint">
|
||||||
|
<property name="enabled">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>Midpoint between two points</string>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string notr="true">...</string>
|
||||||
|
</property>
|
||||||
|
<property name="icon">
|
||||||
|
<iconset resource="share/resources/toolicon.qrc">
|
||||||
|
<normaloff>:/toolicon/32x32/midpoint.png</normaloff>:/toolicon/32x32/midpoint.png</iconset>
|
||||||
|
</property>
|
||||||
|
<property name="iconSize">
|
||||||
|
<size>
|
||||||
|
<width>32</width>
|
||||||
|
<height>32</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="checkable">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
<widget class="QWidget" name="page_2">
|
<widget class="QWidget" name="page_2">
|
||||||
|
|
|
@ -68,5 +68,7 @@
|
||||||
<file>cursor/group_plus_cursor@2x.png</file>
|
<file>cursor/group_plus_cursor@2x.png</file>
|
||||||
<file>cursor/rotation_cursor.png</file>
|
<file>cursor/rotation_cursor.png</file>
|
||||||
<file>cursor/rotation_cursor@2x.png</file>
|
<file>cursor/rotation_cursor@2x.png</file>
|
||||||
|
<file>cursor/midpoint_cursor.png</file>
|
||||||
|
<file>cursor/midpoint_cursor@2x.png</file>
|
||||||
</qresource>
|
</qresource>
|
||||||
</RCC>
|
</RCC>
|
||||||
|
|
BIN
src/app/valentina/share/resources/cursor/midpoint_cursor.png
Normal file
BIN
src/app/valentina/share/resources/cursor/midpoint_cursor.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 459 B |
BIN
src/app/valentina/share/resources/cursor/midpoint_cursor@2x.png
Normal file
BIN
src/app/valentina/share/resources/cursor/midpoint_cursor@2x.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 910 B |
|
@ -66,5 +66,7 @@
|
||||||
<file>toolicon/32x32/group_plus@2x.png</file>
|
<file>toolicon/32x32/group_plus@2x.png</file>
|
||||||
<file>toolicon/32x32/rotation.png</file>
|
<file>toolicon/32x32/rotation.png</file>
|
||||||
<file>toolicon/32x32/rotation@2x.png</file>
|
<file>toolicon/32x32/rotation@2x.png</file>
|
||||||
|
<file>toolicon/32x32/midpoint.png</file>
|
||||||
|
<file>toolicon/32x32/midpoint@2x.png</file>
|
||||||
</qresource>
|
</qresource>
|
||||||
</RCC>
|
</RCC>
|
||||||
|
|
BIN
src/app/valentina/share/resources/toolicon/32x32/midpoint.png
Normal file
BIN
src/app/valentina/share/resources/toolicon/32x32/midpoint.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 685 B |
BIN
src/app/valentina/share/resources/toolicon/32x32/midpoint@2x.png
Normal file
BIN
src/app/valentina/share/resources/toolicon/32x32/midpoint@2x.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.3 KiB |
89
src/app/valentina/share/resources/toolicon/svg/midpoint.svg
Normal file
89
src/app/valentina/share/resources/toolicon/svg/midpoint.svg
Normal file
|
@ -0,0 +1,89 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||||
|
<!-- Created with Inkscape (http://www.inkscape.org/) -->
|
||||||
|
|
||||||
|
<svg
|
||||||
|
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||||
|
xmlns:cc="http://creativecommons.org/ns#"
|
||||||
|
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||||
|
xmlns:svg="http://www.w3.org/2000/svg"
|
||||||
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
|
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||||
|
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||||
|
version="1.1"
|
||||||
|
width="32"
|
||||||
|
height="32"
|
||||||
|
id="svg3837"
|
||||||
|
inkscape:version="0.91 r"
|
||||||
|
sodipodi:docname="midpoint.svg"
|
||||||
|
inkscape:export-filename="/home/dismine/CAD/Valentina_0.5.x/Valentina/src/app/valentina/share/resources/toolicon/32x32/midpoint@2.png"
|
||||||
|
inkscape:export-xdpi="180"
|
||||||
|
inkscape:export-ydpi="180">
|
||||||
|
<sodipodi:namedview
|
||||||
|
pagecolor="#ffffff"
|
||||||
|
bordercolor="#666666"
|
||||||
|
borderopacity="1"
|
||||||
|
objecttolerance="10"
|
||||||
|
gridtolerance="10"
|
||||||
|
guidetolerance="10"
|
||||||
|
inkscape:pageopacity="0"
|
||||||
|
inkscape:pageshadow="2"
|
||||||
|
inkscape:window-width="1855"
|
||||||
|
inkscape:window-height="1056"
|
||||||
|
id="namedview12"
|
||||||
|
showgrid="false"
|
||||||
|
inkscape:zoom="14.75"
|
||||||
|
inkscape:cx="4.5124528"
|
||||||
|
inkscape:cy="20.515633"
|
||||||
|
inkscape:window-x="65"
|
||||||
|
inkscape:window-y="24"
|
||||||
|
inkscape:window-maximized="1"
|
||||||
|
inkscape:current-layer="layer1" />
|
||||||
|
<defs
|
||||||
|
id="defs3839" />
|
||||||
|
<metadata
|
||||||
|
id="metadata3842">
|
||||||
|
<rdf:RDF>
|
||||||
|
<cc:Work
|
||||||
|
rdf:about="">
|
||||||
|
<dc:format>image/svg+xml</dc:format>
|
||||||
|
<dc:type
|
||||||
|
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
|
||||||
|
<dc:title />
|
||||||
|
</cc:Work>
|
||||||
|
</rdf:RDF>
|
||||||
|
</metadata>
|
||||||
|
<g
|
||||||
|
id="layer1">
|
||||||
|
<path
|
||||||
|
style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:2;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
|
||||||
|
d="M 5,4.5 27.998317,28.058453"
|
||||||
|
id="path4205"
|
||||||
|
inkscape:connector-curvature="0"
|
||||||
|
sodipodi:nodetypes="cc" />
|
||||||
|
<path
|
||||||
|
d="m 29.7585,27.987006 a 1.7375,1.7294948 0 0 1 -3.475,0 1.7375,1.7294948 0 1 1 3.475,0 z"
|
||||||
|
id="path2985-2"
|
||||||
|
style="fill:#000000;fill-opacity:1;stroke:#370000;stroke-width:1.56700003;stroke-linejoin:round;stroke-miterlimit:4.9000001;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:0.93950177"
|
||||||
|
inkscape:connector-curvature="0" />
|
||||||
|
<path
|
||||||
|
d="m 6.9338416,4.8053012 a 1.8239208,1.9086996 0 0 1 -3.6478416,0 1.8239208,1.9086996 0 1 1 3.6478416,0 z"
|
||||||
|
id="path2985-2-9"
|
||||||
|
style="fill:#000000;fill-opacity:1;stroke:#370000;stroke-width:1.57200003;stroke-linejoin:round;stroke-miterlimit:4.9000001;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:0.93950177"
|
||||||
|
inkscape:connector-curvature="0" />
|
||||||
|
<path
|
||||||
|
d="m 18.044627,16.211054 a 1.694033,1.7299055 0 0 1 -3.388066,0 1.694033,1.7299055 0 1 1 3.388066,0 z"
|
||||||
|
id="path2985-2-9-1-5"
|
||||||
|
style="fill:#f73208;fill-opacity:1;stroke:#f73208;stroke-width:1.56599998;stroke-linejoin:round;stroke-miterlimit:4.9000001;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
|
||||||
|
inkscape:connector-curvature="0" />
|
||||||
|
<path
|
||||||
|
style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:0.52306283px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
|
||||||
|
d="M 8.6014883,11.263148 11.568004,8.4540331"
|
||||||
|
id="path3337"
|
||||||
|
inkscape:connector-curvature="0" />
|
||||||
|
<path
|
||||||
|
style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:0.44801879px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
|
||||||
|
d="m 21.223272,23.725437 2.578632,-2.588379"
|
||||||
|
id="path3339"
|
||||||
|
inkscape:connector-curvature="0" />
|
||||||
|
</g>
|
||||||
|
</svg>
|
After Width: | Height: | Size: 3.6 KiB |
|
@ -263,6 +263,8 @@ void VPattern::setCurrentData()
|
||||||
|
|
||||||
const VDataTool *vTool = tools.value(id);
|
const VDataTool *vTool = tools.value(id);
|
||||||
*data = vTool->getData();
|
*data = vTool->getData();
|
||||||
|
//Delete special variable if exist
|
||||||
|
data->RemoveVariable(currentLength);
|
||||||
qCDebug(vXML, "Data successfully updated.");
|
qCDebug(vXML, "Data successfully updated.");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -3204,7 +3206,7 @@ void VPattern::ToolsCommonAttributes(const QDomElement &domElement, quint32 &id)
|
||||||
QRectF VPattern::ActiveDrawBoundingRect() const
|
QRectF VPattern::ActiveDrawBoundingRect() const
|
||||||
{
|
{
|
||||||
// This check helps to find missed tools in the switch
|
// This check helps to find missed tools in the switch
|
||||||
Q_STATIC_ASSERT_X(static_cast<int>(Tool::LAST_ONE_DO_NOT_USE) == 43, "Not all tools was used.");
|
Q_STATIC_ASSERT_X(static_cast<int>(Tool::LAST_ONE_DO_NOT_USE) == 44, "Not all tools was used.");
|
||||||
|
|
||||||
QRectF rec;
|
QRectF rec;
|
||||||
|
|
||||||
|
@ -3221,6 +3223,7 @@ QRectF VPattern::ActiveDrawBoundingRect() const
|
||||||
case Tool::LinePoint:
|
case Tool::LinePoint:
|
||||||
case Tool::AbstractSpline:
|
case Tool::AbstractSpline:
|
||||||
case Tool::Cut:
|
case Tool::Cut:
|
||||||
|
case Tool::Midpoint:// Same as Tool::AlongLine, but tool will never has such type
|
||||||
case Tool::LAST_ONE_DO_NOT_USE:
|
case Tool::LAST_ONE_DO_NOT_USE:
|
||||||
Q_UNREACHABLE();
|
Q_UNREACHABLE();
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -163,6 +163,7 @@ const QString angle2Spl_ = angle2_V + spl_;
|
||||||
const QString angle1SplPath = angle1_V + splPath;
|
const QString angle1SplPath = angle1_V + splPath;
|
||||||
const QString angle2SplPath = angle2_V + splPath;
|
const QString angle2SplPath = angle2_V + splPath;
|
||||||
const QString seg_ = QStringLiteral("Seg_");
|
const QString seg_ = QStringLiteral("Seg_");
|
||||||
|
const QString currentLength = QStringLiteral("CurrentLength");
|
||||||
|
|
||||||
const QStringList builInVariables = QStringList() << line_
|
const QStringList builInVariables = QStringList() << line_
|
||||||
<< angleLine_
|
<< angleLine_
|
||||||
|
@ -179,4 +180,5 @@ const QStringList builInVariables = QStringList() << line_
|
||||||
<< angle2Spl_
|
<< angle2Spl_
|
||||||
<< angle1SplPath
|
<< angle1SplPath
|
||||||
<< angle2SplPath
|
<< angle2SplPath
|
||||||
<< seg_;
|
<< seg_
|
||||||
|
<< currentLength;
|
||||||
|
|
|
@ -170,6 +170,7 @@ extern const QString angle2Spl_;
|
||||||
extern const QString angle1SplPath;
|
extern const QString angle1SplPath;
|
||||||
extern const QString angle2SplPath;
|
extern const QString angle2SplPath;
|
||||||
extern const QString seg_;
|
extern const QString seg_;
|
||||||
|
extern const QString currentLength;
|
||||||
|
|
||||||
extern const QStringList builInVariables;
|
extern const QStringList builInVariables;
|
||||||
|
|
||||||
|
|
|
@ -1235,7 +1235,7 @@ QStringList VAbstractPattern::ListPointExpressions() const
|
||||||
{
|
{
|
||||||
// Check if new tool doesn't bring new attribute with a formula.
|
// Check if new tool doesn't bring new attribute with a formula.
|
||||||
// If no just increment number
|
// If no just increment number
|
||||||
Q_STATIC_ASSERT(static_cast<int>(Tool::LAST_ONE_DO_NOT_USE) == 43);
|
Q_STATIC_ASSERT(static_cast<int>(Tool::LAST_ONE_DO_NOT_USE) == 44);
|
||||||
|
|
||||||
QStringList expressions;
|
QStringList expressions;
|
||||||
const QDomNodeList list = elementsByTagName(TagPoint);
|
const QDomNodeList list = elementsByTagName(TagPoint);
|
||||||
|
@ -1306,7 +1306,7 @@ QStringList VAbstractPattern::ListArcExpressions() const
|
||||||
{
|
{
|
||||||
// Check if new tool doesn't bring new attribute with a formula.
|
// Check if new tool doesn't bring new attribute with a formula.
|
||||||
// If no just increment number
|
// If no just increment number
|
||||||
Q_STATIC_ASSERT(static_cast<int>(Tool::LAST_ONE_DO_NOT_USE) == 43);
|
Q_STATIC_ASSERT(static_cast<int>(Tool::LAST_ONE_DO_NOT_USE) == 44);
|
||||||
|
|
||||||
QStringList expressions;
|
QStringList expressions;
|
||||||
const QDomNodeList list = elementsByTagName(TagArc);
|
const QDomNodeList list = elementsByTagName(TagArc);
|
||||||
|
@ -1367,7 +1367,7 @@ QStringList VAbstractPattern::ListPathPointExpressions() const
|
||||||
{
|
{
|
||||||
// Check if new tool doesn't bring new attribute with a formula.
|
// Check if new tool doesn't bring new attribute with a formula.
|
||||||
// If no just increment number
|
// If no just increment number
|
||||||
Q_STATIC_ASSERT(static_cast<int>(Tool::LAST_ONE_DO_NOT_USE) == 43);
|
Q_STATIC_ASSERT(static_cast<int>(Tool::LAST_ONE_DO_NOT_USE) == 44);
|
||||||
|
|
||||||
QStringList expressions;
|
QStringList expressions;
|
||||||
const QDomNodeList list = elementsByTagName(AttrPathPoint);
|
const QDomNodeList list = elementsByTagName(AttrPathPoint);
|
||||||
|
@ -1433,7 +1433,7 @@ QStringList VAbstractPattern::ListOperationExpressions() const
|
||||||
{
|
{
|
||||||
// Check if new tool doesn't bring new attribute with a formula.
|
// Check if new tool doesn't bring new attribute with a formula.
|
||||||
// If no just increment number
|
// If no just increment number
|
||||||
Q_STATIC_ASSERT(static_cast<int>(Tool::LAST_ONE_DO_NOT_USE) == 43);
|
Q_STATIC_ASSERT(static_cast<int>(Tool::LAST_ONE_DO_NOT_USE) == 44);
|
||||||
|
|
||||||
QStringList expressions;
|
QStringList expressions;
|
||||||
const QDomNodeList list = elementsByTagName(TagOperation);
|
const QDomNodeList list = elementsByTagName(TagOperation);
|
||||||
|
|
|
@ -103,6 +103,7 @@ enum class Tool : ToolVisHolderType
|
||||||
UnionDetails,
|
UnionDetails,
|
||||||
Group,
|
Group,
|
||||||
Rotation,
|
Rotation,
|
||||||
|
Midpoint,
|
||||||
LAST_ONE_DO_NOT_USE //add new stuffs above this, this constant must be last and never used
|
LAST_ONE_DO_NOT_USE //add new stuffs above this, this constant must be last and never used
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -420,6 +420,12 @@ void VContainer::AddCurveWithSegments(const QSharedPointer<VAbstractCubicBezierP
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void VContainer::RemoveVariable(const QString &name)
|
||||||
|
{
|
||||||
|
d->variables.remove(name);
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
/**
|
/**
|
||||||
* @brief AddObject add object to container
|
* @brief AddObject add object to container
|
||||||
|
|
|
@ -129,6 +129,7 @@ public:
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
void AddVariable(const QString& name, T *var);
|
void AddVariable(const QString& name, T *var);
|
||||||
|
void RemoveVariable(const QString& name);
|
||||||
|
|
||||||
void UpdateGObject(quint32 id, VGObject* obj);
|
void UpdateGObject(quint32 id, VGObject* obj);
|
||||||
void UpdateDetail(quint32 id, const VDetail &detail);
|
void UpdateDetail(quint32 id, const VDetail &detail);
|
||||||
|
|
|
@ -380,6 +380,7 @@ void VTranslateVars::InitVariables()
|
||||||
variables.insert(angle2SplPath, translate("VTranslateVars", "Angle2SplPath",
|
variables.insert(angle2SplPath, translate("VTranslateVars", "Angle2SplPath",
|
||||||
"Do not add symbol _ to the end of the name"));
|
"Do not add symbol _ to the end of the name"));
|
||||||
variables.insert(seg_, translate("VTranslateVars", "Seg_", "Segment. Left symbol _ in the name"));
|
variables.insert(seg_, translate("VTranslateVars", "Seg_", "Segment. Left symbol _ in the name"));
|
||||||
|
variables.insert(currentLength, translate("VTranslateVars", "CurrentLength", "Do not add space between words"));
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
|
@ -33,6 +33,7 @@
|
||||||
#include "../../../vwidgets/vmaingraphicsscene.h"
|
#include "../../../vwidgets/vmaingraphicsscene.h"
|
||||||
#include "../../../vpatterndb/vtranslatevars.h"
|
#include "../../../vpatterndb/vtranslatevars.h"
|
||||||
#include "../support/dialogeditwrongformula.h"
|
#include "../support/dialogeditwrongformula.h"
|
||||||
|
#include "../vgeometry/vpointf.h"
|
||||||
|
|
||||||
#include <QPushButton>
|
#include <QPushButton>
|
||||||
|
|
||||||
|
@ -44,7 +45,7 @@
|
||||||
*/
|
*/
|
||||||
DialogAlongLine::DialogAlongLine(const VContainer *data, const quint32 &toolId, QWidget *parent)
|
DialogAlongLine::DialogAlongLine(const VContainer *data, const quint32 &toolId, QWidget *parent)
|
||||||
:DialogTool(data, toolId, parent), ui(new Ui::DialogAlongLine),
|
:DialogTool(data, toolId, parent), ui(new Ui::DialogAlongLine),
|
||||||
formula(QString()), formulaBaseHeight(0)
|
formula(QString()), formulaBaseHeight(0), buildMidpoint(false)
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
|
|
||||||
|
@ -93,7 +94,7 @@ void DialogAlongLine::FormulaTextChanged()
|
||||||
void DialogAlongLine::PointChanged()
|
void DialogAlongLine::PointChanged()
|
||||||
{
|
{
|
||||||
QColor color = okColor;
|
QColor color = okColor;
|
||||||
if (getCurrentObjectId(ui->comboBoxFirstPoint) == getCurrentObjectId(ui->comboBoxSecondPoint))
|
if (GetFirstPointId() == GetSecondPointId())
|
||||||
{
|
{
|
||||||
flagError = false;
|
flagError = false;
|
||||||
color = errorColor;
|
color = errorColor;
|
||||||
|
@ -103,6 +104,7 @@ void DialogAlongLine::PointChanged()
|
||||||
flagError = true;
|
flagError = true;
|
||||||
color = okColor;
|
color = okColor;
|
||||||
}
|
}
|
||||||
|
SetCurrentLength();
|
||||||
ChangeColor(ui->labelFirstPoint, color);
|
ChangeColor(ui->labelFirstPoint, color);
|
||||||
ChangeColor(ui->labelSecondPoint, color);
|
ChangeColor(ui->labelSecondPoint, color);
|
||||||
CheckState();
|
CheckState();
|
||||||
|
@ -137,6 +139,9 @@ void DialogAlongLine::DeployFormulaTextEdit()
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
DialogAlongLine::~DialogAlongLine()
|
DialogAlongLine::~DialogAlongLine()
|
||||||
{
|
{
|
||||||
|
VContainer *locData = const_cast<VContainer *> (data);
|
||||||
|
locData->RemoveVariable(currentLength);
|
||||||
|
|
||||||
DeleteVisualization<VisToolAlongLine>();
|
DeleteVisualization<VisToolAlongLine>();
|
||||||
delete ui;
|
delete ui;
|
||||||
}
|
}
|
||||||
|
@ -173,6 +178,10 @@ void DialogAlongLine::ChosenObject(quint32 id, const SceneObject &type)
|
||||||
{
|
{
|
||||||
line->setObject2Id(id);
|
line->setObject2Id(id);
|
||||||
line->RefreshGeometry();
|
line->RefreshGeometry();
|
||||||
|
if (buildMidpoint)
|
||||||
|
{
|
||||||
|
SetFormula(currentLength + QLatin1Literal("/2"));
|
||||||
|
}
|
||||||
prepare = true;
|
prepare = true;
|
||||||
this->setModal(true);
|
this->setModal(true);
|
||||||
this->show();
|
this->show();
|
||||||
|
@ -215,6 +224,20 @@ void DialogAlongLine::closeEvent(QCloseEvent *event)
|
||||||
DialogTool::closeEvent(event);
|
DialogTool::closeEvent(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void DialogAlongLine::SetCurrentLength()
|
||||||
|
{
|
||||||
|
const QSharedPointer<VPointF> p1 = data->GeometricObject<VPointF>(GetFirstPointId());
|
||||||
|
const QSharedPointer<VPointF> p2 = data->GeometricObject<VPointF>(GetSecondPointId());
|
||||||
|
|
||||||
|
VLengthLine *length = new VLengthLine(p1.data(), GetFirstPointId(), p2.data(),
|
||||||
|
GetSecondPointId(), *data->GetPatternUnit());
|
||||||
|
length->SetName(currentLength);
|
||||||
|
|
||||||
|
VContainer *locData = const_cast<VContainer *> (data);
|
||||||
|
locData->AddVariable(currentLength, length);
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
/**
|
/**
|
||||||
* @brief SetSecondPointId set id second point of line
|
* @brief SetSecondPointId set id second point of line
|
||||||
|
@ -229,6 +252,15 @@ void DialogAlongLine::SetSecondPointId(const quint32 &value)
|
||||||
line->setObject2Id(value);
|
line->setObject2Id(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void DialogAlongLine::Build(const Tool &type)
|
||||||
|
{
|
||||||
|
if (type == Tool::Midpoint)
|
||||||
|
{
|
||||||
|
buildMidpoint = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
/**
|
/**
|
||||||
* @brief SetFirstPointId set id first point of line
|
* @brief SetFirstPointId set id first point of line
|
||||||
|
|
|
@ -62,6 +62,8 @@ public:
|
||||||
|
|
||||||
quint32 GetSecondPointId() const;
|
quint32 GetSecondPointId() const;
|
||||||
void SetSecondPointId(const quint32 &value);
|
void SetSecondPointId(const quint32 &value);
|
||||||
|
|
||||||
|
virtual void Build(const Tool &type) Q_DECL_OVERRIDE;
|
||||||
public slots:
|
public slots:
|
||||||
virtual void ChosenObject(quint32 id, const SceneObject &type) Q_DECL_OVERRIDE;
|
virtual void ChosenObject(quint32 id, const SceneObject &type) Q_DECL_OVERRIDE;
|
||||||
/**
|
/**
|
||||||
|
@ -93,6 +95,10 @@ private:
|
||||||
|
|
||||||
/** @brief formulaBaseHeight base height defined by dialogui */
|
/** @brief formulaBaseHeight base height defined by dialogui */
|
||||||
int formulaBaseHeight;
|
int formulaBaseHeight;
|
||||||
|
|
||||||
|
bool buildMidpoint;
|
||||||
|
|
||||||
|
void SetCurrentLength();
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // DIALOGALONGLINE_H
|
#endif // DIALOGALONGLINE_H
|
||||||
|
|
|
@ -919,6 +919,12 @@ void DialogTool::ShowDialog(bool click)
|
||||||
Q_UNUSED(click);
|
Q_UNUSED(click);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void DialogTool::Build(const Tool &type)
|
||||||
|
{
|
||||||
|
Q_UNUSED(type);
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void DialogTool::SetAssociatedTool(VAbstractTool *tool)
|
void DialogTool::SetAssociatedTool(VAbstractTool *tool)
|
||||||
{
|
{
|
||||||
|
|
|
@ -69,6 +69,7 @@ public:
|
||||||
void SetAssociatedTool(VAbstractTool* tool);
|
void SetAssociatedTool(VAbstractTool* tool);
|
||||||
|
|
||||||
virtual void ShowDialog(bool click);
|
virtual void ShowDialog(bool click);
|
||||||
|
virtual void Build(const Tool &type);
|
||||||
|
|
||||||
quint32 GetToolId() const;
|
quint32 GetToolId() const;
|
||||||
void SetToolId(const quint32 &value);
|
void SetToolId(const quint32 &value);
|
||||||
|
|
|
@ -250,6 +250,12 @@ VToolAlongLine* VToolAlongLine::Create(const quint32 _id, const QString &pointNa
|
||||||
const QSharedPointer<VPointF> secondPoint = data->GeometricObject<VPointF>(secondPointId);
|
const QSharedPointer<VPointF> secondPoint = data->GeometricObject<VPointF>(secondPointId);
|
||||||
QLineF line = QLineF(*firstPoint, *secondPoint);
|
QLineF line = QLineF(*firstPoint, *secondPoint);
|
||||||
|
|
||||||
|
//Declare special variable "CurrentLength"
|
||||||
|
VLengthLine *length = new VLengthLine(firstPoint.data(), firstPointId, secondPoint.data(),
|
||||||
|
secondPointId, *data->GetPatternUnit());
|
||||||
|
length->SetName(currentLength);
|
||||||
|
data->AddVariable(currentLength, length);
|
||||||
|
|
||||||
line.setLength(qApp->toPixel(CheckFormula(_id, formula, data)));
|
line.setLength(qApp->toPixel(CheckFormula(_id, formula, data)));
|
||||||
|
|
||||||
quint32 id = _id;
|
quint32 id = _id;
|
||||||
|
@ -270,16 +276,18 @@ VToolAlongLine* VToolAlongLine::Create(const quint32 _id, const QString &pointNa
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
VDrawTool::AddRecord(id, Tool::AlongLine, doc);
|
VDrawTool::AddRecord(id, Tool::AlongLine, doc);
|
||||||
|
VToolAlongLine *point = nullptr;
|
||||||
if (parse == Document::FullParse)
|
if (parse == Document::FullParse)
|
||||||
{
|
{
|
||||||
VToolAlongLine *point = new VToolAlongLine(doc, data, id, formula, firstPointId, secondPointId, typeLine,
|
point = new VToolAlongLine(doc, data, id, formula, firstPointId, secondPointId, typeLine, lineColor,
|
||||||
lineColor, typeCreation);
|
typeCreation);
|
||||||
scene->addItem(point);
|
scene->addItem(point);
|
||||||
InitToolConnections(scene, point);
|
InitToolConnections(scene, point);
|
||||||
doc->AddTool(id, point);
|
doc->AddTool(id, point);
|
||||||
doc->IncrementReferens(firstPoint->getIdTool());
|
doc->IncrementReferens(firstPoint->getIdTool());
|
||||||
doc->IncrementReferens(secondPoint->getIdTool());
|
doc->IncrementReferens(secondPoint->getIdTool());
|
||||||
|
}
|
||||||
|
//Very important to delete it. Only this tool need this special variable.
|
||||||
|
data->RemoveVariable(currentLength);
|
||||||
return point;
|
return point;
|
||||||
}
|
}
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
|
|
|
@ -651,6 +651,7 @@ void TST_MeasurementRegExp::CheckUnderlineExists() const
|
||||||
data.insert(angle1SplPath, false);
|
data.insert(angle1SplPath, false);
|
||||||
data.insert(angle2SplPath, false);
|
data.insert(angle2SplPath, false);
|
||||||
data.insert(seg_, true);
|
data.insert(seg_, true);
|
||||||
|
data.insert(currentLength, false);
|
||||||
|
|
||||||
//Catch case when new internal variable appears.
|
//Catch case when new internal variable appears.
|
||||||
QCOMPARE(data.size(), builInVariables.size());
|
QCOMPARE(data.size(), builInVariables.size());
|
||||||
|
|
Loading…
Reference in New Issue
Block a user