Don't allow selection details with less than 2 points and less than three
objects. --HG-- branch : develop
This commit is contained in:
parent
a38448623c
commit
d9a9df14f6
|
@ -87,14 +87,32 @@ void DialogUnionDetails::UpdateList()
|
||||||
*/
|
*/
|
||||||
bool DialogUnionDetails::CheckObject(const quint32 &id, const quint32 &idDetail) const
|
bool DialogUnionDetails::CheckObject(const quint32 &id, const quint32 &idDetail) const
|
||||||
{
|
{
|
||||||
if (idDetail == 0)
|
if (idDetail == NULL_ID)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
VDetail det = data->GetDetail(idDetail);
|
const VDetail det = data->GetDetail(idDetail);
|
||||||
return det.Containes(id);
|
return det.Containes(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
bool DialogUnionDetails::CheckDetail(const quint32 &idDetail) const
|
||||||
|
{
|
||||||
|
if (idDetail == NULL_ID)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
const VDetail det = data->GetDetail(idDetail);
|
||||||
|
if (det.CountNode() >= 3 && det.listNodePoint().size() >= 2)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
/**
|
/**
|
||||||
* @brief ChoosedDetail help save information about detail and points on detail
|
* @brief ChoosedDetail help save information about detail and points on detail
|
||||||
|
@ -106,13 +124,21 @@ bool DialogUnionDetails::CheckObject(const quint32 &id, const quint32 &idDetail)
|
||||||
void DialogUnionDetails::ChoosedDetail(const quint32 &id, const SceneObject &type, quint32 &idDetail,
|
void DialogUnionDetails::ChoosedDetail(const quint32 &id, const SceneObject &type, quint32 &idDetail,
|
||||||
int &index)
|
int &index)
|
||||||
{
|
{
|
||||||
if (idDetail == 0)
|
if (idDetail == NULL_ID)
|
||||||
{
|
{
|
||||||
if (type == SceneObject::Detail)
|
if (type == SceneObject::Detail)
|
||||||
{
|
{
|
||||||
idDetail = id;
|
if (CheckDetail(id))
|
||||||
emit ToolTip(tr("Select first point"));
|
{
|
||||||
return;
|
idDetail = id;
|
||||||
|
emit ToolTip(tr("Select a first point"));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
emit ToolTip(tr("Workpiece should have at least two points and three objects"));
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (CheckObject(id, idDetail) == false)
|
if (CheckObject(id, idDetail) == false)
|
||||||
|
@ -125,14 +151,14 @@ void DialogUnionDetails::ChoosedDetail(const quint32 &id, const SceneObject &typ
|
||||||
{
|
{
|
||||||
p1 = id;
|
p1 = id;
|
||||||
++numberP;
|
++numberP;
|
||||||
emit ToolTip(tr("Select second point"));
|
emit ToolTip(tr("Select a second point"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (numberP == 1)
|
if (numberP == 1)
|
||||||
{
|
{
|
||||||
if (id == p1)
|
if (id == p1)
|
||||||
{
|
{
|
||||||
emit ToolTip(tr("Select another second point"));
|
emit ToolTip(tr("Select a unique point"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
VDetail d = data->GetDetail(idDetail);
|
VDetail d = data->GetDetail(idDetail);
|
||||||
|
@ -154,13 +180,13 @@ void DialogUnionDetails::ChoosedDetail(const quint32 &id, const SceneObject &typ
|
||||||
numberP = 0;
|
numberP = 0;
|
||||||
p1 = 0;
|
p1 = 0;
|
||||||
p2 = 0;
|
p2 = 0;
|
||||||
emit ToolTip(tr("Select detail"));
|
emit ToolTip(tr("Select a detail"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
emit ToolTip(tr("Select another second point"));
|
emit ToolTip(tr("Select a point on edge"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -84,6 +84,8 @@ private:
|
||||||
quint32 p2;
|
quint32 p2;
|
||||||
|
|
||||||
bool CheckObject(const quint32 &id, const quint32 &idDetail) const;
|
bool CheckObject(const quint32 &id, const quint32 &idDetail) const;
|
||||||
|
bool CheckDetail(const quint32 &idDetail) const;
|
||||||
|
|
||||||
void ChoosedDetail(const quint32 &id, const SceneObject &type, quint32 &idDetail,
|
void ChoosedDetail(const quint32 &id, const SceneObject &type, quint32 &idDetail,
|
||||||
int &index);
|
int &index);
|
||||||
};
|
};
|
||||||
|
|
|
@ -186,7 +186,7 @@ void VDetail::setId(const quint32 &id)
|
||||||
bool VDetail::OnEdge(const quint32 &p1, const quint32 &p2) const
|
bool VDetail::OnEdge(const quint32 &p1, const quint32 &p2) const
|
||||||
{
|
{
|
||||||
QVector<VNodeDetail> list = listNodePoint();
|
QVector<VNodeDetail> list = listNodePoint();
|
||||||
if (list.size() < 3)
|
if (list.size() < 2)
|
||||||
{
|
{
|
||||||
qDebug()<<"Not enough points.";
|
qDebug()<<"Not enough points.";
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -82,10 +82,10 @@ public:
|
||||||
QVector<QPointF> SeamAllowancePoints(const VContainer *data) const;
|
QVector<QPointF> SeamAllowancePoints(const VContainer *data) const;
|
||||||
|
|
||||||
QPainterPath ContourPath(const VContainer *data) const;
|
QPainterPath ContourPath(const VContainer *data) const;
|
||||||
|
QVector<VNodeDetail> listNodePoint()const;
|
||||||
private:
|
private:
|
||||||
QSharedDataPointer<VDetailData> d;
|
QSharedDataPointer<VDetailData> d;
|
||||||
|
|
||||||
QVector<VNodeDetail> listNodePoint()const;
|
|
||||||
static int indexOfNode(const QVector<VNodeDetail> &list, const quint32 &id);
|
static int indexOfNode(const QVector<VNodeDetail> &list, const quint32 &id);
|
||||||
|
|
||||||
QPointF StartSegment(const VContainer *data, const int &i) const;
|
QPointF StartSegment(const VContainer *data, const int &i) const;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user