fixed issue with bad transfrom matrix

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

@ -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)
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
{ {
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
} }
} }

Loading…
Cancel
Save