First successful build. Tool working was not tested!
--HG-- branch : feature
This commit is contained in:
parent
796fde3cfc
commit
ea0000fea6
|
@ -126,6 +126,9 @@ void VToolOptionsPropertyBrowser::ShowItemOptions(QGraphicsItem *item)
|
|||
case VToolPointOfIntersectionCircles::Type:
|
||||
ShowOptionsToolPointOfIntersectionCircles(item);
|
||||
break;
|
||||
case VToolPointOfIntersectionCurves::Type:
|
||||
ShowOptionsToolPointOfIntersectionCurves(item);
|
||||
break;
|
||||
case VToolShoulderPoint::Type:
|
||||
ShowOptionsToolShoulderPoint(item);
|
||||
break;
|
||||
|
@ -231,6 +234,9 @@ void VToolOptionsPropertyBrowser::UpdateOptions()
|
|||
case VToolPointOfIntersectionCircles::Type:
|
||||
UpdateOptionsToolPointOfIntersectionCircles();
|
||||
break;
|
||||
case VToolPointOfIntersectionCurves::Type:
|
||||
UpdateOptionsToolPointOfIntersectionCurves();
|
||||
break;
|
||||
case VToolShoulderPoint::Type:
|
||||
UpdateOptionsToolShoulderPoint();
|
||||
break;
|
||||
|
@ -351,6 +357,9 @@ void VToolOptionsPropertyBrowser::userChangedData(VProperty *property)
|
|||
case VToolPointOfIntersectionCircles::Type:
|
||||
ChangeDataToolPointOfIntersectionCircles(prop);
|
||||
break;
|
||||
case VToolPointOfIntersectionCurves::Type:
|
||||
ChangeDataToolPointOfIntersectionCurves(prop);
|
||||
break;
|
||||
case VToolShoulderPoint::Type:
|
||||
ChangeDataToolShoulderPoint(prop);
|
||||
break;
|
||||
|
@ -471,10 +480,30 @@ void VToolOptionsPropertyBrowser::AddPropertyCrossPoint(Tool *i, const QString &
|
|||
{
|
||||
VEnumProperty* itemProperty = new VEnumProperty(propertyName);
|
||||
itemProperty->setLiterals(QStringList()<< tr("First point") << tr("Second point"));
|
||||
itemProperty->setValue(static_cast<int>(i->GetCrossCirclesPoint())-1);
|
||||
itemProperty->setValue(static_cast<int>(i->GetCrossCirclesPoint()));
|
||||
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()));
|
||||
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()));
|
||||
AddProperty(itemProperty, AttrHCrossPoint);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
template<class Tool>
|
||||
void VToolOptionsPropertyBrowser::AddPropertyLineType(Tool *i, const QString &propertyName,
|
||||
|
@ -588,32 +617,65 @@ void VToolOptionsPropertyBrowser::SetPointName2(const QString &name)
|
|||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
template<class Type>
|
||||
Type VToolOptionsPropertyBrowser::GetCrossPoint(const QVariant &value)
|
||||
{
|
||||
bool ok = false;
|
||||
const int val = value.toInt(&ok);
|
||||
|
||||
auto cross = static_cast<Type>(1);
|
||||
if (ok)
|
||||
{
|
||||
switch(val)
|
||||
{
|
||||
case 1:
|
||||
case 2:
|
||||
cross = static_cast<Type>(val);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return cross;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
template<class Tool>
|
||||
void VToolOptionsPropertyBrowser::SetCrossCirclesPoint(const QVariant &value)
|
||||
{
|
||||
if (Tool *i = qgraphicsitem_cast<Tool *>(currentItem))
|
||||
{
|
||||
bool ok = false;
|
||||
const int val = value.toInt(&ok);
|
||||
i->SetCrossCirclesPoint(GetCrossPoint<CrossCirclesPoint>(value));
|
||||
}
|
||||
else
|
||||
{
|
||||
qWarning()<<"Can't cast item";
|
||||
}
|
||||
}
|
||||
|
||||
CrossCirclesPoint cross = CrossCirclesPoint::FirstPoint;
|
||||
if (ok)
|
||||
{
|
||||
switch(val)
|
||||
{
|
||||
case 0:
|
||||
cross = CrossCirclesPoint::FirstPoint;
|
||||
break;
|
||||
case 1:
|
||||
cross = CrossCirclesPoint::SecondPoint;
|
||||
break;
|
||||
default:
|
||||
cross = CrossCirclesPoint::FirstPoint;
|
||||
break;
|
||||
}
|
||||
}
|
||||
i->SetCrossCirclesPoint(cross);
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
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
|
||||
{
|
||||
|
@ -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)
|
||||
{
|
||||
|
@ -1558,6 +1653,18 @@ void VToolOptionsPropertyBrowser::ShowOptionsToolPointOfIntersectionCircles(QGra
|
|||
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)
|
||||
{
|
||||
|
@ -1930,7 +2037,7 @@ void VToolOptionsPropertyBrowser::UpdateOptionsToolPointOfIntersectionArcs()
|
|||
VToolPointOfIntersectionArcs *i = qgraphicsitem_cast<VToolPointOfIntersectionArcs *>(currentItem);
|
||||
|
||||
idToProperty[AttrName]->setValue(i->name());
|
||||
idToProperty[AttrCrossPoint]->setValue(static_cast<int>(i->GetCrossCirclesPoint())-1);
|
||||
idToProperty[AttrCrossPoint]->setValue(static_cast<int>(i->GetCrossCirclesPoint()));
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -1939,7 +2046,7 @@ void VToolOptionsPropertyBrowser::UpdateOptionsToolPointOfIntersectionCircles()
|
|||
VToolPointOfIntersectionCircles *i = qgraphicsitem_cast<VToolPointOfIntersectionCircles *>(currentItem);
|
||||
|
||||
idToProperty[AttrName]->setValue(i->name());
|
||||
idToProperty[AttrCrossPoint]->setValue(static_cast<int>(i->GetCrossCirclesPoint())-1);
|
||||
idToProperty[AttrCrossPoint]->setValue(static_cast<int>(i->GetCrossCirclesPoint()));
|
||||
|
||||
QVariant c1Radius;
|
||||
c1Radius.setValue(i->GetFirstCircleRadius());
|
||||
|
@ -1950,13 +2057,23 @@ void VToolOptionsPropertyBrowser::UpdateOptionsToolPointOfIntersectionCircles()
|
|||
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()));
|
||||
idToProperty[AttrHCrossPoint]->setValue(static_cast<int>(i->GetHCrossPoint()));
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VToolOptionsPropertyBrowser::UpdateOptionsToolPointFromCircleAndTangent()
|
||||
{
|
||||
VToolPointFromCircleAndTangent *i = qgraphicsitem_cast<VToolPointFromCircleAndTangent *>(currentItem);
|
||||
|
||||
idToProperty[AttrName]->setValue(i->name());
|
||||
idToProperty[AttrCrossPoint]->setValue(static_cast<int>(i->GetCrossCirclesPoint())-1);
|
||||
idToProperty[AttrCrossPoint]->setValue(static_cast<int>(i->GetCrossCirclesPoint()));
|
||||
|
||||
QVariant cRadius;
|
||||
cRadius.setValue(i->GetCircleRadius());
|
||||
|
@ -1969,7 +2086,7 @@ void VToolOptionsPropertyBrowser::UpdateOptionsToolPointFromArcAndTangent()
|
|||
VToolPointFromArcAndTangent *i = qgraphicsitem_cast<VToolPointFromArcAndTangent *>(currentItem);
|
||||
|
||||
idToProperty[AttrName]->setValue(i->name());
|
||||
idToProperty[AttrCrossPoint]->setValue(static_cast<int>(i->GetCrossCirclesPoint())-1);
|
||||
idToProperty[AttrCrossPoint]->setValue(static_cast<int>(i->GetCrossCirclesPoint()));
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -2104,6 +2221,8 @@ QStringList VToolOptionsPropertyBrowser::PropertiesList() const
|
|||
<< AttrC2Radius /* 30 */
|
||||
<< AttrCRadius /* 31 */
|
||||
<< AttrName1 /* 32 */
|
||||
<< AttrName2; /* 33 */
|
||||
<< AttrName2 /* 33 */
|
||||
<< AttrVCrossPoint /* 34 */
|
||||
<< AttrHCrossPoint; /* 35 */
|
||||
return attr;
|
||||
}
|
||||
|
|
|
@ -74,9 +74,18 @@ private:
|
|||
template<class Tool>
|
||||
void SetPointName2(const QString &name);
|
||||
|
||||
template<class Type>
|
||||
Type GetCrossPoint(const QVariant &value);
|
||||
|
||||
template<class Tool>
|
||||
void SetCrossCirclesPoint(const QVariant &value);
|
||||
|
||||
template<class Tool>
|
||||
void SetVCrossCurvesPoint(const QVariant &value);
|
||||
|
||||
template<class Tool>
|
||||
void SetHCrossCurvesPoint(const QVariant &value);
|
||||
|
||||
template<class Tool>
|
||||
void AddPropertyPointName(Tool *i, const QString &propertyName);
|
||||
|
||||
|
@ -89,6 +98,12 @@ private:
|
|||
template<class Tool>
|
||||
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>
|
||||
void AddPropertyLineType(Tool *i, const QString &propertyName, const QMap<QString, QIcon> &styles);
|
||||
|
||||
|
@ -118,6 +133,7 @@ private:
|
|||
void ChangeDataToolPointOfIntersection(VPE::VProperty *property);
|
||||
void ChangeDataToolPointOfIntersectionArcs(VPE::VProperty *property);
|
||||
void ChangeDataToolPointOfIntersectionCircles(VPE::VProperty *property);
|
||||
void ChangeDataToolPointOfIntersectionCurves(VPE::VProperty *property);
|
||||
void ChangeDataToolPointFromCircleAndTangent(VPE::VProperty *property);
|
||||
void ChangeDataToolPointFromArcAndTangent(VPE::VProperty *property);
|
||||
void ChangeDataToolShoulderPoint(VPE::VProperty *property);
|
||||
|
@ -145,6 +161,7 @@ private:
|
|||
void ShowOptionsToolPointOfIntersection(QGraphicsItem *item);
|
||||
void ShowOptionsToolPointOfIntersectionArcs(QGraphicsItem *item);
|
||||
void ShowOptionsToolPointOfIntersectionCircles(QGraphicsItem *item);
|
||||
void ShowOptionsToolPointOfIntersectionCurves(QGraphicsItem *item);
|
||||
void ShowOptionsToolPointFromCircleAndTangent(QGraphicsItem *item);
|
||||
void ShowOptionsToolPointFromArcAndTangent(QGraphicsItem *item);
|
||||
void ShowOptionsToolShoulderPoint(QGraphicsItem *item);
|
||||
|
@ -172,6 +189,7 @@ private:
|
|||
void UpdateOptionsToolPointOfIntersection();
|
||||
void UpdateOptionsToolPointOfIntersectionArcs();
|
||||
void UpdateOptionsToolPointOfIntersectionCircles();
|
||||
void UpdateOptionsToolPointOfIntersectionCurves();
|
||||
void UpdateOptionsToolPointFromCircleAndTangent();
|
||||
void UpdateOptionsToolPointFromArcAndTangent();
|
||||
void UpdateOptionsToolShoulderPoint();
|
||||
|
|
|
@ -995,6 +995,16 @@ void MainWindow::ToolPointOfIntersectionCircles(bool checked)
|
|||
&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)
|
||||
{
|
||||
|
@ -1585,6 +1595,7 @@ void MainWindow::InitToolButtons()
|
|||
&MainWindow::ToolPointOfIntersectionArcs);
|
||||
connect(ui->toolButtonPointOfIntersectionCircles, &QToolButton::clicked, this,
|
||||
&MainWindow::ToolPointOfIntersectionCircles);
|
||||
connect(ui->toolButtonIntersectionCurves, &QToolButton::clicked, this, &MainWindow::ToolPointOfIntersectionCurves);
|
||||
connect(ui->toolButtonPointFromCircleAndTangent, &QToolButton::clicked, this,
|
||||
&MainWindow::ToolPointFromCircleAndTangent);
|
||||
connect(ui->toolButtonPointFromArcAndTangent, &QToolButton::clicked, this, &MainWindow::ToolPointFromArcAndTangent);
|
||||
|
@ -1714,6 +1725,9 @@ void MainWindow::CancelTool()
|
|||
case Tool::PointOfIntersectionCircles:
|
||||
ui->toolButtonPointOfIntersectionCircles->setChecked(false);
|
||||
break;
|
||||
case Tool::PointOfIntersectionCurves:
|
||||
ui->toolButtonIntersectionCurves->setChecked(false);
|
||||
break;
|
||||
case Tool::PointFromCircleAndTangent:
|
||||
ui->toolButtonPointFromCircleAndTangent->setChecked(false);
|
||||
break;
|
||||
|
@ -2892,6 +2906,7 @@ void MainWindow::SetEnableTool(bool enable)
|
|||
ui->toolButtonCurveIntersectAxis->setEnabled(drawTools);
|
||||
ui->toolButtonArcIntersectAxis->setEnabled(drawTools);
|
||||
ui->toolButtonPointOfIntersectionArcs->setEnabled(drawTools);
|
||||
ui->toolButtonIntersectionCurves->setEnabled(drawTools);
|
||||
ui->toolButtonPointOfIntersectionCircles->setEnabled(drawTools);
|
||||
ui->toolButtonPointFromCircleAndTangent->setEnabled(drawTools);
|
||||
ui->toolButtonPointFromArcAndTangent->setEnabled(drawTools);
|
||||
|
@ -3272,6 +3287,10 @@ void MainWindow::LastUsedTool()
|
|||
ui->toolButtonPointOfIntersectionCircles->setChecked(true);
|
||||
ToolPointOfIntersectionCircles(true);
|
||||
break;
|
||||
case Tool::PointOfIntersectionCurves:
|
||||
ui->toolButtonIntersectionCurves->setChecked(true);
|
||||
ToolPointOfIntersectionCurves(true);
|
||||
break;
|
||||
case Tool::PointFromCircleAndTangent:
|
||||
ui->toolButtonPointFromCircleAndTangent->setChecked(true);
|
||||
ToolPointFromCircleAndTangent(true);
|
||||
|
|
|
@ -125,6 +125,7 @@ public slots:
|
|||
void ToolArcIntersectAxis(bool checked);
|
||||
void ToolPointOfIntersectionArcs(bool checked);
|
||||
void ToolPointOfIntersectionCircles(bool checked);
|
||||
void ToolPointOfIntersectionCurves(bool checked);
|
||||
void ToolPointFromCircleAndTangent(bool checked);
|
||||
void ToolPointFromArcAndTangent(bool checked);
|
||||
void ToolArcWithLength(bool checked);
|
||||
|
|
|
@ -48,7 +48,7 @@
|
|||
<string>Tools</string>
|
||||
</property>
|
||||
<property name="currentIndex">
|
||||
<number>0</number>
|
||||
<number>2</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="page">
|
||||
<property name="geometry">
|
||||
|
@ -375,7 +375,7 @@
|
|||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>100</width>
|
||||
<width>130</width>
|
||||
<height>58</height>
|
||||
</rect>
|
||||
</property>
|
||||
|
@ -461,7 +461,7 @@
|
|||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>100</width>
|
||||
<width>130</width>
|
||||
<height>156</height>
|
||||
</rect>
|
||||
</property>
|
||||
|
@ -618,6 +618,32 @@
|
|||
</property>
|
||||
</widget>
|
||||
</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>
|
||||
</widget>
|
||||
<widget class="QWidget" name="page_4">
|
||||
|
@ -625,7 +651,7 @@
|
|||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>100</width>
|
||||
<width>130</width>
|
||||
<height>196</height>
|
||||
</rect>
|
||||
</property>
|
||||
|
@ -867,7 +893,7 @@
|
|||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>100</width>
|
||||
<width>130</width>
|
||||
<height>58</height>
|
||||
</rect>
|
||||
</property>
|
||||
|
@ -953,8 +979,8 @@
|
|||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>98</width>
|
||||
<height>58</height>
|
||||
<width>130</width>
|
||||
<height>386</height>
|
||||
</rect>
|
||||
</property>
|
||||
<attribute name="icon">
|
||||
|
|
|
@ -1,60 +1,62 @@
|
|||
<RCC>
|
||||
<qresource prefix="/">
|
||||
<file>toolicon/32x32/along_line.png</file>
|
||||
<file>toolicon/32x32/along_line@2x.png</file>
|
||||
<file>toolicon/32x32/along_line@2x.png</file>
|
||||
<file>toolicon/32x32/arc.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_cut@2x.png</file>
|
||||
<file>toolicon/32x32/arc_intersect_axis.png</file>
|
||||
<file>toolicon/32x32/arc_intersect_axis@2x.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.png</file>
|
||||
<file>toolicon/32x32/line@2x.png</file>
|
||||
<file>toolicon/32x32/line@2x.png</file>
|
||||
<file>toolicon/32x32/line_intersect_axis.png</file>
|
||||
<file>toolicon/32x32/line_intersect_axis@2x.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.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_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/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.png</file>
|
||||
<file>toolicon/32x32/spline@2x.png</file>
|
||||
<file>toolicon/32x32/spline@2x.png</file>
|
||||
<file>toolicon/32x32/spline_cut_point.png</file>
|
||||
<file>toolicon/32x32/spline_cut_point@2x.png</file>
|
||||
<file>toolicon/32x32/spline_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/splinePath_cut_point.png</file>
|
||||
<file>toolicon/32x32/splinePath_cut_point@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/union@2x.png</file>
|
||||
<file>toolicon/32x32/new_detail.png</file>
|
||||
<file>toolicon/32x32/new_detail@2x.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/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>
|
||||
</RCC>
|
||||
|
|
|
@ -714,7 +714,8 @@ void VPattern::ParsePointElement(VMainGraphicsScene *scene, QDomElement &domElem
|
|||
<< VToolPointOfIntersectionCircles::ToolType /*18*/
|
||||
<< VToolPointFromCircleAndTangent::ToolType /*19*/
|
||||
<< VToolPointFromArcAndTangent::ToolType /*20*/
|
||||
<< VToolTrueDarts::ToolType; /*21*/
|
||||
<< VToolTrueDarts::ToolType /*21*/
|
||||
<< VToolPointOfIntersectionCurves::ToolType; /*22*/
|
||||
switch (points.indexOf(type))
|
||||
{
|
||||
case 0: //VToolBasePoint::ToolType
|
||||
|
@ -783,6 +784,9 @@ void VPattern::ParsePointElement(VMainGraphicsScene *scene, QDomElement &domElem
|
|||
case 21: //VToolTrueDarts::ToolType
|
||||
ParseToolTrueDarts(scene, domElement, parse);
|
||||
break;
|
||||
case 22: //VToolPointOfIntersectionCurves::ToolType
|
||||
ParseToolPointOfIntersectionCurves(scene, domElement, parse);
|
||||
break;
|
||||
default:
|
||||
VException e(tr("Unknown point type '%1'.").arg(type));
|
||||
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,
|
||||
const Document &parse)
|
||||
|
|
|
@ -159,8 +159,8 @@ private:
|
|||
void ParseToolCurveIntersectAxis(VMainGraphicsScene *scene, QDomElement &domElement, const Document &parse);
|
||||
void ParseToolPointOfIntersectionArcs(VMainGraphicsScene *scene, const QDomElement &domElement,
|
||||
const Document &parse);
|
||||
void ParseToolPointOfIntersectionCircles(VMainGraphicsScene *scene, QDomElement &domElement,
|
||||
const Document &parse);
|
||||
void ParseToolPointOfIntersectionCircles(VMainGraphicsScene *scene, QDomElement &domElement, const Document &parse);
|
||||
void ParseToolPointOfIntersectionCurves(VMainGraphicsScene *scene, QDomElement &domElement, const Document &parse);
|
||||
void ParseToolPointFromCircleAndTangent(VMainGraphicsScene *scene, QDomElement &domElement,
|
||||
const Document &parse);
|
||||
void ParseToolPointFromArcAndTangent(VMainGraphicsScene *scene, const QDomElement &domElement,
|
||||
|
|
|
@ -107,11 +107,15 @@ const QString AttrPSpline = QStringLiteral("pSpline");
|
|||
const QString AttrAxisP1 = QStringLiteral("axisP1");
|
||||
const QString AttrAxisP2 = QStringLiteral("axisP2");
|
||||
const QString AttrCurve = QStringLiteral("curve");
|
||||
const QString AttrCurve1 = QStringLiteral("curve1");
|
||||
const QString AttrCurve2 = QStringLiteral("curve2");
|
||||
const QString AttrLineColor = QStringLiteral("lineColor");
|
||||
const QString AttrColor = QStringLiteral("color");
|
||||
const QString AttrFirstArc = QStringLiteral("firstArc");
|
||||
const QString AttrSecondArc = QStringLiteral("secondArc");
|
||||
const QString AttrCrossPoint = QStringLiteral("crossPoint");
|
||||
const QString AttrVCrossPoint = QStringLiteral("vCrossPoint");
|
||||
const QString AttrHCrossPoint = QStringLiteral("hCrossPoint");
|
||||
const QString AttrC1Center = QStringLiteral("c1Center");
|
||||
const QString AttrC2Center = QStringLiteral("c2Center");
|
||||
const QString AttrC1Radius = QStringLiteral("c1Radius");
|
||||
|
|
|
@ -109,11 +109,15 @@ extern const QString AttrPSpline;
|
|||
extern const QString AttrAxisP1;
|
||||
extern const QString AttrAxisP2;
|
||||
extern const QString AttrCurve;
|
||||
extern const QString AttrCurve1;
|
||||
extern const QString AttrCurve2;
|
||||
extern const QString AttrLineColor;
|
||||
extern const QString AttrColor;
|
||||
extern const QString AttrFirstArc;
|
||||
extern const QString AttrSecondArc;
|
||||
extern const QString AttrCrossPoint;
|
||||
extern const QString AttrVCrossPoint;
|
||||
extern const QString AttrHCrossPoint;
|
||||
extern const QString AttrC1Center;
|
||||
extern const QString AttrC2Center;
|
||||
extern const QString AttrC1Radius;
|
||||
|
|
|
@ -120,11 +120,15 @@
|
|||
<xs:attribute name="axisP2" 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="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="color" type="colors"></xs:attribute>
|
||||
<xs:attribute name="firstArc" 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="c2Center" type="xs:unsignedInt"></xs:attribute>
|
||||
<xs:attribute name="c1Radius" type="xs:string"></xs:attribute>
|
||||
|
@ -421,4 +425,10 @@
|
|||
<xs:enumeration value="560"/>
|
||||
</xs:restriction>
|
||||
</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>
|
||||
|
|
|
@ -35,9 +35,13 @@
|
|||
#include <QObject>
|
||||
|
||||
enum class Document : char { LiteParse, LitePPParse, FullParse };
|
||||
enum class CrossCirclesPoint : char {FirstPoint = 1, SecondPoint = 2};
|
||||
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 {LeftPoint = 1, RightPoint = 2};
|
||||
|
||||
class VDataTool;
|
||||
class VContainer;
|
||||
|
||||
|
|
|
@ -155,18 +155,7 @@ QPainterPath VAbstractCurve::GetPath(PathDirection direction) const
|
|||
*/
|
||||
QVector<QPointF> VAbstractCurve::IntersectLine(const QLineF &line) const
|
||||
{
|
||||
QVector<QPointF> points = this->GetPoints();
|
||||
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;
|
||||
return CurveIntersectLine(this->GetPoints(), line);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -176,6 +165,22 @@ bool VAbstractCurve::IsIntersectLine(const QLineF &line) const
|
|||
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
|
||||
{
|
||||
|
|
|
@ -56,6 +56,8 @@ public:
|
|||
|
||||
virtual qreal GetStartAngle () const=0;
|
||||
virtual qreal GetEndAngle () const=0;
|
||||
|
||||
static QVector<QPointF> CurveIntersectLine(const QVector<QPointF> &points, const QLineF &line);
|
||||
protected:
|
||||
QPainterPath ShowDirection(const QVector<QPointF> &points) const;
|
||||
private:
|
||||
|
|
|
@ -91,6 +91,7 @@ enum class Tool : ToolVisHolderType
|
|||
LineIntersectAxis,
|
||||
PointOfIntersectionArcs,
|
||||
PointOfIntersectionCircles,
|
||||
PointOfIntersectionCurves,
|
||||
CurveIntersectAxis,
|
||||
PointOfIntersection,
|
||||
PointFromCircleAndTangent,
|
||||
|
@ -121,6 +122,7 @@ enum class Vis : ToolVisHolderType
|
|||
ToolPointOfIntersection,
|
||||
ToolPointOfIntersectionArcs,
|
||||
ToolPointOfIntersectionCircles,
|
||||
ToolPointOfIntersectionCurves,
|
||||
ToolPointFromCircleAndTangent,
|
||||
ToolPointFromArcAndTangent,
|
||||
ToolShoulderPoint,
|
||||
|
|
|
@ -33,7 +33,8 @@ HEADERS += \
|
|||
$$PWD/tools/dialoguniondetails.h \
|
||||
$$PWD/support/dialogeditwrongformula.h \
|
||||
$$PWD/support/dialogundo.h \
|
||||
$$PWD/tools/dialogtruedarts.h
|
||||
$$PWD/tools/dialogtruedarts.h \
|
||||
$$PWD/tools/dialogpointofintersectioncurves.h
|
||||
|
||||
SOURCES += \
|
||||
$$PWD/tools/dialogalongline.cpp \
|
||||
|
@ -66,7 +67,8 @@ SOURCES += \
|
|||
$$PWD/tools/dialoguniondetails.cpp \
|
||||
$$PWD/support/dialogeditwrongformula.cpp \
|
||||
$$PWD/support/dialogundo.cpp \
|
||||
$$PWD/tools/dialogtruedarts.cpp
|
||||
$$PWD/tools/dialogtruedarts.cpp \
|
||||
$$PWD/tools/dialogpointofintersectioncurves.cpp
|
||||
|
||||
FORMS += \
|
||||
$$PWD/tools/dialogalongline.ui \
|
||||
|
@ -98,4 +100,5 @@ FORMS += \
|
|||
$$PWD/tools/dialoguniondetails.ui \
|
||||
$$PWD/support/dialogeditwrongformula.ui \
|
||||
$$PWD/support/dialogundo.ui \
|
||||
$$PWD/tools/dialogtruedarts.ui
|
||||
$$PWD/tools/dialogtruedarts.ui \
|
||||
$$PWD/tools/dialogpointofintersectioncurves.ui
|
||||
|
|
|
@ -54,6 +54,7 @@
|
|||
#include "dialogs/tools/dialogcurveintersectaxis.h"
|
||||
#include "dialogs/tools/dialogpointofintersectionarcs.h"
|
||||
#include "dialogs/tools/dialogpointofintersectioncircles.h"
|
||||
#include "dialogs/tools/dialogpointofintersectioncurves.h"
|
||||
#include "dialogs/tools/dialogpointfromcircleandtangent.h"
|
||||
#include "dialogs/tools/dialogpointfromarcandtangent.h"
|
||||
#include "dialogs/tools/dialogtruedarts.h"
|
||||
|
|
|
@ -171,7 +171,7 @@ void DialogAlongLine::ChosenObject(quint32 id, const SceneObject &type)
|
|||
{
|
||||
if (flagError)
|
||||
{
|
||||
line->setPoint2Id(id);
|
||||
line->setObject2Id(id);
|
||||
line->RefreshGeometry();
|
||||
prepare = true;
|
||||
this->setModal(true);
|
||||
|
@ -201,8 +201,8 @@ void DialogAlongLine::SaveData()
|
|||
VisToolAlongLine *line = qobject_cast<VisToolAlongLine *>(vis);
|
||||
SCASSERT(line != nullptr);
|
||||
|
||||
line->setPoint1Id(GetFirstPointId());
|
||||
line->setPoint2Id(GetSecondPointId());
|
||||
line->setObject1Id(GetFirstPointId());
|
||||
line->setObject2Id(GetSecondPointId());
|
||||
line->setLength(formula);
|
||||
line->setLineStyle(VAbstractTool::LineStyleToPenStyle(GetTypeLine()));
|
||||
line->RefreshGeometry();
|
||||
|
@ -226,7 +226,7 @@ void DialogAlongLine::SetSecondPointId(const quint32 &value)
|
|||
|
||||
VisToolAlongLine *line = qobject_cast<VisToolAlongLine *>(vis);
|
||||
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);
|
||||
SCASSERT(line != nullptr);
|
||||
line->setPoint1Id(value);
|
||||
line->setObject1Id(value);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
|
|
@ -125,7 +125,7 @@ DialogArc::~DialogArc()
|
|||
void DialogArc::SetCenter(const quint32 &value)
|
||||
{
|
||||
ChangeCurrentData(ui->comboBoxBasePoint, value);
|
||||
vis->setPoint1Id(value);
|
||||
vis->setObject1Id(value);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -248,7 +248,7 @@ void DialogArc::SaveData()
|
|||
VisToolArc *path = qobject_cast<VisToolArc *>(vis);
|
||||
SCASSERT(path != nullptr);
|
||||
|
||||
path->setPoint1Id(GetCenter());
|
||||
path->setObject1Id(GetCenter());
|
||||
path->setRadius(radius);
|
||||
path->setF1(f1);
|
||||
path->setF2(f2);
|
||||
|
|
|
@ -104,7 +104,7 @@ quint32 DialogArcWithLength::GetCenter() const
|
|||
void DialogArcWithLength::SetCenter(const quint32 &value)
|
||||
{
|
||||
ChangeCurrentData(ui->comboBoxCenter, value);
|
||||
vis->setPoint1Id(value);
|
||||
vis->setObject1Id(value);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -325,7 +325,7 @@ void DialogArcWithLength::SaveData()
|
|||
VisToolArcWithLength *path = qobject_cast<VisToolArcWithLength *>(vis);
|
||||
SCASSERT(path != nullptr);
|
||||
|
||||
path->setPoint1Id(GetCenter());
|
||||
path->setObject1Id(GetCenter());
|
||||
path->setRadius(radius);
|
||||
path->setF1(f1);
|
||||
path->setLength(length);
|
||||
|
|
|
@ -176,7 +176,7 @@ void DialogBisector::ChosenObject(quint32 id, const SceneObject &type)
|
|||
if (SetObject(id, ui->comboBoxSecondPoint, tr("Select third point of angle")))
|
||||
{
|
||||
number++;
|
||||
line->setPoint2Id(id);
|
||||
line->setObject2Id(id);
|
||||
line->RefreshGeometry();
|
||||
}
|
||||
}
|
||||
|
@ -192,7 +192,7 @@ void DialogBisector::ChosenObject(quint32 id, const SceneObject &type)
|
|||
{
|
||||
if (SetObject(id, ui->comboBoxThirdPoint, ""))
|
||||
{
|
||||
line->setPoint3Id(id);
|
||||
line->setObject3Id(id);
|
||||
line->RefreshGeometry();
|
||||
prepare = true;
|
||||
this->setModal(true);
|
||||
|
@ -263,7 +263,7 @@ void DialogBisector::SetFirstPointId(const quint32 &value)
|
|||
|
||||
VisToolBisector *line = qobject_cast<VisToolBisector *>(vis);
|
||||
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);
|
||||
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);
|
||||
SCASSERT(line != nullptr);
|
||||
line->setPoint3Id(value);
|
||||
line->setObject3Id(value);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -317,9 +317,9 @@ void DialogBisector::SaveData()
|
|||
VisToolBisector *line = qobject_cast<VisToolBisector *>(vis);
|
||||
SCASSERT(line != nullptr);
|
||||
|
||||
line->setPoint1Id(GetFirstPointId());
|
||||
line->setPoint2Id(GetSecondPointId());
|
||||
line->setPoint3Id(GetThirdPointId());
|
||||
line->setObject1Id(GetFirstPointId());
|
||||
line->setObject2Id(GetSecondPointId());
|
||||
line->setObject3Id(GetThirdPointId());
|
||||
line->setLength(formula);
|
||||
line->setLineStyle(VAbstractTool::LineStyleToPenStyle(GetTypeLine()));
|
||||
line->RefreshGeometry();
|
||||
|
|
|
@ -155,7 +155,7 @@ void DialogCurveIntersectAxis::setCurveId(const quint32 &value)
|
|||
|
||||
VisToolCurveIntersectAxis *line = qobject_cast<VisToolCurveIntersectAxis *>(vis);
|
||||
SCASSERT(line != nullptr);
|
||||
line->setPoint1Id(value);
|
||||
line->setObject1Id(value);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -288,7 +288,7 @@ void DialogCurveIntersectAxis::SaveData()
|
|||
VisToolCurveIntersectAxis *line = qobject_cast<VisToolCurveIntersectAxis *>(vis);
|
||||
SCASSERT(line != nullptr);
|
||||
|
||||
line->setPoint1Id(getCurveId());
|
||||
line->setObject1Id(getCurveId());
|
||||
line->setAxisPointId(GetBasePointId());
|
||||
line->SetAngle(formulaAngle);
|
||||
line->setLineStyle(VAbstractTool::LineStyleToPenStyle(GetTypeLine()));
|
||||
|
|
|
@ -145,7 +145,7 @@ void DialogCutArc::SaveData()
|
|||
VisToolCutArc *path = qobject_cast<VisToolCutArc *>(vis);
|
||||
SCASSERT(path != nullptr);
|
||||
|
||||
path->setPoint1Id(getArcId());
|
||||
path->setObject1Id(getArcId());
|
||||
path->setLength(formula);
|
||||
path->RefreshGeometry();
|
||||
}
|
||||
|
@ -168,7 +168,7 @@ void DialogCutArc::setArcId(const quint32 &value)
|
|||
|
||||
VisToolCutArc *path = qobject_cast<VisToolCutArc *>(vis);
|
||||
SCASSERT(path != nullptr);
|
||||
path->setPoint1Id(value);
|
||||
path->setObject1Id(value);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
|
|
@ -124,7 +124,7 @@ void DialogCutSpline::setSplineId(const quint32 &value)
|
|||
|
||||
VisToolCutSpline *path = qobject_cast<VisToolCutSpline *>(vis);
|
||||
SCASSERT(path != nullptr);
|
||||
path->setPoint1Id(value);
|
||||
path->setObject1Id(value);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -180,7 +180,7 @@ void DialogCutSpline::SaveData()
|
|||
VisToolCutSpline *path = qobject_cast<VisToolCutSpline *>(vis);
|
||||
SCASSERT(path != nullptr);
|
||||
|
||||
path->setPoint1Id(getSplineId());
|
||||
path->setObject1Id(getSplineId());
|
||||
path->setLength(formula);
|
||||
path->RefreshGeometry();
|
||||
}
|
||||
|
|
|
@ -124,7 +124,7 @@ void DialogCutSplinePath::setSplinePathId(const quint32 &value)
|
|||
|
||||
VisToolCutSplinePath *path = qobject_cast<VisToolCutSplinePath *>(vis);
|
||||
SCASSERT(path != nullptr);
|
||||
path->setPoint1Id(value);
|
||||
path->setObject1Id(value);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -180,7 +180,7 @@ void DialogCutSplinePath::SaveData()
|
|||
VisToolCutSplinePath *path = qobject_cast<VisToolCutSplinePath *>(vis);
|
||||
SCASSERT(path != nullptr);
|
||||
|
||||
path->setPoint1Id(getSplinePathId());
|
||||
path->setObject1Id(getSplinePathId());
|
||||
path->setLength(formula);
|
||||
path->RefreshGeometry();
|
||||
}
|
||||
|
|
|
@ -253,7 +253,7 @@ void DialogEndLine::SetBasePointId(const quint32 &value)
|
|||
|
||||
VisToolEndLine *line = qobject_cast<VisToolEndLine *>(vis);
|
||||
SCASSERT(line != nullptr);
|
||||
line->setPoint1Id(value);
|
||||
line->setObject1Id(value);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -324,7 +324,7 @@ void DialogEndLine::SaveData()
|
|||
VisToolEndLine *line = qobject_cast<VisToolEndLine *>(vis);
|
||||
SCASSERT(line != nullptr);
|
||||
|
||||
line->setPoint1Id(GetBasePointId());
|
||||
line->setObject1Id(GetBasePointId());
|
||||
line->setLength(formulaLength);
|
||||
line->SetAngle(formulaAngle);
|
||||
line->setLineStyle(VAbstractTool::LineStyleToPenStyle(GetTypeLine()));
|
||||
|
|
|
@ -112,7 +112,7 @@ void DialogHeight::SetBasePointId(const quint32 &value)
|
|||
|
||||
VisToolHeight *line = qobject_cast<VisToolHeight *>(vis);
|
||||
SCASSERT(line != nullptr);
|
||||
line->setPoint1Id(value);
|
||||
line->setObject1Id(value);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -224,7 +224,7 @@ void DialogHeight::SaveData()
|
|||
VisToolHeight *line = qobject_cast<VisToolHeight *>(vis);
|
||||
SCASSERT(line != nullptr);
|
||||
|
||||
line->setPoint1Id(GetBasePointId());
|
||||
line->setObject1Id(GetBasePointId());
|
||||
line->setLineP1Id(GetP1LineId());
|
||||
line->setLineP2Id(GetP2LineId());
|
||||
line->setLineStyle(VAbstractTool::LineStyleToPenStyle(GetTypeLine()));
|
||||
|
|
|
@ -120,7 +120,7 @@ void DialogLine::SetFirstPoint(const quint32 &value)
|
|||
|
||||
VisToolLine *line = qobject_cast<VisToolLine *>(vis);
|
||||
SCASSERT(line != nullptr);
|
||||
line->setPoint1Id(value);
|
||||
line->setObject1Id(value);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -154,7 +154,7 @@ void DialogLine::SaveData()
|
|||
VisToolLine *line = qobject_cast<VisToolLine *>(vis);
|
||||
SCASSERT(line != nullptr);
|
||||
|
||||
line->setPoint1Id(GetFirstPoint());
|
||||
line->setObject1Id(GetFirstPoint());
|
||||
line->setPoint2Id(GetSecondPoint());
|
||||
line->setLineStyle(VAbstractTool::LineStyleToPenStyle(GetTypeLine()));
|
||||
line->RefreshGeometry();
|
||||
|
|
|
@ -179,7 +179,7 @@ void DialogLineIntersect::SaveData()
|
|||
VisToolLineIntersect *line = qobject_cast<VisToolLineIntersect *>(vis);
|
||||
SCASSERT(line != nullptr);
|
||||
|
||||
line->setPoint1Id(GetP1Line1());
|
||||
line->setObject1Id(GetP1Line1());
|
||||
line->setLine1P2Id(GetP2Line1());
|
||||
line->setLine2P1Id(GetP1Line2());
|
||||
line->setLine2P2Id(GetP2Line2());
|
||||
|
@ -333,7 +333,7 @@ void DialogLineIntersect::SetP1Line1(const quint32 &value)
|
|||
|
||||
VisToolLineIntersect *line = qobject_cast<VisToolLineIntersect *>(vis);
|
||||
SCASSERT(line != nullptr);
|
||||
line->setPoint1Id(value);
|
||||
line->setObject1Id(value);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
|
|
@ -164,7 +164,7 @@ void DialogLineIntersectAxis::SetFirstPointId(const quint32 &value)
|
|||
|
||||
VisToolLineIntersectAxis *line = qobject_cast<VisToolLineIntersectAxis *>(vis);
|
||||
SCASSERT(line != nullptr);
|
||||
line->setPoint1Id(value);
|
||||
line->setObject1Id(value);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -356,7 +356,7 @@ void DialogLineIntersectAxis::SaveData()
|
|||
VisToolLineIntersectAxis *line = qobject_cast<VisToolLineIntersectAxis *>(vis);
|
||||
SCASSERT(line != nullptr);
|
||||
|
||||
line->setPoint1Id(GetFirstPointId());
|
||||
line->setObject1Id(GetFirstPointId());
|
||||
line->setPoint2Id(GetSecondPointId());
|
||||
line->setAxisPointId(GetBasePointId());
|
||||
line->SetAngle(formulaAngle);
|
||||
|
|
|
@ -165,7 +165,7 @@ void DialogNormal::ChosenObject(quint32 id, const SceneObject &type)
|
|||
{
|
||||
if (SetObject(id, ui->comboBoxSecondPoint, ""))
|
||||
{
|
||||
line->setPoint2Id(id);
|
||||
line->setObject2Id(id);
|
||||
line->RefreshGeometry();
|
||||
prepare = true;
|
||||
this->setModal(true);
|
||||
|
@ -191,8 +191,8 @@ void DialogNormal::SaveData()
|
|||
VisToolNormal *line = qobject_cast<VisToolNormal *>(vis);
|
||||
SCASSERT(line != nullptr);
|
||||
|
||||
line->setPoint1Id(GetFirstPointId());
|
||||
line->setPoint2Id(GetSecondPointId());
|
||||
line->setObject1Id(GetFirstPointId());
|
||||
line->setObject2Id(GetSecondPointId());
|
||||
line->setLength(formula);
|
||||
line->SetAngle(angle);
|
||||
line->setLineStyle(VAbstractTool::LineStyleToPenStyle(GetTypeLine()));
|
||||
|
@ -217,7 +217,7 @@ void DialogNormal::SetSecondPointId(const quint32 &value)
|
|||
|
||||
VisToolNormal *line = qobject_cast<VisToolNormal *>(vis);
|
||||
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);
|
||||
SCASSERT(line != nullptr);
|
||||
line->setPoint1Id(value);
|
||||
line->setObject1Id(value);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
|
|
@ -103,13 +103,13 @@ void DialogPointFromArcAndTangent::SetTangentPointId(const quint32 &value)
|
|||
|
||||
VisToolPointFromArcAndTangent *point = qobject_cast<VisToolPointFromArcAndTangent *>(vis);
|
||||
SCASSERT(point != nullptr);
|
||||
point->setPoint1Id(value);
|
||||
point->setObject1Id(value);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
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);
|
||||
SCASSERT(point != nullptr);
|
||||
|
||||
point->setPoint1Id(GetTangentPointId());
|
||||
point->setObject1Id(GetTangentPointId());
|
||||
point->setArcId(GetArcId());
|
||||
point->setCrossPoint(GetCrossCirclesPoint());
|
||||
point->RefreshGeometry();
|
||||
|
|
|
@ -112,7 +112,7 @@ void DialogPointFromCircleAndTangent::SetCircleCenterId(const quint32 &value)
|
|||
|
||||
VisToolPointFromCircleAndTangent *point = qobject_cast<VisToolPointFromCircleAndTangent *>(vis);
|
||||
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);
|
||||
SCASSERT(point != nullptr);
|
||||
point->setPoint1Id(value);
|
||||
point->setObject1Id(value);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
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, ""))
|
||||
{
|
||||
number = 0;
|
||||
point->setPoint2Id(id);
|
||||
point->setObject2Id(id);
|
||||
point->RefreshGeometry();
|
||||
prepare = true;
|
||||
this->setModal(true);
|
||||
|
@ -299,8 +299,8 @@ void DialogPointFromCircleAndTangent::SaveData()
|
|||
VisToolPointFromCircleAndTangent *point = qobject_cast<VisToolPointFromCircleAndTangent *>(vis);
|
||||
SCASSERT(point != nullptr);
|
||||
|
||||
point->setPoint1Id(GetTangentPointId());
|
||||
point->setPoint2Id(GetCircleCenterId());
|
||||
point->setObject1Id(GetTangentPointId());
|
||||
point->setObject2Id(GetCircleCenterId());
|
||||
point->setCRadius(radius);
|
||||
point->setCrossPoint(GetCrossCirclesPoint());
|
||||
point->RefreshGeometry();
|
||||
|
|
|
@ -214,7 +214,7 @@ void DialogPointOfContact::SaveData()
|
|||
VisToolPointOfContact *line = qobject_cast<VisToolPointOfContact *>(vis);
|
||||
SCASSERT(line != nullptr);
|
||||
|
||||
line->setPoint1Id(GetFirstPoint());
|
||||
line->setObject1Id(GetFirstPoint());
|
||||
line->setLineP2Id(GetSecondPoint());
|
||||
line->setRadiusId(getCenter());
|
||||
line->setRadius(radius);
|
||||
|
@ -253,7 +253,7 @@ void DialogPointOfContact::SetFirstPoint(const quint32 &value)
|
|||
|
||||
VisToolPointOfContact *line = qobject_cast<VisToolPointOfContact *>(vis);
|
||||
SCASSERT(line != nullptr);
|
||||
line->setPoint1Id(value);
|
||||
line->setObject1Id(value);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
|
|
@ -110,7 +110,7 @@ void DialogPointOfIntersection::ChosenObject(quint32 id, const SceneObject &type
|
|||
if (SetObject(id, ui->comboBoxFirstPoint, tr("Select point for Y value (horizontal)")))
|
||||
{
|
||||
number++;
|
||||
line->setPoint1Id(id);
|
||||
line->setObject1Id(id);
|
||||
line->RefreshGeometry();
|
||||
}
|
||||
break;
|
||||
|
@ -141,7 +141,7 @@ void DialogPointOfIntersection::SaveData()
|
|||
VisToolPointOfIntersection *line = qobject_cast<VisToolPointOfIntersection *>(vis);
|
||||
SCASSERT(line != nullptr);
|
||||
|
||||
line->setPoint1Id(GetFirstPointId());
|
||||
line->setObject1Id(GetFirstPointId());
|
||||
line->setPoint2Id(GetSecondPointId());
|
||||
line->RefreshGeometry();
|
||||
}
|
||||
|
@ -182,7 +182,7 @@ void DialogPointOfIntersection::SetFirstPointId(const quint32 &value)
|
|||
|
||||
VisToolPointOfIntersection *line = qobject_cast<VisToolPointOfIntersection *>(vis);
|
||||
SCASSERT(line != nullptr);
|
||||
line->setPoint1Id(value);
|
||||
line->setObject1Id(value);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
|
|
@ -113,7 +113,7 @@ void DialogPointOfIntersectionArcs::SetSecondArcId(const quint32 &value)
|
|||
//---------------------------------------------------------------------------------------------------------------------
|
||||
CrossCirclesPoint DialogPointOfIntersectionArcs::GetCrossArcPoint() const
|
||||
{
|
||||
return getCurrentCrossPoint(ui->comboBoxResult);
|
||||
return getCurrentCrossPoint<CrossCirclesPoint>(ui->comboBoxResult);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
|
|
@ -128,7 +128,7 @@ void DialogPointOfIntersectionCircles::SetFirstCircleCenterId(const quint32 &val
|
|||
|
||||
VisToolPointOfIntersectionCircles *point = qobject_cast<VisToolPointOfIntersectionCircles *>(vis);
|
||||
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);
|
||||
SCASSERT(point != nullptr);
|
||||
point->setPoint2Id(value);
|
||||
point->setObject2Id(value);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -200,7 +200,7 @@ void DialogPointOfIntersectionCircles::SetSecondCircleRadius(const QString &valu
|
|||
//---------------------------------------------------------------------------------------------------------------------
|
||||
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, ""))
|
||||
{
|
||||
number = 0;
|
||||
point->setPoint2Id(id);
|
||||
point->setObject2Id(id);
|
||||
point->RefreshGeometry();
|
||||
prepare = true;
|
||||
DialogAccepted();
|
||||
|
@ -389,8 +389,8 @@ void DialogPointOfIntersectionCircles::SaveData()
|
|||
VisToolPointOfIntersectionCircles *point = qobject_cast<VisToolPointOfIntersectionCircles *>(vis);
|
||||
SCASSERT(point != nullptr);
|
||||
|
||||
point->setPoint1Id(GetFirstCircleCenterId());
|
||||
point->setPoint2Id(GetSecondCircleCenterId());
|
||||
point->setObject1Id(GetFirstCircleCenterId());
|
||||
point->setObject2Id(GetSecondCircleCenterId());
|
||||
point->setC1Radius(c1Radius);
|
||||
point->setC2Radius(c2Radius);
|
||||
point->setCrossPoint(GetCrossCirclesPoint());
|
||||
|
|
|
@ -0,0 +1,204 @@
|
|||
/************************************************************************
|
||||
**
|
||||
** @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);
|
||||
|
||||
FillComboBoxCurves(ui->comboBoxCurve1);
|
||||
FillComboBoxCurves(ui->comboBoxCurve2);
|
||||
FillComboBoxVCrossCurvesPoint(ui->comboBoxVCorrection);
|
||||
FillComboBoxHCrossCurvesPoint(ui->comboBoxHCorrection);
|
||||
|
||||
connect(ui->lineEditNamePoint, &QLineEdit::textChanged, this, &DialogPointOfIntersectionCurves::NamePointChanged);
|
||||
|
||||
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)
|
||||
{
|
||||
setCurrentPointId(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)
|
||||
{
|
||||
setCurrentPointId(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();
|
||||
}
|
|
@ -0,0 +1,77 @@
|
|||
/************************************************************************
|
||||
**
|
||||
** @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;
|
||||
|
||||
private:
|
||||
Q_DISABLE_COPY(DialogPointOfIntersectionCurves)
|
||||
|
||||
Ui::DialogPointOfIntersectionCurves *ui;
|
||||
};
|
||||
|
||||
#endif // DIALOGPOINTOFINTERSECTIONCURVES_H
|
162
src/libs/vtools/dialogs/tools/dialogpointofintersectioncurves.ui
Normal file
162
src/libs/vtools/dialogs/tools/dialogpointofintersectioncurves.ui
Normal 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="label_4">
|
||||
<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="label_5">
|
||||
<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>
|
|
@ -219,7 +219,7 @@ void DialogShoulderPoint::SaveData()
|
|||
VisToolShoulderPoint *line = qobject_cast<VisToolShoulderPoint *>(vis);
|
||||
SCASSERT(line != nullptr);
|
||||
|
||||
line->setPoint1Id(GetP3());
|
||||
line->setObject1Id(GetP3());
|
||||
line->setLineP1Id(GetP1Line());
|
||||
line->setLineP2Id(GetP2Line());
|
||||
line->setLength(formula);
|
||||
|
@ -245,7 +245,7 @@ void DialogShoulderPoint::SetP3(const quint32 &value)
|
|||
|
||||
VisToolShoulderPoint *line = qobject_cast<VisToolShoulderPoint *>(vis);
|
||||
SCASSERT(line != nullptr);
|
||||
line->setPoint1Id(value);
|
||||
line->setObject1Id(value);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
|
|
@ -119,7 +119,7 @@ void DialogSpline::ChosenObject(quint32 id, const SceneObject &type)
|
|||
ui->spinBoxAngle1->setValue(static_cast<qint32>(QLineF(p1, p4).angle()));
|
||||
ui->spinBoxAngle2->setValue(static_cast<qint32>(QLineF(p4, p1).angle()));
|
||||
|
||||
path->setPoint4Id(id);
|
||||
path->setObject4Id(id);
|
||||
path->RefreshGeometry();
|
||||
prepare = true;
|
||||
DialogAccepted();
|
||||
|
@ -150,8 +150,8 @@ void DialogSpline::SaveData()
|
|||
VisToolSpline *path = qobject_cast<VisToolSpline *>(vis);
|
||||
SCASSERT(path != nullptr);
|
||||
|
||||
path->setPoint1Id(GetP1());
|
||||
path->setPoint4Id(GetP4());
|
||||
path->setObject1Id(GetP1());
|
||||
path->setObject4Id(GetP4());
|
||||
path->SetAngle1(angle1);
|
||||
path->SetAngle2(angle2);
|
||||
path->SetKAsm1(kAsm1);
|
||||
|
@ -287,7 +287,7 @@ void DialogSpline::SetP4(const quint32 &value)
|
|||
|
||||
VisToolSpline *path = qobject_cast<VisToolSpline *>(vis);
|
||||
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);
|
||||
SCASSERT(path != nullptr);
|
||||
path->setPoint1Id(value);
|
||||
path->setObject1Id(value);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
|
|
@ -227,6 +227,24 @@ void DialogTool::FillComboBoxCrossCirclesPoints(QComboBox *box) const
|
|||
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::LeftPoint)));
|
||||
box->addItem(tr("Rightmost point"), QVariant(static_cast<int>(HCrossCurvesPoint::RightPoint)));
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
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)
|
||||
{
|
||||
|
|
|
@ -42,12 +42,12 @@
|
|||
#include <QRadioButton>
|
||||
#include <QPushButton>
|
||||
#include <QCheckBox>
|
||||
#include <QComboBox>
|
||||
|
||||
Q_DECLARE_LOGGING_CATEGORY(vDialog)
|
||||
|
||||
class QDoubleSpinBox;
|
||||
class QLabel;
|
||||
class QComboBox;
|
||||
class QListWidgetItem;
|
||||
class VContainer;
|
||||
class QPlainTextEdit;
|
||||
|
@ -196,6 +196,8 @@ protected:
|
|||
void FillComboBoxTypeLine(QComboBox *box, const QMap<QString, QIcon> &stylesPics) const;
|
||||
void FillComboBoxLineColors(QComboBox *box)const;
|
||||
void FillComboBoxCrossCirclesPoints(QComboBox *box) const;
|
||||
void FillComboBoxVCrossCurvesPoint(QComboBox *box) const;
|
||||
void FillComboBoxHCrossCurvesPoint(QComboBox *box) const;
|
||||
|
||||
virtual void CheckState();
|
||||
QString GetComboBoxCurrentData(const QComboBox *box)const;
|
||||
|
@ -219,8 +221,10 @@ protected:
|
|||
const quint32 &ch1 = NULL_ID, const quint32 &ch2 = NULL_ID) const;
|
||||
void setCurrentCurveId(QComboBox *box, const quint32 &value) const;
|
||||
|
||||
quint32 getCurrentObjectId(QComboBox *box) const;
|
||||
CrossCirclesPoint getCurrentCrossPoint(QComboBox *box) const;
|
||||
quint32 getCurrentObjectId(QComboBox *box) const;
|
||||
|
||||
template <typename T>
|
||||
T getCurrentCrossPoint(QComboBox *box) const;
|
||||
|
||||
bool SetObject(const quint32 &id, QComboBox *box, const QString &toolTip);
|
||||
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
|
||||
|
|
|
@ -109,7 +109,7 @@ void DialogTriangle::ChosenObject(quint32 id, const SceneObject &type)
|
|||
if (SetObject(id, ui->comboBoxAxisP2, tr("Select first point")))
|
||||
{
|
||||
number++;
|
||||
line->setPoint2Id(id);
|
||||
line->setObject2Id(id);
|
||||
line->RefreshGeometry();
|
||||
}
|
||||
}
|
||||
|
@ -167,8 +167,8 @@ void DialogTriangle::SaveData()
|
|||
VisToolTriangle *line = qobject_cast<VisToolTriangle *>(vis);
|
||||
SCASSERT(line != nullptr);
|
||||
|
||||
line->setPoint1Id(GetAxisP1Id());
|
||||
line->setPoint2Id(GetAxisP2Id());
|
||||
line->setObject1Id(GetAxisP1Id());
|
||||
line->setObject2Id(GetAxisP2Id());
|
||||
line->setHypotenuseP1Id(GetFirstPointId());
|
||||
line->setHypotenuseP2Id(GetSecondPointId());
|
||||
line->RefreshGeometry();
|
||||
|
@ -257,7 +257,7 @@ void DialogTriangle::SetAxisP2Id(const quint32 &value)
|
|||
|
||||
VisToolTriangle *line = qobject_cast<VisToolTriangle *>(vis);
|
||||
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);
|
||||
SCASSERT(line != nullptr);
|
||||
line->setPoint1Id(value);
|
||||
line->setObject1Id(value);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
|
|
@ -130,7 +130,7 @@ void DialogTrueDarts::SetFirstBasePointId(const quint32 &value)
|
|||
|
||||
VisToolTrueDarts *points = qobject_cast<VisToolTrueDarts *>(vis);
|
||||
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);
|
||||
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")))
|
||||
{
|
||||
number++;
|
||||
points->setPoint2Id(id);
|
||||
points->setObject2Id(id);
|
||||
points->RefreshGeometry();
|
||||
}
|
||||
}
|
||||
|
@ -356,8 +356,8 @@ void DialogTrueDarts::SaveData()
|
|||
VisToolTrueDarts *points = qobject_cast<VisToolTrueDarts *>(vis);
|
||||
SCASSERT(points != nullptr);
|
||||
|
||||
points->setPoint1Id(GetFirstBasePointId());
|
||||
points->setPoint2Id(GetSecondBasePointId());
|
||||
points->setObject1Id(GetFirstBasePointId());
|
||||
points->setObject2Id(GetSecondBasePointId());
|
||||
points->setD1PointId(GetFirstDartPointId());
|
||||
points->setD2PointId(GetSecondDartPointId());
|
||||
points->setD3PointId(GetThirdDartPointId());
|
||||
|
|
|
@ -52,6 +52,7 @@
|
|||
#include "toolpoint/toolsinglepoint/vtoolpointofintersection.h"
|
||||
#include "toolpoint/toolsinglepoint/vtoolpointofintersectionarcs.h"
|
||||
#include "toolpoint/toolsinglepoint/vtoolpointofintersectioncircles.h"
|
||||
#include "toolpoint/toolsinglepoint/vtoolpointofintersectioncurves.h"
|
||||
#include "toolpoint/toolsinglepoint/vtoolpointfromcircleandtangent.h"
|
||||
#include "toolpoint/toolsinglepoint/vtoolpointfromarcandtangent.h"
|
||||
#include "toolpoint/tooldoublepoint/vtooltruedarts.h"
|
||||
|
|
|
@ -355,7 +355,7 @@ void VToolArc::SetVisualization()
|
|||
SCASSERT(visual != nullptr);
|
||||
|
||||
const VTranslateVars *trVars = qApp->TrVars();
|
||||
visual->setPoint1Id(arc->GetCenter().id());
|
||||
visual->setObject1Id(arc->GetCenter().id());
|
||||
visual->setRadius(trVars->FormulaToUser(arc->GetFormulaRadius()));
|
||||
visual->setF1(trVars->FormulaToUser(arc->GetFormulaF1()));
|
||||
visual->setF2(trVars->FormulaToUser(arc->GetFormulaF2()));
|
||||
|
|
|
@ -311,7 +311,7 @@ void VToolArcWithLength::SetVisualization()
|
|||
SCASSERT(visual != nullptr);
|
||||
|
||||
const VTranslateVars *trVars = qApp->TrVars();
|
||||
visual->setPoint1Id(arc->GetCenter().id());
|
||||
visual->setObject1Id(arc->GetCenter().id());
|
||||
visual->setRadius(trVars->FormulaToUser(arc->GetFormulaRadius()));
|
||||
visual->setF1(trVars->FormulaToUser(arc->GetFormulaF1()));
|
||||
visual->setLength(trVars->FormulaToUser(arc->GetFormulaLength()));
|
||||
|
|
|
@ -481,8 +481,8 @@ void VToolSpline::SetVisualization()
|
|||
SCASSERT(visual != nullptr);
|
||||
|
||||
const QSharedPointer<VSpline> spl = VAbstractTool::data.GeometricObject<VSpline>(id);
|
||||
visual->setPoint1Id(spl->GetP1().id());
|
||||
visual->setPoint4Id(spl->GetP4().id());
|
||||
visual->setObject1Id(spl->GetP1().id());
|
||||
visual->setObject4Id(spl->GetP4().id());
|
||||
visual->SetAngle1(spl->GetStartAngle());
|
||||
visual->SetAngle2(spl->GetEndAngle());
|
||||
visual->SetKAsm1(spl->GetKasm1());
|
||||
|
|
|
@ -360,8 +360,8 @@ void VToolTrueDarts::SetVisualization()
|
|||
VisToolTrueDarts *visual = qobject_cast<VisToolTrueDarts *>(vis);
|
||||
SCASSERT(visual != nullptr);
|
||||
|
||||
visual->setPoint1Id(baseLineP1Id);
|
||||
visual->setPoint2Id(baseLineP2Id);
|
||||
visual->setObject1Id(baseLineP1Id);
|
||||
visual->setObject2Id(baseLineP2Id);
|
||||
visual->setD1PointId(dartP1Id);
|
||||
visual->setD2PointId(dartP2Id);
|
||||
visual->setD3PointId(dartP3Id);
|
||||
|
|
|
@ -241,7 +241,7 @@ void VToolCutArc::SetVisualization()
|
|||
VisToolCutArc *visual = qobject_cast<VisToolCutArc *>(vis);
|
||||
SCASSERT(visual != nullptr);
|
||||
|
||||
visual->setPoint1Id(curveCutId);
|
||||
visual->setObject1Id(curveCutId);
|
||||
visual->setLength(qApp->TrVars()->FormulaToUser(formula));
|
||||
visual->RefreshGeometry();
|
||||
}
|
||||
|
|
|
@ -249,7 +249,7 @@ void VToolCutSpline::SetVisualization()
|
|||
VisToolCutSpline *visual = qobject_cast<VisToolCutSpline *>(vis);
|
||||
SCASSERT(visual != nullptr);
|
||||
|
||||
visual->setPoint1Id(curveCutId);
|
||||
visual->setObject1Id(curveCutId);
|
||||
visual->setLength(qApp->TrVars()->FormulaToUser(formula));
|
||||
visual->RefreshGeometry();
|
||||
}
|
||||
|
|
|
@ -293,7 +293,7 @@ void VToolCutSplinePath::SetVisualization()
|
|||
VisToolCutSplinePath *visual = qobject_cast<VisToolCutSplinePath *>(vis);
|
||||
SCASSERT(visual != nullptr);
|
||||
|
||||
visual->setPoint1Id(curveCutId);
|
||||
visual->setObject1Id(curveCutId);
|
||||
visual->setLength(qApp->TrVars()->FormulaToUser(formula));
|
||||
visual->RefreshGeometry();
|
||||
}
|
||||
|
|
|
@ -143,8 +143,8 @@ void VToolAlongLine::SetVisualization()
|
|||
{
|
||||
VisToolAlongLine *visual = qobject_cast<VisToolAlongLine *>(vis);
|
||||
SCASSERT(visual != nullptr)
|
||||
visual->setPoint1Id(basePointId);
|
||||
visual->setPoint2Id(secondPointId);
|
||||
visual->setObject1Id(basePointId);
|
||||
visual->setObject2Id(secondPointId);
|
||||
visual->setLength(qApp->TrVars()->FormulaToUser(formulaLength));
|
||||
visual->setLineStyle(VAbstractTool::LineStyleToPenStyle(typeLine));
|
||||
visual->RefreshGeometry();
|
||||
|
|
|
@ -302,9 +302,9 @@ void VToolBisector::SetVisualization()
|
|||
VisToolBisector *visual = qobject_cast<VisToolBisector *>(vis);
|
||||
SCASSERT(visual != nullptr);
|
||||
|
||||
visual->setPoint1Id(firstPointId);
|
||||
visual->setPoint2Id(basePointId);
|
||||
visual->setPoint3Id(thirdPointId);
|
||||
visual->setObject1Id(firstPointId);
|
||||
visual->setObject2Id(basePointId);
|
||||
visual->setObject3Id(thirdPointId);
|
||||
visual->setLength(qApp->TrVars()->FormulaToUser(formulaLength));
|
||||
visual->setLineStyle(VAbstractTool::LineStyleToPenStyle(typeLine));
|
||||
visual->RefreshGeometry();
|
||||
|
|
|
@ -278,7 +278,7 @@ void VToolCurveIntersectAxis::SetVisualization()
|
|||
VisToolCurveIntersectAxis *visual = qobject_cast<VisToolCurveIntersectAxis *>(vis);
|
||||
SCASSERT(visual != nullptr);
|
||||
|
||||
visual->setPoint1Id(curveId);
|
||||
visual->setObject1Id(curveId);
|
||||
visual->setAxisPointId(basePointId);
|
||||
visual->SetAngle(qApp->TrVars()->FormulaToUser(formulaAngle));
|
||||
visual->setLineStyle(VAbstractTool::LineStyleToPenStyle(typeLine));
|
||||
|
|
|
@ -240,7 +240,7 @@ void VToolEndLine::SetVisualization()
|
|||
VisToolEndLine *visual = qobject_cast<VisToolEndLine *>(vis);
|
||||
SCASSERT(visual != nullptr);
|
||||
|
||||
visual->setPoint1Id(basePointId);
|
||||
visual->setObject1Id(basePointId);
|
||||
visual->setLength(qApp->TrVars()->FormulaToUser(formulaLength));
|
||||
visual->SetAngle(qApp->TrVars()->FormulaToUser(formulaAngle));
|
||||
visual->setLineStyle(VAbstractTool::LineStyleToPenStyle(typeLine));
|
||||
|
|
|
@ -246,7 +246,7 @@ void VToolHeight::SetVisualization()
|
|||
VisToolHeight *visual = qobject_cast<VisToolHeight *>(vis);
|
||||
SCASSERT(visual != nullptr);
|
||||
|
||||
visual->setPoint1Id(basePointId);
|
||||
visual->setObject1Id(basePointId);
|
||||
visual->setLineP1Id(p1LineId);
|
||||
visual->setLineP2Id(p2LineId);
|
||||
visual->setLineStyle(VAbstractTool::LineStyleToPenStyle(typeLine));
|
||||
|
|
|
@ -292,7 +292,7 @@ void VToolLineIntersectAxis::SetVisualization()
|
|||
VisToolLineIntersectAxis *visual = qobject_cast<VisToolLineIntersectAxis *>(vis);
|
||||
SCASSERT(visual != nullptr);
|
||||
|
||||
visual->setPoint1Id(firstPointId);
|
||||
visual->setObject1Id(firstPointId);
|
||||
visual->setPoint2Id(secondPointId);
|
||||
visual->setAxisPointId(basePointId);
|
||||
visual->SetAngle(qApp->TrVars()->FormulaToUser(formulaAngle));
|
||||
|
|
|
@ -279,8 +279,8 @@ void VToolNormal::SetVisualization()
|
|||
VisToolNormal *visual = qobject_cast<VisToolNormal *>(vis);
|
||||
SCASSERT(visual != nullptr);
|
||||
|
||||
visual->setPoint1Id(basePointId);
|
||||
visual->setPoint2Id(secondPointId);
|
||||
visual->setObject1Id(basePointId);
|
||||
visual->setObject2Id(secondPointId);
|
||||
visual->setLength(qApp->TrVars()->FormulaToUser(formulaLength));
|
||||
visual->SetAngle(angle);
|
||||
visual->setLineStyle(VAbstractTool::LineStyleToPenStyle(typeLine));
|
||||
|
|
|
@ -306,7 +306,7 @@ void VToolShoulderPoint::SetVisualization()
|
|||
VisToolShoulderPoint *visual = qobject_cast<VisToolShoulderPoint *>(vis);
|
||||
SCASSERT(visual != nullptr);
|
||||
|
||||
visual->setPoint1Id(pShoulder);
|
||||
visual->setObject1Id(pShoulder);
|
||||
visual->setLineP1Id(basePointId);
|
||||
visual->setLineP2Id(p2Line);
|
||||
visual->setLength(qApp->TrVars()->FormulaToUser(formulaLength));
|
||||
|
|
|
@ -265,7 +265,7 @@ void VToolLineIntersect::SetVisualization()
|
|||
VisToolLineIntersect *visual = qobject_cast<VisToolLineIntersect *>(vis);
|
||||
SCASSERT(visual != nullptr);
|
||||
|
||||
visual->setPoint1Id(p1Line1);
|
||||
visual->setObject1Id(p1Line1);
|
||||
visual->setLine1P2Id(p2Line1);
|
||||
visual->setLine2P1Id(p1Line2);
|
||||
visual->setLine2P2Id(p2Line2);
|
||||
|
|
|
@ -318,7 +318,7 @@ void VToolPointFromArcAndTangent::SetVisualization()
|
|||
VisToolPointFromArcAndTangent *visual = qobject_cast<VisToolPointFromArcAndTangent *>(vis);
|
||||
SCASSERT(visual != nullptr);
|
||||
|
||||
visual->setPoint1Id(tangentPointId);
|
||||
visual->setObject1Id(tangentPointId);
|
||||
visual->setArcId(arcId);
|
||||
visual->setCrossPoint(crossPoint);
|
||||
visual->RefreshGeometry();
|
||||
|
|
|
@ -305,8 +305,8 @@ void VToolPointFromCircleAndTangent::SetVisualization()
|
|||
VisToolPointFromCircleAndTangent *visual = qobject_cast<VisToolPointFromCircleAndTangent *>(vis);
|
||||
SCASSERT(visual != nullptr);
|
||||
|
||||
visual->setPoint1Id(tangentPointId);
|
||||
visual->setPoint2Id(circleCenterId);
|
||||
visual->setObject1Id(tangentPointId);
|
||||
visual->setObject2Id(circleCenterId);
|
||||
visual->setCRadius(circleRadius);
|
||||
visual->setCrossPoint(crossPoint);
|
||||
visual->RefreshGeometry();
|
||||
|
|
|
@ -318,7 +318,7 @@ void VToolPointOfContact::SetVisualization()
|
|||
VisToolPointOfContact *visual = qobject_cast<VisToolPointOfContact *>(vis);
|
||||
SCASSERT(visual != nullptr);
|
||||
|
||||
visual->setPoint1Id(firstPointId);
|
||||
visual->setObject1Id(firstPointId);
|
||||
visual->setLineP2Id(secondPointId);
|
||||
visual->setRadiusId(center);
|
||||
visual->setRadius(qApp->TrVars()->FormulaToUser(arcRadius));
|
||||
|
|
|
@ -220,7 +220,7 @@ void VToolPointOfIntersection::SetVisualization()
|
|||
VisToolPointOfIntersection *visual = qobject_cast<VisToolPointOfIntersection *>(vis);
|
||||
SCASSERT(visual != nullptr);
|
||||
|
||||
visual->setPoint1Id(firstPointId);
|
||||
visual->setObject1Id(firstPointId);
|
||||
visual->setPoint2Id(secondPointId);
|
||||
visual->RefreshGeometry();
|
||||
}
|
||||
|
|
|
@ -344,8 +344,8 @@ void VToolPointOfIntersectionCircles::SetVisualization()
|
|||
VisToolPointOfIntersectionCircles *visual = qobject_cast<VisToolPointOfIntersectionCircles *>(vis);
|
||||
SCASSERT(visual != nullptr);
|
||||
|
||||
visual->setPoint1Id(firstCircleCenterId);
|
||||
visual->setPoint2Id(secondCircleCenterId);
|
||||
visual->setObject1Id(firstCircleCenterId);
|
||||
visual->setObject2Id(secondCircleCenterId);
|
||||
visual->setC1Radius(firstCircleRadius);
|
||||
visual->setC2Radius(secondCircleRadius);
|
||||
visual->setCrossPoint(crossPoint);
|
||||
|
|
|
@ -0,0 +1,388 @@
|
|||
/************************************************************************
|
||||
**
|
||||
** @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)
|
||||
{
|
||||
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::RightPoint)
|
||||
{
|
||||
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();
|
||||
}
|
||||
}
|
|
@ -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
|
|
@ -282,8 +282,8 @@ void VToolTriangle::SetVisualization()
|
|||
VisToolTriangle * visual = qobject_cast<VisToolTriangle *>(vis);
|
||||
SCASSERT(visual != nullptr);
|
||||
|
||||
visual->setPoint1Id(axisP1Id);
|
||||
visual->setPoint2Id(axisP2Id);
|
||||
visual->setObject1Id(axisP1Id);
|
||||
visual->setObject2Id(axisP2Id);
|
||||
visual->setHypotenuseP1Id(firstPointId);
|
||||
visual->setHypotenuseP2Id(secondPointId);
|
||||
visual->RefreshGeometry();
|
||||
|
|
|
@ -405,7 +405,7 @@ void VToolLine::SetVisualization()
|
|||
VisToolLine *visual = qobject_cast<VisToolLine *>(vis);
|
||||
SCASSERT(visual != nullptr);
|
||||
|
||||
visual->setPoint1Id(firstPoint);
|
||||
visual->setObject1Id(firstPoint);
|
||||
visual->setPoint2Id(secondPoint);
|
||||
visual->setLineStyle(VAbstractTool::LineStyleToPenStyle(typeLine));
|
||||
visual->RefreshGeometry();
|
||||
|
|
|
@ -46,7 +46,8 @@ HEADERS += \
|
|||
$$PWD/drawTools/toolcurve/vtoolarcwithlength.h \
|
||||
$$PWD/drawTools/toolpoint/vabstractpoint.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 += \
|
||||
$$PWD/vtooldetail.cpp \
|
||||
|
@ -90,4 +91,5 @@ SOURCES += \
|
|||
$$PWD/drawTools/toolcurve/vtoolarcwithlength.cpp \
|
||||
$$PWD/drawTools/toolpoint/vabstractpoint.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
|
||||
|
|
|
@ -32,7 +32,7 @@
|
|||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
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)
|
||||
{
|
||||
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()
|
||||
{
|
||||
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);
|
||||
|
||||
if (point2Id <= NULL_ID)
|
||||
if (object2Id <= NULL_ID)
|
||||
{
|
||||
DrawLine(line, QLineF(first->toQPointF(), Visualization::scenePos), supportColor);
|
||||
}
|
||||
else
|
||||
{
|
||||
const QSharedPointer<VPointF> second = Visualization::data->GeometricObject<VPointF>(point2Id);
|
||||
const QSharedPointer<VPointF> second = Visualization::data->GeometricObject<VPointF>(object2Id);
|
||||
DrawPoint(lineP2, second->toQPointF(), supportColor);
|
||||
|
||||
DrawLine(line, QLineF(first->toQPointF(), second->toQPointF()), supportColor);
|
||||
|
|
|
@ -41,13 +41,13 @@ public:
|
|||
virtual ~VisToolAlongLine() Q_DECL_OVERRIDE;
|
||||
|
||||
virtual void RefreshGeometry() Q_DECL_OVERRIDE;
|
||||
void setPoint2Id(const quint32 &value);
|
||||
void setObject2Id(const quint32 &value);
|
||||
void setLength(const QString &expression);
|
||||
virtual int type() const Q_DECL_OVERRIDE {return Type;}
|
||||
enum { Type = UserType + static_cast<int>(Vis::ToolAlongLine)};
|
||||
private:
|
||||
Q_DISABLE_COPY(VisToolAlongLine)
|
||||
quint32 point2Id;
|
||||
quint32 object2Id;
|
||||
QGraphicsEllipseItem *point;
|
||||
QGraphicsEllipseItem *lineP1;
|
||||
QGraphicsEllipseItem *lineP2;
|
||||
|
|
|
@ -45,9 +45,9 @@ VisToolArc::~VisToolArc()
|
|||
//---------------------------------------------------------------------------------------------------------------------
|
||||
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);
|
||||
|
||||
if (qFuzzyCompare(1 + radius, 1 + 0) == false && f1 >= 0 && f2 >= 0 && qFuzzyCompare(1 + f1, 1 + f2) == false)
|
||||
|
|
|
@ -45,9 +45,9 @@ VisToolArcWithLength::~VisToolArcWithLength()
|
|||
//---------------------------------------------------------------------------------------------------------------------
|
||||
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);
|
||||
|
||||
if (qFuzzyCompare(1 + radius, 1 + 0) == false && f1 >= 0 && qFuzzyCompare(1 + length, 1 + 0) == false)
|
||||
|
|
|
@ -33,7 +33,7 @@
|
|||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
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)
|
||||
{
|
||||
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()
|
||||
{
|
||||
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);
|
||||
|
||||
if (point2Id <= NULL_ID)
|
||||
if (object2Id <= NULL_ID)
|
||||
{
|
||||
DrawLine(line1, QLineF(first->toQPointF(), Visualization::scenePos), supportColor);
|
||||
}
|
||||
else
|
||||
{
|
||||
const QSharedPointer<VPointF> second = Visualization::data->GeometricObject<VPointF>(point2Id);
|
||||
const QSharedPointer<VPointF> second = Visualization::data->GeometricObject<VPointF>(object2Id);
|
||||
DrawPoint(line1P2, 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);
|
||||
}
|
||||
else
|
||||
{
|
||||
const QSharedPointer<VPointF> third = Visualization::data->GeometricObject<VPointF>(point3Id);
|
||||
const QSharedPointer<VPointF> third = Visualization::data->GeometricObject<VPointF>(object3Id);
|
||||
DrawPoint(line2P2, third->toQPointF(), supportColor);
|
||||
|
||||
DrawLine(line2, QLineF(second->toQPointF(), third->toQPointF()), supportColor);
|
||||
|
|
|
@ -39,15 +39,15 @@ public:
|
|||
virtual ~VisToolBisector() Q_DECL_OVERRIDE;
|
||||
|
||||
virtual void RefreshGeometry() Q_DECL_OVERRIDE;
|
||||
void setPoint2Id(const quint32 &value);
|
||||
void setPoint3Id(const quint32 &value);
|
||||
void setObject2Id(const quint32 &value);
|
||||
void setObject3Id(const quint32 &value);
|
||||
void setLength(const QString &expression);
|
||||
virtual int type() const Q_DECL_OVERRIDE {return Type;}
|
||||
enum { Type = UserType + static_cast<int>(Vis::ToolBisector)};
|
||||
private:
|
||||
Q_DISABLE_COPY(VisToolBisector)
|
||||
quint32 point2Id;
|
||||
quint32 point3Id;
|
||||
quint32 object2Id;
|
||||
quint32 object3Id;
|
||||
QGraphicsEllipseItem *point;
|
||||
QGraphicsEllipseItem *line1P1;
|
||||
QGraphicsEllipseItem *line1P2;
|
||||
|
|
|
@ -52,9 +52,9 @@ VisToolCurveIntersectAxis::~VisToolCurveIntersectAxis()
|
|||
//---------------------------------------------------------------------------------------------------------------------
|
||||
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);
|
||||
|
||||
if (axisPointId > NULL_ID)
|
||||
|
|
|
@ -51,9 +51,9 @@ VisToolCutArc::~VisToolCutArc()
|
|||
//---------------------------------------------------------------------------------------------------------------------
|
||||
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);
|
||||
|
||||
if (qFuzzyCompare(1 + length, 1 + 0) == false)
|
||||
|
|
|
@ -51,9 +51,9 @@ VisToolCutSpline::~VisToolCutSpline()
|
|||
//---------------------------------------------------------------------------------------------------------------------
|
||||
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);
|
||||
|
||||
if (qFuzzyCompare(1 + length, 1 + 0) == false)
|
||||
|
|
|
@ -51,9 +51,9 @@ VisToolCutSplinePath::~VisToolCutSplinePath()
|
|||
//---------------------------------------------------------------------------------------------------------------------
|
||||
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);
|
||||
|
||||
if (qFuzzyCompare(1 + length, 1 + 0) == false)
|
||||
|
|
|
@ -49,7 +49,7 @@ VisToolEndLine::~VisToolEndLine()
|
|||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VisToolEndLine::RefreshGeometry()
|
||||
{
|
||||
const QSharedPointer<VPointF> first = Visualization::data->GeometricObject<VPointF>(point1Id);
|
||||
const QSharedPointer<VPointF> first = Visualization::data->GeometricObject<VPointF>(object1Id);
|
||||
QLineF line;
|
||||
if (qFuzzyCompare(1 + length, 1 + 0))
|
||||
{
|
||||
|
|
|
@ -51,9 +51,9 @@ VisToolHeight::~VisToolHeight()
|
|||
//---------------------------------------------------------------------------------------------------------------------
|
||||
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);
|
||||
|
||||
if (lineP1Id <= NULL_ID)
|
||||
|
|
|
@ -46,7 +46,7 @@ VisToolLine::~VisToolLine()
|
|||
void VisToolLine::RefreshGeometry()
|
||||
{
|
||||
QLineF line;
|
||||
const QSharedPointer<VPointF> first = Visualization::data->GeometricObject<VPointF>(point1Id);
|
||||
const QSharedPointer<VPointF> first = Visualization::data->GeometricObject<VPointF>(object1Id);
|
||||
if (point2Id == NULL_ID)
|
||||
{
|
||||
line = QLineF(first->toQPointF(), Visualization::scenePos);
|
||||
|
|
|
@ -52,9 +52,9 @@ VisToolLineIntersect::~VisToolLineIntersect()
|
|||
//---------------------------------------------------------------------------------------------------------------------
|
||||
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);
|
||||
|
||||
if (line1P2Id <= NULL_ID)
|
||||
|
|
|
@ -54,9 +54,9 @@ VisToolLineIntersectAxis::~VisToolLineIntersectAxis()
|
|||
//---------------------------------------------------------------------------------------------------------------------
|
||||
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);
|
||||
|
||||
if (point2Id <= NULL_ID)
|
||||
|
|
|
@ -32,7 +32,7 @@
|
|||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
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)
|
||||
{
|
||||
this->mainColor = Qt::red;
|
||||
|
@ -51,12 +51,12 @@ VisToolNormal::~VisToolNormal()
|
|||
//---------------------------------------------------------------------------------------------------------------------
|
||||
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);
|
||||
|
||||
if (point2Id <= NULL_ID)
|
||||
if (object2Id <= NULL_ID)
|
||||
{
|
||||
QLineF line_mouse(first->toQPointF(), Visualization::scenePos);
|
||||
DrawLine(line, line_mouse, supportColor);
|
||||
|
@ -67,7 +67,7 @@ void VisToolNormal::RefreshGeometry()
|
|||
}
|
||||
else
|
||||
{
|
||||
const QSharedPointer<VPointF> second = Visualization::data->GeometricObject<VPointF>(point2Id);
|
||||
const QSharedPointer<VPointF> second = Visualization::data->GeometricObject<VPointF>(object2Id);
|
||||
DrawPoint(lineP2, second->toQPointF(), supportColor);
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
|
|
@ -40,7 +40,7 @@ public:
|
|||
|
||||
virtual void RefreshGeometry() Q_DECL_OVERRIDE;
|
||||
|
||||
void setPoint2Id(const quint32 &value);
|
||||
void setObject2Id(const quint32 &value);
|
||||
void setLength(const QString &expression);
|
||||
qreal GetAngle() const;
|
||||
void SetAngle(const qreal &value);
|
||||
|
@ -48,7 +48,7 @@ public:
|
|||
enum { Type = UserType + static_cast<int>(Vis::ToolNormal)};
|
||||
private:
|
||||
Q_DISABLE_COPY(VisToolNormal)
|
||||
quint32 point2Id;
|
||||
quint32 object2Id;
|
||||
QGraphicsEllipseItem *point;
|
||||
QGraphicsEllipseItem *lineP1;
|
||||
QGraphicsEllipseItem *lineP2;
|
||||
|
|
|
@ -50,9 +50,9 @@ VisToolPointFromArcAndTangent::~VisToolPointFromArcAndTangent()
|
|||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VisToolPointFromArcAndTangent::RefreshGeometry()
|
||||
{
|
||||
if (point1Id > NULL_ID)// tangent point
|
||||
if (object1Id > NULL_ID)// tangent point
|
||||
{
|
||||
const QSharedPointer<VPointF> tan = Visualization::data->GeometricObject<VPointF>(point1Id);
|
||||
const QSharedPointer<VPointF> tan = Visualization::data->GeometricObject<VPointF>(object1Id);
|
||||
DrawPoint(tangent, tan->toQPointF(), supportColor);
|
||||
|
||||
if (arcId > NULL_ID)// circle center
|
||||
|
|
|
@ -33,7 +33,7 @@
|
|||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
VisToolPointFromCircleAndTangent::VisToolPointFromCircleAndTangent(const VContainer *data, QGraphicsItem *parent)
|
||||
: VisLine(data, parent), point2Id(NULL_ID), cRadius(0), crossPoint(CrossCirclesPoint::FirstPoint),
|
||||
: VisLine(data, parent), object2Id(NULL_ID), cRadius(0), crossPoint(CrossCirclesPoint::FirstPoint),
|
||||
point(nullptr), tangent(nullptr), cCenter(nullptr), cPath(nullptr), tangent2(nullptr)
|
||||
{
|
||||
cPath = InitItem<QGraphicsEllipseItem>(Qt::darkGreen, this);
|
||||
|
@ -50,14 +50,14 @@ VisToolPointFromCircleAndTangent::~VisToolPointFromCircleAndTangent()
|
|||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VisToolPointFromCircleAndTangent::RefreshGeometry()
|
||||
{
|
||||
if (point1Id > NULL_ID)// tangent point
|
||||
if (object1Id > NULL_ID)// tangent point
|
||||
{
|
||||
const QSharedPointer<VPointF> tan = Visualization::data->GeometricObject<VPointF>(point1Id);
|
||||
const QSharedPointer<VPointF> tan = Visualization::data->GeometricObject<VPointF>(object1Id);
|
||||
DrawPoint(tangent, tan->toQPointF(), supportColor);
|
||||
|
||||
if (point2Id > NULL_ID)// circle center
|
||||
if (object2Id > NULL_ID)// circle center
|
||||
{
|
||||
const QSharedPointer<VPointF> center = Visualization::data->GeometricObject<VPointF>(point2Id);
|
||||
const QSharedPointer<VPointF> center = Visualization::data->GeometricObject<VPointF>(object2Id);
|
||||
DrawPoint(cCenter, center->toQPointF(), supportColor);
|
||||
|
||||
if (cRadius > 0)
|
||||
|
@ -76,9 +76,9 @@ void VisToolPointFromCircleAndTangent::RefreshGeometry()
|
|||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VisToolPointFromCircleAndTangent::setPoint2Id(const quint32 &value)
|
||||
void VisToolPointFromCircleAndTangent::setObject2Id(const quint32 &value)
|
||||
{
|
||||
point2Id = value;
|
||||
object2Id = value;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
|
|
@ -41,7 +41,7 @@ public:
|
|||
|
||||
virtual void RefreshGeometry() Q_DECL_OVERRIDE;
|
||||
|
||||
void setPoint2Id(const quint32 &value);
|
||||
void setObject2Id(const quint32 &value);
|
||||
void setCRadius(const QString &value);
|
||||
void setCrossPoint(const CrossCirclesPoint &value);
|
||||
|
||||
|
@ -49,7 +49,7 @@ public:
|
|||
enum { Type = UserType + static_cast<int>(Vis::ToolPointFromCircleAndTangent)};
|
||||
private:
|
||||
Q_DISABLE_COPY(VisToolPointFromCircleAndTangent)
|
||||
quint32 point2Id;
|
||||
quint32 object2Id;
|
||||
qreal cRadius;
|
||||
CrossCirclesPoint crossPoint;
|
||||
QGraphicsEllipseItem *point;
|
||||
|
|
|
@ -50,9 +50,9 @@ VisToolPointOfContact::~VisToolPointOfContact()
|
|||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VisToolPointOfContact::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);
|
||||
|
||||
if (lineP2Id <= NULL_ID)
|
||||
|
|
|
@ -49,14 +49,14 @@ VisToolPointOfIntersection::~VisToolPointOfIntersection()
|
|||
void VisToolPointOfIntersection::RefreshGeometry()
|
||||
{
|
||||
QLineF axisL1;
|
||||
if (point1Id <= NULL_ID)
|
||||
if (object1Id <= NULL_ID)
|
||||
{
|
||||
axisL1 = Axis(Visualization::scenePos, 90);
|
||||
DrawLine(this, axisL1, supportColor, Qt::DashLine);
|
||||
}
|
||||
else
|
||||
{
|
||||
const QSharedPointer<VPointF> first = Visualization::data->GeometricObject<VPointF>(point1Id);
|
||||
const QSharedPointer<VPointF> first = Visualization::data->GeometricObject<VPointF>(object1Id);
|
||||
DrawPoint(axisP1, first->toQPointF(), supportColor);
|
||||
|
||||
axisL1 = Axis(first->toQPointF(), 90);
|
||||
|
|
|
@ -33,7 +33,7 @@
|
|||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
VisToolPointOfIntersectionCircles::VisToolPointOfIntersectionCircles(const VContainer *data, QGraphicsItem *parent)
|
||||
: VisLine(data, parent), point2Id(NULL_ID), c1Radius(0), c2Radius(0),
|
||||
: VisLine(data, parent), object2Id(NULL_ID), c1Radius(0), c2Radius(0),
|
||||
crossPoint(CrossCirclesPoint::FirstPoint), point(nullptr), c1Center(nullptr), c2Center(nullptr), c1Path(nullptr),
|
||||
c2Path(nullptr)
|
||||
{
|
||||
|
@ -51,14 +51,14 @@ VisToolPointOfIntersectionCircles::~VisToolPointOfIntersectionCircles()
|
|||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VisToolPointOfIntersectionCircles::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(c1Center, first->toQPointF(), supportColor);
|
||||
|
||||
if (point2Id > NULL_ID)
|
||||
if (object2Id > NULL_ID)
|
||||
{
|
||||
const QSharedPointer<VPointF> second = Visualization::data->GeometricObject<VPointF>(point2Id);
|
||||
const QSharedPointer<VPointF> second = Visualization::data->GeometricObject<VPointF>(object2Id);
|
||||
DrawPoint(c2Center, second->toQPointF(), supportColor);
|
||||
|
||||
if (c1Radius > 0 && c2Radius > 0)
|
||||
|
@ -84,7 +84,7 @@ void VisToolPointOfIntersectionCircles::VisualMode(const quint32 &id)
|
|||
VMainGraphicsScene *scene = qobject_cast<VMainGraphicsScene *>(qApp->getCurrentScene());
|
||||
SCASSERT(scene != nullptr);
|
||||
|
||||
this->point1Id = id;
|
||||
this->object1Id = id;
|
||||
Visualization::scenePos = scene->getScenePos();
|
||||
RefreshGeometry();
|
||||
|
||||
|
@ -92,9 +92,9 @@ void VisToolPointOfIntersectionCircles::VisualMode(const quint32 &id)
|
|||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VisToolPointOfIntersectionCircles::setPoint2Id(const quint32 &value)
|
||||
void VisToolPointOfIntersectionCircles::setObject2Id(const quint32 &value)
|
||||
{
|
||||
point2Id = value;
|
||||
object2Id = value;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
|
|
@ -42,7 +42,7 @@ public:
|
|||
virtual void RefreshGeometry() Q_DECL_OVERRIDE;
|
||||
virtual void VisualMode(const quint32 &id) Q_DECL_OVERRIDE;
|
||||
|
||||
void setPoint2Id(const quint32 &value);
|
||||
void setObject2Id(const quint32 &value);
|
||||
void setC1Radius(const QString &value);
|
||||
void setC2Radius(const QString &value);
|
||||
void setCrossPoint(const CrossCirclesPoint &value);
|
||||
|
@ -51,7 +51,7 @@ public:
|
|||
enum { Type = UserType + static_cast<int>(Vis::ToolPointOfIntersectionCircles)};
|
||||
private:
|
||||
Q_DISABLE_COPY(VisToolPointOfIntersectionCircles)
|
||||
quint32 point2Id;
|
||||
quint32 object2Id;
|
||||
qreal c1Radius;
|
||||
qreal c2Radius;
|
||||
CrossCirclesPoint crossPoint;
|
||||
|
|
|
@ -0,0 +1,94 @@
|
|||
/************************************************************************
|
||||
**
|
||||
** @file vistoolpointofintersectioncurves.cpp
|
||||
** @author Roman Telezhynskyi <dismine(at)gmail.com>
|
||||
** @date 24 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 "vistoolpointofintersectioncurves.h"
|
||||
#include "../tools/drawTools/toolpoint/toolsinglepoint/vtoolpointofintersectioncurves.h"
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
VisToolPointOfIntersectionCurves::VisToolPointOfIntersectionCurves(const VContainer *data, QGraphicsItem *parent)
|
||||
:VisPath(data, parent),
|
||||
object2Id(NULL_ID),
|
||||
vCrossPoint(VCrossCurvesPoint::HighestPoint),
|
||||
hCrossPoint(HCrossCurvesPoint::LeftPoint),
|
||||
point(nullptr),
|
||||
visCurve2(nullptr)
|
||||
{
|
||||
visCurve2 = InitItem<QGraphicsPathItem>(supportColor, this);
|
||||
point = InitPoint(mainColor, this);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VisToolPointOfIntersectionCurves::RefreshGeometry()
|
||||
{
|
||||
if (object1Id > NULL_ID)
|
||||
{
|
||||
auto curve1 = Visualization::data->GeometricObject<VAbstractCurve>(object1Id);
|
||||
DrawPath(this, curve1->GetPath(PathDirection::Show), supportColor, Qt::SolidLine, Qt::RoundCap);
|
||||
|
||||
if (object2Id > NULL_ID)
|
||||
{
|
||||
auto curve2 = Visualization::data->GeometricObject<VAbstractCurve>(object2Id);
|
||||
DrawPath(visCurve2, curve2->GetPath(PathDirection::Show), supportColor, Qt::SolidLine, Qt::RoundCap);
|
||||
|
||||
auto p = VToolPointOfIntersectionCurves::FindPoint(curve1->GetPoints(), curve2->GetPoints(), vCrossPoint,
|
||||
hCrossPoint);
|
||||
DrawPoint(point, p, mainColor);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VisToolPointOfIntersectionCurves::VisualMode(const quint32 &id)
|
||||
{
|
||||
auto scene = qobject_cast<VMainGraphicsScene *>(qApp->getCurrentScene());
|
||||
SCASSERT(scene != nullptr);
|
||||
|
||||
this->object1Id = id;
|
||||
Visualization::scenePos = scene->getScenePos();
|
||||
RefreshGeometry();
|
||||
|
||||
AddOnScene();
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VisToolPointOfIntersectionCurves::setObject2Id(const quint32 &value)
|
||||
{
|
||||
object2Id = value;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VisToolPointOfIntersectionCurves::setVCrossPoint(const VCrossCurvesPoint &value)
|
||||
{
|
||||
vCrossPoint = value;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VisToolPointOfIntersectionCurves::setHCrossPoint(const HCrossCurvesPoint &value)
|
||||
{
|
||||
hCrossPoint = value;
|
||||
}
|
|
@ -0,0 +1,62 @@
|
|||
/************************************************************************
|
||||
**
|
||||
** @file vistoolpointofintersectioncurves.h
|
||||
** @author Roman Telezhynskyi <dismine(at)gmail.com>
|
||||
** @date 24 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 VISTOOLPOINTOFINTERSECTIONCURVES_H
|
||||
#define VISTOOLPOINTOFINTERSECTIONCURVES_H
|
||||
|
||||
#include "vispath.h"
|
||||
#include "../ifc/xml/vabstractpattern.h"
|
||||
|
||||
class VisToolPointOfIntersectionCurves : public VisPath
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit VisToolPointOfIntersectionCurves(const VContainer *data, QGraphicsItem *parent = 0);
|
||||
virtual ~VisToolPointOfIntersectionCurves() Q_DECL_OVERRIDE {}
|
||||
|
||||
virtual void RefreshGeometry() Q_DECL_OVERRIDE;
|
||||
virtual void VisualMode(const quint32 &id) Q_DECL_OVERRIDE;
|
||||
|
||||
void setObject2Id(const quint32 &value);
|
||||
void setVCrossPoint(const VCrossCurvesPoint &value);
|
||||
void setHCrossPoint(const HCrossCurvesPoint &value);
|
||||
|
||||
virtual int type() const Q_DECL_OVERRIDE {return Type;}
|
||||
enum { Type = UserType + static_cast<int>(Vis::ToolPointOfIntersectionCurves)};
|
||||
private:
|
||||
Q_DISABLE_COPY(VisToolPointOfIntersectionCurves)
|
||||
quint32 object2Id;
|
||||
VCrossCurvesPoint vCrossPoint;
|
||||
HCrossCurvesPoint hCrossPoint;
|
||||
|
||||
QGraphicsEllipseItem *point;
|
||||
QGraphicsPathItem *visCurve2;
|
||||
|
||||
};
|
||||
|
||||
#endif // VISTOOLPOINTOFINTERSECTIONCURVES_H
|
|
@ -53,9 +53,9 @@ VisToolShoulderPoint::~VisToolShoulderPoint()
|
|||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VisToolShoulderPoint::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);
|
||||
|
||||
if (lineP1Id <= NULL_ID)
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user