Successful show first point.
--HG-- branch : feature
This commit is contained in:
parent
2beac39ce1
commit
e37e2d48f3
|
@ -106,7 +106,7 @@ void DialogPointOfIntersectionArcs::SetSecondArcId(const quint32 &value)
|
|||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
CrossArcPoint DialogPointOfIntersectionArcs::GetCrossArcPoint() const
|
||||
CrossArcsPoint DialogPointOfIntersectionArcs::GetCrossArcPoint() const
|
||||
{
|
||||
int value;
|
||||
bool ok = false;
|
||||
|
@ -117,25 +117,25 @@ CrossArcPoint DialogPointOfIntersectionArcs::GetCrossArcPoint() const
|
|||
#endif
|
||||
if (not ok)
|
||||
{
|
||||
return CrossArcPoint::FirstPoint;
|
||||
return CrossArcsPoint::FirstPoint;
|
||||
}
|
||||
|
||||
switch(value)
|
||||
{
|
||||
case 1:
|
||||
return CrossArcPoint::FirstPoint;
|
||||
return CrossArcsPoint::FirstPoint;
|
||||
break;
|
||||
case 2:
|
||||
return CrossArcPoint::SecondPoint;
|
||||
return CrossArcsPoint::SecondPoint;
|
||||
break;
|
||||
default:
|
||||
return CrossArcPoint::FirstPoint;
|
||||
return CrossArcsPoint::FirstPoint;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogPointOfIntersectionArcs::SetCrossArcPoint(CrossArcPoint &p)
|
||||
void DialogPointOfIntersectionArcs::SetCrossArcPoint(CrossArcsPoint &p)
|
||||
{
|
||||
const qint32 index = ui->comboBoxResult->findData(static_cast<int>(p));
|
||||
if (index != -1)
|
||||
|
@ -164,15 +164,15 @@ void DialogPointOfIntersectionArcs::ChosenObject(quint32 id, const SceneObject &
|
|||
if (SetObject(id, ui->comboBoxArc1, tr("Select second an arc")))
|
||||
{
|
||||
number++;
|
||||
point->setArc1Id(id);
|
||||
point->RefreshGeometry();
|
||||
point->VisualMode(id);
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
if (getCurrentObjectId(ui->comboBoxArc2) != id)
|
||||
if (getCurrentObjectId(ui->comboBoxArc1) != id)
|
||||
{
|
||||
if (SetObject(id, ui->comboBoxArc2, ""))
|
||||
{
|
||||
number = 0;
|
||||
point->setArc2Id(id);
|
||||
point->RefreshGeometry();
|
||||
prepare = true;
|
||||
|
@ -229,6 +229,6 @@ void DialogPointOfIntersectionArcs::SaveData()
|
|||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogPointOfIntersectionArcs::FillComboBoxCrossArcPoints()
|
||||
{
|
||||
ui->comboBoxResult->addItem(tr("First point"), QVariant(static_cast<int>(CrossArcPoint::FirstPoint)));
|
||||
ui->comboBoxResult->addItem(tr("Second point"), QVariant(static_cast<int>(CrossArcPoint::SecondPoint)));
|
||||
ui->comboBoxResult->addItem(tr("First point"), QVariant(static_cast<int>(CrossArcsPoint::FirstPoint)));
|
||||
ui->comboBoxResult->addItem(tr("Second point"), QVariant(static_cast<int>(CrossArcsPoint::SecondPoint)));
|
||||
}
|
||||
|
|
|
@ -53,8 +53,8 @@ public:
|
|||
quint32 GetSecondArcId() const;
|
||||
void SetSecondArcId(const quint32 &value);
|
||||
|
||||
CrossArcPoint GetCrossArcPoint() const;
|
||||
void SetCrossArcPoint(CrossArcPoint &p);
|
||||
CrossArcsPoint GetCrossArcPoint() const;
|
||||
void SetCrossArcPoint(CrossArcsPoint &p);
|
||||
|
||||
public slots:
|
||||
virtual void ChosenObject(quint32 id, const SceneObject &type);
|
||||
|
|
|
@ -6,19 +6,19 @@
|
|||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>285</width>
|
||||
<width>300</width>
|
||||
<height>179</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>285</width>
|
||||
<width>300</width>
|
||||
<height>179</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>285</width>
|
||||
<width>300</width>
|
||||
<height>179</height>
|
||||
</size>
|
||||
</property>
|
||||
|
|
|
@ -696,7 +696,7 @@ void MainWindow::ToolCurveIntersectAxis(bool checked)
|
|||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void MainWindow::PointOfIntersectionArcs(bool checked)
|
||||
void MainWindow::ToolPointOfIntersectionArcs(bool checked)
|
||||
{
|
||||
SetToolButtonWithApply<DialogPointOfIntersectionArcs>(checked, Tool::PointOfIntersectionArcs,
|
||||
"://cursor/point_of_intersection_arcs.png",
|
||||
|
@ -1000,7 +1000,7 @@ void MainWindow::InitToolButtons()
|
|||
connect(ui->toolButtonCurveIntersectAxis, &QToolButton::clicked, this, &MainWindow::ToolCurveIntersectAxis);
|
||||
connect(ui->toolButtonArcIntersectAxis, &QToolButton::clicked, this, &MainWindow::ToolCurveIntersectAxis);
|
||||
connect(ui->toolButtonLayoutSettings, &QToolButton::clicked, this, &MainWindow::ToolLayoutSettings);
|
||||
connect(ui->toolButtonPointOfIntersectionArcs, &QToolButton::clicked, this, &MainWindow::PointOfIntersectionArcs);
|
||||
connect(ui->toolButtonPointOfIntersectionArcs, &QToolButton::clicked, this, &MainWindow::ToolPointOfIntersectionArcs);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -2477,6 +2477,10 @@ void MainWindow::LastUsedTool()
|
|||
ui->toolButtonPointOfIntersection->setChecked(true);
|
||||
ToolPointOfIntersection(true);
|
||||
break;
|
||||
case Tool::PointOfIntersectionArcs:
|
||||
ui->toolButtonPointOfIntersectionArcs->setChecked(true);
|
||||
ToolPointOfIntersectionArcs(true);
|
||||
break;
|
||||
case Tool::CutSpline:
|
||||
ui->toolButtonSplineCutPoint->setChecked(true);
|
||||
ToolCutSpline(true);
|
||||
|
|
|
@ -115,13 +115,13 @@ public slots:
|
|||
void ToolCutArc(bool checked);
|
||||
void ToolLineIntersectAxis(bool checked);
|
||||
void ToolCurveIntersectAxis(bool checked);
|
||||
void PointOfIntersectionArcs(bool checked);
|
||||
void ToolPointOfIntersectionArcs(bool checked);
|
||||
|
||||
void ClosedDialogDetail(int result);
|
||||
void ClosedDialogUnionDetails(int result);
|
||||
|
||||
//tmp
|
||||
void LastUsedTool();
|
||||
void LastUsedTool();
|
||||
|
||||
/**
|
||||
* @brief Edit XML code of pattern
|
||||
|
|
|
@ -50,7 +50,7 @@
|
|||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>105</width>
|
||||
<width>100</width>
|
||||
<height>272</height>
|
||||
</rect>
|
||||
</property>
|
||||
|
@ -337,7 +337,7 @@
|
|||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>105</width>
|
||||
<width>100</width>
|
||||
<height>58</height>
|
||||
</rect>
|
||||
</property>
|
||||
|
@ -413,7 +413,7 @@
|
|||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>105</width>
|
||||
<width>100</width>
|
||||
<height>156</height>
|
||||
</rect>
|
||||
</property>
|
||||
|
@ -683,6 +683,9 @@
|
|||
<height>32</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
|
@ -692,7 +695,7 @@
|
|||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>105</width>
|
||||
<width>100</width>
|
||||
<height>58</height>
|
||||
</rect>
|
||||
</property>
|
||||
|
@ -768,8 +771,8 @@
|
|||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>105</width>
|
||||
<height>380</height>
|
||||
<width>98</width>
|
||||
<height>58</height>
|
||||
</rect>
|
||||
</property>
|
||||
<attribute name="label">
|
||||
|
|
|
@ -37,7 +37,7 @@ const QString VToolPointOfIntersectionArcs::ToolType = QStringLiteral("pointOfIn
|
|||
//---------------------------------------------------------------------------------------------------------------------
|
||||
VToolPointOfIntersectionArcs::VToolPointOfIntersectionArcs(VPattern *doc, VContainer *data, const quint32 &id,
|
||||
const quint32 &firstArcId, const quint32 &secondArcId,
|
||||
CrossArcPoint pType, const Source &typeCreation,
|
||||
CrossArcsPoint pType, const Source &typeCreation,
|
||||
QGraphicsItem *parent)
|
||||
:VToolPoint(doc, data, id, parent), firstArcId(firstArcId), secondArcId(secondArcId), crossPoint(pType)
|
||||
{
|
||||
|
@ -73,7 +73,7 @@ VToolPointOfIntersectionArcs *VToolPointOfIntersectionArcs::Create(DialogTool *d
|
|||
SCASSERT(dialogTool != nullptr);
|
||||
const quint32 firstArcId = dialogTool->GetFirstArcId();
|
||||
const quint32 secondArcId = dialogTool->GetSecondArcId();
|
||||
const CrossArcPoint pType = dialogTool->GetCrossArcPoint();
|
||||
const CrossArcsPoint pType = dialogTool->GetCrossArcPoint();
|
||||
const QString pointName = dialogTool->getPointName();
|
||||
VToolPointOfIntersectionArcs *point = nullptr;
|
||||
point = Create(0, pointName, firstArcId, secondArcId, pType, 5, 10, scene, doc, data, Document::FullParse,
|
||||
|
@ -88,7 +88,7 @@ VToolPointOfIntersectionArcs *VToolPointOfIntersectionArcs::Create(DialogTool *d
|
|||
//---------------------------------------------------------------------------------------------------------------------
|
||||
VToolPointOfIntersectionArcs *VToolPointOfIntersectionArcs::Create(const quint32 _id, const QString &pointName,
|
||||
const quint32 &firstArcId,
|
||||
const quint32 &secondArcId, CrossArcPoint pType,
|
||||
const quint32 &secondArcId, CrossArcsPoint pType,
|
||||
const qreal &mx, const qreal &my,
|
||||
VMainGraphicsScene *scene, VPattern *doc,
|
||||
VContainer *data, const Document &parse,
|
||||
|
@ -130,7 +130,7 @@ VToolPointOfIntersectionArcs *VToolPointOfIntersectionArcs::Create(const quint32
|
|||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
QPointF VToolPointOfIntersectionArcs::FindPoint(const VArc *arc1, const VArc *arc2, const CrossArcPoint pType)
|
||||
QPointF VToolPointOfIntersectionArcs::FindPoint(const VArc *arc1, const VArc *arc2, const CrossArcsPoint pType)
|
||||
{
|
||||
QPointF p1, p2;
|
||||
const int res = VGObject::IntersectionCircles(arc1->GetCenter().toQPointF(), arc1->GetRadius(),
|
||||
|
@ -139,7 +139,7 @@ QPointF VToolPointOfIntersectionArcs::FindPoint(const VArc *arc1, const VArc *ar
|
|||
switch(res)
|
||||
{
|
||||
case 2:
|
||||
if (pType == CrossArcPoint::FirstPoint)
|
||||
if (pType == CrossArcsPoint::FirstPoint)
|
||||
{
|
||||
return p1;
|
||||
}
|
||||
|
@ -196,13 +196,13 @@ void VToolPointOfIntersectionArcs::SetSecondArcId(const quint32 &value)
|
|||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
CrossArcPoint VToolPointOfIntersectionArcs::GetCrossArcPoint() const
|
||||
CrossArcsPoint VToolPointOfIntersectionArcs::GetCrossArcsPoint() const
|
||||
{
|
||||
return crossPoint;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VToolPointOfIntersectionArcs::SetCrossArcPoint(CrossArcPoint &value)
|
||||
void VToolPointOfIntersectionArcs::SetCrossArcsPoint(CrossArcsPoint &value)
|
||||
{
|
||||
crossPoint = value;
|
||||
|
||||
|
@ -271,7 +271,7 @@ void VToolPointOfIntersectionArcs::ReadToolAttributes(const QDomElement &domElem
|
|||
{
|
||||
firstArcId = doc->GetParametrUInt(domElement, AttrFirstArc, NULL_ID_STR);
|
||||
secondArcId = doc->GetParametrUInt(domElement, AttrSecondArc, NULL_ID_STR);
|
||||
crossPoint = static_cast<CrossArcPoint>(doc->GetParametrUInt(domElement, AttrCrossPoint, "1"));
|
||||
crossPoint = static_cast<CrossArcsPoint>(doc->GetParametrUInt(domElement, AttrCrossPoint, "1"));
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
|
|
@ -40,17 +40,17 @@ class VToolPointOfIntersectionArcs : public VToolPoint
|
|||
|
||||
public:
|
||||
VToolPointOfIntersectionArcs(VPattern *doc, VContainer *data, const quint32 &id, const quint32 &firstArcId,
|
||||
const quint32 &secondArcId, CrossArcPoint crossPoint, const Source &typeCreation,
|
||||
const quint32 &secondArcId, CrossArcsPoint crossPoint, const Source &typeCreation,
|
||||
QGraphicsItem * parent = nullptr);
|
||||
virtual void setDialog();
|
||||
static VToolPointOfIntersectionArcs *Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern *doc,
|
||||
VContainer *data);
|
||||
static VToolPointOfIntersectionArcs *Create(const quint32 _id, const QString &pointName, const quint32 &firstArcId,
|
||||
const quint32 &secondArcId, CrossArcPoint crossPoint,
|
||||
const quint32 &secondArcId, CrossArcsPoint crossPoint,
|
||||
const qreal &mx, const qreal &my, VMainGraphicsScene *scene,
|
||||
VPattern *doc, VContainer *data, const Document &parse,
|
||||
const Source &typeCreation);
|
||||
static QPointF FindPoint(const VArc *arc1, const VArc *arc2, const CrossArcPoint crossPoint);
|
||||
static QPointF FindPoint(const VArc *arc1, const VArc *arc2, const CrossArcsPoint crossPoint);
|
||||
static const QString ToolType;
|
||||
virtual int type() const {return Type;}
|
||||
enum { Type = UserType + static_cast<int>(Tool::PointOfIntersectionArcs) };
|
||||
|
@ -61,8 +61,8 @@ public:
|
|||
quint32 GetSecondArcId() const;
|
||||
void SetSecondArcId(const quint32 &value);
|
||||
|
||||
CrossArcPoint GetCrossArcPoint() const;
|
||||
void SetCrossArcPoint(CrossArcPoint &value);
|
||||
CrossArcsPoint GetCrossArcsPoint() const;
|
||||
void SetCrossArcsPoint(CrossArcsPoint &value);
|
||||
|
||||
virtual void ShowVisualization(bool show);
|
||||
public slots:
|
||||
|
@ -83,7 +83,7 @@ private:
|
|||
/** @brief secondArcId id second arc. */
|
||||
quint32 secondArcId;
|
||||
|
||||
CrossArcPoint crossPoint;
|
||||
CrossArcsPoint crossPoint;
|
||||
};
|
||||
|
||||
#endif // VTOOLPOINTOFINTERSECTIONARCS_H
|
||||
|
|
|
@ -33,7 +33,7 @@
|
|||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
VisToolPointOfIntersectionArcs::VisToolPointOfIntersectionArcs(const VContainer *data, QGraphicsItem *parent)
|
||||
: VisLine(data, parent), arc1Id(NULL_ID), arc2Id(NULL_ID), crossPoint(CrossArcPoint::FirstPoint), point(nullptr),
|
||||
: VisLine(data, parent), arc1Id(NULL_ID), arc2Id(NULL_ID), crossPoint(CrossArcsPoint::FirstPoint), point(nullptr),
|
||||
arc1Path(nullptr), arc2Path(nullptr)
|
||||
{
|
||||
arc1Path = InitItem<QGraphicsPathItem>(Qt::darkGreen, this);
|
||||
|
@ -56,12 +56,12 @@ void VisToolPointOfIntersectionArcs::RefreshGeometry()
|
|||
if (arc1Id > NULL_ID)
|
||||
{
|
||||
const QSharedPointer<VArc> arc1 = Visualization::data->GeometricObject<VArc>(arc1Id);
|
||||
DrawPath(arc1Path, arc1->GetPath(PathDirection::Hide), supportColor, Qt::SolidLine, Qt::RoundCap);
|
||||
DrawPath(arc1Path, arc1->GetPath(PathDirection::Hide), Qt::darkGreen, Qt::SolidLine, Qt::RoundCap);
|
||||
|
||||
if (arc2Id > NULL_ID)
|
||||
{
|
||||
const QSharedPointer<VArc> arc2 = Visualization::data->GeometricObject<VArc>(arc2Id);
|
||||
DrawPath(arc2Path, arc2->GetPath(PathDirection::Hide), supportColor, Qt::SolidLine, Qt::RoundCap);
|
||||
DrawPath(arc2Path, arc2->GetPath(PathDirection::Hide), Qt::darkRed, Qt::SolidLine, Qt::RoundCap);
|
||||
|
||||
const QPointF fPoint = VToolPointOfIntersectionArcs::FindPoint(arc1.data(), arc2.data(), crossPoint);
|
||||
DrawPoint(point, fPoint, mainColor);
|
||||
|
@ -69,6 +69,19 @@ void VisToolPointOfIntersectionArcs::RefreshGeometry()
|
|||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VisToolPointOfIntersectionArcs::VisualMode(const quint32 &id)
|
||||
{
|
||||
VMainGraphicsScene *scene = qobject_cast<VMainGraphicsScene *>(qApp->getCurrentScene());
|
||||
SCASSERT(scene != nullptr);
|
||||
|
||||
this->arc1Id = id;
|
||||
Visualization::scenePos = scene->getScenePos();
|
||||
RefreshGeometry();
|
||||
|
||||
AddOnScene();
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VisToolPointOfIntersectionArcs::setArc1Id(const quint32 &value)
|
||||
{
|
||||
|
@ -82,7 +95,7 @@ void VisToolPointOfIntersectionArcs::setArc2Id(const quint32 &value)
|
|||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VisToolPointOfIntersectionArcs::setCrossPoint(const CrossArcPoint &value)
|
||||
void VisToolPointOfIntersectionArcs::setCrossPoint(const CrossArcsPoint &value)
|
||||
{
|
||||
crossPoint = value;
|
||||
}
|
||||
|
|
|
@ -40,10 +40,11 @@ public:
|
|||
virtual ~VisToolPointOfIntersectionArcs();
|
||||
|
||||
virtual void RefreshGeometry();
|
||||
virtual void VisualMode(const quint32 &id);
|
||||
|
||||
void setArc1Id(const quint32 &value);
|
||||
void setArc2Id(const quint32 &value);
|
||||
void setCrossPoint(const CrossArcPoint &value);
|
||||
void setCrossPoint(const CrossArcsPoint &value);
|
||||
|
||||
virtual int type() const {return Type;}
|
||||
enum { Type = UserType + static_cast<int>(Vis::ToolPointOfIntersection)};
|
||||
|
@ -51,7 +52,7 @@ private:
|
|||
Q_DISABLE_COPY(VisToolPointOfIntersectionArcs)
|
||||
quint32 arc1Id;
|
||||
quint32 arc2Id;
|
||||
CrossArcPoint crossPoint;
|
||||
CrossArcsPoint crossPoint;
|
||||
QGraphicsEllipseItem *point;
|
||||
QGraphicsPathItem *arc1Path;
|
||||
QGraphicsPathItem *arc2Path;
|
||||
|
|
|
@ -52,7 +52,7 @@ public:
|
|||
void setPoint1Id(const quint32 &value);
|
||||
void setLineStyle(const Qt::PenStyle &value);
|
||||
void setScenePos(const QPointF &value);
|
||||
void VisualMode(const quint32 &pointId);
|
||||
virtual void VisualMode(const quint32 &pointId);
|
||||
void setMainColor(const QColor &value);
|
||||
signals:
|
||||
void ToolTip(const QString &toolTip);
|
||||
|
|
|
@ -116,6 +116,9 @@ void VToolOptionsPropertyBrowser::ShowItemOptions(QGraphicsItem *item)
|
|||
case VToolPointOfIntersection::Type:
|
||||
ShowOptionsToolPointOfIntersection(item);
|
||||
break;
|
||||
case VToolPointOfIntersectionArcs::Type:
|
||||
ShowOptionsToolPointOfIntersectionArcs(item);
|
||||
break;
|
||||
case VToolShoulderPoint::Type:
|
||||
ShowOptionsToolShoulderPoint(item);
|
||||
break;
|
||||
|
@ -203,6 +206,9 @@ void VToolOptionsPropertyBrowser::UpdateOptions()
|
|||
case VToolPointOfIntersection::Type:
|
||||
UpdateOptionsToolPointOfIntersection();
|
||||
break;
|
||||
case VToolPointOfIntersectionArcs::Type:
|
||||
UpdateOptionsToolPointOfIntersectionArcs();
|
||||
break;
|
||||
case VToolShoulderPoint::Type:
|
||||
UpdateOptionsToolShoulderPoint();
|
||||
break;
|
||||
|
@ -305,6 +311,9 @@ void VToolOptionsPropertyBrowser::userChangedData(VProperty *property)
|
|||
case VToolPointOfIntersection::Type:
|
||||
ChangeDataToolPointOfIntersection(prop);
|
||||
break;
|
||||
case VToolPointOfIntersectionArcs::Type:
|
||||
ChangeDataToolPointOfIntersectionArcs(prop);
|
||||
break;
|
||||
case VToolShoulderPoint::Type:
|
||||
ChangeDataToolShoulderPoint(prop);
|
||||
break;
|
||||
|
@ -388,6 +397,16 @@ void VToolOptionsPropertyBrowser::AddPropertyPointName(Tool *i, const QString &p
|
|||
AddProperty(itemName, VAbstractTool::AttrName);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
template<class Tool>
|
||||
void VToolOptionsPropertyBrowser::AddPropertyCrossPoint(Tool *i, const QString &propertyName)
|
||||
{
|
||||
VEnumProperty* itemProperty = new VEnumProperty(propertyName);
|
||||
itemProperty->setLiterals(QStringList()<< tr("First point") << tr("Second point"));
|
||||
itemProperty->setValue(static_cast<int>(i->GetCrossArcsPoint())-1);
|
||||
AddProperty(itemProperty, VAbstractTool::AttrCrossPoint);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
template<class Tool>
|
||||
void VToolOptionsPropertyBrowser::AddPropertyLineType(Tool *i, const QString &propertyName,
|
||||
|
@ -827,6 +846,49 @@ void VToolOptionsPropertyBrowser::ChangeDataToolPointOfIntersection(VProperty *p
|
|||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VToolOptionsPropertyBrowser::ChangeDataToolPointOfIntersectionArcs(VProperty *property)
|
||||
{
|
||||
SCASSERT(property != nullptr)
|
||||
|
||||
const QVariant value = property->data(VProperty::DPC_Data, Qt::DisplayRole);
|
||||
const QString id = propertyToId[property];
|
||||
|
||||
VToolPointOfIntersectionArcs *i = qgraphicsitem_cast<VToolPointOfIntersectionArcs *>(currentItem);
|
||||
SCASSERT(i != nullptr);
|
||||
switch (PropertiesList().indexOf(id))
|
||||
{
|
||||
case 0: // VAbstractTool::AttrName
|
||||
SetPointName<VToolPointOfIntersectionArcs>(value.toString());
|
||||
break;
|
||||
case 28: // VAbstractTool::AttrCrossPoint
|
||||
{
|
||||
const QVariant value = property->data(VProperty::DPC_Data, Qt::EditRole);
|
||||
bool ok = false;
|
||||
const int val = value.toInt(&ok);
|
||||
|
||||
CrossArcsPoint cross = CrossArcsPoint::FirstPoint;
|
||||
if (ok)
|
||||
{
|
||||
switch(val)
|
||||
{
|
||||
case 0:
|
||||
cross = CrossArcsPoint::FirstPoint;
|
||||
case 1:
|
||||
cross = CrossArcsPoint::SecondPoint;
|
||||
default:
|
||||
cross = CrossArcsPoint::FirstPoint;
|
||||
}
|
||||
}
|
||||
i->SetCrossArcsPoint(cross);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
qWarning()<<"Unknown property type. id = "<<id;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VToolOptionsPropertyBrowser::ChangeDataToolShoulderPoint(VProperty *property)
|
||||
{
|
||||
|
@ -1171,6 +1233,17 @@ void VToolOptionsPropertyBrowser::ShowOptionsToolPointOfIntersection(QGraphicsIt
|
|||
AddPropertyPointName(i, tr("Point label"));
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VToolOptionsPropertyBrowser::ShowOptionsToolPointOfIntersectionArcs(QGraphicsItem *item)
|
||||
{
|
||||
VToolPointOfIntersectionArcs *i = qgraphicsitem_cast<VToolPointOfIntersectionArcs *>(item);
|
||||
i->ShowVisualization(true);
|
||||
formView->setTitle(tr("Tool to make point from intersection two arcs"));
|
||||
|
||||
AddPropertyPointName(i, tr("Point label"));
|
||||
AddPropertyCrossPoint(i, tr("Take"));
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VToolOptionsPropertyBrowser::ShowOptionsToolShoulderPoint(QGraphicsItem *item)
|
||||
{
|
||||
|
@ -1485,6 +1558,15 @@ void VToolOptionsPropertyBrowser::UpdateOptionsToolPointOfIntersection()
|
|||
idToProperty[VAbstractTool::AttrName]->setValue(i->name());
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VToolOptionsPropertyBrowser::UpdateOptionsToolPointOfIntersectionArcs()
|
||||
{
|
||||
VToolPointOfIntersectionArcs *i = qgraphicsitem_cast<VToolPointOfIntersectionArcs *>(currentItem);
|
||||
|
||||
idToProperty[VAbstractTool::AttrName]->setValue(i->name());
|
||||
idToProperty[VAbstractTool::AttrCrossPoint]->setValue(static_cast<int>(i->GetCrossArcsPoint())-1);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VToolOptionsPropertyBrowser::UpdateOptionsToolShoulderPoint()
|
||||
{
|
||||
|
@ -1611,6 +1693,7 @@ QStringList VToolOptionsPropertyBrowser::PropertiesList() const
|
|||
<< VAbstractTool::AttrAxisP2 /* 24 */
|
||||
<< VAbstractTool::AttrKCurve /* 25 */
|
||||
<< VAbstractTool::AttrLineColor /* 26 */
|
||||
<< VAbstractTool::AttrColor; /* 27 */
|
||||
<< VAbstractTool::AttrColor /* 27 */
|
||||
<< VAbstractTool::AttrCrossPoint; /* 28 */
|
||||
return attr;
|
||||
}
|
||||
|
|
|
@ -71,6 +71,9 @@ private:
|
|||
template<class Tool>
|
||||
void AddPropertyPointName(Tool *i, const QString &propertyName);
|
||||
|
||||
template<class Tool>
|
||||
void AddPropertyCrossPoint(Tool *i, const QString &propertyName);
|
||||
|
||||
template<class Tool>
|
||||
void AddPropertyLineType(Tool *i, const QString &propertyName, const QMap<QString, QIcon> &styles);
|
||||
|
||||
|
@ -96,6 +99,7 @@ private:
|
|||
void ChangeDataToolNormal(VPE::VProperty *property);
|
||||
void ChangeDataToolPointOfContact(VPE::VProperty *property);
|
||||
void ChangeDataToolPointOfIntersection(VPE::VProperty *property);
|
||||
void ChangeDataToolPointOfIntersectionArcs(VPE::VProperty *property);
|
||||
void ChangeDataToolShoulderPoint(VPE::VProperty *property);
|
||||
void ChangeDataToolSpline(VPE::VProperty *property);
|
||||
void ChangeDataToolSplinePath(VPE::VProperty *property);
|
||||
|
@ -117,6 +121,7 @@ private:
|
|||
void ShowOptionsToolNormal(QGraphicsItem *item);
|
||||
void ShowOptionsToolPointOfContact(QGraphicsItem *item);
|
||||
void ShowOptionsToolPointOfIntersection(QGraphicsItem *item);
|
||||
void ShowOptionsToolPointOfIntersectionArcs(QGraphicsItem *item);
|
||||
void ShowOptionsToolShoulderPoint(QGraphicsItem *item);
|
||||
void ShowOptionsToolSpline(QGraphicsItem *item);
|
||||
void ShowOptionsToolSplinePath(QGraphicsItem *item);
|
||||
|
@ -138,6 +143,7 @@ private:
|
|||
void UpdateOptionsToolNormal();
|
||||
void UpdateOptionsToolPointOfContact();
|
||||
void UpdateOptionsToolPointOfIntersection();
|
||||
void UpdateOptionsToolPointOfIntersectionArcs();
|
||||
void UpdateOptionsToolShoulderPoint();
|
||||
void UpdateOptionsToolSpline();
|
||||
void UpdateOptionsToolSplinePath();
|
||||
|
|
|
@ -38,7 +38,7 @@ class VMainGraphicsScene;
|
|||
|
||||
enum class Document : char { LiteParse, LitePPParse, FullParse };
|
||||
enum class LabelType : char {NewPatternPiece, NewLabel};
|
||||
enum class CrossArcPoint : char {FirstPoint = 1, SecondPoint = 2};
|
||||
enum class CrossArcsPoint : char {FirstPoint = 1, SecondPoint = 2};
|
||||
|
||||
/**
|
||||
* @brief The VPattern class working with pattern file.
|
||||
|
|
|
@ -267,10 +267,36 @@ int VGObject::IntersectionCircles(const QPointF &c1, double r1, const QPointF &c
|
|||
{
|
||||
return 3;// Circles are equal
|
||||
}
|
||||
const double a = 2.0 * (c2.x() - c1.x());
|
||||
const double b = 2.0 * (c2.y() - c1.y());
|
||||
const double c = c1.x() * c1.x() + c1.y() * c1.y() - r1 * r1 - (c2.x() * c2.x() + c2.y() * c2.y() - r2 * r2);
|
||||
return LineIntersectCircle (c1, r1, CreateSegment(a, b, c), p1, p2);
|
||||
const double a = - 2.0 * (c2.x() - c1.x());
|
||||
const double b = - 2.0 * (c2.y() - c1.y());
|
||||
const double c = (c2.x() - c1.x())* (c2.x() - c1.x()) + (c2.y() - c1.y()) * (c2.y() - c1.y()) + r1 * r1 - r2 * r2;
|
||||
|
||||
const double x0 = -a*c/(a*a+b*b);
|
||||
const double y0 = -b*c/(a*a+b*b);
|
||||
|
||||
if (c*c > r1*r1*(a*a+b*b))
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
else if (qFuzzyCompare(c*c, r1*r1*(a*a+b*b)))
|
||||
{
|
||||
p1 = QPointF(x0 + c1.x(), y0 + c1.y());
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
const double d = r1*r1 - c*c/(a*a+b*b);
|
||||
const double mult = sqrt (d / (a*a+b*b));
|
||||
|
||||
const double ax = x0 + b * mult;
|
||||
const double bx = x0 - b * mult;
|
||||
const double ay = y0 - a * mult;
|
||||
const double by = y0 + a * mult;
|
||||
|
||||
p1 = QPointF(ax + c1.x(), ay + c1.y());
|
||||
p2 = QPointF(bx + c1.x(), by + c1.y());
|
||||
return 2;
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -429,18 +455,6 @@ double VGObject::GetEpsilon(const QPointF &p1, const QPointF &p2)
|
|||
return epsilon;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
QLineF VGObject::CreateSegment(double a, double b, double c)
|
||||
{
|
||||
const double x1 = 0;
|
||||
const double y1 = (-a*x1-c)/b;
|
||||
|
||||
const double x2 = 1000;
|
||||
const double y2 = (-a*x2-c)/b;
|
||||
|
||||
return QLineF(x1, y1, x2, y2);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief GetReversePoint return revers container of points.
|
||||
|
|
|
@ -90,7 +90,6 @@ private:
|
|||
static bool IsPointOnLineviaPDP(const QPointF &t, const QPointF &p1, const QPointF &p2);
|
||||
static double PerpDotProduct(const QPointF &t, const QPointF &p1, const QPointF &p2);
|
||||
static double GetEpsilon(const QPointF &p1, const QPointF &p2);
|
||||
static QLineF CreateSegment(double a, double b, double c);
|
||||
};
|
||||
|
||||
#endif // VGOBJECT_H
|
||||
|
|
Loading…
Reference in New Issue
Block a user