BlockView trace fix
This commit is contained in:
@@ -483,16 +483,16 @@ int BlockBusItem::neighborSegmentPoint(int point, int * seg) const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void BlockBusItem::testPoint(QPointF pos, int * sel_point, int * sel_segment) {
|
void BlockBusItem::testPoint(QPointF pos, int * sel_point, int * sel_segment, bool for_trace) {
|
||||||
for (int i = 0; i < pol.size(); ++i) {
|
for (int i = 0; i < pol.size(); ++i) {
|
||||||
if ((pol[i] - pos).manhattanLength() <= 10.) { // Point
|
if ((pol[i] - pos).manhattanLength() <= (for_trace ? 5. : 10.)) { // Point
|
||||||
*sel_point = i;
|
*sel_point = i;
|
||||||
*sel_segment = -1;
|
*sel_segment = -1;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (int i = 0; i < segments.size(); ++i) {
|
for (int i = 0; i < segments.size(); ++i) {
|
||||||
if (distPointToLine(pol[segments[i].first], pol[segments[i].second], pos) <= 7.) { // Segment
|
if (distPointToLine(pol[segments[i].first], pol[segments[i].second], pos) <= (for_trace ? 5. : 7.)) { // Segment
|
||||||
*sel_point = -1;
|
*sel_point = -1;
|
||||||
*sel_segment = i;
|
*sel_segment = i;
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ public:
|
|||||||
double endpointImageScale() const {return im_end_scale;}
|
double endpointImageScale() const {return im_end_scale;}
|
||||||
void appendPoint(const QPointF & p);
|
void appendPoint(const QPointF & p);
|
||||||
void appendPoint(qreal x, qreal y);
|
void appendPoint(qreal x, qreal y);
|
||||||
void testPoint(QPointF pos, int * sel_point, int * sel_segment);
|
void testPoint(QPointF pos, int * sel_point, int * sel_segment, bool for_trace = false);
|
||||||
void clear();
|
void clear();
|
||||||
/*void setStart(const QPointF & p) {pol[0] = p; scene()->update();}
|
/*void setStart(const QPointF & p) {pol[0] = p; scene()->update();}
|
||||||
void setStart(qreal x, qreal y) {setStart(QPointF(x, y));}
|
void setStart(qreal x, qreal y) {setStart(QPointF(x, y));}
|
||||||
|
|||||||
@@ -1349,7 +1349,7 @@ void BlockView::matchBus() {
|
|||||||
//qDebug() << "1" << buses.size() << tmp_bus.pol;
|
//qDebug() << "1" << buses.size() << tmp_bus.pol;
|
||||||
for (int i = 0; i < buses.size(); ++i) {
|
for (int i = 0; i < buses.size(); ++i) {
|
||||||
b = buses[i];
|
b = buses[i];
|
||||||
b->testPoint(point, &sp, &ss);
|
b->testPoint(point, &sp, &ss, true);
|
||||||
//qDebug() << i << sp << ss;
|
//qDebug() << i << sp << ss;
|
||||||
if (sp >= 0 || ss >= 0) break;
|
if (sp >= 0 || ss >= 0) break;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user