Fixed method CheckLoops.

--HG--
branch : feature
This commit is contained in:
dismine 2014-01-13 00:34:36 +02:00
parent aa4feb648a
commit 1cffddc672
3 changed files with 27 additions and 31 deletions

View file

@ -241,22 +241,22 @@ QVector<QPointF> VContainer::CorrectEquidistantPoints(const QVector<QPointF> &po
correctPoints.append(points.at(i)); correctPoints.append(points.at(i));
} }
} }
// if(correctPoints.size()<3) if(correctPoints.size()<3)
// { {
// return correctPoints; return correctPoints;
// } }
// //Remove point on line //Remove point on line
// QPointF point; QPointF point;
// for(qint32 i = 1; i <correctPoints.size()-1; ++i) for(qint32 i = 1; i <correctPoints.size()-1; ++i)
// { {
// QLineF l1(correctPoints[i-1], correctPoints[i]); QLineF l1(correctPoints[i-1], correctPoints[i]);
// QLineF l2(correctPoints[i], correctPoints[i+1]); QLineF l2(correctPoints[i], correctPoints[i+1]);
// QLineF::IntersectType intersect = l1.intersect(l2, &point); QLineF::IntersectType intersect = l1.intersect(l2, &point);
// if (intersect == QLineF::NoIntersection) if (intersect == QLineF::NoIntersection)
// { {
// correctPoints.remove(i); correctPoints.remove(i);
// } }
// } }
return correctPoints; return correctPoints;
} }
@ -579,7 +579,6 @@ QVector<QPointF> VContainer::CheckLoops(const QVector<QPointF> &points) const
/*We found loop.*/ /*We found loop.*/
ekvPoints.append(points.at(i)); ekvPoints.append(points.at(i));
ekvPoints.append(crosPoint); ekvPoints.append(crosPoint);
ekvPoints.append(points.at(j+1));
i = j + 2; i = j + 2;
} }
} }

View file

@ -304,7 +304,7 @@ protected:
* @brief RemoveAllChild * @brief RemoveAllChild
* @param domElement * @param domElement
*/ */
void RemoveAllChild(QDomElement &domElement); void RemoveAllChild(QDomElement &domElement);
virtual void DeleteTool(QGraphicsItem *tool); virtual void DeleteTool(QGraphicsItem *tool);
template <typename T> template <typename T>
/** /**

View file

@ -251,24 +251,21 @@ QVariant VToolDetail::itemChange(QGraphicsItem::GraphicsItemChange change, const
QGraphicsScene *sc = this->scene(); QGraphicsScene *sc = this->scene();
QRectF rect = sc->itemsBoundingRect(); QRectF rect = sc->itemsBoundingRect();
//Correct BoundingRect //Correct BoundingRect
rect = QRectF(0, 0, rect.width() + rect.x(), rect.height() + rect.y()); //rect = QRectF(0, 0, rect.width() + rect.x(), rect.height() + rect.y());
qDebug()<<"rect"<<rect; qDebug()<<"rect"<<rect;
QList<QGraphicsView*> list = sc->views(); QList<QGraphicsView*> list = sc->views();
QRect rec = list[0]->contentsRect(); QRect rec = list[0]->contentsRect();
qDebug()<<"rec"<<rec; QTransform t = list[0]->transform();
qDebug()<<"m11="<<t.m11();
qDebug()<<"m22="<<t.m22();
//Correct contentsRect //Correct contentsRect
rec = QRect(0, 0, rec.width() - rec.x(), rec.height() - rec.y()); rec = QRect(0, 0, rec.width()/t.m11() - rec.x(), rec.height()/t.m22() - rec.y());
// rec = QRectF(rec.x()/t.m11(), rec.y()/t.m22(), rec.width()/t.m11(), rec.height()/t.m22());
if(rec.contains(rect.toRect())) qDebug()<<"rec"<<rec;
{ rec = rec.united(rect.toRect());
sc->setSceneRect(rec); qDebug()<<"rec1"<<rec;
} sc->setSceneRect(rec);
else
{
rect = rect.united(rec);
sc->setSceneRect(rect);
}
doc->haveLiteChange(); doc->haveLiteChange();
} }