Merge with feature. Resolved issue #132. Intersect Curves.

--HG--
branch : develop
This commit is contained in:
Roman Telezhynskyi 2016-01-25 19:16:04 +02:00
commit 3b76a421f8
126 changed files with 2152 additions and 398 deletions

View File

@ -8,6 +8,11 @@ syntax: glob
# Valentina lock files # Valentina lock files
*.lock *.lock
# Valentina and Tape makes reserve copy of each pattern file before conversion to higher version.
*(v*).val
*(v*).vit
*(v*).vst
# KDE directory preferences # KDE directory preferences
.directory .directory

View File

@ -1,4 +1,5 @@
# Version 0.5.0 # Version 0.5.0
- [#132] Intersect Curves.
- Added language Chinese (China). - Added language Chinese (China).
- New icon for VAL file. Updated Tape logo. Updated ico for standard measurements. - New icon for VAL file. Updated Tape logo. Updated ico for standard measurements.
- [#325] Check pattern for inverse compatibility. - [#325] Check pattern for inverse compatibility.

View File

@ -126,6 +126,9 @@ void VToolOptionsPropertyBrowser::ShowItemOptions(QGraphicsItem *item)
case VToolPointOfIntersectionCircles::Type: case VToolPointOfIntersectionCircles::Type:
ShowOptionsToolPointOfIntersectionCircles(item); ShowOptionsToolPointOfIntersectionCircles(item);
break; break;
case VToolPointOfIntersectionCurves::Type:
ShowOptionsToolPointOfIntersectionCurves(item);
break;
case VToolShoulderPoint::Type: case VToolShoulderPoint::Type:
ShowOptionsToolShoulderPoint(item); ShowOptionsToolShoulderPoint(item);
break; break;
@ -231,6 +234,9 @@ void VToolOptionsPropertyBrowser::UpdateOptions()
case VToolPointOfIntersectionCircles::Type: case VToolPointOfIntersectionCircles::Type:
UpdateOptionsToolPointOfIntersectionCircles(); UpdateOptionsToolPointOfIntersectionCircles();
break; break;
case VToolPointOfIntersectionCurves::Type:
UpdateOptionsToolPointOfIntersectionCurves();
break;
case VToolShoulderPoint::Type: case VToolShoulderPoint::Type:
UpdateOptionsToolShoulderPoint(); UpdateOptionsToolShoulderPoint();
break; break;
@ -351,6 +357,9 @@ void VToolOptionsPropertyBrowser::userChangedData(VProperty *property)
case VToolPointOfIntersectionCircles::Type: case VToolPointOfIntersectionCircles::Type:
ChangeDataToolPointOfIntersectionCircles(prop); ChangeDataToolPointOfIntersectionCircles(prop);
break; break;
case VToolPointOfIntersectionCurves::Type:
ChangeDataToolPointOfIntersectionCurves(prop);
break;
case VToolShoulderPoint::Type: case VToolShoulderPoint::Type:
ChangeDataToolShoulderPoint(prop); ChangeDataToolShoulderPoint(prop);
break; break;
@ -475,6 +484,26 @@ void VToolOptionsPropertyBrowser::AddPropertyCrossPoint(Tool *i, const QString &
AddProperty(itemProperty, AttrCrossPoint); AddProperty(itemProperty, AttrCrossPoint);
} }
//---------------------------------------------------------------------------------------------------------------------
template<class Tool>
void VToolOptionsPropertyBrowser::AddPropertyVCrossPoint(Tool *i, const QString &propertyName)
{
auto itemProperty = new VEnumProperty(propertyName);
itemProperty->setLiterals(QStringList()<< tr("Highest point") << tr("Lowest point"));
itemProperty->setValue(static_cast<int>(i->GetVCrossPoint())-1);
AddProperty(itemProperty, AttrVCrossPoint);
}
//---------------------------------------------------------------------------------------------------------------------
template<class Tool>
void VToolOptionsPropertyBrowser::AddPropertyHCrossPoint(Tool *i, const QString &propertyName)
{
auto itemProperty = new VEnumProperty(propertyName);
itemProperty->setLiterals(QStringList()<< tr("Leftmost point") << tr("Rightmost point"));
itemProperty->setValue(static_cast<int>(i->GetHCrossPoint())-1);
AddProperty(itemProperty, AttrHCrossPoint);
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
template<class Tool> template<class Tool>
void VToolOptionsPropertyBrowser::AddPropertyLineType(Tool *i, const QString &propertyName, void VToolOptionsPropertyBrowser::AddPropertyLineType(Tool *i, const QString &propertyName,
@ -589,31 +618,64 @@ void VToolOptionsPropertyBrowser::SetPointName2(const QString &name)
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
template<class Tool> template<class Type>
void VToolOptionsPropertyBrowser::SetCrossCirclesPoint(const QVariant &value) Type VToolOptionsPropertyBrowser::GetCrossPoint(const QVariant &value)
{ {
if (Tool *i = qgraphicsitem_cast<Tool *>(currentItem))
{
bool ok = false; bool ok = false;
const int val = value.toInt(&ok); const int val = value.toInt(&ok);
CrossCirclesPoint cross = CrossCirclesPoint::FirstPoint; auto cross = static_cast<Type>(1);
if (ok) if (ok)
{ {
switch(val) switch(val)
{ {
case 0: case 0:
cross = CrossCirclesPoint::FirstPoint;
break;
case 1: case 1:
cross = CrossCirclesPoint::SecondPoint; cross = static_cast<Type>(val+1);
break; break;
default: default:
cross = CrossCirclesPoint::FirstPoint;
break; break;
} }
} }
i->SetCrossCirclesPoint(cross);
return cross;
}
//---------------------------------------------------------------------------------------------------------------------
template<class Tool>
void VToolOptionsPropertyBrowser::SetCrossCirclesPoint(const QVariant &value)
{
if (Tool *i = qgraphicsitem_cast<Tool *>(currentItem))
{
i->SetCrossCirclesPoint(GetCrossPoint<CrossCirclesPoint>(value));
}
else
{
qWarning()<<"Can't cast item";
}
}
//---------------------------------------------------------------------------------------------------------------------
template<class Tool>
void VToolOptionsPropertyBrowser::SetVCrossCurvesPoint(const QVariant &value)
{
if (auto i = qgraphicsitem_cast<Tool *>(currentItem))
{
i->SetVCrossPoint(GetCrossPoint<VCrossCurvesPoint>(value));
}
else
{
qWarning()<<"Can't cast item";
}
}
//---------------------------------------------------------------------------------------------------------------------
template<class Tool>
void VToolOptionsPropertyBrowser::SetHCrossCurvesPoint(const QVariant &value)
{
if (auto i = qgraphicsitem_cast<Tool *>(currentItem))
{
i->SetHCrossPoint(GetCrossPoint<HCrossCurvesPoint>(value));
} }
else else
{ {
@ -1111,6 +1173,39 @@ void VToolOptionsPropertyBrowser::ChangeDataToolPointOfIntersectionCircles(VProp
} }
} }
//---------------------------------------------------------------------------------------------------------------------
void VToolOptionsPropertyBrowser::ChangeDataToolPointOfIntersectionCurves(VProperty *property)
{
SCASSERT(property != nullptr)
const QVariant value = property->data(VProperty::DPC_Data, Qt::DisplayRole);
const QString id = propertyToId[property];
auto i = qgraphicsitem_cast<VToolPointOfIntersectionCurves *>(currentItem);
SCASSERT(i != nullptr);
switch (PropertiesList().indexOf(id))
{
case 0: // AttrName
SetPointName<VToolPointOfIntersectionCurves>(value.toString());
break;
case 34: // AttrVCrossPoint
{
const QVariant value = property->data(VProperty::DPC_Data, Qt::EditRole);
SetVCrossCurvesPoint<VToolPointOfIntersectionCurves>(value);
break;
}
case 35: // AttrHCrossPoint
{
const QVariant value = property->data(VProperty::DPC_Data, Qt::EditRole);
SetHCrossCurvesPoint<VToolPointOfIntersectionCurves>(value);
break;
}
default:
qWarning()<<"Unknown property type. id = "<<id;
break;
}
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void VToolOptionsPropertyBrowser::ChangeDataToolPointFromCircleAndTangent(VProperty *property) void VToolOptionsPropertyBrowser::ChangeDataToolPointFromCircleAndTangent(VProperty *property)
{ {
@ -1558,6 +1653,18 @@ void VToolOptionsPropertyBrowser::ShowOptionsToolPointOfIntersectionCircles(QGra
AddPropertyCrossPoint(i, tr("Take")); AddPropertyCrossPoint(i, tr("Take"));
} }
//---------------------------------------------------------------------------------------------------------------------
void VToolOptionsPropertyBrowser::ShowOptionsToolPointOfIntersectionCurves(QGraphicsItem *item)
{
auto i = qgraphicsitem_cast<VToolPointOfIntersectionCurves *>(item);
i->ShowVisualization(true);
formView->setTitle(tr("Tool to make point from intersection two curves"));
AddPropertyPointName(i, tr("Point label"));
AddPropertyVCrossPoint(i, tr("Vertical correction"));
AddPropertyHCrossPoint(i, tr("Horizontal correction"));
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void VToolOptionsPropertyBrowser::ShowOptionsToolPointFromCircleAndTangent(QGraphicsItem *item) void VToolOptionsPropertyBrowser::ShowOptionsToolPointFromCircleAndTangent(QGraphicsItem *item)
{ {
@ -1950,6 +2057,16 @@ void VToolOptionsPropertyBrowser::UpdateOptionsToolPointOfIntersectionCircles()
idToProperty[AttrC2Radius]->setValue(c2Radius); idToProperty[AttrC2Radius]->setValue(c2Radius);
} }
//---------------------------------------------------------------------------------------------------------------------
void VToolOptionsPropertyBrowser::UpdateOptionsToolPointOfIntersectionCurves()
{
auto i = qgraphicsitem_cast<VToolPointOfIntersectionCurves *>(currentItem);
idToProperty[AttrName]->setValue(i->name());
idToProperty[AttrVCrossPoint]->setValue(static_cast<int>(i->GetVCrossPoint())-1);
idToProperty[AttrHCrossPoint]->setValue(static_cast<int>(i->GetHCrossPoint())-1);
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void VToolOptionsPropertyBrowser::UpdateOptionsToolPointFromCircleAndTangent() void VToolOptionsPropertyBrowser::UpdateOptionsToolPointFromCircleAndTangent()
{ {
@ -2104,6 +2221,8 @@ QStringList VToolOptionsPropertyBrowser::PropertiesList() const
<< AttrC2Radius /* 30 */ << AttrC2Radius /* 30 */
<< AttrCRadius /* 31 */ << AttrCRadius /* 31 */
<< AttrName1 /* 32 */ << AttrName1 /* 32 */
<< AttrName2; /* 33 */ << AttrName2 /* 33 */
<< AttrVCrossPoint /* 34 */
<< AttrHCrossPoint; /* 35 */
return attr; return attr;
} }

View File

@ -74,9 +74,18 @@ private:
template<class Tool> template<class Tool>
void SetPointName2(const QString &name); void SetPointName2(const QString &name);
template<class Type>
Type GetCrossPoint(const QVariant &value);
template<class Tool> template<class Tool>
void SetCrossCirclesPoint(const QVariant &value); void SetCrossCirclesPoint(const QVariant &value);
template<class Tool>
void SetVCrossCurvesPoint(const QVariant &value);
template<class Tool>
void SetHCrossCurvesPoint(const QVariant &value);
template<class Tool> template<class Tool>
void AddPropertyPointName(Tool *i, const QString &propertyName); void AddPropertyPointName(Tool *i, const QString &propertyName);
@ -89,6 +98,12 @@ private:
template<class Tool> template<class Tool>
void AddPropertyCrossPoint(Tool *i, const QString &propertyName); void AddPropertyCrossPoint(Tool *i, const QString &propertyName);
template<class Tool>
void AddPropertyVCrossPoint(Tool *i, const QString &propertyName);
template<class Tool>
void AddPropertyHCrossPoint(Tool *i, const QString &propertyName);
template<class Tool> template<class Tool>
void AddPropertyLineType(Tool *i, const QString &propertyName, const QMap<QString, QIcon> &styles); void AddPropertyLineType(Tool *i, const QString &propertyName, const QMap<QString, QIcon> &styles);
@ -118,6 +133,7 @@ private:
void ChangeDataToolPointOfIntersection(VPE::VProperty *property); void ChangeDataToolPointOfIntersection(VPE::VProperty *property);
void ChangeDataToolPointOfIntersectionArcs(VPE::VProperty *property); void ChangeDataToolPointOfIntersectionArcs(VPE::VProperty *property);
void ChangeDataToolPointOfIntersectionCircles(VPE::VProperty *property); void ChangeDataToolPointOfIntersectionCircles(VPE::VProperty *property);
void ChangeDataToolPointOfIntersectionCurves(VPE::VProperty *property);
void ChangeDataToolPointFromCircleAndTangent(VPE::VProperty *property); void ChangeDataToolPointFromCircleAndTangent(VPE::VProperty *property);
void ChangeDataToolPointFromArcAndTangent(VPE::VProperty *property); void ChangeDataToolPointFromArcAndTangent(VPE::VProperty *property);
void ChangeDataToolShoulderPoint(VPE::VProperty *property); void ChangeDataToolShoulderPoint(VPE::VProperty *property);
@ -145,6 +161,7 @@ private:
void ShowOptionsToolPointOfIntersection(QGraphicsItem *item); void ShowOptionsToolPointOfIntersection(QGraphicsItem *item);
void ShowOptionsToolPointOfIntersectionArcs(QGraphicsItem *item); void ShowOptionsToolPointOfIntersectionArcs(QGraphicsItem *item);
void ShowOptionsToolPointOfIntersectionCircles(QGraphicsItem *item); void ShowOptionsToolPointOfIntersectionCircles(QGraphicsItem *item);
void ShowOptionsToolPointOfIntersectionCurves(QGraphicsItem *item);
void ShowOptionsToolPointFromCircleAndTangent(QGraphicsItem *item); void ShowOptionsToolPointFromCircleAndTangent(QGraphicsItem *item);
void ShowOptionsToolPointFromArcAndTangent(QGraphicsItem *item); void ShowOptionsToolPointFromArcAndTangent(QGraphicsItem *item);
void ShowOptionsToolShoulderPoint(QGraphicsItem *item); void ShowOptionsToolShoulderPoint(QGraphicsItem *item);
@ -172,6 +189,7 @@ private:
void UpdateOptionsToolPointOfIntersection(); void UpdateOptionsToolPointOfIntersection();
void UpdateOptionsToolPointOfIntersectionArcs(); void UpdateOptionsToolPointOfIntersectionArcs();
void UpdateOptionsToolPointOfIntersectionCircles(); void UpdateOptionsToolPointOfIntersectionCircles();
void UpdateOptionsToolPointOfIntersectionCurves();
void UpdateOptionsToolPointFromCircleAndTangent(); void UpdateOptionsToolPointFromCircleAndTangent();
void UpdateOptionsToolPointFromArcAndTangent(); void UpdateOptionsToolPointFromArcAndTangent();
void UpdateOptionsToolShoulderPoint(); void UpdateOptionsToolShoulderPoint();

View File

@ -217,6 +217,13 @@ void MainWindow::AddPP(const QString &PPName)
qCDebug(vMainWindow, "Error creating pattern piece with the name %s.", qUtf8Printable(PPName)); qCDebug(vMainWindow, "Error creating pattern piece with the name %s.", qUtf8Printable(PPName));
return; return;
} }
if (comboBoxDraws->count() == 0)
{
sceneDraw->InitOrigins();
sceneDetails->InitOrigins();
}
comboBoxDraws->blockSignals(true); comboBoxDraws->blockSignals(true);
comboBoxDraws->addItem(PPName); comboBoxDraws->addItem(PPName);
@ -995,6 +1002,16 @@ void MainWindow::ToolPointOfIntersectionCircles(bool checked)
&MainWindow::ApplyDialog<VToolPointOfIntersectionCircles>); &MainWindow::ApplyDialog<VToolPointOfIntersectionCircles>);
} }
//---------------------------------------------------------------------------------------------------------------------
void MainWindow::ToolPointOfIntersectionCurves(bool checked)
{
SetToolButtonWithApply<DialogPointOfIntersectionCurves>(checked, Tool::PointOfIntersectionCurves,
"://cursor/intersection_curves_cursor.png",
tr("Select first curve"),
&MainWindow::ClosedDialogWithApply<VToolPointOfIntersectionCurves>,
&MainWindow::ApplyDialog<VToolPointOfIntersectionCurves>);
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void MainWindow::ToolPointFromCircleAndTangent(bool checked) void MainWindow::ToolPointFromCircleAndTangent(bool checked)
{ {
@ -1585,6 +1602,7 @@ void MainWindow::InitToolButtons()
&MainWindow::ToolPointOfIntersectionArcs); &MainWindow::ToolPointOfIntersectionArcs);
connect(ui->toolButtonPointOfIntersectionCircles, &QToolButton::clicked, this, connect(ui->toolButtonPointOfIntersectionCircles, &QToolButton::clicked, this,
&MainWindow::ToolPointOfIntersectionCircles); &MainWindow::ToolPointOfIntersectionCircles);
connect(ui->toolButtonIntersectionCurves, &QToolButton::clicked, this, &MainWindow::ToolPointOfIntersectionCurves);
connect(ui->toolButtonPointFromCircleAndTangent, &QToolButton::clicked, this, connect(ui->toolButtonPointFromCircleAndTangent, &QToolButton::clicked, this,
&MainWindow::ToolPointFromCircleAndTangent); &MainWindow::ToolPointFromCircleAndTangent);
connect(ui->toolButtonPointFromArcAndTangent, &QToolButton::clicked, this, &MainWindow::ToolPointFromArcAndTangent); connect(ui->toolButtonPointFromArcAndTangent, &QToolButton::clicked, this, &MainWindow::ToolPointFromArcAndTangent);
@ -1714,6 +1732,9 @@ void MainWindow::CancelTool()
case Tool::PointOfIntersectionCircles: case Tool::PointOfIntersectionCircles:
ui->toolButtonPointOfIntersectionCircles->setChecked(false); ui->toolButtonPointOfIntersectionCircles->setChecked(false);
break; break;
case Tool::PointOfIntersectionCurves:
ui->toolButtonIntersectionCurves->setChecked(false);
break;
case Tool::PointFromCircleAndTangent: case Tool::PointFromCircleAndTangent:
ui->toolButtonPointFromCircleAndTangent->setChecked(false); ui->toolButtonPointFromCircleAndTangent->setChecked(false);
break; break;
@ -2503,7 +2524,7 @@ void MainWindow::SetEnableWidgets(bool enable)
{ {
comboBoxDraws->setEnabled(enable); comboBoxDraws->setEnabled(enable);
ui->actionOptionDraw->setEnabled(enable); ui->actionOptionDraw->setEnabled(enable);
if (enable && not curFile.isEmpty() && not patternReadOnly) if (enable && not patternReadOnly)
{ {
ui->actionSave->setEnabled(enable); ui->actionSave->setEnabled(enable);
} }
@ -2892,6 +2913,7 @@ void MainWindow::SetEnableTool(bool enable)
ui->toolButtonCurveIntersectAxis->setEnabled(drawTools); ui->toolButtonCurveIntersectAxis->setEnabled(drawTools);
ui->toolButtonArcIntersectAxis->setEnabled(drawTools); ui->toolButtonArcIntersectAxis->setEnabled(drawTools);
ui->toolButtonPointOfIntersectionArcs->setEnabled(drawTools); ui->toolButtonPointOfIntersectionArcs->setEnabled(drawTools);
ui->toolButtonIntersectionCurves->setEnabled(drawTools);
ui->toolButtonPointOfIntersectionCircles->setEnabled(drawTools); ui->toolButtonPointOfIntersectionCircles->setEnabled(drawTools);
ui->toolButtonPointFromCircleAndTangent->setEnabled(drawTools); ui->toolButtonPointFromCircleAndTangent->setEnabled(drawTools);
ui->toolButtonPointFromArcAndTangent->setEnabled(drawTools); ui->toolButtonPointFromArcAndTangent->setEnabled(drawTools);
@ -3272,6 +3294,10 @@ void MainWindow::LastUsedTool()
ui->toolButtonPointOfIntersectionCircles->setChecked(true); ui->toolButtonPointOfIntersectionCircles->setChecked(true);
ToolPointOfIntersectionCircles(true); ToolPointOfIntersectionCircles(true);
break; break;
case Tool::PointOfIntersectionCurves:
ui->toolButtonIntersectionCurves->setChecked(true);
ToolPointOfIntersectionCurves(true);
break;
case Tool::PointFromCircleAndTangent: case Tool::PointFromCircleAndTangent:
ui->toolButtonPointFromCircleAndTangent->setChecked(true); ui->toolButtonPointFromCircleAndTangent->setChecked(true);
ToolPointFromCircleAndTangent(true); ToolPointFromCircleAndTangent(true);
@ -4138,7 +4164,7 @@ QString MainWindow::GetPatternFileName()
{ {
shownName = StrippedName(curFile); shownName = StrippedName(curFile);
} }
shownName += "[*]"; shownName += QLatin1Literal("[*]");
return shownName; return shownName;
} }
@ -4151,15 +4177,15 @@ QString MainWindow::GetMeasurementFileName()
} }
else else
{ {
QString shownName = " ["; QString shownName(" [");
shownName += StrippedName(AbsoluteMPath(curFile, doc->MPath())); shownName += StrippedName(AbsoluteMPath(curFile, doc->MPath()));
if(mChanges) if(mChanges)
{ {
shownName += "*"; shownName += QLatin1Literal("*");
} }
shownName += "]"; shownName += QLatin1Literal("]");
return shownName; return shownName;
} }
} }
@ -4167,7 +4193,14 @@ QString MainWindow::GetMeasurementFileName()
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void MainWindow::UpdateWindowTitle() void MainWindow::UpdateWindowTitle()
{ {
if (not patternReadOnly)
{
setWindowTitle(GetPatternFileName()+GetMeasurementFileName()); setWindowTitle(GetPatternFileName()+GetMeasurementFileName());
}
else
{
setWindowTitle(GetPatternFileName()+GetMeasurementFileName() + " " + tr("(read only)"));
}
setWindowFilePath(curFile); setWindowFilePath(curFile);
#if defined(Q_OS_MAC) #if defined(Q_OS_MAC)

View File

@ -125,6 +125,7 @@ public slots:
void ToolArcIntersectAxis(bool checked); void ToolArcIntersectAxis(bool checked);
void ToolPointOfIntersectionArcs(bool checked); void ToolPointOfIntersectionArcs(bool checked);
void ToolPointOfIntersectionCircles(bool checked); void ToolPointOfIntersectionCircles(bool checked);
void ToolPointOfIntersectionCurves(bool checked);
void ToolPointFromCircleAndTangent(bool checked); void ToolPointFromCircleAndTangent(bool checked);
void ToolPointFromArcAndTangent(bool checked); void ToolPointFromArcAndTangent(bool checked);
void ToolArcWithLength(bool checked); void ToolArcWithLength(bool checked);

View File

@ -48,7 +48,7 @@
<string>Tools</string> <string>Tools</string>
</property> </property>
<property name="currentIndex"> <property name="currentIndex">
<number>0</number> <number>2</number>
</property> </property>
<widget class="QWidget" name="page"> <widget class="QWidget" name="page">
<property name="geometry"> <property name="geometry">
@ -375,7 +375,7 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>100</width> <width>130</width>
<height>58</height> <height>58</height>
</rect> </rect>
</property> </property>
@ -461,7 +461,7 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>100</width> <width>130</width>
<height>156</height> <height>156</height>
</rect> </rect>
</property> </property>
@ -618,6 +618,32 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="3" column="1">
<widget class="QToolButton" name="toolButtonIntersectionCurves">
<property name="enabled">
<bool>false</bool>
</property>
<property name="toolTip">
<string>Point intersection curves</string>
</property>
<property name="text">
<string notr="true">...</string>
</property>
<property name="icon">
<iconset resource="share/resources/toolicon.qrc">
<normaloff>:/toolicon/32x32/intersection_curves.png</normaloff>:/toolicon/32x32/intersection_curves.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_4"> <widget class="QWidget" name="page_4">
@ -625,7 +651,7 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>100</width> <width>130</width>
<height>196</height> <height>196</height>
</rect> </rect>
</property> </property>
@ -867,7 +893,7 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>100</width> <width>130</width>
<height>58</height> <height>58</height>
</rect> </rect>
</property> </property>
@ -953,8 +979,8 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>98</width> <width>130</width>
<height>58</height> <height>386</height>
</rect> </rect>
</property> </property>
<attribute name="icon"> <attribute name="icon">

View File

@ -1,62 +1,64 @@
<RCC> <RCC>
<qresource prefix="/"> <qresource prefix="/">
<file>cursor/endline_cursor.png</file> <file>cursor/endline_cursor.png</file>
<file>cursor/endline_cursor@2x.png</file>
<file>cursor/line_cursor.png</file> <file>cursor/line_cursor.png</file>
<file>cursor/line_cursor@2x.png</file>
<file>cursor/alongline_cursor.png</file> <file>cursor/alongline_cursor.png</file>
<file>cursor/alongline_cursor@2x.png</file>
<file>cursor/shoulder_cursor.png</file> <file>cursor/shoulder_cursor.png</file>
<file>cursor/shoulder_cursor@2x.png</file>
<file>cursor/normal_cursor.png</file> <file>cursor/normal_cursor.png</file>
<file>cursor/normal_cursor@2x.png</file>
<file>cursor/bisector_cursor.png</file> <file>cursor/bisector_cursor.png</file>
<file>cursor/bisector_cursor@2x.png</file>
<file>cursor/intersect_cursor.png</file> <file>cursor/intersect_cursor.png</file>
<file>cursor/intersect_cursor@2x.png</file>
<file>cursor/spline_cursor.png</file> <file>cursor/spline_cursor.png</file>
<file>cursor/spline_cursor@2x.png</file>
<file>cursor/arc_cursor.png</file> <file>cursor/arc_cursor.png</file>
<file>cursor/arc_cursor@2x.png</file>
<file>cursor/splinepath_cursor.png</file> <file>cursor/splinepath_cursor.png</file>
<file>cursor/splinepath_cursor@2x.png</file>
<file>cursor/pointcontact_cursor.png</file> <file>cursor/pointcontact_cursor.png</file>
<file>cursor/pointcontact_cursor@2x.png</file>
<file>cursor/new_detail_cursor.png</file> <file>cursor/new_detail_cursor.png</file>
<file>cursor/new_detail_cursor@2x.png</file>
<file>cursor/height_cursor.png</file> <file>cursor/height_cursor.png</file>
<file>cursor/height_cursor@2x.png</file>
<file>cursor/triangle_cursor.png</file> <file>cursor/triangle_cursor.png</file>
<file>cursor/triangle_cursor@2x.png</file>
<file>cursor/pointofintersect_cursor.png</file> <file>cursor/pointofintersect_cursor.png</file>
<file>cursor/pointofintersect_cursor@2x.png</file>
<file>cursor/spline_cut_point_cursor.png</file> <file>cursor/spline_cut_point_cursor.png</file>
<file>cursor/spline_cut_point_cursor@2x.png</file>
<file>cursor/splinepath_cut_point_cursor.png</file> <file>cursor/splinepath_cut_point_cursor.png</file>
<file>cursor/splinepath_cut_point_cursor@2x.png</file>
<file>cursor/union_cursor.png</file> <file>cursor/union_cursor.png</file>
<file>cursor/union_cursor@2x.png</file>
<file>cursor/arc_cut_cursor.png</file> <file>cursor/arc_cut_cursor.png</file>
<file>cursor/arc_cut_cursor@2x.png</file>
<file>cursor/cursor-arrow-closehand.png</file> <file>cursor/cursor-arrow-closehand.png</file>
<file>cursor/cursor-arrow-openhand.png</file> <file>cursor/cursor-arrow-openhand.png</file>
<file>cursor/line_intersect_axis_cursor.png</file> <file>cursor/line_intersect_axis_cursor.png</file>
<file>cursor/arc_intersect_axis_cursor.png</file>
<file>cursor/curve_intersect_axis_cursor.png</file>
<file>cursor/point_of_intersection_arcs.png</file>
<file>cursor/point_of_intersection_circles.png</file>
<file>cursor/point_from_circle_and_tangent_cursor.png</file>
<file>cursor/point_from_arc_and_tangent_cursor.png</file>
<file>cursor/arc_with_length_cursor.png</file>
<file>cursor/true_darts_cursor.png</file>
<file>cursor/alongline_cursor@2x.png</file>
<file>cursor/arc_cursor@2x.png</file>
<file>cursor/arc_cut_cursor@2x.png</file>
<file>cursor/arc_intersect_axis_cursor@2x.png</file>
<file>cursor/arc_with_length_cursor@2x.png</file>
<file>cursor/bisector_cursor@2x.png</file>
<file>cursor/curve_intersect_axis_cursor@2x.png</file>
<file>cursor/endline_cursor@2x.png</file>
<file>cursor/height_cursor@2x.png</file>
<file>cursor/intersect_cursor@2x.png</file>
<file>cursor/line_cursor@2x.png</file>
<file>cursor/line_intersect_axis_cursor@2x.png</file> <file>cursor/line_intersect_axis_cursor@2x.png</file>
<file>cursor/new_detail_cursor@2x.png</file> <file>cursor/arc_intersect_axis_cursor.png</file>
<file>cursor/normal_cursor@2x.png</file> <file>cursor/arc_intersect_axis_cursor@2x.png</file>
<file>cursor/point_from_arc_and_tangent_cursor@2x.png</file> <file>cursor/curve_intersect_axis_cursor.png</file>
<file>cursor/point_from_circle_and_tangent_cursor@2x.png</file> <file>cursor/curve_intersect_axis_cursor@2x.png</file>
<file>cursor/point_of_intersection_circles@2x.png</file> <file>cursor/point_of_intersection_arcs.png</file>
<file>cursor/pointcontact_cursor@2x.png</file>
<file>cursor/pointofintersect_cursor@2x.png</file>
<file>cursor/shoulder_cursor@2x.png</file>
<file>cursor/spline_cursor@2x.png</file>
<file>cursor/spline_cut_point_cursor@2x.png</file>
<file>cursor/splinepath_cursor@2x.png</file>
<file>cursor/splinepath_cut_point_cursor@2x.png</file>
<file>cursor/true_darts_cursor@2x.png</file>
<file>cursor/union_cursor@2x.png</file>
<file>cursor/triangle_cursor@2x.png</file>
<file>cursor/point_of_intersection_arcs@2x.png</file> <file>cursor/point_of_intersection_arcs@2x.png</file>
<file>cursor/point_of_intersection_circles.png</file>
<file>cursor/point_of_intersection_circles@2x.png</file>
<file>cursor/point_from_circle_and_tangent_cursor.png</file>
<file>cursor/point_from_circle_and_tangent_cursor@2x.png</file>
<file>cursor/point_from_arc_and_tangent_cursor.png</file>
<file>cursor/point_from_arc_and_tangent_cursor@2x.png</file>
<file>cursor/arc_with_length_cursor.png</file>
<file>cursor/arc_with_length_cursor@2x.png</file>
<file>cursor/true_darts_cursor.png</file>
<file>cursor/true_darts_cursor@2x.png</file>
<file>cursor/intersection_curves_cursor.png</file>
<file>cursor/intersection_curves_cursor@2x.png</file>
</qresource> </qresource>
</RCC> </RCC>

Binary file not shown.

After

Width:  |  Height:  |  Size: 644 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

View File

@ -1,62 +1,62 @@
<RCC> <RCC>
<qresource prefix="/"> <qresource prefix="/">
<file>toolicon/32x32/along_line.png</file> <file>toolicon/32x32/along_line.png</file>
<file>toolicon/32x32/arc.png</file>
<file>toolicon/32x32/arc_cut.png</file>
<file>toolicon/32x32/arc_intersect_axis.png</file>
<file>toolicon/32x32/bisector.png</file>
<file>toolicon/32x32/curve_intersect_axis.png</file>
<file>toolicon/32x32/height.png</file>
<file>toolicon/32x32/intersect.png</file>
<file>toolicon/32x32/line.png</file>
<file>toolicon/32x32/line_intersect_axis.png</file>
<file>toolicon/32x32/normal.png</file>
<file>toolicon/32x32/point_from_arc_and_tangent.png</file>
<file>toolicon/32x32/point_from_circle_and_tangent.png</file>
<file>toolicon/32x32/point_of_contact.png</file>
<file>toolicon/32x32/point_of_intersection.png</file>
<file>toolicon/32x32/point_of_intersection_arcs.png</file>
<file>toolicon/32x32/point_of_intersection_circles.png</file>
<file>toolicon/32x32/segment.png</file>
<file>toolicon/32x32/shoulder.png</file>
<file>toolicon/32x32/spline.png</file>
<file>toolicon/32x32/spline_cut_point.png</file>
<file>toolicon/32x32/splinePath.png</file>
<file>toolicon/32x32/splinePath_cut_point.png</file>
<file>toolicon/32x32/triangle.png</file>
<file>toolicon/32x32/union.png</file>
<file>toolicon/32x32/new_detail.png</file>
<file>toolicon/32x32/arc_with_length.png</file>
<file>toolicon/32x32/true_darts.png</file>
<file>toolicon/32x32/along_line@2x.png</file> <file>toolicon/32x32/along_line@2x.png</file>
<file>toolicon/32x32/arc_cut@2x.png</file> <file>toolicon/32x32/arc.png</file>
<file>toolicon/32x32/arc_intersect_axis@2x.png</file>
<file>toolicon/32x32/arc_with_length@2x.png</file>
<file>toolicon/32x32/arc@2x.png</file> <file>toolicon/32x32/arc@2x.png</file>
<file>toolicon/32x32/arc_cut.png</file>
<file>toolicon/32x32/arc_cut@2x.png</file>
<file>toolicon/32x32/arc_intersect_axis.png</file>
<file>toolicon/32x32/arc_intersect_axis@2x.png</file>
<file>toolicon/32x32/bisector.png</file>
<file>toolicon/32x32/bisector@2x.png</file> <file>toolicon/32x32/bisector@2x.png</file>
<file>toolicon/32x32/curve_intersect_axis.png</file>
<file>toolicon/32x32/curve_intersect_axis@2x.png</file> <file>toolicon/32x32/curve_intersect_axis@2x.png</file>
<file>toolicon/32x32/height.png</file>
<file>toolicon/32x32/height@2x.png</file> <file>toolicon/32x32/height@2x.png</file>
<file>toolicon/32x32/intersect.png</file>
<file>toolicon/32x32/intersect@2x.png</file> <file>toolicon/32x32/intersect@2x.png</file>
<file>toolicon/32x32/line_intersect_axis@2x.png</file> <file>toolicon/32x32/line.png</file>
<file>toolicon/32x32/line@2x.png</file> <file>toolicon/32x32/line@2x.png</file>
<file>toolicon/32x32/new_detail@2x.png</file> <file>toolicon/32x32/line_intersect_axis.png</file>
<file>toolicon/32x32/line_intersect_axis@2x.png</file>
<file>toolicon/32x32/normal.png</file>
<file>toolicon/32x32/normal@2x.png</file> <file>toolicon/32x32/normal@2x.png</file>
<file>toolicon/32x32/point_from_arc_and_tangent.png</file>
<file>toolicon/32x32/point_from_arc_and_tangent@2x.png</file> <file>toolicon/32x32/point_from_arc_and_tangent@2x.png</file>
<file>toolicon/32x32/point_from_circle_and_tangent.png</file>
<file>toolicon/32x32/point_from_circle_and_tangent@2x.png</file> <file>toolicon/32x32/point_from_circle_and_tangent@2x.png</file>
<file>toolicon/32x32/point_of_contact.png</file>
<file>toolicon/32x32/point_of_contact@2x.png</file> <file>toolicon/32x32/point_of_contact@2x.png</file>
<file>toolicon/32x32/point_of_intersection_arcs@2x.png</file> <file>toolicon/32x32/point_of_intersection.png</file>
<file>toolicon/32x32/point_of_intersection_circles@2x.png</file>
<file>toolicon/32x32/point_of_intersection@2x.png</file> <file>toolicon/32x32/point_of_intersection@2x.png</file>
<file>toolicon/32x32/point_of_intersection_arcs.png</file>
<file>toolicon/32x32/point_of_intersection_arcs@2x.png</file>
<file>toolicon/32x32/point_of_intersection_circles.png</file>
<file>toolicon/32x32/point_of_intersection_circles@2x.png</file>
<file>toolicon/32x32/segment.png</file>
<file>toolicon/32x32/segment@2x.png</file> <file>toolicon/32x32/segment@2x.png</file>
<file>toolicon/32x32/shoulder.png</file>
<file>toolicon/32x32/shoulder@2x.png</file> <file>toolicon/32x32/shoulder@2x.png</file>
<file>toolicon/32x32/spline_cut_point@2x.png</file> <file>toolicon/32x32/spline.png</file>
<file>toolicon/32x32/spline@2x.png</file> <file>toolicon/32x32/spline@2x.png</file>
<file>toolicon/32x32/splinePath_cut_point 2.png</file> <file>toolicon/32x32/spline_cut_point.png</file>
<file>toolicon/32x32/splinePath_cut_point copy.png</file> <file>toolicon/32x32/spline_cut_point@2x.png</file>
<file>toolicon/32x32/splinePath_cut_point@2x.png</file> <file>toolicon/32x32/splinePath.png</file>
<file>toolicon/32x32/splinePath@2x.png</file> <file>toolicon/32x32/splinePath@2x.png</file>
<file>toolicon/32x32/true_darts@2x.png</file> <file>toolicon/32x32/splinePath_cut_point.png</file>
<file>toolicon/32x32/union@2x.png</file> <file>toolicon/32x32/splinePath_cut_point@2x.png</file>
<file>toolicon/32x32/triangle.png</file>
<file>toolicon/32x32/triangle@2x.png</file> <file>toolicon/32x32/triangle@2x.png</file>
<file>toolicon/32x32/union.png</file>
<file>toolicon/32x32/union@2x.png</file>
<file>toolicon/32x32/new_detail.png</file>
<file>toolicon/32x32/new_detail@2x.png</file>
<file>toolicon/32x32/arc_with_length.png</file>
<file>toolicon/32x32/arc_with_length@2x.png</file>
<file>toolicon/32x32/true_darts.png</file>
<file>toolicon/32x32/true_darts@2x.png</file>
<file>toolicon/32x32/intersection_curves.png</file>
<file>toolicon/32x32/intersection_curves@2x.png</file>
</qresource> </qresource>
</RCC> </RCC>

Binary file not shown.

After

Width:  |  Height:  |  Size: 961 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1020 B

View File

@ -0,0 +1,85 @@
<?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="intersection_curves.svg"
inkscape:export-filename="/home/dismine/CAD/Valentina_0.5.x/Valentina/src/app/valentina/share/resources/toolicon/32x32/intersection_curves.png"
inkscape:export-xdpi="90"
inkscape:export-ydpi="90">
<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="5.6568543"
inkscape:cx="-72.289176"
inkscape:cy="32.639235"
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:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
d="M 2.5180412,3.2496819 C 12.841262,3.1641463 19.945046,5.4776542 18.782514,9.8818142 16.934085,14.421945 9.0088794,22.18468 12.251608,25.053443 c 3.334016,2.799205 8.539479,3.494502 15.056839,3.614344"
id="path3355"
inkscape:connector-curvature="0"
sodipodi:nodetypes="cccc" />
<path
style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:2;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
d="M 29.476152,1.7857417 C 19.985275,1.9825632 13.396984,4.7066858 14.359699,9.4796408 15.949843,14.381704 23.050252,22.629351 19.999082,25.850771 16.865638,28.998947 12.06204,29.903905 6.0659753,30.217902"
id="path3355-2"
inkscape:connector-curvature="0"
sodipodi:nodetypes="cccc" />
<path
inkscape:connector-curvature="0"
style="fill:#fd004a;fill-opacity:1;stroke:#fd004a;stroke-width:1.57200003;stroke-linejoin:round;stroke-miterlimit:4.9000001;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
id="path9923"
d="m 18.042671,5.4063913 a 1.823921,1.9086998 0 0 1 -3.647842,0 1.823921,1.9086998 0 1 1 3.647842,0 z" />
<path
d="m 18.198921,13.875374 a 1.823921,1.9086998 0 0 1 -3.647842,0 1.823921,1.9086998 0 1 1 3.647842,0 z"
id="path2985-2-9"
style="fill:#37fd00;fill-opacity:1;stroke:#37fd00;stroke-width:1.57200003;stroke-linejoin:round;stroke-miterlimit:4.9000001;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
inkscape:connector-curvature="0" />
<path
d="m 19.323921,27.687641 a 1.823921,1.9086998 0 0 1 -3.647842,0 1.823921,1.9086998 0 1 1 3.647842,0 z"
id="path2985-2-9-0"
style="fill:#37fd00;fill-opacity:1;stroke:#37fd00;stroke-width:1.57200003;stroke-linejoin:round;stroke-miterlimit:4.9000001;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
inkscape:connector-curvature="0" />
</g>
</svg>

After

Width:  |  Height:  |  Size: 3.8 KiB

View File

@ -714,7 +714,8 @@ void VPattern::ParsePointElement(VMainGraphicsScene *scene, QDomElement &domElem
<< VToolPointOfIntersectionCircles::ToolType /*18*/ << VToolPointOfIntersectionCircles::ToolType /*18*/
<< VToolPointFromCircleAndTangent::ToolType /*19*/ << VToolPointFromCircleAndTangent::ToolType /*19*/
<< VToolPointFromArcAndTangent::ToolType /*20*/ << VToolPointFromArcAndTangent::ToolType /*20*/
<< VToolTrueDarts::ToolType; /*21*/ << VToolTrueDarts::ToolType /*21*/
<< VToolPointOfIntersectionCurves::ToolType; /*22*/
switch (points.indexOf(type)) switch (points.indexOf(type))
{ {
case 0: //VToolBasePoint::ToolType case 0: //VToolBasePoint::ToolType
@ -783,6 +784,9 @@ void VPattern::ParsePointElement(VMainGraphicsScene *scene, QDomElement &domElem
case 21: //VToolTrueDarts::ToolType case 21: //VToolTrueDarts::ToolType
ParseToolTrueDarts(scene, domElement, parse); ParseToolTrueDarts(scene, domElement, parse);
break; break;
case 22: //VToolPointOfIntersectionCurves::ToolType
ParseToolPointOfIntersectionCurves(scene, domElement, parse);
break;
default: default:
VException e(tr("Unknown point type '%1'.").arg(type)); VException e(tr("Unknown point type '%1'.").arg(type));
throw e; throw e;
@ -1690,6 +1694,37 @@ void VPattern::ParseToolPointOfIntersectionCircles(VMainGraphicsScene *scene, QD
} }
} }
//---------------------------------------------------------------------------------------------------------------------
void VPattern::ParseToolPointOfIntersectionCurves(VMainGraphicsScene *scene, QDomElement &domElement,
const Document &parse)
{
SCASSERT(scene != nullptr);
Q_ASSERT_X(not domElement.isNull(), Q_FUNC_INFO, "domElement is null");
try
{
quint32 id = 0;
QString name;
qreal mx = 0;
qreal my = 0;
PointsCommonAttributes(domElement, id, name, mx, my);
const auto curve1Id = GetParametrUInt(domElement, AttrCurve1, NULL_ID_STR);
const auto curve2Id = GetParametrUInt(domElement, AttrCurve2, NULL_ID_STR);
const auto vCrossPoint = static_cast<VCrossCurvesPoint>(GetParametrUInt(domElement, AttrVCrossPoint, "1"));
const auto hCrossPoint = static_cast<HCrossCurvesPoint>(GetParametrUInt(domElement, AttrHCrossPoint, "1"));
VToolPointOfIntersectionCurves::Create(id, name, curve1Id, curve2Id, vCrossPoint, hCrossPoint, mx, my,
scene, this, data, parse, Source::FromFile);
}
catch (const VExceptionBadId &e)
{
VExceptionObjectError excep(tr("Error creating or updating point of intersection curves"), domElement);
excep.AddMoreInformation(e.ErrorMessage());
throw excep;
}
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void VPattern::ParseToolPointFromCircleAndTangent(VMainGraphicsScene *scene, QDomElement &domElement, void VPattern::ParseToolPointFromCircleAndTangent(VMainGraphicsScene *scene, QDomElement &domElement,
const Document &parse) const Document &parse)

View File

@ -159,8 +159,8 @@ private:
void ParseToolCurveIntersectAxis(VMainGraphicsScene *scene, QDomElement &domElement, const Document &parse); void ParseToolCurveIntersectAxis(VMainGraphicsScene *scene, QDomElement &domElement, const Document &parse);
void ParseToolPointOfIntersectionArcs(VMainGraphicsScene *scene, const QDomElement &domElement, void ParseToolPointOfIntersectionArcs(VMainGraphicsScene *scene, const QDomElement &domElement,
const Document &parse); const Document &parse);
void ParseToolPointOfIntersectionCircles(VMainGraphicsScene *scene, QDomElement &domElement, void ParseToolPointOfIntersectionCircles(VMainGraphicsScene *scene, QDomElement &domElement, const Document &parse);
const Document &parse); void ParseToolPointOfIntersectionCurves(VMainGraphicsScene *scene, QDomElement &domElement, const Document &parse);
void ParseToolPointFromCircleAndTangent(VMainGraphicsScene *scene, QDomElement &domElement, void ParseToolPointFromCircleAndTangent(VMainGraphicsScene *scene, QDomElement &domElement,
const Document &parse); const Document &parse);
void ParseToolPointFromArcAndTangent(VMainGraphicsScene *scene, const QDomElement &domElement, void ParseToolPointFromArcAndTangent(VMainGraphicsScene *scene, const QDomElement &domElement,

View File

@ -107,11 +107,15 @@ const QString AttrPSpline = QStringLiteral("pSpline");
const QString AttrAxisP1 = QStringLiteral("axisP1"); const QString AttrAxisP1 = QStringLiteral("axisP1");
const QString AttrAxisP2 = QStringLiteral("axisP2"); const QString AttrAxisP2 = QStringLiteral("axisP2");
const QString AttrCurve = QStringLiteral("curve"); const QString AttrCurve = QStringLiteral("curve");
const QString AttrCurve1 = QStringLiteral("curve1");
const QString AttrCurve2 = QStringLiteral("curve2");
const QString AttrLineColor = QStringLiteral("lineColor"); const QString AttrLineColor = QStringLiteral("lineColor");
const QString AttrColor = QStringLiteral("color"); const QString AttrColor = QStringLiteral("color");
const QString AttrFirstArc = QStringLiteral("firstArc"); const QString AttrFirstArc = QStringLiteral("firstArc");
const QString AttrSecondArc = QStringLiteral("secondArc"); const QString AttrSecondArc = QStringLiteral("secondArc");
const QString AttrCrossPoint = QStringLiteral("crossPoint"); const QString AttrCrossPoint = QStringLiteral("crossPoint");
const QString AttrVCrossPoint = QStringLiteral("vCrossPoint");
const QString AttrHCrossPoint = QStringLiteral("hCrossPoint");
const QString AttrC1Center = QStringLiteral("c1Center"); const QString AttrC1Center = QStringLiteral("c1Center");
const QString AttrC2Center = QStringLiteral("c2Center"); const QString AttrC2Center = QStringLiteral("c2Center");
const QString AttrC1Radius = QStringLiteral("c1Radius"); const QString AttrC1Radius = QStringLiteral("c1Radius");

View File

@ -109,11 +109,15 @@ extern const QString AttrPSpline;
extern const QString AttrAxisP1; extern const QString AttrAxisP1;
extern const QString AttrAxisP2; extern const QString AttrAxisP2;
extern const QString AttrCurve; extern const QString AttrCurve;
extern const QString AttrCurve1;
extern const QString AttrCurve2;
extern const QString AttrLineColor; extern const QString AttrLineColor;
extern const QString AttrColor; extern const QString AttrColor;
extern const QString AttrFirstArc; extern const QString AttrFirstArc;
extern const QString AttrSecondArc; extern const QString AttrSecondArc;
extern const QString AttrCrossPoint; extern const QString AttrCrossPoint;
extern const QString AttrVCrossPoint;
extern const QString AttrHCrossPoint;
extern const QString AttrC1Center; extern const QString AttrC1Center;
extern const QString AttrC2Center; extern const QString AttrC2Center;
extern const QString AttrC1Radius; extern const QString AttrC1Radius;

View File

@ -120,11 +120,15 @@
<xs:attribute name="axisP2" type="xs:unsignedInt"></xs:attribute> <xs:attribute name="axisP2" type="xs:unsignedInt"></xs:attribute>
<xs:attribute name="arc" type="xs:unsignedInt"></xs:attribute> <xs:attribute name="arc" type="xs:unsignedInt"></xs:attribute>
<xs:attribute name="curve" type="xs:unsignedInt"></xs:attribute> <xs:attribute name="curve" type="xs:unsignedInt"></xs:attribute>
<xs:attribute name="curve1" type="xs:unsignedInt"></xs:attribute>
<xs:attribute name="curve2" type="xs:unsignedInt"></xs:attribute>
<xs:attribute name="lineColor" type="colors"></xs:attribute> <xs:attribute name="lineColor" type="colors"></xs:attribute>
<xs:attribute name="color" type="colors"></xs:attribute> <xs:attribute name="color" type="colors"></xs:attribute>
<xs:attribute name="firstArc" type="xs:unsignedInt"></xs:attribute> <xs:attribute name="firstArc" type="xs:unsignedInt"></xs:attribute>
<xs:attribute name="secondArc" type="xs:unsignedInt"></xs:attribute> <xs:attribute name="secondArc" type="xs:unsignedInt"></xs:attribute>
<xs:attribute name="crossPoint" type="xs:unsignedInt"></xs:attribute> <xs:attribute name="crossPoint" type="crossType"></xs:attribute>
<xs:attribute name="vCrossPoint" type="crossType"></xs:attribute>
<xs:attribute name="hCrossPoint" type="crossType"></xs:attribute>
<xs:attribute name="c1Center" type="xs:unsignedInt"></xs:attribute> <xs:attribute name="c1Center" type="xs:unsignedInt"></xs:attribute>
<xs:attribute name="c2Center" type="xs:unsignedInt"></xs:attribute> <xs:attribute name="c2Center" type="xs:unsignedInt"></xs:attribute>
<xs:attribute name="c1Radius" type="xs:string"></xs:attribute> <xs:attribute name="c1Radius" type="xs:string"></xs:attribute>
@ -421,4 +425,10 @@
<xs:enumeration value="560"/> <xs:enumeration value="560"/>
</xs:restriction> </xs:restriction>
</xs:simpleType> </xs:simpleType>
<xs:simpleType name="crossType">
<xs:restriction base="xs:unsignedInt">
<xs:enumeration value="1"/>
<xs:enumeration value="2"/>
</xs:restriction>
</xs:simpleType>
</xs:schema> </xs:schema>

View File

@ -35,9 +35,13 @@
#include <QObject> #include <QObject>
enum class Document : char { LiteParse, LitePPParse, FullParse }; enum class Document : char { LiteParse, LitePPParse, FullParse };
enum class CrossCirclesPoint : char {FirstPoint = 1, SecondPoint = 2};
enum class LabelType : char {NewPatternPiece, NewLabel}; enum class LabelType : char {NewPatternPiece, NewLabel};
// Don't touch values!!!. Same values stored in xml.
enum class CrossCirclesPoint : char {FirstPoint = 1, SecondPoint = 2};
enum class VCrossCurvesPoint : char {HighestPoint = 1, LowestPoint = 2};
enum class HCrossCurvesPoint : char {LeftmostPoint = 1, RightmostPoint = 2};
class VDataTool; class VDataTool;
class VContainer; class VContainer;

View File

@ -155,18 +155,7 @@ QPainterPath VAbstractCurve::GetPath(PathDirection direction) const
*/ */
QVector<QPointF> VAbstractCurve::IntersectLine(const QLineF &line) const QVector<QPointF> VAbstractCurve::IntersectLine(const QLineF &line) const
{ {
QVector<QPointF> points = this->GetPoints(); return CurveIntersectLine(this->GetPoints(), line);
QVector<QPointF> intersections;
for ( qint32 i = 0; i < points.count()-1; ++i )
{
QPointF crosPoint;
QLineF::IntersectType type = line.intersect(QLineF ( points.at(i), points.at(i+1)), &crosPoint);
if ( type == QLineF::BoundedIntersection )
{
intersections.append(crosPoint);
}
}
return intersections;
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
@ -176,6 +165,22 @@ bool VAbstractCurve::IsIntersectLine(const QLineF &line) const
return not points.isEmpty(); return not points.isEmpty();
} }
//---------------------------------------------------------------------------------------------------------------------
QVector<QPointF> VAbstractCurve::CurveIntersectLine(const QVector<QPointF> &points, const QLineF &line)
{
QVector<QPointF> intersections;
for ( auto i = 0; i < points.count()-1; ++i )
{
QPointF crosPoint;
const auto type = line.intersect(QLineF(points.at(i), points.at(i+1)), &crosPoint);
if ( type == QLineF::BoundedIntersection )
{
intersections.append(crosPoint);
}
}
return intersections;
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
QPainterPath VAbstractCurve::ShowDirection(const QVector<QPointF> &points) const QPainterPath VAbstractCurve::ShowDirection(const QVector<QPointF> &points) const
{ {

View File

@ -56,6 +56,8 @@ public:
virtual qreal GetStartAngle () const=0; virtual qreal GetStartAngle () const=0;
virtual qreal GetEndAngle () const=0; virtual qreal GetEndAngle () const=0;
static QVector<QPointF> CurveIntersectLine(const QVector<QPointF> &points, const QLineF &line);
protected: protected:
QPainterPath ShowDirection(const QVector<QPointF> &points) const; QPainterPath ShowDirection(const QVector<QPointF> &points) const;
private: private:

View File

@ -91,6 +91,7 @@ enum class Tool : ToolVisHolderType
LineIntersectAxis, LineIntersectAxis,
PointOfIntersectionArcs, PointOfIntersectionArcs,
PointOfIntersectionCircles, PointOfIntersectionCircles,
PointOfIntersectionCurves,
CurveIntersectAxis, CurveIntersectAxis,
PointOfIntersection, PointOfIntersection,
PointFromCircleAndTangent, PointFromCircleAndTangent,
@ -121,6 +122,7 @@ enum class Vis : ToolVisHolderType
ToolPointOfIntersection, ToolPointOfIntersection,
ToolPointOfIntersectionArcs, ToolPointOfIntersectionArcs,
ToolPointOfIntersectionCircles, ToolPointOfIntersectionCircles,
ToolPointOfIntersectionCurves,
ToolPointFromCircleAndTangent, ToolPointFromCircleAndTangent,
ToolPointFromArcAndTangent, ToolPointFromArcAndTangent,
ToolShoulderPoint, ToolShoulderPoint,

View File

@ -33,7 +33,8 @@ HEADERS += \
$$PWD/tools/dialoguniondetails.h \ $$PWD/tools/dialoguniondetails.h \
$$PWD/support/dialogeditwrongformula.h \ $$PWD/support/dialogeditwrongformula.h \
$$PWD/support/dialogundo.h \ $$PWD/support/dialogundo.h \
$$PWD/tools/dialogtruedarts.h $$PWD/tools/dialogtruedarts.h \
$$PWD/tools/dialogpointofintersectioncurves.h
SOURCES += \ SOURCES += \
$$PWD/tools/dialogalongline.cpp \ $$PWD/tools/dialogalongline.cpp \
@ -66,7 +67,8 @@ SOURCES += \
$$PWD/tools/dialoguniondetails.cpp \ $$PWD/tools/dialoguniondetails.cpp \
$$PWD/support/dialogeditwrongformula.cpp \ $$PWD/support/dialogeditwrongformula.cpp \
$$PWD/support/dialogundo.cpp \ $$PWD/support/dialogundo.cpp \
$$PWD/tools/dialogtruedarts.cpp $$PWD/tools/dialogtruedarts.cpp \
$$PWD/tools/dialogpointofintersectioncurves.cpp
FORMS += \ FORMS += \
$$PWD/tools/dialogalongline.ui \ $$PWD/tools/dialogalongline.ui \
@ -98,4 +100,5 @@ FORMS += \
$$PWD/tools/dialoguniondetails.ui \ $$PWD/tools/dialoguniondetails.ui \
$$PWD/support/dialogeditwrongformula.ui \ $$PWD/support/dialogeditwrongformula.ui \
$$PWD/support/dialogundo.ui \ $$PWD/support/dialogundo.ui \
$$PWD/tools/dialogtruedarts.ui $$PWD/tools/dialogtruedarts.ui \
$$PWD/tools/dialogpointofintersectioncurves.ui

View File

@ -54,6 +54,7 @@
#include "dialogs/tools/dialogcurveintersectaxis.h" #include "dialogs/tools/dialogcurveintersectaxis.h"
#include "dialogs/tools/dialogpointofintersectionarcs.h" #include "dialogs/tools/dialogpointofintersectionarcs.h"
#include "dialogs/tools/dialogpointofintersectioncircles.h" #include "dialogs/tools/dialogpointofintersectioncircles.h"
#include "dialogs/tools/dialogpointofintersectioncurves.h"
#include "dialogs/tools/dialogpointfromcircleandtangent.h" #include "dialogs/tools/dialogpointfromcircleandtangent.h"
#include "dialogs/tools/dialogpointfromarcandtangent.h" #include "dialogs/tools/dialogpointfromarcandtangent.h"
#include "dialogs/tools/dialogtruedarts.h" #include "dialogs/tools/dialogtruedarts.h"

View File

@ -171,7 +171,7 @@ void DialogAlongLine::ChosenObject(quint32 id, const SceneObject &type)
{ {
if (flagError) if (flagError)
{ {
line->setPoint2Id(id); line->setObject2Id(id);
line->RefreshGeometry(); line->RefreshGeometry();
prepare = true; prepare = true;
this->setModal(true); this->setModal(true);
@ -201,8 +201,8 @@ void DialogAlongLine::SaveData()
VisToolAlongLine *line = qobject_cast<VisToolAlongLine *>(vis); VisToolAlongLine *line = qobject_cast<VisToolAlongLine *>(vis);
SCASSERT(line != nullptr); SCASSERT(line != nullptr);
line->setPoint1Id(GetFirstPointId()); line->setObject1Id(GetFirstPointId());
line->setPoint2Id(GetSecondPointId()); line->setObject2Id(GetSecondPointId());
line->setLength(formula); line->setLength(formula);
line->setLineStyle(VAbstractTool::LineStyleToPenStyle(GetTypeLine())); line->setLineStyle(VAbstractTool::LineStyleToPenStyle(GetTypeLine()));
line->RefreshGeometry(); line->RefreshGeometry();
@ -226,7 +226,7 @@ void DialogAlongLine::SetSecondPointId(const quint32 &value)
VisToolAlongLine *line = qobject_cast<VisToolAlongLine *>(vis); VisToolAlongLine *line = qobject_cast<VisToolAlongLine *>(vis);
SCASSERT(line != nullptr); SCASSERT(line != nullptr);
line->setPoint2Id(value); line->setObject2Id(value);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
@ -240,7 +240,7 @@ void DialogAlongLine::SetFirstPointId(const quint32 &value)
VisToolAlongLine *line = qobject_cast<VisToolAlongLine *>(vis); VisToolAlongLine *line = qobject_cast<VisToolAlongLine *>(vis);
SCASSERT(line != nullptr); SCASSERT(line != nullptr);
line->setPoint1Id(value); line->setObject1Id(value);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------

View File

@ -125,7 +125,7 @@ DialogArc::~DialogArc()
void DialogArc::SetCenter(const quint32 &value) void DialogArc::SetCenter(const quint32 &value)
{ {
ChangeCurrentData(ui->comboBoxBasePoint, value); ChangeCurrentData(ui->comboBoxBasePoint, value);
vis->setPoint1Id(value); vis->setObject1Id(value);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
@ -248,7 +248,7 @@ void DialogArc::SaveData()
VisToolArc *path = qobject_cast<VisToolArc *>(vis); VisToolArc *path = qobject_cast<VisToolArc *>(vis);
SCASSERT(path != nullptr); SCASSERT(path != nullptr);
path->setPoint1Id(GetCenter()); path->setObject1Id(GetCenter());
path->setRadius(radius); path->setRadius(radius);
path->setF1(f1); path->setF1(f1);
path->setF2(f2); path->setF2(f2);

View File

@ -104,7 +104,7 @@ quint32 DialogArcWithLength::GetCenter() const
void DialogArcWithLength::SetCenter(const quint32 &value) void DialogArcWithLength::SetCenter(const quint32 &value)
{ {
ChangeCurrentData(ui->comboBoxCenter, value); ChangeCurrentData(ui->comboBoxCenter, value);
vis->setPoint1Id(value); vis->setObject1Id(value);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
@ -325,7 +325,7 @@ void DialogArcWithLength::SaveData()
VisToolArcWithLength *path = qobject_cast<VisToolArcWithLength *>(vis); VisToolArcWithLength *path = qobject_cast<VisToolArcWithLength *>(vis);
SCASSERT(path != nullptr); SCASSERT(path != nullptr);
path->setPoint1Id(GetCenter()); path->setObject1Id(GetCenter());
path->setRadius(radius); path->setRadius(radius);
path->setF1(f1); path->setF1(f1);
path->setLength(length); path->setLength(length);

View File

@ -176,7 +176,7 @@ void DialogBisector::ChosenObject(quint32 id, const SceneObject &type)
if (SetObject(id, ui->comboBoxSecondPoint, tr("Select third point of angle"))) if (SetObject(id, ui->comboBoxSecondPoint, tr("Select third point of angle")))
{ {
number++; number++;
line->setPoint2Id(id); line->setObject2Id(id);
line->RefreshGeometry(); line->RefreshGeometry();
} }
} }
@ -192,7 +192,7 @@ void DialogBisector::ChosenObject(quint32 id, const SceneObject &type)
{ {
if (SetObject(id, ui->comboBoxThirdPoint, "")) if (SetObject(id, ui->comboBoxThirdPoint, ""))
{ {
line->setPoint3Id(id); line->setObject3Id(id);
line->RefreshGeometry(); line->RefreshGeometry();
prepare = true; prepare = true;
this->setModal(true); this->setModal(true);
@ -263,7 +263,7 @@ void DialogBisector::SetFirstPointId(const quint32 &value)
VisToolBisector *line = qobject_cast<VisToolBisector *>(vis); VisToolBisector *line = qobject_cast<VisToolBisector *>(vis);
SCASSERT(line != nullptr); SCASSERT(line != nullptr);
line->setPoint1Id(value); line->setObject1Id(value);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
@ -277,7 +277,7 @@ void DialogBisector::SetSecondPointId(const quint32 &value)
VisToolBisector *line = qobject_cast<VisToolBisector *>(vis); VisToolBisector *line = qobject_cast<VisToolBisector *>(vis);
SCASSERT(line != nullptr); SCASSERT(line != nullptr);
line->setPoint2Id(value); line->setObject2Id(value);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
@ -291,7 +291,7 @@ void DialogBisector::SetThirdPointId(const quint32 &value)
VisToolBisector *line = qobject_cast<VisToolBisector *>(vis); VisToolBisector *line = qobject_cast<VisToolBisector *>(vis);
SCASSERT(line != nullptr); SCASSERT(line != nullptr);
line->setPoint3Id(value); line->setObject3Id(value);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
@ -317,9 +317,9 @@ void DialogBisector::SaveData()
VisToolBisector *line = qobject_cast<VisToolBisector *>(vis); VisToolBisector *line = qobject_cast<VisToolBisector *>(vis);
SCASSERT(line != nullptr); SCASSERT(line != nullptr);
line->setPoint1Id(GetFirstPointId()); line->setObject1Id(GetFirstPointId());
line->setPoint2Id(GetSecondPointId()); line->setObject2Id(GetSecondPointId());
line->setPoint3Id(GetThirdPointId()); line->setObject3Id(GetThirdPointId());
line->setLength(formula); line->setLength(formula);
line->setLineStyle(VAbstractTool::LineStyleToPenStyle(GetTypeLine())); line->setLineStyle(VAbstractTool::LineStyleToPenStyle(GetTypeLine()));
line->RefreshGeometry(); line->RefreshGeometry();

View File

@ -155,7 +155,7 @@ void DialogCurveIntersectAxis::setCurveId(const quint32 &value)
VisToolCurveIntersectAxis *line = qobject_cast<VisToolCurveIntersectAxis *>(vis); VisToolCurveIntersectAxis *line = qobject_cast<VisToolCurveIntersectAxis *>(vis);
SCASSERT(line != nullptr); SCASSERT(line != nullptr);
line->setPoint1Id(value); line->setObject1Id(value);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
@ -288,7 +288,7 @@ void DialogCurveIntersectAxis::SaveData()
VisToolCurveIntersectAxis *line = qobject_cast<VisToolCurveIntersectAxis *>(vis); VisToolCurveIntersectAxis *line = qobject_cast<VisToolCurveIntersectAxis *>(vis);
SCASSERT(line != nullptr); SCASSERT(line != nullptr);
line->setPoint1Id(getCurveId()); line->setObject1Id(getCurveId());
line->setAxisPointId(GetBasePointId()); line->setAxisPointId(GetBasePointId());
line->SetAngle(formulaAngle); line->SetAngle(formulaAngle);
line->setLineStyle(VAbstractTool::LineStyleToPenStyle(GetTypeLine())); line->setLineStyle(VAbstractTool::LineStyleToPenStyle(GetTypeLine()));

View File

@ -145,7 +145,7 @@ void DialogCutArc::SaveData()
VisToolCutArc *path = qobject_cast<VisToolCutArc *>(vis); VisToolCutArc *path = qobject_cast<VisToolCutArc *>(vis);
SCASSERT(path != nullptr); SCASSERT(path != nullptr);
path->setPoint1Id(getArcId()); path->setObject1Id(getArcId());
path->setLength(formula); path->setLength(formula);
path->RefreshGeometry(); path->RefreshGeometry();
} }
@ -168,7 +168,7 @@ void DialogCutArc::setArcId(const quint32 &value)
VisToolCutArc *path = qobject_cast<VisToolCutArc *>(vis); VisToolCutArc *path = qobject_cast<VisToolCutArc *>(vis);
SCASSERT(path != nullptr); SCASSERT(path != nullptr);
path->setPoint1Id(value); path->setObject1Id(value);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------

View File

@ -124,7 +124,7 @@ void DialogCutSpline::setSplineId(const quint32 &value)
VisToolCutSpline *path = qobject_cast<VisToolCutSpline *>(vis); VisToolCutSpline *path = qobject_cast<VisToolCutSpline *>(vis);
SCASSERT(path != nullptr); SCASSERT(path != nullptr);
path->setPoint1Id(value); path->setObject1Id(value);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
@ -180,7 +180,7 @@ void DialogCutSpline::SaveData()
VisToolCutSpline *path = qobject_cast<VisToolCutSpline *>(vis); VisToolCutSpline *path = qobject_cast<VisToolCutSpline *>(vis);
SCASSERT(path != nullptr); SCASSERT(path != nullptr);
path->setPoint1Id(getSplineId()); path->setObject1Id(getSplineId());
path->setLength(formula); path->setLength(formula);
path->RefreshGeometry(); path->RefreshGeometry();
} }

View File

@ -124,7 +124,7 @@ void DialogCutSplinePath::setSplinePathId(const quint32 &value)
VisToolCutSplinePath *path = qobject_cast<VisToolCutSplinePath *>(vis); VisToolCutSplinePath *path = qobject_cast<VisToolCutSplinePath *>(vis);
SCASSERT(path != nullptr); SCASSERT(path != nullptr);
path->setPoint1Id(value); path->setObject1Id(value);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
@ -180,7 +180,7 @@ void DialogCutSplinePath::SaveData()
VisToolCutSplinePath *path = qobject_cast<VisToolCutSplinePath *>(vis); VisToolCutSplinePath *path = qobject_cast<VisToolCutSplinePath *>(vis);
SCASSERT(path != nullptr); SCASSERT(path != nullptr);
path->setPoint1Id(getSplinePathId()); path->setObject1Id(getSplinePathId());
path->setLength(formula); path->setLength(formula);
path->RefreshGeometry(); path->RefreshGeometry();
} }

View File

@ -253,7 +253,7 @@ void DialogEndLine::SetBasePointId(const quint32 &value)
VisToolEndLine *line = qobject_cast<VisToolEndLine *>(vis); VisToolEndLine *line = qobject_cast<VisToolEndLine *>(vis);
SCASSERT(line != nullptr); SCASSERT(line != nullptr);
line->setPoint1Id(value); line->setObject1Id(value);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
@ -324,7 +324,7 @@ void DialogEndLine::SaveData()
VisToolEndLine *line = qobject_cast<VisToolEndLine *>(vis); VisToolEndLine *line = qobject_cast<VisToolEndLine *>(vis);
SCASSERT(line != nullptr); SCASSERT(line != nullptr);
line->setPoint1Id(GetBasePointId()); line->setObject1Id(GetBasePointId());
line->setLength(formulaLength); line->setLength(formulaLength);
line->SetAngle(formulaAngle); line->SetAngle(formulaAngle);
line->setLineStyle(VAbstractTool::LineStyleToPenStyle(GetTypeLine())); line->setLineStyle(VAbstractTool::LineStyleToPenStyle(GetTypeLine()));

View File

@ -112,7 +112,7 @@ void DialogHeight::SetBasePointId(const quint32 &value)
VisToolHeight *line = qobject_cast<VisToolHeight *>(vis); VisToolHeight *line = qobject_cast<VisToolHeight *>(vis);
SCASSERT(line != nullptr); SCASSERT(line != nullptr);
line->setPoint1Id(value); line->setObject1Id(value);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
@ -224,7 +224,7 @@ void DialogHeight::SaveData()
VisToolHeight *line = qobject_cast<VisToolHeight *>(vis); VisToolHeight *line = qobject_cast<VisToolHeight *>(vis);
SCASSERT(line != nullptr); SCASSERT(line != nullptr);
line->setPoint1Id(GetBasePointId()); line->setObject1Id(GetBasePointId());
line->setLineP1Id(GetP1LineId()); line->setLineP1Id(GetP1LineId());
line->setLineP2Id(GetP2LineId()); line->setLineP2Id(GetP2LineId());
line->setLineStyle(VAbstractTool::LineStyleToPenStyle(GetTypeLine())); line->setLineStyle(VAbstractTool::LineStyleToPenStyle(GetTypeLine()));

View File

@ -120,7 +120,7 @@ void DialogLine::SetFirstPoint(const quint32 &value)
VisToolLine *line = qobject_cast<VisToolLine *>(vis); VisToolLine *line = qobject_cast<VisToolLine *>(vis);
SCASSERT(line != nullptr); SCASSERT(line != nullptr);
line->setPoint1Id(value); line->setObject1Id(value);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
@ -154,7 +154,7 @@ void DialogLine::SaveData()
VisToolLine *line = qobject_cast<VisToolLine *>(vis); VisToolLine *line = qobject_cast<VisToolLine *>(vis);
SCASSERT(line != nullptr); SCASSERT(line != nullptr);
line->setPoint1Id(GetFirstPoint()); line->setObject1Id(GetFirstPoint());
line->setPoint2Id(GetSecondPoint()); line->setPoint2Id(GetSecondPoint());
line->setLineStyle(VAbstractTool::LineStyleToPenStyle(GetTypeLine())); line->setLineStyle(VAbstractTool::LineStyleToPenStyle(GetTypeLine()));
line->RefreshGeometry(); line->RefreshGeometry();

View File

@ -179,7 +179,7 @@ void DialogLineIntersect::SaveData()
VisToolLineIntersect *line = qobject_cast<VisToolLineIntersect *>(vis); VisToolLineIntersect *line = qobject_cast<VisToolLineIntersect *>(vis);
SCASSERT(line != nullptr); SCASSERT(line != nullptr);
line->setPoint1Id(GetP1Line1()); line->setObject1Id(GetP1Line1());
line->setLine1P2Id(GetP2Line1()); line->setLine1P2Id(GetP2Line1());
line->setLine2P1Id(GetP1Line2()); line->setLine2P1Id(GetP1Line2());
line->setLine2P2Id(GetP2Line2()); line->setLine2P2Id(GetP2Line2());
@ -333,7 +333,7 @@ void DialogLineIntersect::SetP1Line1(const quint32 &value)
VisToolLineIntersect *line = qobject_cast<VisToolLineIntersect *>(vis); VisToolLineIntersect *line = qobject_cast<VisToolLineIntersect *>(vis);
SCASSERT(line != nullptr); SCASSERT(line != nullptr);
line->setPoint1Id(value); line->setObject1Id(value);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------

View File

@ -164,7 +164,7 @@ void DialogLineIntersectAxis::SetFirstPointId(const quint32 &value)
VisToolLineIntersectAxis *line = qobject_cast<VisToolLineIntersectAxis *>(vis); VisToolLineIntersectAxis *line = qobject_cast<VisToolLineIntersectAxis *>(vis);
SCASSERT(line != nullptr); SCASSERT(line != nullptr);
line->setPoint1Id(value); line->setObject1Id(value);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
@ -356,7 +356,7 @@ void DialogLineIntersectAxis::SaveData()
VisToolLineIntersectAxis *line = qobject_cast<VisToolLineIntersectAxis *>(vis); VisToolLineIntersectAxis *line = qobject_cast<VisToolLineIntersectAxis *>(vis);
SCASSERT(line != nullptr); SCASSERT(line != nullptr);
line->setPoint1Id(GetFirstPointId()); line->setObject1Id(GetFirstPointId());
line->setPoint2Id(GetSecondPointId()); line->setPoint2Id(GetSecondPointId());
line->setAxisPointId(GetBasePointId()); line->setAxisPointId(GetBasePointId());
line->SetAngle(formulaAngle); line->SetAngle(formulaAngle);

View File

@ -165,7 +165,7 @@ void DialogNormal::ChosenObject(quint32 id, const SceneObject &type)
{ {
if (SetObject(id, ui->comboBoxSecondPoint, "")) if (SetObject(id, ui->comboBoxSecondPoint, ""))
{ {
line->setPoint2Id(id); line->setObject2Id(id);
line->RefreshGeometry(); line->RefreshGeometry();
prepare = true; prepare = true;
this->setModal(true); this->setModal(true);
@ -191,8 +191,8 @@ void DialogNormal::SaveData()
VisToolNormal *line = qobject_cast<VisToolNormal *>(vis); VisToolNormal *line = qobject_cast<VisToolNormal *>(vis);
SCASSERT(line != nullptr); SCASSERT(line != nullptr);
line->setPoint1Id(GetFirstPointId()); line->setObject1Id(GetFirstPointId());
line->setPoint2Id(GetSecondPointId()); line->setObject2Id(GetSecondPointId());
line->setLength(formula); line->setLength(formula);
line->SetAngle(angle); line->SetAngle(angle);
line->setLineStyle(VAbstractTool::LineStyleToPenStyle(GetTypeLine())); line->setLineStyle(VAbstractTool::LineStyleToPenStyle(GetTypeLine()));
@ -217,7 +217,7 @@ void DialogNormal::SetSecondPointId(const quint32 &value)
VisToolNormal *line = qobject_cast<VisToolNormal *>(vis); VisToolNormal *line = qobject_cast<VisToolNormal *>(vis);
SCASSERT(line != nullptr); SCASSERT(line != nullptr);
line->setPoint2Id(value); line->setObject2Id(value);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
@ -243,7 +243,7 @@ void DialogNormal::SetFirstPointId(const quint32 &value)
VisToolNormal *line = qobject_cast<VisToolNormal *>(vis); VisToolNormal *line = qobject_cast<VisToolNormal *>(vis);
SCASSERT(line != nullptr); SCASSERT(line != nullptr);
line->setPoint1Id(value); line->setObject1Id(value);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------

View File

@ -103,13 +103,13 @@ void DialogPointFromArcAndTangent::SetTangentPointId(const quint32 &value)
VisToolPointFromArcAndTangent *point = qobject_cast<VisToolPointFromArcAndTangent *>(vis); VisToolPointFromArcAndTangent *point = qobject_cast<VisToolPointFromArcAndTangent *>(vis);
SCASSERT(point != nullptr); SCASSERT(point != nullptr);
point->setPoint1Id(value); point->setObject1Id(value);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
CrossCirclesPoint DialogPointFromArcAndTangent::GetCrossCirclesPoint() const CrossCirclesPoint DialogPointFromArcAndTangent::GetCrossCirclesPoint() const
{ {
return getCurrentCrossPoint(ui->comboBoxResult); return getCurrentCrossPoint<CrossCirclesPoint>(ui->comboBoxResult);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
@ -182,7 +182,7 @@ void DialogPointFromArcAndTangent::SaveData()
VisToolPointFromArcAndTangent *point = qobject_cast<VisToolPointFromArcAndTangent *>(vis); VisToolPointFromArcAndTangent *point = qobject_cast<VisToolPointFromArcAndTangent *>(vis);
SCASSERT(point != nullptr); SCASSERT(point != nullptr);
point->setPoint1Id(GetTangentPointId()); point->setObject1Id(GetTangentPointId());
point->setArcId(GetArcId()); point->setArcId(GetArcId());
point->setCrossPoint(GetCrossCirclesPoint()); point->setCrossPoint(GetCrossCirclesPoint());
point->RefreshGeometry(); point->RefreshGeometry();

View File

@ -112,7 +112,7 @@ void DialogPointFromCircleAndTangent::SetCircleCenterId(const quint32 &value)
VisToolPointFromCircleAndTangent *point = qobject_cast<VisToolPointFromCircleAndTangent *>(vis); VisToolPointFromCircleAndTangent *point = qobject_cast<VisToolPointFromCircleAndTangent *>(vis);
SCASSERT(point != nullptr); SCASSERT(point != nullptr);
point->setPoint2Id(value); point->setObject2Id(value);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
@ -153,13 +153,13 @@ void DialogPointFromCircleAndTangent::SetTangentPointId(const quint32 &value)
VisToolPointFromCircleAndTangent *point = qobject_cast<VisToolPointFromCircleAndTangent *>(vis); VisToolPointFromCircleAndTangent *point = qobject_cast<VisToolPointFromCircleAndTangent *>(vis);
SCASSERT(point != nullptr); SCASSERT(point != nullptr);
point->setPoint1Id(value); point->setObject1Id(value);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
CrossCirclesPoint DialogPointFromCircleAndTangent::GetCrossCirclesPoint() const CrossCirclesPoint DialogPointFromCircleAndTangent::GetCrossCirclesPoint() const
{ {
return getCurrentCrossPoint(ui->comboBoxResult); return getCurrentCrossPoint<CrossCirclesPoint>(ui->comboBoxResult);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
@ -201,7 +201,7 @@ void DialogPointFromCircleAndTangent::ChosenObject(quint32 id, const SceneObject
if (SetObject(id, ui->comboBoxCircleCenter, "")) if (SetObject(id, ui->comboBoxCircleCenter, ""))
{ {
number = 0; number = 0;
point->setPoint2Id(id); point->setObject2Id(id);
point->RefreshGeometry(); point->RefreshGeometry();
prepare = true; prepare = true;
this->setModal(true); this->setModal(true);
@ -299,8 +299,8 @@ void DialogPointFromCircleAndTangent::SaveData()
VisToolPointFromCircleAndTangent *point = qobject_cast<VisToolPointFromCircleAndTangent *>(vis); VisToolPointFromCircleAndTangent *point = qobject_cast<VisToolPointFromCircleAndTangent *>(vis);
SCASSERT(point != nullptr); SCASSERT(point != nullptr);
point->setPoint1Id(GetTangentPointId()); point->setObject1Id(GetTangentPointId());
point->setPoint2Id(GetCircleCenterId()); point->setObject2Id(GetCircleCenterId());
point->setCRadius(radius); point->setCRadius(radius);
point->setCrossPoint(GetCrossCirclesPoint()); point->setCrossPoint(GetCrossCirclesPoint());
point->RefreshGeometry(); point->RefreshGeometry();

View File

@ -214,7 +214,7 @@ void DialogPointOfContact::SaveData()
VisToolPointOfContact *line = qobject_cast<VisToolPointOfContact *>(vis); VisToolPointOfContact *line = qobject_cast<VisToolPointOfContact *>(vis);
SCASSERT(line != nullptr); SCASSERT(line != nullptr);
line->setPoint1Id(GetFirstPoint()); line->setObject1Id(GetFirstPoint());
line->setLineP2Id(GetSecondPoint()); line->setLineP2Id(GetSecondPoint());
line->setRadiusId(getCenter()); line->setRadiusId(getCenter());
line->setRadius(radius); line->setRadius(radius);
@ -253,7 +253,7 @@ void DialogPointOfContact::SetFirstPoint(const quint32 &value)
VisToolPointOfContact *line = qobject_cast<VisToolPointOfContact *>(vis); VisToolPointOfContact *line = qobject_cast<VisToolPointOfContact *>(vis);
SCASSERT(line != nullptr); SCASSERT(line != nullptr);
line->setPoint1Id(value); line->setObject1Id(value);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------

View File

@ -110,7 +110,7 @@ void DialogPointOfIntersection::ChosenObject(quint32 id, const SceneObject &type
if (SetObject(id, ui->comboBoxFirstPoint, tr("Select point for Y value (horizontal)"))) if (SetObject(id, ui->comboBoxFirstPoint, tr("Select point for Y value (horizontal)")))
{ {
number++; number++;
line->setPoint1Id(id); line->setObject1Id(id);
line->RefreshGeometry(); line->RefreshGeometry();
} }
break; break;
@ -141,7 +141,7 @@ void DialogPointOfIntersection::SaveData()
VisToolPointOfIntersection *line = qobject_cast<VisToolPointOfIntersection *>(vis); VisToolPointOfIntersection *line = qobject_cast<VisToolPointOfIntersection *>(vis);
SCASSERT(line != nullptr); SCASSERT(line != nullptr);
line->setPoint1Id(GetFirstPointId()); line->setObject1Id(GetFirstPointId());
line->setPoint2Id(GetSecondPointId()); line->setPoint2Id(GetSecondPointId());
line->RefreshGeometry(); line->RefreshGeometry();
} }
@ -182,7 +182,7 @@ void DialogPointOfIntersection::SetFirstPointId(const quint32 &value)
VisToolPointOfIntersection *line = qobject_cast<VisToolPointOfIntersection *>(vis); VisToolPointOfIntersection *line = qobject_cast<VisToolPointOfIntersection *>(vis);
SCASSERT(line != nullptr); SCASSERT(line != nullptr);
line->setPoint1Id(value); line->setObject1Id(value);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------

View File

@ -113,7 +113,7 @@ void DialogPointOfIntersectionArcs::SetSecondArcId(const quint32 &value)
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
CrossCirclesPoint DialogPointOfIntersectionArcs::GetCrossArcPoint() const CrossCirclesPoint DialogPointOfIntersectionArcs::GetCrossArcPoint() const
{ {
return getCurrentCrossPoint(ui->comboBoxResult); return getCurrentCrossPoint<CrossCirclesPoint>(ui->comboBoxResult);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------

View File

@ -128,7 +128,7 @@ void DialogPointOfIntersectionCircles::SetFirstCircleCenterId(const quint32 &val
VisToolPointOfIntersectionCircles *point = qobject_cast<VisToolPointOfIntersectionCircles *>(vis); VisToolPointOfIntersectionCircles *point = qobject_cast<VisToolPointOfIntersectionCircles *>(vis);
SCASSERT(point != nullptr); SCASSERT(point != nullptr);
point->setPoint1Id(value); point->setObject1Id(value);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
@ -144,7 +144,7 @@ void DialogPointOfIntersectionCircles::SetSecondCircleCenterId(const quint32 &va
VisToolPointOfIntersectionCircles *point = qobject_cast<VisToolPointOfIntersectionCircles *>(vis); VisToolPointOfIntersectionCircles *point = qobject_cast<VisToolPointOfIntersectionCircles *>(vis);
SCASSERT(point != nullptr); SCASSERT(point != nullptr);
point->setPoint2Id(value); point->setObject2Id(value);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
@ -200,7 +200,7 @@ void DialogPointOfIntersectionCircles::SetSecondCircleRadius(const QString &valu
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
CrossCirclesPoint DialogPointOfIntersectionCircles::GetCrossCirclesPoint() const CrossCirclesPoint DialogPointOfIntersectionCircles::GetCrossCirclesPoint() const
{ {
return getCurrentCrossPoint(ui->comboBoxResult); return getCurrentCrossPoint<CrossCirclesPoint>(ui->comboBoxResult);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
@ -242,7 +242,7 @@ void DialogPointOfIntersectionCircles::ChosenObject(quint32 id, const SceneObjec
if (SetObject(id, ui->comboBoxCircle2Center, "")) if (SetObject(id, ui->comboBoxCircle2Center, ""))
{ {
number = 0; number = 0;
point->setPoint2Id(id); point->setObject2Id(id);
point->RefreshGeometry(); point->RefreshGeometry();
prepare = true; prepare = true;
DialogAccepted(); DialogAccepted();
@ -389,8 +389,8 @@ void DialogPointOfIntersectionCircles::SaveData()
VisToolPointOfIntersectionCircles *point = qobject_cast<VisToolPointOfIntersectionCircles *>(vis); VisToolPointOfIntersectionCircles *point = qobject_cast<VisToolPointOfIntersectionCircles *>(vis);
SCASSERT(point != nullptr); SCASSERT(point != nullptr);
point->setPoint1Id(GetFirstCircleCenterId()); point->setObject1Id(GetFirstCircleCenterId());
point->setPoint2Id(GetSecondCircleCenterId()); point->setObject2Id(GetSecondCircleCenterId());
point->setC1Radius(c1Radius); point->setC1Radius(c1Radius);
point->setC2Radius(c2Radius); point->setC2Radius(c2Radius);
point->setCrossPoint(GetCrossCirclesPoint()); point->setCrossPoint(GetCrossCirclesPoint());

View File

@ -0,0 +1,240 @@
/************************************************************************
**
** @file dialogpointofintersectioncurves.cpp
** @author Roman Telezhynskyi <dismine(at)gmail.com>
** @date 23 1, 2016
**
** @brief
** @copyright
** This source code is part of the Valentine project, a pattern making
** program, whose allow create and modeling patterns of clothing.
** Copyright (C) 2016 Valentina project
** <https://bitbucket.org/dismine/valentina> All Rights Reserved.
**
** Valentina is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** Valentina is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with Valentina. If not, see <http://www.gnu.org/licenses/>.
**
*************************************************************************/
#include "dialogpointofintersectioncurves.h"
#include "ui_dialogpointofintersectioncurves.h"
#include "../../visualization/vistoolpointofintersectioncurves.h"
//---------------------------------------------------------------------------------------------------------------------
DialogPointOfIntersectionCurves::DialogPointOfIntersectionCurves(const VContainer *data, const quint32 &toolId,
QWidget *parent)
:DialogTool(data, toolId, parent),
ui(new Ui::DialogPointOfIntersectionCurves)
{
ui->setupUi(this);
#if QT_VERSION >= QT_VERSION_CHECK(5, 2, 0)
ui->lineEditNamePoint->setClearButtonEnabled(true);
#endif
ui->lineEditNamePoint->setText(qApp->getCurrentDocument()->GenerateLabel(LabelType::NewLabel));
labelEditNamePoint = ui->labelEditNamePoint;
InitOkCancelApply(ui);
CheckState();
FillComboBoxCurves(ui->comboBoxCurve1);
FillComboBoxCurves(ui->comboBoxCurve2);
FillComboBoxVCrossCurvesPoint(ui->comboBoxVCorrection);
FillComboBoxHCrossCurvesPoint(ui->comboBoxHCorrection);
connect(ui->lineEditNamePoint, &QLineEdit::textChanged, this, &DialogPointOfIntersectionCurves::NamePointChanged);
connect(ui->comboBoxCurve1, static_cast<void (QComboBox::*)(const QString &)>(&QComboBox::currentIndexChanged),
this, &DialogPointOfIntersectionCurves::CurveChanged);
connect(ui->comboBoxCurve2, static_cast<void (QComboBox::*)(const QString &)>(&QComboBox::currentIndexChanged),
this, &DialogPointOfIntersectionCurves::CurveChanged);
vis = new VisToolPointOfIntersectionCurves(data);
}
//---------------------------------------------------------------------------------------------------------------------
DialogPointOfIntersectionCurves::~DialogPointOfIntersectionCurves()
{
DeleteVisualization<VisToolPointOfIntersectionCurves>();
delete ui;
}
//---------------------------------------------------------------------------------------------------------------------
void DialogPointOfIntersectionCurves::SetPointName(const QString &value)
{
pointName = value;
ui->lineEditNamePoint->setText(pointName);
}
//---------------------------------------------------------------------------------------------------------------------
quint32 DialogPointOfIntersectionCurves::GetFirstCurveId() const
{
return getCurrentObjectId(ui->comboBoxCurve1);
}
//---------------------------------------------------------------------------------------------------------------------
void DialogPointOfIntersectionCurves::SetFirstCurveId(const quint32 &value)
{
setCurrentCurveId(ui->comboBoxCurve1, value);
auto point = qobject_cast<VisToolPointOfIntersectionCurves *>(vis);
SCASSERT(point != nullptr);
point->setObject1Id(value);
}
//---------------------------------------------------------------------------------------------------------------------
quint32 DialogPointOfIntersectionCurves::GetSecondCurveId() const
{
return getCurrentObjectId(ui->comboBoxCurve2);
}
//---------------------------------------------------------------------------------------------------------------------
void DialogPointOfIntersectionCurves::SetSecondCurveId(const quint32 &value)
{
setCurrentCurveId(ui->comboBoxCurve2, value);
auto point = qobject_cast<VisToolPointOfIntersectionCurves *>(vis);
SCASSERT(point != nullptr);
point->setObject2Id(value);
}
//---------------------------------------------------------------------------------------------------------------------
VCrossCurvesPoint DialogPointOfIntersectionCurves::GetVCrossPoint() const
{
return getCurrentCrossPoint<VCrossCurvesPoint>(ui->comboBoxVCorrection);
}
//---------------------------------------------------------------------------------------------------------------------
void DialogPointOfIntersectionCurves::SetVCrossPoint(const VCrossCurvesPoint &vP)
{
auto index = ui->comboBoxVCorrection->findData(static_cast<int>(vP));
if (index != -1)
{
ui->comboBoxVCorrection->setCurrentIndex(index);
auto point = qobject_cast<VisToolPointOfIntersectionCurves *>(vis);
SCASSERT(point != nullptr);
point->setVCrossPoint(vP);
}
}
//---------------------------------------------------------------------------------------------------------------------
HCrossCurvesPoint DialogPointOfIntersectionCurves::GetHCrossPoint() const
{
return getCurrentCrossPoint<HCrossCurvesPoint>(ui->comboBoxHCorrection);
}
//---------------------------------------------------------------------------------------------------------------------
void DialogPointOfIntersectionCurves::SetHCrossPoint(const HCrossCurvesPoint &hP)
{
auto index = ui->comboBoxHCorrection->findData(static_cast<int>(hP));
if (index != -1)
{
ui->comboBoxHCorrection->setCurrentIndex(index);
auto point = qobject_cast<VisToolPointOfIntersectionCurves *>(vis);
SCASSERT(point != nullptr);
point->setHCrossPoint(hP);
}
}
//---------------------------------------------------------------------------------------------------------------------
void DialogPointOfIntersectionCurves::ChosenObject(quint32 id, const SceneObject &type)
{
if (prepare == false)// After first choose we ignore all objects
{
if (type == SceneObject::Spline || type == SceneObject::Arc || type == SceneObject::SplinePath)
{
auto point = qobject_cast<VisToolPointOfIntersectionCurves *>(vis);
SCASSERT(point != nullptr);
switch (number)
{
case 0:
if (SetObject(id, ui->comboBoxCurve1, tr("Select second curve")))
{
number++;
point->VisualMode(id);
}
break;
case 1:
if (getCurrentObjectId(ui->comboBoxCurve1) != id)
{
if (SetObject(id, ui->comboBoxCurve2, ""))
{
number = 0;
point->setObject2Id(id);
point->RefreshGeometry();
prepare = true;
DialogAccepted();
}
}
break;
default:
break;
}
}
}
}
//---------------------------------------------------------------------------------------------------------------------
void DialogPointOfIntersectionCurves::ShowVisualization()
{
AddVisualization<VisToolPointOfIntersectionCurves>();
}
//---------------------------------------------------------------------------------------------------------------------
void DialogPointOfIntersectionCurves::SaveData()
{
pointName = ui->lineEditNamePoint->text();
auto point = qobject_cast<VisToolPointOfIntersectionCurves *>(vis);
SCASSERT(point != nullptr);
point->setObject1Id(GetFirstCurveId());
point->setObject2Id(GetSecondCurveId());
point->setVCrossPoint(GetVCrossPoint());
point->setHCrossPoint(GetHCrossPoint());
point->RefreshGeometry();
}
//---------------------------------------------------------------------------------------------------------------------
void DialogPointOfIntersectionCurves::CheckState()
{
SCASSERT(bOk != nullptr);
bOk->setEnabled(flagName && flagError);
// In case dialog hasn't apply button
if ( bApply != nullptr)
{
bApply->setEnabled(bOk->isEnabled());
}
}
//---------------------------------------------------------------------------------------------------------------------
void DialogPointOfIntersectionCurves::CurveChanged()
{
QColor color = okColor;
if (getCurrentObjectId(ui->comboBoxCurve1) == getCurrentObjectId(ui->comboBoxCurve2))
{
flagError = false;
color = errorColor;
}
else
{
flagError = true;
color = okColor;
}
ChangeColor(ui->labelCurve1, color);
ChangeColor(ui->labelCurve2, color);
CheckState();
}

View File

@ -0,0 +1,81 @@
/************************************************************************
**
** @file dialogpointofintersectioncurves.h
** @author Roman Telezhynskyi <dismine(at)gmail.com>
** @date 23 1, 2016
**
** @brief
** @copyright
** This source code is part of the Valentine project, a pattern making
** program, whose allow create and modeling patterns of clothing.
** Copyright (C) 2016 Valentina project
** <https://bitbucket.org/dismine/valentina> All Rights Reserved.
**
** Valentina is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** Valentina is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with Valentina. If not, see <http://www.gnu.org/licenses/>.
**
*************************************************************************/
#ifndef DIALOGPOINTOFINTERSECTIONCURVES_H
#define DIALOGPOINTOFINTERSECTIONCURVES_H
#include "dialogtool.h"
namespace Ui {
class DialogPointOfIntersectionCurves;
}
class DialogPointOfIntersectionCurves : public DialogTool
{
Q_OBJECT
public:
explicit DialogPointOfIntersectionCurves(const VContainer *data, const quint32 &toolId, QWidget *parent = 0);
virtual ~DialogPointOfIntersectionCurves() Q_DECL_OVERRIDE;
void SetPointName(const QString &value);
quint32 GetFirstCurveId() const;
void SetFirstCurveId(const quint32 &value);
quint32 GetSecondCurveId() const;
void SetSecondCurveId(const quint32 &value);
VCrossCurvesPoint GetVCrossPoint() const;
void SetVCrossPoint(const VCrossCurvesPoint &vP);
HCrossCurvesPoint GetHCrossPoint() const;
void SetHCrossPoint(const HCrossCurvesPoint &hP);
public slots:
virtual void ChosenObject(quint32 id, const SceneObject &type) Q_DECL_OVERRIDE;
protected:
virtual void ShowVisualization() Q_DECL_OVERRIDE;
/**
* @brief SaveData Put dialog data in local variables
*/
virtual void SaveData() Q_DECL_OVERRIDE;
virtual void CheckState() Q_DECL_OVERRIDE;
private slots:
void CurveChanged();
private:
Q_DISABLE_COPY(DialogPointOfIntersectionCurves)
Ui::DialogPointOfIntersectionCurves *ui;
};
#endif // DIALOGPOINTOFINTERSECTIONCURVES_H

View File

@ -0,0 +1,162 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>DialogPointOfIntersectionCurves</class>
<widget class="QDialog" name="DialogPointOfIntersectionCurves">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>285</width>
<height>212</height>
</rect>
</property>
<property name="windowTitle">
<string>Tool point of intersection curves</string>
</property>
<property name="windowIcon">
<iconset resource="../../../vmisc/share/resources/icon.qrc">
<normaloff>:/icon/64x64/icon64x64.png</normaloff>:/icon/64x64/icon64x64.png</iconset>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<layout class="QFormLayout" name="formLayout">
<property name="fieldGrowthPolicy">
<enum>QFormLayout::ExpandingFieldsGrow</enum>
</property>
<item row="0" column="0">
<widget class="QLabel" name="labelCurve1">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>First curve:</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QComboBox" name="comboBoxCurve1">
<property name="toolTip">
<string/>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="labelCurve2">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Second curve:</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QComboBox" name="comboBoxCurve2"/>
</item>
<item row="2" column="0">
<widget class="QLabel" name="labelEditNamePoint">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Point label:</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QLineEdit" name="lineEditNamePoint">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="toolTip">
<string>Unique label</string>
</property>
<property name="placeholderText">
<string>Choose unique label.</string>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="label">
<property name="text">
<string>Vertical correction:</string>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QComboBox" name="comboBoxVCorrection"/>
</item>
<item row="4" column="0">
<widget class="QLabel" name="label_2">
<property name="text">
<string>Horizontal correction:</string>
</property>
</widget>
</item>
<item row="4" column="1">
<widget class="QComboBox" name="comboBoxHCorrection"/>
</item>
</layout>
</item>
<item>
<widget class="QDialogButtonBox" name="buttonBox">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="standardButtons">
<set>QDialogButtonBox::Apply|QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
</property>
</widget>
</item>
</layout>
</widget>
<resources>
<include location="../../../vmisc/share/resources/icon.qrc"/>
</resources>
<connections>
<connection>
<sender>buttonBox</sender>
<signal>accepted()</signal>
<receiver>DialogPointOfIntersectionCurves</receiver>
<slot>accept()</slot>
<hints>
<hint type="sourcelabel">
<x>248</x>
<y>254</y>
</hint>
<hint type="destinationlabel">
<x>157</x>
<y>274</y>
</hint>
</hints>
</connection>
<connection>
<sender>buttonBox</sender>
<signal>rejected()</signal>
<receiver>DialogPointOfIntersectionCurves</receiver>
<slot>reject()</slot>
<hints>
<hint type="sourcelabel">
<x>316</x>
<y>260</y>
</hint>
<hint type="destinationlabel">
<x>286</x>
<y>274</y>
</hint>
</hints>
</connection>
</connections>
</ui>

View File

@ -219,7 +219,7 @@ void DialogShoulderPoint::SaveData()
VisToolShoulderPoint *line = qobject_cast<VisToolShoulderPoint *>(vis); VisToolShoulderPoint *line = qobject_cast<VisToolShoulderPoint *>(vis);
SCASSERT(line != nullptr); SCASSERT(line != nullptr);
line->setPoint1Id(GetP3()); line->setObject1Id(GetP3());
line->setLineP1Id(GetP1Line()); line->setLineP1Id(GetP1Line());
line->setLineP2Id(GetP2Line()); line->setLineP2Id(GetP2Line());
line->setLength(formula); line->setLength(formula);
@ -245,7 +245,7 @@ void DialogShoulderPoint::SetP3(const quint32 &value)
VisToolShoulderPoint *line = qobject_cast<VisToolShoulderPoint *>(vis); VisToolShoulderPoint *line = qobject_cast<VisToolShoulderPoint *>(vis);
SCASSERT(line != nullptr); SCASSERT(line != nullptr);
line->setPoint1Id(value); line->setObject1Id(value);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------

View File

@ -119,7 +119,7 @@ void DialogSpline::ChosenObject(quint32 id, const SceneObject &type)
ui->spinBoxAngle1->setValue(static_cast<qint32>(QLineF(p1, p4).angle())); ui->spinBoxAngle1->setValue(static_cast<qint32>(QLineF(p1, p4).angle()));
ui->spinBoxAngle2->setValue(static_cast<qint32>(QLineF(p4, p1).angle())); ui->spinBoxAngle2->setValue(static_cast<qint32>(QLineF(p4, p1).angle()));
path->setPoint4Id(id); path->setObject4Id(id);
path->RefreshGeometry(); path->RefreshGeometry();
prepare = true; prepare = true;
DialogAccepted(); DialogAccepted();
@ -150,8 +150,8 @@ void DialogSpline::SaveData()
VisToolSpline *path = qobject_cast<VisToolSpline *>(vis); VisToolSpline *path = qobject_cast<VisToolSpline *>(vis);
SCASSERT(path != nullptr); SCASSERT(path != nullptr);
path->setPoint1Id(GetP1()); path->setObject1Id(GetP1());
path->setPoint4Id(GetP4()); path->setObject4Id(GetP4());
path->SetAngle1(angle1); path->SetAngle1(angle1);
path->SetAngle2(angle2); path->SetAngle2(angle2);
path->SetKAsm1(kAsm1); path->SetKAsm1(kAsm1);
@ -287,7 +287,7 @@ void DialogSpline::SetP4(const quint32 &value)
VisToolSpline *path = qobject_cast<VisToolSpline *>(vis); VisToolSpline *path = qobject_cast<VisToolSpline *>(vis);
SCASSERT(path != nullptr); SCASSERT(path != nullptr);
path->setPoint4Id(value); path->setObject4Id(value);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
@ -301,7 +301,7 @@ void DialogSpline::SetP1(const quint32 &value)
VisToolSpline *path = qobject_cast<VisToolSpline *>(vis); VisToolSpline *path = qobject_cast<VisToolSpline *>(vis);
SCASSERT(path != nullptr); SCASSERT(path != nullptr);
path->setPoint1Id(value); path->setObject1Id(value);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------

View File

@ -227,6 +227,24 @@ void DialogTool::FillComboBoxCrossCirclesPoints(QComboBox *box) const
box->addItem(tr("Second point"), QVariant(static_cast<int>(CrossCirclesPoint::SecondPoint))); box->addItem(tr("Second point"), QVariant(static_cast<int>(CrossCirclesPoint::SecondPoint)));
} }
//---------------------------------------------------------------------------------------------------------------------
void DialogTool::FillComboBoxVCrossCurvesPoint(QComboBox *box) const
{
SCASSERT(box != nullptr);
box->addItem(tr("Highest point"), QVariant(static_cast<int>(VCrossCurvesPoint::HighestPoint)));
box->addItem(tr("Lowest point"), QVariant(static_cast<int>(VCrossCurvesPoint::LowestPoint)));
}
//---------------------------------------------------------------------------------------------------------------------
void DialogTool::FillComboBoxHCrossCurvesPoint(QComboBox *box) const
{
SCASSERT(box != nullptr);
box->addItem(tr("Leftmost point"), QVariant(static_cast<int>(HCrossCurvesPoint::LeftmostPoint)));
box->addItem(tr("Rightmost point"), QVariant(static_cast<int>(HCrossCurvesPoint::RightmostPoint)));
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
QString DialogTool::GetComboBoxCurrentData(const QComboBox *box) const QString DialogTool::GetComboBoxCurrentData(const QComboBox *box) const
{ {
@ -488,35 +506,6 @@ quint32 DialogTool::getCurrentObjectId(QComboBox *box) const
} }
} }
//---------------------------------------------------------------------------------------------------------------------
CrossCirclesPoint DialogTool::getCurrentCrossPoint(QComboBox *box) const
{
int value;
bool ok = false;
#if QT_VERSION < QT_VERSION_CHECK(5, 2, 0)
value = box->itemData(box->currentIndex()).toInt(&ok);
#else
value = box->currentData().toInt(&ok);
#endif
if (not ok)
{
return CrossCirclesPoint::FirstPoint;
}
switch(value)
{
case 1:
return CrossCirclesPoint::FirstPoint;
break;
case 2:
return CrossCirclesPoint::SecondPoint;
break;
default:
return CrossCirclesPoint::FirstPoint;
break;
}
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
bool DialogTool::SetObject(const quint32 &id, QComboBox *box, const QString &toolTip) bool DialogTool::SetObject(const quint32 &id, QComboBox *box, const QString &toolTip)
{ {

View File

@ -32,7 +32,7 @@
#include "../vmisc/vabstractapplication.h" #include "../vmisc/vabstractapplication.h"
#include "../vmisc/logging.h" #include "../vmisc/logging.h"
#include "../vwidgets/vmaingraphicsscene.h" #include "../vwidgets/vmaingraphicsscene.h"
#include "visualization/visualization.h" #include "../../visualization/visualization.h"
#include "../ifc/xml/vabstractpattern.h" #include "../ifc/xml/vabstractpattern.h"
#include <QDialog> #include <QDialog>
@ -42,12 +42,12 @@
#include <QRadioButton> #include <QRadioButton>
#include <QPushButton> #include <QPushButton>
#include <QCheckBox> #include <QCheckBox>
#include <QComboBox>
Q_DECLARE_LOGGING_CATEGORY(vDialog) Q_DECLARE_LOGGING_CATEGORY(vDialog)
class QDoubleSpinBox; class QDoubleSpinBox;
class QLabel; class QLabel;
class QComboBox;
class QListWidgetItem; class QListWidgetItem;
class VContainer; class VContainer;
class QPlainTextEdit; class QPlainTextEdit;
@ -196,6 +196,8 @@ protected:
void FillComboBoxTypeLine(QComboBox *box, const QMap<QString, QIcon> &stylesPics) const; void FillComboBoxTypeLine(QComboBox *box, const QMap<QString, QIcon> &stylesPics) const;
void FillComboBoxLineColors(QComboBox *box)const; void FillComboBoxLineColors(QComboBox *box)const;
void FillComboBoxCrossCirclesPoints(QComboBox *box) const; void FillComboBoxCrossCirclesPoints(QComboBox *box) const;
void FillComboBoxVCrossCurvesPoint(QComboBox *box) const;
void FillComboBoxHCrossCurvesPoint(QComboBox *box) const;
virtual void CheckState(); virtual void CheckState();
QString GetComboBoxCurrentData(const QComboBox *box)const; QString GetComboBoxCurrentData(const QComboBox *box)const;
@ -220,7 +222,9 @@ protected:
void setCurrentCurveId(QComboBox *box, const quint32 &value) const; void setCurrentCurveId(QComboBox *box, const quint32 &value) const;
quint32 getCurrentObjectId(QComboBox *box) const; quint32 getCurrentObjectId(QComboBox *box) const;
CrossCirclesPoint getCurrentCrossPoint(QComboBox *box) const;
template <typename T>
T getCurrentCrossPoint(QComboBox *box) const;
bool SetObject(const quint32 &id, QComboBox *box, const QString &toolTip); bool SetObject(const quint32 &id, QComboBox *box, const QString &toolTip);
void DeployFormula(QPlainTextEdit *formula, QPushButton *buttonGrowLength, int formulaBaseHeight); void DeployFormula(QPlainTextEdit *formula, QPushButton *buttonGrowLength, int formulaBaseHeight);
@ -362,4 +366,32 @@ inline void DialogTool::DeleteVisualization()
} }
} }
//---------------------------------------------------------------------------------------------------------------------
template <typename T>
inline T DialogTool::getCurrentCrossPoint(QComboBox *box) const
{
int value;
bool ok = false;
#if QT_VERSION < QT_VERSION_CHECK(5, 2, 0)
value = box->itemData(box->currentIndex()).toInt(&ok);
#else
value = box->currentData().toInt(&ok);
#endif
if (not ok)
{
return static_cast<T>(1);
}
switch(value)
{
case 1:
case 2:
return static_cast<T>(value);
break;
default:
return static_cast<T>(1);
break;
}
}
#endif // DIALOGTOOL_H #endif // DIALOGTOOL_H

View File

@ -109,7 +109,7 @@ void DialogTriangle::ChosenObject(quint32 id, const SceneObject &type)
if (SetObject(id, ui->comboBoxAxisP2, tr("Select first point"))) if (SetObject(id, ui->comboBoxAxisP2, tr("Select first point")))
{ {
number++; number++;
line->setPoint2Id(id); line->setObject2Id(id);
line->RefreshGeometry(); line->RefreshGeometry();
} }
} }
@ -167,8 +167,8 @@ void DialogTriangle::SaveData()
VisToolTriangle *line = qobject_cast<VisToolTriangle *>(vis); VisToolTriangle *line = qobject_cast<VisToolTriangle *>(vis);
SCASSERT(line != nullptr); SCASSERT(line != nullptr);
line->setPoint1Id(GetAxisP1Id()); line->setObject1Id(GetAxisP1Id());
line->setPoint2Id(GetAxisP2Id()); line->setObject2Id(GetAxisP2Id());
line->setHypotenuseP1Id(GetFirstPointId()); line->setHypotenuseP1Id(GetFirstPointId());
line->setHypotenuseP2Id(GetSecondPointId()); line->setHypotenuseP2Id(GetSecondPointId());
line->RefreshGeometry(); line->RefreshGeometry();
@ -257,7 +257,7 @@ void DialogTriangle::SetAxisP2Id(const quint32 &value)
VisToolTriangle *line = qobject_cast<VisToolTriangle *>(vis); VisToolTriangle *line = qobject_cast<VisToolTriangle *>(vis);
SCASSERT(line != nullptr); SCASSERT(line != nullptr);
line->setPoint2Id(value); line->setObject2Id(value);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
@ -271,7 +271,7 @@ void DialogTriangle::SetAxisP1Id(const quint32 &value)
VisToolTriangle *line = qobject_cast<VisToolTriangle *>(vis); VisToolTriangle *line = qobject_cast<VisToolTriangle *>(vis);
SCASSERT(line != nullptr); SCASSERT(line != nullptr);
line->setPoint1Id(value); line->setObject1Id(value);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------

View File

@ -130,7 +130,7 @@ void DialogTrueDarts::SetFirstBasePointId(const quint32 &value)
VisToolTrueDarts *points = qobject_cast<VisToolTrueDarts *>(vis); VisToolTrueDarts *points = qobject_cast<VisToolTrueDarts *>(vis);
SCASSERT(points != nullptr); SCASSERT(points != nullptr);
points->setPoint1Id(value); points->setObject1Id(value);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
@ -146,7 +146,7 @@ void DialogTrueDarts::SetSecondBasePointId(const quint32 &value)
VisToolTrueDarts *points = qobject_cast<VisToolTrueDarts *>(vis); VisToolTrueDarts *points = qobject_cast<VisToolTrueDarts *>(vis);
SCASSERT(points != nullptr); SCASSERT(points != nullptr);
points->setPoint2Id(value); points->setObject2Id(value);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
@ -230,7 +230,7 @@ void DialogTrueDarts::ChosenObject(quint32 id, const SceneObject &type)
if (SetObject(id, ui->comboBoxSecondBasePoint, tr("Select the first dart point"))) if (SetObject(id, ui->comboBoxSecondBasePoint, tr("Select the first dart point")))
{ {
number++; number++;
points->setPoint2Id(id); points->setObject2Id(id);
points->RefreshGeometry(); points->RefreshGeometry();
} }
} }
@ -356,8 +356,8 @@ void DialogTrueDarts::SaveData()
VisToolTrueDarts *points = qobject_cast<VisToolTrueDarts *>(vis); VisToolTrueDarts *points = qobject_cast<VisToolTrueDarts *>(vis);
SCASSERT(points != nullptr); SCASSERT(points != nullptr);
points->setPoint1Id(GetFirstBasePointId()); points->setObject1Id(GetFirstBasePointId());
points->setPoint2Id(GetSecondBasePointId()); points->setObject2Id(GetSecondBasePointId());
points->setD1PointId(GetFirstDartPointId()); points->setD1PointId(GetFirstDartPointId());
points->setD2PointId(GetSecondDartPointId()); points->setD2PointId(GetSecondDartPointId());
points->setD3PointId(GetThirdDartPointId()); points->setD3PointId(GetThirdDartPointId());

View File

@ -52,6 +52,7 @@
#include "toolpoint/toolsinglepoint/vtoolpointofintersection.h" #include "toolpoint/toolsinglepoint/vtoolpointofintersection.h"
#include "toolpoint/toolsinglepoint/vtoolpointofintersectionarcs.h" #include "toolpoint/toolsinglepoint/vtoolpointofintersectionarcs.h"
#include "toolpoint/toolsinglepoint/vtoolpointofintersectioncircles.h" #include "toolpoint/toolsinglepoint/vtoolpointofintersectioncircles.h"
#include "toolpoint/toolsinglepoint/vtoolpointofintersectioncurves.h"
#include "toolpoint/toolsinglepoint/vtoolpointfromcircleandtangent.h" #include "toolpoint/toolsinglepoint/vtoolpointfromcircleandtangent.h"
#include "toolpoint/toolsinglepoint/vtoolpointfromarcandtangent.h" #include "toolpoint/toolsinglepoint/vtoolpointfromarcandtangent.h"
#include "toolpoint/tooldoublepoint/vtooltruedarts.h" #include "toolpoint/tooldoublepoint/vtooltruedarts.h"

View File

@ -355,7 +355,7 @@ void VToolArc::SetVisualization()
SCASSERT(visual != nullptr); SCASSERT(visual != nullptr);
const VTranslateVars *trVars = qApp->TrVars(); const VTranslateVars *trVars = qApp->TrVars();
visual->setPoint1Id(arc->GetCenter().id()); visual->setObject1Id(arc->GetCenter().id());
visual->setRadius(trVars->FormulaToUser(arc->GetFormulaRadius())); visual->setRadius(trVars->FormulaToUser(arc->GetFormulaRadius()));
visual->setF1(trVars->FormulaToUser(arc->GetFormulaF1())); visual->setF1(trVars->FormulaToUser(arc->GetFormulaF1()));
visual->setF2(trVars->FormulaToUser(arc->GetFormulaF2())); visual->setF2(trVars->FormulaToUser(arc->GetFormulaF2()));

View File

@ -311,7 +311,7 @@ void VToolArcWithLength::SetVisualization()
SCASSERT(visual != nullptr); SCASSERT(visual != nullptr);
const VTranslateVars *trVars = qApp->TrVars(); const VTranslateVars *trVars = qApp->TrVars();
visual->setPoint1Id(arc->GetCenter().id()); visual->setObject1Id(arc->GetCenter().id());
visual->setRadius(trVars->FormulaToUser(arc->GetFormulaRadius())); visual->setRadius(trVars->FormulaToUser(arc->GetFormulaRadius()));
visual->setF1(trVars->FormulaToUser(arc->GetFormulaF1())); visual->setF1(trVars->FormulaToUser(arc->GetFormulaF1()));
visual->setLength(trVars->FormulaToUser(arc->GetFormulaLength())); visual->setLength(trVars->FormulaToUser(arc->GetFormulaLength()));

View File

@ -481,8 +481,8 @@ void VToolSpline::SetVisualization()
SCASSERT(visual != nullptr); SCASSERT(visual != nullptr);
const QSharedPointer<VSpline> spl = VAbstractTool::data.GeometricObject<VSpline>(id); const QSharedPointer<VSpline> spl = VAbstractTool::data.GeometricObject<VSpline>(id);
visual->setPoint1Id(spl->GetP1().id()); visual->setObject1Id(spl->GetP1().id());
visual->setPoint4Id(spl->GetP4().id()); visual->setObject4Id(spl->GetP4().id());
visual->SetAngle1(spl->GetStartAngle()); visual->SetAngle1(spl->GetStartAngle());
visual->SetAngle2(spl->GetEndAngle()); visual->SetAngle2(spl->GetEndAngle());
visual->SetKAsm1(spl->GetKasm1()); visual->SetKAsm1(spl->GetKasm1());

View File

@ -360,8 +360,8 @@ void VToolTrueDarts::SetVisualization()
VisToolTrueDarts *visual = qobject_cast<VisToolTrueDarts *>(vis); VisToolTrueDarts *visual = qobject_cast<VisToolTrueDarts *>(vis);
SCASSERT(visual != nullptr); SCASSERT(visual != nullptr);
visual->setPoint1Id(baseLineP1Id); visual->setObject1Id(baseLineP1Id);
visual->setPoint2Id(baseLineP2Id); visual->setObject2Id(baseLineP2Id);
visual->setD1PointId(dartP1Id); visual->setD1PointId(dartP1Id);
visual->setD2PointId(dartP2Id); visual->setD2PointId(dartP2Id);
visual->setD3PointId(dartP3Id); visual->setD3PointId(dartP3Id);

View File

@ -241,7 +241,7 @@ void VToolCutArc::SetVisualization()
VisToolCutArc *visual = qobject_cast<VisToolCutArc *>(vis); VisToolCutArc *visual = qobject_cast<VisToolCutArc *>(vis);
SCASSERT(visual != nullptr); SCASSERT(visual != nullptr);
visual->setPoint1Id(curveCutId); visual->setObject1Id(curveCutId);
visual->setLength(qApp->TrVars()->FormulaToUser(formula)); visual->setLength(qApp->TrVars()->FormulaToUser(formula));
visual->RefreshGeometry(); visual->RefreshGeometry();
} }

View File

@ -249,7 +249,7 @@ void VToolCutSpline::SetVisualization()
VisToolCutSpline *visual = qobject_cast<VisToolCutSpline *>(vis); VisToolCutSpline *visual = qobject_cast<VisToolCutSpline *>(vis);
SCASSERT(visual != nullptr); SCASSERT(visual != nullptr);
visual->setPoint1Id(curveCutId); visual->setObject1Id(curveCutId);
visual->setLength(qApp->TrVars()->FormulaToUser(formula)); visual->setLength(qApp->TrVars()->FormulaToUser(formula));
visual->RefreshGeometry(); visual->RefreshGeometry();
} }

View File

@ -293,7 +293,7 @@ void VToolCutSplinePath::SetVisualization()
VisToolCutSplinePath *visual = qobject_cast<VisToolCutSplinePath *>(vis); VisToolCutSplinePath *visual = qobject_cast<VisToolCutSplinePath *>(vis);
SCASSERT(visual != nullptr); SCASSERT(visual != nullptr);
visual->setPoint1Id(curveCutId); visual->setObject1Id(curveCutId);
visual->setLength(qApp->TrVars()->FormulaToUser(formula)); visual->setLength(qApp->TrVars()->FormulaToUser(formula));
visual->RefreshGeometry(); visual->RefreshGeometry();
} }

View File

@ -143,8 +143,8 @@ void VToolAlongLine::SetVisualization()
{ {
VisToolAlongLine *visual = qobject_cast<VisToolAlongLine *>(vis); VisToolAlongLine *visual = qobject_cast<VisToolAlongLine *>(vis);
SCASSERT(visual != nullptr) SCASSERT(visual != nullptr)
visual->setPoint1Id(basePointId); visual->setObject1Id(basePointId);
visual->setPoint2Id(secondPointId); visual->setObject2Id(secondPointId);
visual->setLength(qApp->TrVars()->FormulaToUser(formulaLength)); visual->setLength(qApp->TrVars()->FormulaToUser(formulaLength));
visual->setLineStyle(VAbstractTool::LineStyleToPenStyle(typeLine)); visual->setLineStyle(VAbstractTool::LineStyleToPenStyle(typeLine));
visual->RefreshGeometry(); visual->RefreshGeometry();

View File

@ -302,9 +302,9 @@ void VToolBisector::SetVisualization()
VisToolBisector *visual = qobject_cast<VisToolBisector *>(vis); VisToolBisector *visual = qobject_cast<VisToolBisector *>(vis);
SCASSERT(visual != nullptr); SCASSERT(visual != nullptr);
visual->setPoint1Id(firstPointId); visual->setObject1Id(firstPointId);
visual->setPoint2Id(basePointId); visual->setObject2Id(basePointId);
visual->setPoint3Id(thirdPointId); visual->setObject3Id(thirdPointId);
visual->setLength(qApp->TrVars()->FormulaToUser(formulaLength)); visual->setLength(qApp->TrVars()->FormulaToUser(formulaLength));
visual->setLineStyle(VAbstractTool::LineStyleToPenStyle(typeLine)); visual->setLineStyle(VAbstractTool::LineStyleToPenStyle(typeLine));
visual->RefreshGeometry(); visual->RefreshGeometry();

View File

@ -278,7 +278,7 @@ void VToolCurveIntersectAxis::SetVisualization()
VisToolCurveIntersectAxis *visual = qobject_cast<VisToolCurveIntersectAxis *>(vis); VisToolCurveIntersectAxis *visual = qobject_cast<VisToolCurveIntersectAxis *>(vis);
SCASSERT(visual != nullptr); SCASSERT(visual != nullptr);
visual->setPoint1Id(curveId); visual->setObject1Id(curveId);
visual->setAxisPointId(basePointId); visual->setAxisPointId(basePointId);
visual->SetAngle(qApp->TrVars()->FormulaToUser(formulaAngle)); visual->SetAngle(qApp->TrVars()->FormulaToUser(formulaAngle));
visual->setLineStyle(VAbstractTool::LineStyleToPenStyle(typeLine)); visual->setLineStyle(VAbstractTool::LineStyleToPenStyle(typeLine));

View File

@ -240,7 +240,7 @@ void VToolEndLine::SetVisualization()
VisToolEndLine *visual = qobject_cast<VisToolEndLine *>(vis); VisToolEndLine *visual = qobject_cast<VisToolEndLine *>(vis);
SCASSERT(visual != nullptr); SCASSERT(visual != nullptr);
visual->setPoint1Id(basePointId); visual->setObject1Id(basePointId);
visual->setLength(qApp->TrVars()->FormulaToUser(formulaLength)); visual->setLength(qApp->TrVars()->FormulaToUser(formulaLength));
visual->SetAngle(qApp->TrVars()->FormulaToUser(formulaAngle)); visual->SetAngle(qApp->TrVars()->FormulaToUser(formulaAngle));
visual->setLineStyle(VAbstractTool::LineStyleToPenStyle(typeLine)); visual->setLineStyle(VAbstractTool::LineStyleToPenStyle(typeLine));

View File

@ -246,7 +246,7 @@ void VToolHeight::SetVisualization()
VisToolHeight *visual = qobject_cast<VisToolHeight *>(vis); VisToolHeight *visual = qobject_cast<VisToolHeight *>(vis);
SCASSERT(visual != nullptr); SCASSERT(visual != nullptr);
visual->setPoint1Id(basePointId); visual->setObject1Id(basePointId);
visual->setLineP1Id(p1LineId); visual->setLineP1Id(p1LineId);
visual->setLineP2Id(p2LineId); visual->setLineP2Id(p2LineId);
visual->setLineStyle(VAbstractTool::LineStyleToPenStyle(typeLine)); visual->setLineStyle(VAbstractTool::LineStyleToPenStyle(typeLine));

View File

@ -292,7 +292,7 @@ void VToolLineIntersectAxis::SetVisualization()
VisToolLineIntersectAxis *visual = qobject_cast<VisToolLineIntersectAxis *>(vis); VisToolLineIntersectAxis *visual = qobject_cast<VisToolLineIntersectAxis *>(vis);
SCASSERT(visual != nullptr); SCASSERT(visual != nullptr);
visual->setPoint1Id(firstPointId); visual->setObject1Id(firstPointId);
visual->setPoint2Id(secondPointId); visual->setPoint2Id(secondPointId);
visual->setAxisPointId(basePointId); visual->setAxisPointId(basePointId);
visual->SetAngle(qApp->TrVars()->FormulaToUser(formulaAngle)); visual->SetAngle(qApp->TrVars()->FormulaToUser(formulaAngle));

View File

@ -279,8 +279,8 @@ void VToolNormal::SetVisualization()
VisToolNormal *visual = qobject_cast<VisToolNormal *>(vis); VisToolNormal *visual = qobject_cast<VisToolNormal *>(vis);
SCASSERT(visual != nullptr); SCASSERT(visual != nullptr);
visual->setPoint1Id(basePointId); visual->setObject1Id(basePointId);
visual->setPoint2Id(secondPointId); visual->setObject2Id(secondPointId);
visual->setLength(qApp->TrVars()->FormulaToUser(formulaLength)); visual->setLength(qApp->TrVars()->FormulaToUser(formulaLength));
visual->SetAngle(angle); visual->SetAngle(angle);
visual->setLineStyle(VAbstractTool::LineStyleToPenStyle(typeLine)); visual->setLineStyle(VAbstractTool::LineStyleToPenStyle(typeLine));

View File

@ -306,7 +306,7 @@ void VToolShoulderPoint::SetVisualization()
VisToolShoulderPoint *visual = qobject_cast<VisToolShoulderPoint *>(vis); VisToolShoulderPoint *visual = qobject_cast<VisToolShoulderPoint *>(vis);
SCASSERT(visual != nullptr); SCASSERT(visual != nullptr);
visual->setPoint1Id(pShoulder); visual->setObject1Id(pShoulder);
visual->setLineP1Id(basePointId); visual->setLineP1Id(basePointId);
visual->setLineP2Id(p2Line); visual->setLineP2Id(p2Line);
visual->setLength(qApp->TrVars()->FormulaToUser(formulaLength)); visual->setLength(qApp->TrVars()->FormulaToUser(formulaLength));

View File

@ -265,7 +265,7 @@ void VToolLineIntersect::SetVisualization()
VisToolLineIntersect *visual = qobject_cast<VisToolLineIntersect *>(vis); VisToolLineIntersect *visual = qobject_cast<VisToolLineIntersect *>(vis);
SCASSERT(visual != nullptr); SCASSERT(visual != nullptr);
visual->setPoint1Id(p1Line1); visual->setObject1Id(p1Line1);
visual->setLine1P2Id(p2Line1); visual->setLine1P2Id(p2Line1);
visual->setLine2P1Id(p1Line2); visual->setLine2P1Id(p1Line2);
visual->setLine2P2Id(p2Line2); visual->setLine2P2Id(p2Line2);

View File

@ -318,7 +318,7 @@ void VToolPointFromArcAndTangent::SetVisualization()
VisToolPointFromArcAndTangent *visual = qobject_cast<VisToolPointFromArcAndTangent *>(vis); VisToolPointFromArcAndTangent *visual = qobject_cast<VisToolPointFromArcAndTangent *>(vis);
SCASSERT(visual != nullptr); SCASSERT(visual != nullptr);
visual->setPoint1Id(tangentPointId); visual->setObject1Id(tangentPointId);
visual->setArcId(arcId); visual->setArcId(arcId);
visual->setCrossPoint(crossPoint); visual->setCrossPoint(crossPoint);
visual->RefreshGeometry(); visual->RefreshGeometry();

View File

@ -305,8 +305,8 @@ void VToolPointFromCircleAndTangent::SetVisualization()
VisToolPointFromCircleAndTangent *visual = qobject_cast<VisToolPointFromCircleAndTangent *>(vis); VisToolPointFromCircleAndTangent *visual = qobject_cast<VisToolPointFromCircleAndTangent *>(vis);
SCASSERT(visual != nullptr); SCASSERT(visual != nullptr);
visual->setPoint1Id(tangentPointId); visual->setObject1Id(tangentPointId);
visual->setPoint2Id(circleCenterId); visual->setObject2Id(circleCenterId);
visual->setCRadius(circleRadius); visual->setCRadius(circleRadius);
visual->setCrossPoint(crossPoint); visual->setCrossPoint(crossPoint);
visual->RefreshGeometry(); visual->RefreshGeometry();

View File

@ -318,7 +318,7 @@ void VToolPointOfContact::SetVisualization()
VisToolPointOfContact *visual = qobject_cast<VisToolPointOfContact *>(vis); VisToolPointOfContact *visual = qobject_cast<VisToolPointOfContact *>(vis);
SCASSERT(visual != nullptr); SCASSERT(visual != nullptr);
visual->setPoint1Id(firstPointId); visual->setObject1Id(firstPointId);
visual->setLineP2Id(secondPointId); visual->setLineP2Id(secondPointId);
visual->setRadiusId(center); visual->setRadiusId(center);
visual->setRadius(qApp->TrVars()->FormulaToUser(arcRadius)); visual->setRadius(qApp->TrVars()->FormulaToUser(arcRadius));

View File

@ -220,7 +220,7 @@ void VToolPointOfIntersection::SetVisualization()
VisToolPointOfIntersection *visual = qobject_cast<VisToolPointOfIntersection *>(vis); VisToolPointOfIntersection *visual = qobject_cast<VisToolPointOfIntersection *>(vis);
SCASSERT(visual != nullptr); SCASSERT(visual != nullptr);
visual->setPoint1Id(firstPointId); visual->setObject1Id(firstPointId);
visual->setPoint2Id(secondPointId); visual->setPoint2Id(secondPointId);
visual->RefreshGeometry(); visual->RefreshGeometry();
} }

View File

@ -344,8 +344,8 @@ void VToolPointOfIntersectionCircles::SetVisualization()
VisToolPointOfIntersectionCircles *visual = qobject_cast<VisToolPointOfIntersectionCircles *>(vis); VisToolPointOfIntersectionCircles *visual = qobject_cast<VisToolPointOfIntersectionCircles *>(vis);
SCASSERT(visual != nullptr); SCASSERT(visual != nullptr);
visual->setPoint1Id(firstCircleCenterId); visual->setObject1Id(firstCircleCenterId);
visual->setPoint2Id(secondCircleCenterId); visual->setObject2Id(secondCircleCenterId);
visual->setC1Radius(firstCircleRadius); visual->setC1Radius(firstCircleRadius);
visual->setC2Radius(secondCircleRadius); visual->setC2Radius(secondCircleRadius);
visual->setCrossPoint(crossPoint); visual->setCrossPoint(crossPoint);

View File

@ -0,0 +1,393 @@
/************************************************************************
**
** @file vtoolpointofintersectioncurves.cpp
** @author Roman Telezhynskyi <dismine(at)gmail.com>
** @date 22 1, 2016
**
** @brief
** @copyright
** This source code is part of the Valentine project, a pattern making
** program, whose allow create and modeling patterns of clothing.
** Copyright (C) 2016 Valentina project
** <https://bitbucket.org/dismine/valentina> All Rights Reserved.
**
** Valentina is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** Valentina is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with Valentina. If not, see <http://www.gnu.org/licenses/>.
**
*************************************************************************/
#include "vtoolpointofintersectioncurves.h"
#include "../../../../dialogs/tools/dialogpointofintersectioncurves.h"
#include "../../../../visualization/vistoolpointofintersectioncurves.h"
const QString VToolPointOfIntersectionCurves::ToolType = QStringLiteral("pointOfIntersectionCurves");
//---------------------------------------------------------------------------------------------------------------------
VToolPointOfIntersectionCurves::VToolPointOfIntersectionCurves(VAbstractPattern *doc, VContainer *data,
const quint32 &id, const quint32 firstCurveId,
quint32 secondCurveId, VCrossCurvesPoint vCrossPoint,
HCrossCurvesPoint hCrossPoint, const Source &typeCreation,
QGraphicsItem *parent)
:VToolSinglePoint(doc, data, id, parent),
firstCurveId(firstCurveId),
secondCurveId(secondCurveId),
vCrossPoint(vCrossPoint),
hCrossPoint(hCrossPoint)
{
ToolCreation(typeCreation);
}
//---------------------------------------------------------------------------------------------------------------------
void VToolPointOfIntersectionCurves::setDialog()
{
SCASSERT(dialog != nullptr);
auto dialogTool = qobject_cast<DialogPointOfIntersectionCurves*>(dialog);
SCASSERT(dialogTool != nullptr);
auto p = VAbstractTool::data.GeometricObject<VPointF>(id);
dialogTool->SetFirstCurveId(firstCurveId);
dialogTool->SetSecondCurveId(secondCurveId);
dialogTool->SetVCrossPoint(vCrossPoint);
dialogTool->SetHCrossPoint(hCrossPoint);
dialogTool->SetPointName(p->name());
}
//---------------------------------------------------------------------------------------------------------------------
VToolPointOfIntersectionCurves *VToolPointOfIntersectionCurves::Create(DialogTool *dialog, VMainGraphicsScene *scene,
VAbstractPattern *doc, VContainer *data)
{
SCASSERT(dialog != nullptr);
auto dialogTool = qobject_cast<DialogPointOfIntersectionCurves*>(dialog);
SCASSERT(dialogTool != nullptr);
const quint32 firstCurveId = dialogTool->GetFirstCurveId();
const quint32 secondCurveId = dialogTool->GetSecondCurveId();
const VCrossCurvesPoint vCrossPoint = dialogTool->GetVCrossPoint();
const HCrossCurvesPoint hCrossPoint = dialogTool->GetHCrossPoint();
const QString pointName = dialogTool->getPointName();
VToolPointOfIntersectionCurves *point = Create(0, pointName, firstCurveId, secondCurveId, vCrossPoint, hCrossPoint,
5, 10, scene, doc, data, Document::FullParse, Source::FromGui);
if (point != nullptr)
{
point->dialog=dialogTool;
}
return point;
}
//---------------------------------------------------------------------------------------------------------------------
VToolPointOfIntersectionCurves *VToolPointOfIntersectionCurves::Create(const quint32 _id, const QString &pointName,
quint32 firstCurveId, quint32 secondCurveId,
VCrossCurvesPoint vCrossPoint,
HCrossCurvesPoint hCrossPoint, const qreal &mx,
const qreal &my, VMainGraphicsScene *scene,
VAbstractPattern *doc, VContainer *data,
const Document &parse,
const Source &typeCreation)
{
auto curve1 = data->GeometricObject<VAbstractCurve>(firstCurveId);
auto curve2 = data->GeometricObject<VAbstractCurve>(secondCurveId);
const QPointF point = VToolPointOfIntersectionCurves::FindPoint(curve1->GetPoints(), curve2->GetPoints(),
vCrossPoint, hCrossPoint);
quint32 id = _id;
if (typeCreation == Source::FromGui)
{
id = data->AddGObject(new VPointF(point, pointName, mx, my));
}
else
{
data->UpdateGObject(id, new VPointF(point, pointName, mx, my));
if (parse != Document::FullParse)
{
doc->UpdateToolData(id, data);
}
}
VDrawTool::AddRecord(id, Tool::PointOfIntersectionCurves, doc);
if (parse == Document::FullParse)
{
auto point = new VToolPointOfIntersectionCurves(doc, data, id, firstCurveId, secondCurveId, vCrossPoint,
hCrossPoint, typeCreation);
scene->addItem(point);
connect(point, &VToolPointOfIntersectionCurves::ChoosedTool, scene, &VMainGraphicsScene::ChoosedItem);
connect(scene, &VMainGraphicsScene::NewFactor, point, &VToolPointOfIntersectionCurves::SetFactor);
connect(scene, &VMainGraphicsScene::DisableItem, point, &VToolPointOfIntersectionCurves::Disable);
connect(scene, &VMainGraphicsScene::EnableToolMove, point, &VToolPointOfIntersectionCurves::EnableToolMove);
doc->AddTool(id, point);
doc->IncrementReferens(firstCurveId);
doc->IncrementReferens(secondCurveId);
return point;
}
return nullptr;
}
//---------------------------------------------------------------------------------------------------------------------
QPointF VToolPointOfIntersectionCurves::FindPoint(const QVector<QPointF> &curve1Points,
const QVector<QPointF> &curve2Points,
VCrossCurvesPoint vCrossPoint, HCrossCurvesPoint hCrossPoint)
{
if (curve1Points.isEmpty() || curve2Points.isEmpty())
{
return QPointF();
}
QVector<QPointF> intersections;
for ( auto i = 0; i < curve1Points.count()-1; ++i )
{
intersections << VAbstractCurve::CurveIntersectLine(curve2Points,
QLineF(curve1Points.at(i), curve1Points.at(i+1)));
}
if (intersections.isEmpty())
{
return QPointF();
}
if (intersections.size() == 1)
{
return intersections.at(0);
}
QVector<QPointF> vIntersections;
if (vCrossPoint == VCrossCurvesPoint::HighestPoint)
{
qreal minY = intersections.at(0).y();
vIntersections.append(intersections.at(0));
for ( auto i = 1; i < intersections.count(); ++i )
{
const QPointF p = intersections.at(i);
if (p.y() > minY)
{
continue;
}
else if (p.y() < minY)
{
minY = p.y();
vIntersections.clear();
vIntersections.append(p);
}
else
{
vIntersections.append(p);
}
}
}
else
{
qreal maxY = intersections.at(0).y();
vIntersections.append(intersections.at(0));
for ( auto i = 1; i < intersections.count(); ++i )
{
const QPointF p = intersections.at(i);
if (p.y() > maxY)
{
maxY = p.y();
vIntersections.clear();
vIntersections.append(p);
}
else if (p.y() < maxY)
{
continue;
}
else
{
vIntersections.append(p);
}
}
}
if (vIntersections.isEmpty())
{
return QPointF();
}
if (vIntersections.size() == 1)
{
return vIntersections.at(0);
}
QPointF crossPoint = vIntersections.at(0);
if (hCrossPoint == HCrossCurvesPoint::RightmostPoint)
{
qreal maxX = vIntersections.at(0).x();
for ( auto i = 1; i < vIntersections.count(); ++i )
{
const QPointF p = vIntersections.at(i);
if (p.x() > maxX)
{
maxX = p.x();
crossPoint = p;
}
}
}
else
{
qreal minX = vIntersections.at(0).x();
for ( auto i = 1; i < vIntersections.count(); ++i )
{
const QPointF p = vIntersections.at(i);
if (p.x() < minX)
{
minX = p.x();
crossPoint = p;
}
}
}
return crossPoint;
}
//---------------------------------------------------------------------------------------------------------------------
quint32 VToolPointOfIntersectionCurves::GetFirstCurveId() const
{
return firstCurveId;
}
//---------------------------------------------------------------------------------------------------------------------
void VToolPointOfIntersectionCurves::SetFirstCurveId(const quint32 &value)
{
if (value != NULL_ID)
{
firstCurveId = value;
auto obj = VAbstractTool::data.GetGObject(id);
SaveOption(obj);
}
}
//---------------------------------------------------------------------------------------------------------------------
quint32 VToolPointOfIntersectionCurves::GetSecondCurveId() const
{
return secondCurveId;
}
//---------------------------------------------------------------------------------------------------------------------
void VToolPointOfIntersectionCurves::SetSecondCurveId(const quint32 &value)
{
if (value != NULL_ID)
{
secondCurveId = value;
auto obj = VAbstractTool::data.GetGObject(id);
SaveOption(obj);
}
}
//---------------------------------------------------------------------------------------------------------------------
VCrossCurvesPoint VToolPointOfIntersectionCurves::GetVCrossPoint() const
{
return vCrossPoint;
}
//---------------------------------------------------------------------------------------------------------------------
void VToolPointOfIntersectionCurves::SetVCrossPoint(const VCrossCurvesPoint &value)
{
vCrossPoint = value;
auto obj = VAbstractTool::data.GetGObject(id);
SaveOption(obj);
}
//---------------------------------------------------------------------------------------------------------------------
HCrossCurvesPoint VToolPointOfIntersectionCurves::GetHCrossPoint() const
{
return hCrossPoint;
}
//---------------------------------------------------------------------------------------------------------------------
void VToolPointOfIntersectionCurves::SetHCrossPoint(const HCrossCurvesPoint &value)
{
hCrossPoint = value;
auto obj = VAbstractTool::data.GetGObject(id);
SaveOption(obj);
}
//---------------------------------------------------------------------------------------------------------------------
void VToolPointOfIntersectionCurves::ShowVisualization(bool show)
{
ShowToolVisualization<VisToolPointOfIntersectionCurves>(show);
}
//---------------------------------------------------------------------------------------------------------------------
void VToolPointOfIntersectionCurves::RemoveReferens()
{
doc->DecrementReferens(firstCurveId);
doc->DecrementReferens(secondCurveId);
}
//---------------------------------------------------------------------------------------------------------------------
void VToolPointOfIntersectionCurves::contextMenuEvent(QGraphicsSceneContextMenuEvent *event)
{
try
{
ContextMenu<DialogPointOfIntersectionCurves>(this, event);
}
catch(const VExceptionToolWasDeleted &e)
{
Q_UNUSED(e);
return;//Leave this method immediately!!!
}
}
//---------------------------------------------------------------------------------------------------------------------
void VToolPointOfIntersectionCurves::SaveDialog(QDomElement &domElement)
{
SCASSERT(dialog != nullptr);
auto dialogTool = qobject_cast<DialogPointOfIntersectionCurves*>(dialog);
SCASSERT(dialogTool != nullptr);
doc->SetAttribute(domElement, AttrName, dialogTool->getPointName());
doc->SetAttribute(domElement, AttrCurve1, QString().setNum(dialogTool->GetFirstCurveId()));
doc->SetAttribute(domElement, AttrCurve2, QString().setNum(dialogTool->GetSecondCurveId()));
doc->SetAttribute(domElement, AttrVCrossPoint, QString().setNum(static_cast<int>(dialogTool->GetVCrossPoint())));
doc->SetAttribute(domElement, AttrHCrossPoint, QString().setNum(static_cast<int>(dialogTool->GetHCrossPoint())));
}
//---------------------------------------------------------------------------------------------------------------------
void VToolPointOfIntersectionCurves::SaveOptions(QDomElement &tag, QSharedPointer<VGObject> &obj)
{
VToolSinglePoint::SaveOptions(tag, obj);
doc->SetAttribute(tag, AttrType, ToolType);
doc->SetAttribute(tag, AttrCurve1, firstCurveId);
doc->SetAttribute(tag, AttrCurve2, secondCurveId);
doc->SetAttribute(tag, AttrVCrossPoint, static_cast<int>(vCrossPoint));
doc->SetAttribute(tag, AttrHCrossPoint, static_cast<int>(hCrossPoint));
}
//---------------------------------------------------------------------------------------------------------------------
void VToolPointOfIntersectionCurves::ReadToolAttributes(const QDomElement &domElement)
{
firstCurveId = doc->GetParametrUInt(domElement, AttrCurve1, NULL_ID_STR);
secondCurveId = doc->GetParametrUInt(domElement, AttrCurve2, NULL_ID_STR);
vCrossPoint = static_cast<VCrossCurvesPoint>(doc->GetParametrUInt(domElement, AttrVCrossPoint, "1"));
hCrossPoint = static_cast<HCrossCurvesPoint>(doc->GetParametrUInt(domElement, AttrHCrossPoint, "1"));
}
//---------------------------------------------------------------------------------------------------------------------
void VToolPointOfIntersectionCurves::SetVisualization()
{
if (vis != nullptr)
{
auto visual = qobject_cast<VisToolPointOfIntersectionCurves *>(vis);
SCASSERT(visual != nullptr);
visual->setObject1Id(firstCurveId);
visual->setObject2Id(secondCurveId);
visual->setVCrossPoint(vCrossPoint);
visual->setHCrossPoint(hCrossPoint);
visual->RefreshGeometry();
}
}

View File

@ -0,0 +1,87 @@
/************************************************************************
**
** @file vtoolpointofintersectioncurves.h
** @author Roman Telezhynskyi <dismine(at)gmail.com>
** @date 22 1, 2016
**
** @brief
** @copyright
** This source code is part of the Valentine project, a pattern making
** program, whose allow create and modeling patterns of clothing.
** Copyright (C) 2016 Valentina project
** <https://bitbucket.org/dismine/valentina> All Rights Reserved.
**
** Valentina is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** Valentina is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with Valentina. If not, see <http://www.gnu.org/licenses/>.
**
*************************************************************************/
#ifndef VTOOLPOINTOFINTERSECTIONCURVES_H
#define VTOOLPOINTOFINTERSECTIONCURVES_H
#include "vtoolsinglepoint.h"
class VToolPointOfIntersectionCurves : public VToolSinglePoint
{
Q_OBJECT
public:
explicit VToolPointOfIntersectionCurves(VAbstractPattern *doc, VContainer *data, const quint32 &id, const
quint32 firstCurveId, quint32 secondCurveId,
VCrossCurvesPoint vCrossPoint, HCrossCurvesPoint hCrossPoint,
const Source &typeCreation, QGraphicsItem * parent = nullptr);
virtual void setDialog() Q_DECL_OVERRIDE;
static VToolPointOfIntersectionCurves *Create(DialogTool *dialog, VMainGraphicsScene *scene,
VAbstractPattern *doc, VContainer *data);
static VToolPointOfIntersectionCurves *Create(const quint32 _id, const QString &pointName,
quint32 firstCurveId, quint32 secondCurveId,
VCrossCurvesPoint vCrossPoint, HCrossCurvesPoint hCrossPoint,
const qreal &mx, const qreal &my, VMainGraphicsScene *scene,
VAbstractPattern *doc, VContainer *data, const Document &parse,
const Source &typeCreation);
static QPointF FindPoint(const QVector<QPointF> &curve1Points, const QVector<QPointF> &curve2Points,
VCrossCurvesPoint vCrossPoint, HCrossCurvesPoint hCrossPoint);
static const QString ToolType;
virtual int type() const Q_DECL_OVERRIDE {return Type;}
enum { Type = UserType + static_cast<int>(Tool::PointOfIntersectionCurves) };
quint32 GetFirstCurveId() const;
void SetFirstCurveId(const quint32 &value);
quint32 GetSecondCurveId() const;
void SetSecondCurveId(const quint32 &value);
VCrossCurvesPoint GetVCrossPoint() const;
void SetVCrossPoint(const VCrossCurvesPoint &value);
HCrossCurvesPoint GetHCrossPoint() const;
void SetHCrossPoint(const HCrossCurvesPoint &value);
virtual void ShowVisualization(bool show) Q_DECL_OVERRIDE;
protected:
virtual void RemoveReferens() Q_DECL_OVERRIDE;
virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent * event ) Q_DECL_OVERRIDE;
virtual void SaveDialog(QDomElement &domElement) Q_DECL_OVERRIDE;
virtual void SaveOptions(QDomElement &tag, QSharedPointer<VGObject> &obj) Q_DECL_OVERRIDE;
virtual void ReadToolAttributes(const QDomElement &domElement) Q_DECL_OVERRIDE;
virtual void SetVisualization() Q_DECL_OVERRIDE;
private:
Q_DISABLE_COPY(VToolPointOfIntersectionCurves)
quint32 firstCurveId;
quint32 secondCurveId;
VCrossCurvesPoint vCrossPoint;
HCrossCurvesPoint hCrossPoint;
};
#endif // VTOOLPOINTOFINTERSECTIONCURVES_H

View File

@ -282,8 +282,8 @@ void VToolTriangle::SetVisualization()
VisToolTriangle * visual = qobject_cast<VisToolTriangle *>(vis); VisToolTriangle * visual = qobject_cast<VisToolTriangle *>(vis);
SCASSERT(visual != nullptr); SCASSERT(visual != nullptr);
visual->setPoint1Id(axisP1Id); visual->setObject1Id(axisP1Id);
visual->setPoint2Id(axisP2Id); visual->setObject2Id(axisP2Id);
visual->setHypotenuseP1Id(firstPointId); visual->setHypotenuseP1Id(firstPointId);
visual->setHypotenuseP2Id(secondPointId); visual->setHypotenuseP2Id(secondPointId);
visual->RefreshGeometry(); visual->RefreshGeometry();

View File

@ -405,7 +405,7 @@ void VToolLine::SetVisualization()
VisToolLine *visual = qobject_cast<VisToolLine *>(vis); VisToolLine *visual = qobject_cast<VisToolLine *>(vis);
SCASSERT(visual != nullptr); SCASSERT(visual != nullptr);
visual->setPoint1Id(firstPoint); visual->setObject1Id(firstPoint);
visual->setPoint2Id(secondPoint); visual->setPoint2Id(secondPoint);
visual->setLineStyle(VAbstractTool::LineStyleToPenStyle(typeLine)); visual->setLineStyle(VAbstractTool::LineStyleToPenStyle(typeLine));
visual->RefreshGeometry(); visual->RefreshGeometry();

View File

@ -46,7 +46,8 @@ HEADERS += \
$$PWD/drawTools/toolcurve/vtoolarcwithlength.h \ $$PWD/drawTools/toolcurve/vtoolarcwithlength.h \
$$PWD/drawTools/toolpoint/vabstractpoint.h \ $$PWD/drawTools/toolpoint/vabstractpoint.h \
$$PWD/drawTools/toolpoint/tooldoublepoint/vtooldoublepoint.h \ $$PWD/drawTools/toolpoint/tooldoublepoint/vtooldoublepoint.h \
$$PWD/drawTools/toolpoint/tooldoublepoint/vtooltruedarts.h $$PWD/drawTools/toolpoint/tooldoublepoint/vtooltruedarts.h \
$$PWD/drawTools/toolpoint/toolsinglepoint/vtoolpointofintersectioncurves.h
SOURCES += \ SOURCES += \
$$PWD/vtooldetail.cpp \ $$PWD/vtooldetail.cpp \
@ -90,4 +91,5 @@ SOURCES += \
$$PWD/drawTools/toolcurve/vtoolarcwithlength.cpp \ $$PWD/drawTools/toolcurve/vtoolarcwithlength.cpp \
$$PWD/drawTools/toolpoint/vabstractpoint.cpp \ $$PWD/drawTools/toolpoint/vabstractpoint.cpp \
$$PWD/drawTools/toolpoint/tooldoublepoint/vtooldoublepoint.cpp \ $$PWD/drawTools/toolpoint/tooldoublepoint/vtooldoublepoint.cpp \
$$PWD/drawTools/toolpoint/tooldoublepoint/vtooltruedarts.cpp $$PWD/drawTools/toolpoint/tooldoublepoint/vtooltruedarts.cpp \
$$PWD/drawTools/toolpoint/toolsinglepoint/vtoolpointofintersectioncurves.cpp

View File

@ -33,7 +33,7 @@
#include "../ifc/xml/vabstractpattern.h" #include "../ifc/xml/vabstractpattern.h"
#include "../vmisc/vabstractapplication.h" #include "../vmisc/vabstractapplication.h"
#include "../vwidgets/vmaingraphicsscene.h" #include "../vwidgets/vmaingraphicsscene.h"
#include "visualization/visualization.h" #include "../visualization/visualization.h"
class QDomElement; class QDomElement;
class QLineF; class QLineF;

View File

@ -32,7 +32,7 @@
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
VisToolAlongLine::VisToolAlongLine(const VContainer *data, QGraphicsItem *parent) VisToolAlongLine::VisToolAlongLine(const VContainer *data, QGraphicsItem *parent)
: VisLine(data, parent), point2Id(NULL_ID), point(nullptr), lineP1(nullptr), lineP2(nullptr), line(nullptr), : VisLine(data, parent), object2Id(NULL_ID), point(nullptr), lineP1(nullptr), lineP2(nullptr), line(nullptr),
length(0) length(0)
{ {
this->mainColor = Qt::red; this->mainColor = Qt::red;
@ -49,9 +49,9 @@ VisToolAlongLine::~VisToolAlongLine()
{} {}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void VisToolAlongLine::setPoint2Id(const quint32 &value) void VisToolAlongLine::setObject2Id(const quint32 &value)
{ {
point2Id = value; object2Id = value;
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
@ -63,18 +63,18 @@ void VisToolAlongLine::setLength(const QString &expression)
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void VisToolAlongLine::RefreshGeometry() void VisToolAlongLine::RefreshGeometry()
{ {
if (point1Id > NULL_ID) if (object1Id > NULL_ID)
{ {
const QSharedPointer<VPointF> first = Visualization::data->GeometricObject<VPointF>(point1Id); const QSharedPointer<VPointF> first = Visualization::data->GeometricObject<VPointF>(object1Id);
DrawPoint(lineP1, first->toQPointF(), supportColor); DrawPoint(lineP1, first->toQPointF(), supportColor);
if (point2Id <= NULL_ID) if (object2Id <= NULL_ID)
{ {
DrawLine(line, QLineF(first->toQPointF(), Visualization::scenePos), supportColor); DrawLine(line, QLineF(first->toQPointF(), Visualization::scenePos), supportColor);
} }
else else
{ {
const QSharedPointer<VPointF> second = Visualization::data->GeometricObject<VPointF>(point2Id); const QSharedPointer<VPointF> second = Visualization::data->GeometricObject<VPointF>(object2Id);
DrawPoint(lineP2, second->toQPointF(), supportColor); DrawPoint(lineP2, second->toQPointF(), supportColor);
DrawLine(line, QLineF(first->toQPointF(), second->toQPointF()), supportColor); DrawLine(line, QLineF(first->toQPointF(), second->toQPointF()), supportColor);

View File

@ -41,13 +41,13 @@ public:
virtual ~VisToolAlongLine() Q_DECL_OVERRIDE; virtual ~VisToolAlongLine() Q_DECL_OVERRIDE;
virtual void RefreshGeometry() Q_DECL_OVERRIDE; virtual void RefreshGeometry() Q_DECL_OVERRIDE;
void setPoint2Id(const quint32 &value); void setObject2Id(const quint32 &value);
void setLength(const QString &expression); void setLength(const QString &expression);
virtual int type() const Q_DECL_OVERRIDE {return Type;} virtual int type() const Q_DECL_OVERRIDE {return Type;}
enum { Type = UserType + static_cast<int>(Vis::ToolAlongLine)}; enum { Type = UserType + static_cast<int>(Vis::ToolAlongLine)};
private: private:
Q_DISABLE_COPY(VisToolAlongLine) Q_DISABLE_COPY(VisToolAlongLine)
quint32 point2Id; quint32 object2Id;
QGraphicsEllipseItem *point; QGraphicsEllipseItem *point;
QGraphicsEllipseItem *lineP1; QGraphicsEllipseItem *lineP1;
QGraphicsEllipseItem *lineP2; QGraphicsEllipseItem *lineP2;

View File

@ -45,9 +45,9 @@ VisToolArc::~VisToolArc()
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void VisToolArc::RefreshGeometry() void VisToolArc::RefreshGeometry()
{ {
if (point1Id > NULL_ID) if (object1Id > NULL_ID)
{ {
const QSharedPointer<VPointF> first = Visualization::data->GeometricObject<VPointF>(point1Id); const QSharedPointer<VPointF> first = Visualization::data->GeometricObject<VPointF>(object1Id);
DrawPoint(arcCenter, first->toQPointF(), supportColor); DrawPoint(arcCenter, first->toQPointF(), supportColor);
if (qFuzzyCompare(1 + radius, 1 + 0) == false && f1 >= 0 && f2 >= 0 && qFuzzyCompare(1 + f1, 1 + f2) == false) if (qFuzzyCompare(1 + radius, 1 + 0) == false && f1 >= 0 && f2 >= 0 && qFuzzyCompare(1 + f1, 1 + f2) == false)

View File

@ -45,9 +45,9 @@ VisToolArcWithLength::~VisToolArcWithLength()
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void VisToolArcWithLength::RefreshGeometry() void VisToolArcWithLength::RefreshGeometry()
{ {
if (point1Id > NULL_ID) if (object1Id > NULL_ID)
{ {
const QSharedPointer<VPointF> first = Visualization::data->GeometricObject<VPointF>(point1Id); const QSharedPointer<VPointF> first = Visualization::data->GeometricObject<VPointF>(object1Id);
DrawPoint(arcCenter, first->toQPointF(), supportColor); DrawPoint(arcCenter, first->toQPointF(), supportColor);
if (qFuzzyCompare(1 + radius, 1 + 0) == false && f1 >= 0 && qFuzzyCompare(1 + length, 1 + 0) == false) if (qFuzzyCompare(1 + radius, 1 + 0) == false && f1 >= 0 && qFuzzyCompare(1 + length, 1 + 0) == false)

View File

@ -33,7 +33,7 @@
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
VisToolBisector::VisToolBisector(const VContainer *data, QGraphicsItem *parent) VisToolBisector::VisToolBisector(const VContainer *data, QGraphicsItem *parent)
:VisLine(data, parent), point2Id(NULL_ID), point3Id(NULL_ID), point(nullptr), line1P1(nullptr), line1P2(nullptr), :VisLine(data, parent), object2Id(NULL_ID), object3Id(NULL_ID), point(nullptr), line1P1(nullptr), line1P2(nullptr),
line1(nullptr), line2P2(nullptr), line2(nullptr), length(0) line1(nullptr), line2P2(nullptr), line2(nullptr), length(0)
{ {
line1P1 = InitPoint(supportColor, this); line1P1 = InitPoint(supportColor, this);
@ -47,15 +47,15 @@ VisToolBisector::VisToolBisector(const VContainer *data, QGraphicsItem *parent)
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void VisToolBisector::setPoint2Id(const quint32 &value) void VisToolBisector::setObject2Id(const quint32 &value)
{ {
point2Id = value; object2Id = value;
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void VisToolBisector::setPoint3Id(const quint32 &value) void VisToolBisector::setObject3Id(const quint32 &value)
{ {
point3Id = value; object3Id = value;
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
@ -71,29 +71,29 @@ VisToolBisector::~VisToolBisector()
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void VisToolBisector::RefreshGeometry() void VisToolBisector::RefreshGeometry()
{ {
if (point1Id > NULL_ID) if (object1Id > NULL_ID)
{ {
const QSharedPointer<VPointF> first = Visualization::data->GeometricObject<VPointF>(point1Id); const QSharedPointer<VPointF> first = Visualization::data->GeometricObject<VPointF>(object1Id);
DrawPoint(line1P1, first->toQPointF(), supportColor); DrawPoint(line1P1, first->toQPointF(), supportColor);
if (point2Id <= NULL_ID) if (object2Id <= NULL_ID)
{ {
DrawLine(line1, QLineF(first->toQPointF(), Visualization::scenePos), supportColor); DrawLine(line1, QLineF(first->toQPointF(), Visualization::scenePos), supportColor);
} }
else else
{ {
const QSharedPointer<VPointF> second = Visualization::data->GeometricObject<VPointF>(point2Id); const QSharedPointer<VPointF> second = Visualization::data->GeometricObject<VPointF>(object2Id);
DrawPoint(line1P2, second->toQPointF(), supportColor); DrawPoint(line1P2, second->toQPointF(), supportColor);
DrawLine(line1, QLineF(first->toQPointF(), second->toQPointF()), supportColor); DrawLine(line1, QLineF(first->toQPointF(), second->toQPointF()), supportColor);
if (point3Id <= NULL_ID) if (object3Id <= NULL_ID)
{ {
DrawLine(line2, QLineF(second->toQPointF(), Visualization::scenePos), supportColor); DrawLine(line2, QLineF(second->toQPointF(), Visualization::scenePos), supportColor);
} }
else else
{ {
const QSharedPointer<VPointF> third = Visualization::data->GeometricObject<VPointF>(point3Id); const QSharedPointer<VPointF> third = Visualization::data->GeometricObject<VPointF>(object3Id);
DrawPoint(line2P2, third->toQPointF(), supportColor); DrawPoint(line2P2, third->toQPointF(), supportColor);
DrawLine(line2, QLineF(second->toQPointF(), third->toQPointF()), supportColor); DrawLine(line2, QLineF(second->toQPointF(), third->toQPointF()), supportColor);

View File

@ -39,15 +39,15 @@ public:
virtual ~VisToolBisector() Q_DECL_OVERRIDE; virtual ~VisToolBisector() Q_DECL_OVERRIDE;
virtual void RefreshGeometry() Q_DECL_OVERRIDE; virtual void RefreshGeometry() Q_DECL_OVERRIDE;
void setPoint2Id(const quint32 &value); void setObject2Id(const quint32 &value);
void setPoint3Id(const quint32 &value); void setObject3Id(const quint32 &value);
void setLength(const QString &expression); void setLength(const QString &expression);
virtual int type() const Q_DECL_OVERRIDE {return Type;} virtual int type() const Q_DECL_OVERRIDE {return Type;}
enum { Type = UserType + static_cast<int>(Vis::ToolBisector)}; enum { Type = UserType + static_cast<int>(Vis::ToolBisector)};
private: private:
Q_DISABLE_COPY(VisToolBisector) Q_DISABLE_COPY(VisToolBisector)
quint32 point2Id; quint32 object2Id;
quint32 point3Id; quint32 object3Id;
QGraphicsEllipseItem *point; QGraphicsEllipseItem *point;
QGraphicsEllipseItem *line1P1; QGraphicsEllipseItem *line1P1;
QGraphicsEllipseItem *line1P2; QGraphicsEllipseItem *line1P2;

View File

@ -52,9 +52,9 @@ VisToolCurveIntersectAxis::~VisToolCurveIntersectAxis()
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void VisToolCurveIntersectAxis::RefreshGeometry() void VisToolCurveIntersectAxis::RefreshGeometry()
{ {
if (point1Id > NULL_ID) if (object1Id > NULL_ID)
{ {
const QSharedPointer<VAbstractCurve> curve = Visualization::data->GeometricObject<VAbstractCurve>(point1Id); const QSharedPointer<VAbstractCurve> curve = Visualization::data->GeometricObject<VAbstractCurve>(object1Id);
DrawPath(visCurve, curve->GetPath(PathDirection::Show), supportColor, Qt::SolidLine, Qt::RoundCap); DrawPath(visCurve, curve->GetPath(PathDirection::Show), supportColor, Qt::SolidLine, Qt::RoundCap);
if (axisPointId > NULL_ID) if (axisPointId > NULL_ID)

View File

@ -51,9 +51,9 @@ VisToolCutArc::~VisToolCutArc()
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void VisToolCutArc::RefreshGeometry() void VisToolCutArc::RefreshGeometry()
{ {
if (point1Id > NULL_ID) if (object1Id > NULL_ID)
{ {
const QSharedPointer<VArc> arc = Visualization::data->GeometricObject<VArc>(point1Id); const QSharedPointer<VArc> arc = Visualization::data->GeometricObject<VArc>(object1Id);
DrawPath(this, arc->GetPath(PathDirection::Show), supportColor, Qt::SolidLine, Qt::RoundCap); DrawPath(this, arc->GetPath(PathDirection::Show), supportColor, Qt::SolidLine, Qt::RoundCap);
if (qFuzzyCompare(1 + length, 1 + 0) == false) if (qFuzzyCompare(1 + length, 1 + 0) == false)

View File

@ -51,9 +51,9 @@ VisToolCutSpline::~VisToolCutSpline()
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void VisToolCutSpline::RefreshGeometry() void VisToolCutSpline::RefreshGeometry()
{ {
if (point1Id > NULL_ID) if (object1Id > NULL_ID)
{ {
const QSharedPointer<VSpline> spl = Visualization::data->GeometricObject<VSpline>(point1Id); const QSharedPointer<VSpline> spl = Visualization::data->GeometricObject<VSpline>(object1Id);
DrawPath(this, spl->GetPath(PathDirection::Show), supportColor, Qt::SolidLine, Qt::RoundCap); DrawPath(this, spl->GetPath(PathDirection::Show), supportColor, Qt::SolidLine, Qt::RoundCap);
if (qFuzzyCompare(1 + length, 1 + 0) == false) if (qFuzzyCompare(1 + length, 1 + 0) == false)

View File

@ -51,9 +51,9 @@ VisToolCutSplinePath::~VisToolCutSplinePath()
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void VisToolCutSplinePath::RefreshGeometry() void VisToolCutSplinePath::RefreshGeometry()
{ {
if (point1Id > NULL_ID) if (object1Id > NULL_ID)
{ {
const QSharedPointer<VSplinePath> splPath = Visualization::data->GeometricObject<VSplinePath>(point1Id); const QSharedPointer<VSplinePath> splPath = Visualization::data->GeometricObject<VSplinePath>(object1Id);
DrawPath(this, splPath->GetPath(PathDirection::Show), supportColor, Qt::SolidLine, Qt::RoundCap); DrawPath(this, splPath->GetPath(PathDirection::Show), supportColor, Qt::SolidLine, Qt::RoundCap);
if (qFuzzyCompare(1 + length, 1 + 0) == false) if (qFuzzyCompare(1 + length, 1 + 0) == false)

View File

@ -49,7 +49,7 @@ VisToolEndLine::~VisToolEndLine()
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void VisToolEndLine::RefreshGeometry() void VisToolEndLine::RefreshGeometry()
{ {
const QSharedPointer<VPointF> first = Visualization::data->GeometricObject<VPointF>(point1Id); const QSharedPointer<VPointF> first = Visualization::data->GeometricObject<VPointF>(object1Id);
QLineF line; QLineF line;
if (qFuzzyCompare(1 + length, 1 + 0)) if (qFuzzyCompare(1 + length, 1 + 0))
{ {

View File

@ -51,9 +51,9 @@ VisToolHeight::~VisToolHeight()
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void VisToolHeight::RefreshGeometry() void VisToolHeight::RefreshGeometry()
{ {
if (point1Id > NULL_ID) if (object1Id > NULL_ID)
{ {
const QSharedPointer<VPointF> first = Visualization::data->GeometricObject<VPointF>(point1Id); const QSharedPointer<VPointF> first = Visualization::data->GeometricObject<VPointF>(object1Id);
DrawPoint(base_point, first->toQPointF(), supportColor); DrawPoint(base_point, first->toQPointF(), supportColor);
if (lineP1Id <= NULL_ID) if (lineP1Id <= NULL_ID)

View File

@ -46,7 +46,7 @@ VisToolLine::~VisToolLine()
void VisToolLine::RefreshGeometry() void VisToolLine::RefreshGeometry()
{ {
QLineF line; QLineF line;
const QSharedPointer<VPointF> first = Visualization::data->GeometricObject<VPointF>(point1Id); const QSharedPointer<VPointF> first = Visualization::data->GeometricObject<VPointF>(object1Id);
if (point2Id == NULL_ID) if (point2Id == NULL_ID)
{ {
line = QLineF(first->toQPointF(), Visualization::scenePos); line = QLineF(first->toQPointF(), Visualization::scenePos);

View File

@ -52,9 +52,9 @@ VisToolLineIntersect::~VisToolLineIntersect()
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void VisToolLineIntersect::RefreshGeometry() void VisToolLineIntersect::RefreshGeometry()
{ {
if (point1Id > NULL_ID) if (object1Id > NULL_ID)
{ {
const QSharedPointer<VPointF> first = Visualization::data->GeometricObject<VPointF>(point1Id); const QSharedPointer<VPointF> first = Visualization::data->GeometricObject<VPointF>(object1Id);
DrawPoint(line1P1, first->toQPointF(), supportColor); DrawPoint(line1P1, first->toQPointF(), supportColor);
if (line1P2Id <= NULL_ID) if (line1P2Id <= NULL_ID)

View File

@ -54,9 +54,9 @@ VisToolLineIntersectAxis::~VisToolLineIntersectAxis()
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void VisToolLineIntersectAxis::RefreshGeometry() void VisToolLineIntersectAxis::RefreshGeometry()
{ {
if (point1Id > NULL_ID) if (object1Id > NULL_ID)
{ {
const QSharedPointer<VPointF> first = Visualization::data->GeometricObject<VPointF>(point1Id); const QSharedPointer<VPointF> first = Visualization::data->GeometricObject<VPointF>(object1Id);
DrawPoint(lineP1, first->toQPointF(), supportColor); DrawPoint(lineP1, first->toQPointF(), supportColor);
if (point2Id <= NULL_ID) if (point2Id <= NULL_ID)

View File

@ -32,7 +32,7 @@
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
VisToolNormal::VisToolNormal(const VContainer *data, QGraphicsItem *parent) VisToolNormal::VisToolNormal(const VContainer *data, QGraphicsItem *parent)
: VisLine(data, parent), point2Id(NULL_ID), point(nullptr), lineP1(nullptr), lineP2(nullptr), line(nullptr), : VisLine(data, parent), object2Id(NULL_ID), point(nullptr), lineP1(nullptr), lineP2(nullptr), line(nullptr),
length(0), angle(0) length(0), angle(0)
{ {
this->mainColor = Qt::red; this->mainColor = Qt::red;
@ -51,12 +51,12 @@ VisToolNormal::~VisToolNormal()
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void VisToolNormal::RefreshGeometry() void VisToolNormal::RefreshGeometry()
{ {
if (point1Id > NULL_ID) if (object1Id > NULL_ID)
{ {
const QSharedPointer<VPointF> first = Visualization::data->GeometricObject<VPointF>(point1Id); const QSharedPointer<VPointF> first = Visualization::data->GeometricObject<VPointF>(object1Id);
DrawPoint(lineP1, first->toQPointF(), supportColor); DrawPoint(lineP1, first->toQPointF(), supportColor);
if (point2Id <= NULL_ID) if (object2Id <= NULL_ID)
{ {
QLineF line_mouse(first->toQPointF(), Visualization::scenePos); QLineF line_mouse(first->toQPointF(), Visualization::scenePos);
DrawLine(line, line_mouse, supportColor); DrawLine(line, line_mouse, supportColor);
@ -67,7 +67,7 @@ void VisToolNormal::RefreshGeometry()
} }
else else
{ {
const QSharedPointer<VPointF> second = Visualization::data->GeometricObject<VPointF>(point2Id); const QSharedPointer<VPointF> second = Visualization::data->GeometricObject<VPointF>(object2Id);
DrawPoint(lineP2, second->toQPointF(), supportColor); DrawPoint(lineP2, second->toQPointF(), supportColor);
QLineF line_mouse(first->toQPointF(), second->toQPointF()); QLineF line_mouse(first->toQPointF(), second->toQPointF());
@ -92,9 +92,9 @@ void VisToolNormal::RefreshGeometry()
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void VisToolNormal::setPoint2Id(const quint32 &value) void VisToolNormal::setObject2Id(const quint32 &value)
{ {
point2Id = value; object2Id = value;
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------

Some files were not shown because too many files have changed in this diff Show More