Commit 68db0058 authored by Claudio Valerio's avatar Claudio Valerio

fixed issue with bad transfrom matrix

parent 59725062
...@@ -1216,23 +1216,23 @@ bool UBSvgSubsetAdaptor::UBSvgSubsetWriter::persistScene(int pageIndex) ...@@ -1216,23 +1216,23 @@ bool UBSvgSubsetAdaptor::UBSvgSubsetWriter::persistScene(int pageIndex)
foreach(QGraphicsItem* item, strokesGroupItem->childItems()) { foreach(QGraphicsItem* item, strokesGroupItem->childItems()) {
UBGraphicsPolygonItem* poly = qgraphicsitem_cast<UBGraphicsPolygonItem*>(item); UBGraphicsPolygonItem* poly = qgraphicsitem_cast<UBGraphicsPolygonItem*>(item);
if (!poly) { if (!poly)
continue; continue;
} else if (!resultPoly) { if (!resultPoly) {
resultPoly = poly; resultPoly = poly;
continue; 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); items.removeOne(poly);
} }
if (resultPoly) { 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); polygonItemToSvgPolygon(resultPoly, true);
items.removeOne(resultPoly); items.removeOne(resultPoly);
} }
...@@ -1242,9 +1242,7 @@ bool UBSvgSubsetAdaptor::UBSvgSubsetWriter::persistScene(int pageIndex) ...@@ -1242,9 +1242,7 @@ bool UBSvgSubsetAdaptor::UBSvgSubsetWriter::persistScene(int pageIndex)
UBGraphicsPolygonItem *polygonItem = qgraphicsitem_cast<UBGraphicsPolygonItem*> (item); UBGraphicsPolygonItem *polygonItem = qgraphicsitem_cast<UBGraphicsPolygonItem*> (item);
if (polygonItem && polygonItem->isVisible()) if (polygonItem && polygonItem->isVisible())
{ {
UBGraphicsStroke* currentStroke = polygonItem->stroke(); UBGraphicsStroke* currentStroke = polygonItem->stroke();
if (openStroke && (currentStroke != openStroke)) if (openStroke && (currentStroke != openStroke))
{ {
mXmlWriter.writeEndElement(); //g mXmlWriter.writeEndElement(); //g
...@@ -2370,9 +2368,9 @@ void UBSvgSubsetAdaptor::UBSvgSubsetReader::graphicsItemFromSvg(QGraphicsItem* g ...@@ -2370,9 +2368,9 @@ void UBSvgSubsetAdaptor::UBSvgSubsetReader::graphicsItemFromSvg(QGraphicsItem* g
{ {
if (!svgX.isNull() && !svgY.isNull()) if (!svgX.isNull() && !svgY.isNull())
{ {
#ifdef Q_WS_WIN #ifdef Q_WS_WIN
gItem->setPos(svgX.toString().toFloat(), svgY.toString().toFloat()); gItem->setPos(svgX.toString().toFloat(), svgY.toString().toFloat());
#endif #endif
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment