|
|
@ -571,12 +571,14 @@ UBGraphicsScene* UBSvgSubsetAdaptor::UBSvgSubsetReader::loadScene() |
|
|
|
mStrokesList.insert(parentId,group); |
|
|
|
mStrokesList.insert(parentId,group); |
|
|
|
currentStroke = new UBGraphicsStroke(); |
|
|
|
currentStroke = new UBGraphicsStroke(); |
|
|
|
group->setTransform(polygonItem->transform()); |
|
|
|
group->setTransform(polygonItem->transform()); |
|
|
|
|
|
|
|
UBGraphicsItem::assignZValue(group, zFromSvg); |
|
|
|
} |
|
|
|
} |
|
|
|
else |
|
|
|
else |
|
|
|
group = mStrokesList.value(parentId); |
|
|
|
group = mStrokesList.value(parentId); |
|
|
|
|
|
|
|
|
|
|
|
if(polygonItem->transform().isIdentity()) |
|
|
|
if(polygonItem->transform().isIdentity()) |
|
|
|
polygonItem->setTransform(group->transform()); |
|
|
|
polygonItem->setTransform(group->transform()); |
|
|
|
|
|
|
|
|
|
|
|
group->addToGroup(polygonItem); |
|
|
|
group->addToGroup(polygonItem); |
|
|
|
polygonItem->setStrokesGroup(group); |
|
|
|
polygonItem->setStrokesGroup(group); |
|
|
|
polygonItem->setStroke(currentStroke); |
|
|
|
polygonItem->setStroke(currentStroke); |
|
|
@ -602,12 +604,14 @@ UBGraphicsScene* UBSvgSubsetAdaptor::UBSvgSubsetReader::loadScene() |
|
|
|
mStrokesList.insert(parentId,group); |
|
|
|
mStrokesList.insert(parentId,group); |
|
|
|
currentStroke = new UBGraphicsStroke(); |
|
|
|
currentStroke = new UBGraphicsStroke(); |
|
|
|
group->setTransform(polygonItem->transform()); |
|
|
|
group->setTransform(polygonItem->transform()); |
|
|
|
|
|
|
|
UBGraphicsItem::assignZValue(group, zFromSvg); |
|
|
|
} |
|
|
|
} |
|
|
|
else |
|
|
|
else |
|
|
|
group = mStrokesList.value(parentId); |
|
|
|
group = mStrokesList.value(parentId); |
|
|
|
|
|
|
|
|
|
|
|
if(polygonItem->transform().isIdentity()) |
|
|
|
if(polygonItem->transform().isIdentity()) |
|
|
|
polygonItem->setTransform(group->transform()); |
|
|
|
polygonItem->setTransform(group->transform()); |
|
|
|
|
|
|
|
|
|
|
|
group->addToGroup(polygonItem); |
|
|
|
group->addToGroup(polygonItem); |
|
|
|
polygonItem->setStrokesGroup(group); |
|
|
|
polygonItem->setStrokesGroup(group); |
|
|
|
polygonItem->setStroke(currentStroke); |
|
|
|
polygonItem->setStroke(currentStroke); |
|
|
@ -990,10 +994,13 @@ UBGraphicsScene* UBSvgSubsetAdaptor::UBSvgSubsetReader::loadScene() |
|
|
|
|
|
|
|
|
|
|
|
qDebug() << "Number of detected strokes: " << mStrokesList.count(); |
|
|
|
qDebug() << "Number of detected strokes: " << mStrokesList.count(); |
|
|
|
QHashIterator<QString, UBGraphicsStrokesGroup*> iterator(mStrokesList); |
|
|
|
QHashIterator<QString, UBGraphicsStrokesGroup*> iterator(mStrokesList); |
|
|
|
|
|
|
|
qreal zValue = 0; |
|
|
|
while (iterator.hasNext()) { |
|
|
|
while (iterator.hasNext()) { |
|
|
|
iterator.next(); |
|
|
|
iterator.next(); |
|
|
|
|
|
|
|
zValue = iterator.value()->zValue(); |
|
|
|
qDebug() << "Number of polygons : " << (int)(((UBGraphicsStrokesGroup*)iterator.value())->childItems().count()); |
|
|
|
qDebug() << "Number of polygons : " << (int)(((UBGraphicsStrokesGroup*)iterator.value())->childItems().count()); |
|
|
|
mScene->addItem(iterator.value()); |
|
|
|
mScene->addItem(iterator.value()); |
|
|
|
|
|
|
|
iterator.value()->setZValue(zValue); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (mScene) |
|
|
|
if (mScene) |
|
|
@ -1229,12 +1236,13 @@ bool UBSvgSubsetAdaptor::UBSvgSubsetWriter::persistScene(int pageIndex) |
|
|
|
items.removeOne(poly); |
|
|
|
items.removeOne(poly); |
|
|
|
} |
|
|
|
} |
|
|
|
if (resultPoly) { |
|
|
|
if (resultPoly) { |
|
|
|
|
|
|
|
resultPoly->setZValue(strokesGroupItem->zValue()); |
|
|
|
//Claudio: the painter path simplification remove all the polygons overlap
|
|
|
|
//Claudio: the painter path simplification remove all the polygons overlap
|
|
|
|
QPainterPath painterPath; |
|
|
|
QPainterPath painterPath; |
|
|
|
painterPath.addPolygon(resultPoly->polygon()); |
|
|
|
painterPath.addPolygon(resultPoly->polygon()); |
|
|
|
painterPath = painterPath.simplified(); |
|
|
|
painterPath = painterPath.simplified(); |
|
|
|
resultPoly->setPolygon(painterPath.toFillPolygon()); |
|
|
|
resultPoly->setPolygon(painterPath.toFillPolygon()); |
|
|
|
polygonItemToSvgPolygon(resultPoly, true); |
|
|
|
polygonItemToSvgPolygon(resultPoly, false); |
|
|
|
items.removeOne(resultPoly); |
|
|
|
items.removeOne(resultPoly); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@ -1701,8 +1709,7 @@ UBGraphicsPolygonItem* UBSvgSubsetAdaptor::UBSvgSubsetReader::polygonItemFromPol |
|
|
|
|
|
|
|
|
|
|
|
if (!svgPoints.isNull()) |
|
|
|
if (!svgPoints.isNull()) |
|
|
|
{ |
|
|
|
{ |
|
|
|
QStringList ts = svgPoints.toString().split(QLatin1Char(' '), |
|
|
|
QStringList ts = svgPoints.toString().split(QLatin1Char(' '), QString::SkipEmptyParts); |
|
|
|
QString::SkipEmptyParts); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
foreach(const QString sPoint, ts) |
|
|
|
foreach(const QString sPoint, ts) |
|
|
|
{ |
|
|
|
{ |
|
|
|