fixed issue with bad transfrom matrix

preferencesAboutTextFull
Claudio Valerio 11 years ago
parent 59725062a9
commit 68db0058c1
  1. 20
      src/adaptors/UBSvgSubsetAdaptor.cpp

@ -1216,23 +1216,23 @@ bool UBSvgSubsetAdaptor::UBSvgSubsetWriter::persistScene(int pageIndex)
foreach(QGraphicsItem* item, strokesGroupItem->childItems()) {
UBGraphicsPolygonItem* poly = qgraphicsitem_cast<UBGraphicsPolygonItem*>(item);
if (!poly) {
if (!poly)
continue;
} else if (!resultPoly) {
if (!resultPoly) {
resultPoly = poly;
continue;
}
QPolygonF newPolygon = poly->sceneTransform().map(poly->polygon());
QPainterPath strokePainterPath;
strokePainterPath.addPolygon(resultPoly->sceneTransform().map(resultPoly->polygon()));
QPolygonF oldPolygons = strokePainterPath.simplified().toFillPolygon(resultPoly->sceneTransform().inverted());
newPolygon = oldPolygons.united(newPolygon);
resultPoly->setPolygon(newPolygon);
//
QPolygonF unitedPolygon = resultPoly->polygon().united(poly->polygon());
resultPoly->setPolygon(unitedPolygon);
items.removeOne(poly);
}
if (resultPoly) {
//Claudio: the painter path simplification remove all the polygons overlap
QPainterPath painterPath;
painterPath.addPolygon(resultPoly->polygon());
painterPath = painterPath.simplified();
resultPoly->setPolygon(painterPath.toFillPolygon());
polygonItemToSvgPolygon(resultPoly, true);
items.removeOne(resultPoly);
}
@ -1242,9 +1242,7 @@ bool UBSvgSubsetAdaptor::UBSvgSubsetWriter::persistScene(int pageIndex)
UBGraphicsPolygonItem *polygonItem = qgraphicsitem_cast<UBGraphicsPolygonItem*> (item);
if (polygonItem && polygonItem->isVisible())
{
UBGraphicsStroke* currentStroke = polygonItem->stroke();
if (openStroke && (currentStroke != openStroke))
{
mXmlWriter.writeEndElement(); //g

Loading…
Cancel
Save