git-svn-id: svn://db.shs.com.ru/libs@176 a8b55f48-bf90-11e4-a774-851b48703e85
This commit is contained in:
@@ -218,7 +218,7 @@ void BlockBusItem::simplify(bool full) {
|
||||
else sp[i] = pol[segments[segs[i]].first];
|
||||
}
|
||||
QLineF l0(sp[0], cp), l1(cp, sp[1]);
|
||||
if (l0.angle() != l1.angle()) continue;
|
||||
if (qAbs(l0.angle() - l1.angle()) > 0.1) continue;
|
||||
if (segments[s0].first == p) {
|
||||
if (segments[s1].first == p) segments[s0].first = segments[s1].second;
|
||||
else segments[s0].first = segments[s1].first;
|
||||
@@ -313,6 +313,22 @@ BlockBusItem * BlockBusItem::copy() const {
|
||||
}
|
||||
|
||||
|
||||
void BlockBusItem::saveState() {
|
||||
segments_s = segments;
|
||||
ends_ind_s = ends_ind;
|
||||
ends_s = ends;
|
||||
pol_s = pol;
|
||||
}
|
||||
|
||||
|
||||
void BlockBusItem::restoreState() {
|
||||
segments = segments_s;
|
||||
ends_ind = ends_ind_s;
|
||||
ends = ends_s;
|
||||
pol = pol_s;
|
||||
}
|
||||
|
||||
|
||||
void BlockBusItem::updateGeometry() {
|
||||
ends = endpoints();
|
||||
ends_ind.clear();
|
||||
@@ -359,21 +375,25 @@ QVector<int> BlockBusItem::endpoints() const {
|
||||
}
|
||||
|
||||
|
||||
QVector<int> BlockBusItem::endpointLine(int ep) const {
|
||||
QVector<int> BlockBusItem::endpointLine(int ep, double angle) const {
|
||||
QVector<int> ret;
|
||||
int seg = -1;
|
||||
int np = segmentPointPair(ep, &seg), pp = np;
|
||||
if (ep < 0 || np < 0) return ret;
|
||||
if (pol[np] == pol[ep]) return ret;
|
||||
QPointF sp = pol[np] - pol[ep];
|
||||
bool sdir = (qAbs(sp.x()) >= qAbs(sp.y()));
|
||||
//QPointF sp = pol[np] - pol[ep];
|
||||
QLineF l(pol[ep], pol[np]);
|
||||
//qDebug() << "first" << l.angle() << angle << (l.angle() != angle);
|
||||
if (qAbs(l.angle() - angle) > 0.1) return ret;
|
||||
//qDebug() << "check next" << segments.size();
|
||||
for (int i = 0; i < segments.size(); ++i) {
|
||||
//qDebug() << i << np << pointSegmentsCount(np);
|
||||
if (np < 0) break;
|
||||
if (pointSegmentsCount(np) != 2) break;
|
||||
if (i > 0) {
|
||||
sp = pol[np] - pol[pp];
|
||||
bool idir = (qAbs(sp.x()) >= qAbs(sp.y()));
|
||||
if (sdir != idir) break;
|
||||
QLineF l(pol[pp], pol[np]);
|
||||
//qDebug() << i << l.angle() << angle;
|
||||
if (qAbs(l.angle() - angle) > 0.1) break;
|
||||
}
|
||||
ret << np;
|
||||
pp = np;
|
||||
|
||||
Reference in New Issue
Block a user