|
|
@ -16,6 +16,7 @@ |
|
|
|
#include <QSvgGenerator> |
|
|
|
#include <QSvgGenerator> |
|
|
|
#include <QSvgRenderer> |
|
|
|
#include <QSvgRenderer> |
|
|
|
#include <QPixmap> |
|
|
|
#include <QPixmap> |
|
|
|
|
|
|
|
#include <QMap> |
|
|
|
|
|
|
|
|
|
|
|
#include "core/UBPersistenceManager.h" |
|
|
|
#include "core/UBPersistenceManager.h" |
|
|
|
|
|
|
|
|
|
|
@ -248,6 +249,11 @@ bool UBCFFSubsetAdaptor::UBCFFSubsetReader::parseSvgRect(const QDomElement &elem |
|
|
|
painter.end(); |
|
|
|
painter.end(); |
|
|
|
|
|
|
|
|
|
|
|
UBGraphicsSvgItem *svgItem = mCurrentScene->addSvg(QUrl::fromLocalFile(generator->fileName())); |
|
|
|
UBGraphicsSvgItem *svgItem = mCurrentScene->addSvg(QUrl::fromLocalFile(generator->fileName())); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
QString uuid = QUuid::createUuid().toString(); |
|
|
|
|
|
|
|
mRefToUuidMap.insert(element.attribute(aId), uuid); |
|
|
|
|
|
|
|
svgItem->setUuid(QUuid(uuid)); |
|
|
|
|
|
|
|
|
|
|
|
QTransform transform; |
|
|
|
QTransform transform; |
|
|
|
QString textTransform = element.attribute(aTransform); |
|
|
|
QString textTransform = element.attribute(aTransform); |
|
|
|
|
|
|
|
|
|
|
@ -298,6 +304,11 @@ bool UBCFFSubsetAdaptor::UBCFFSubsetReader::parseSvgEllipse(const QDomElement &e |
|
|
|
painter.end(); |
|
|
|
painter.end(); |
|
|
|
|
|
|
|
|
|
|
|
UBGraphicsSvgItem *svgItem = mCurrentScene->addSvg(QUrl::fromLocalFile(generator->fileName())); |
|
|
|
UBGraphicsSvgItem *svgItem = mCurrentScene->addSvg(QUrl::fromLocalFile(generator->fileName())); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
QString uuid = QUuid::createUuid().toString(); |
|
|
|
|
|
|
|
mRefToUuidMap.insert(element.attribute(aId), uuid); |
|
|
|
|
|
|
|
svgItem->setUuid(QUuid(uuid)); |
|
|
|
|
|
|
|
|
|
|
|
QTransform transform; |
|
|
|
QTransform transform; |
|
|
|
QString textTransform = element.attribute(aTransform); |
|
|
|
QString textTransform = element.attribute(aTransform); |
|
|
|
|
|
|
|
|
|
|
@ -373,37 +384,65 @@ bool UBCFFSubsetAdaptor::UBCFFSubsetReader::parseSvgPolygon(const QDomElement &e |
|
|
|
brush.setColor(fillColor); |
|
|
|
brush.setColor(fillColor); |
|
|
|
brush.setStyle(Qt::SolidPattern); |
|
|
|
brush.setStyle(Qt::SolidPattern); |
|
|
|
|
|
|
|
|
|
|
|
QSvgGenerator *generator = createSvgGenerator(width + pen.width(), height + pen.width()); |
|
|
|
|
|
|
|
QPainter painter; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
painter.begin(generator); //drawing to svg tmp file
|
|
|
|
QUuid itemUuid(element.attribute(aId).right(QUuid().toString().length())); |
|
|
|
|
|
|
|
QUuid itemGroupUuid(element.attribute(aId).left(QUuid().toString().length()-1)); |
|
|
|
|
|
|
|
if (!itemUuid.isNull() && (itemGroupUuid!=itemUuid)) // reimported from UBZ
|
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
UBGraphicsPolygonItem *graphicsPolygon = mCurrentScene->polygonToPolygonItem(polygon); |
|
|
|
|
|
|
|
|
|
|
|
painter.translate(pen.widthF() / 2 - x1, pen.widthF() / 2 - y1); |
|
|
|
graphicsPolygon->setBrush(brush); |
|
|
|
painter.setBrush(brush); |
|
|
|
|
|
|
|
painter.setPen(pen); |
|
|
|
|
|
|
|
painter.drawPolygon(polygon); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
painter.end(); |
|
|
|
QTransform transform; |
|
|
|
|
|
|
|
QString textTransform = element.attribute(aTransform); |
|
|
|
|
|
|
|
|
|
|
|
//add resulting svg file to scene
|
|
|
|
graphicsPolygon->resetTransform(); |
|
|
|
UBGraphicsSvgItem *svgItem = mCurrentScene->addSvg(QUrl::fromLocalFile(generator->fileName())); |
|
|
|
if (!textTransform.isNull()) { |
|
|
|
QTransform transform; |
|
|
|
transform = transformFromString(textTransform, graphicsPolygon); |
|
|
|
QString textTransform = element.attribute(aTransform); |
|
|
|
} |
|
|
|
|
|
|
|
mCurrentScene->addItem(graphicsPolygon); |
|
|
|
|
|
|
|
|
|
|
|
svgItem->resetTransform(); |
|
|
|
graphicsPolygon->setUuid(itemUuid); |
|
|
|
if (!textTransform.isNull()) { |
|
|
|
mRefToUuidMap.insert(element.attribute(aId), itemUuid); |
|
|
|
transform = transformFromString(textTransform, svgItem); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
repositionSvgItem(svgItem, width +strokeWidth, height + strokeWidth, x1 - strokeWidth/2 + transform.m31(), y1 + strokeWidth/2 + transform.m32(), transform); |
|
|
|
|
|
|
|
hashSceneItem(element, svgItem); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (mGSectionContainer) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
addItemToGSection(svgItem); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
else // single CFF
|
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
QSvgGenerator *generator = createSvgGenerator(width + pen.width(), height + pen.width()); |
|
|
|
|
|
|
|
QPainter painter; |
|
|
|
|
|
|
|
|
|
|
|
delete generator; |
|
|
|
painter.begin(generator); //drawing to svg tmp file
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
painter.translate(pen.widthF() / 2 - x1, pen.widthF() / 2 - y1); |
|
|
|
|
|
|
|
painter.setBrush(brush); |
|
|
|
|
|
|
|
painter.setPen(pen); |
|
|
|
|
|
|
|
painter.drawPolygon(polygon); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
painter.end(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//add resulting svg file to scene
|
|
|
|
|
|
|
|
UBGraphicsSvgItem *svgItem = mCurrentScene->addSvg(QUrl::fromLocalFile(generator->fileName())); |
|
|
|
|
|
|
|
QTransform transform; |
|
|
|
|
|
|
|
QString textTransform = element.attribute(aTransform); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
QUuid uuid = QUuid::createUuid().toString(); |
|
|
|
|
|
|
|
mRefToUuidMap.insert(element.attribute(aId), uuid); |
|
|
|
|
|
|
|
svgItem->setUuid(uuid); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
svgItem->resetTransform(); |
|
|
|
|
|
|
|
if (!textTransform.isNull()) { |
|
|
|
|
|
|
|
transform = transformFromString(textTransform, svgItem); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
repositionSvgItem(svgItem, width +strokeWidth, height + strokeWidth, x1 - strokeWidth/2 + transform.m31(), y1 + strokeWidth/2 + transform.m32(), transform); |
|
|
|
|
|
|
|
hashSceneItem(element, svgItem); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (mGSectionContainer) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
addItemToGSection(svgItem); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
delete generator; |
|
|
|
|
|
|
|
} |
|
|
|
return true; |
|
|
|
return true; |
|
|
|
} |
|
|
|
} |
|
|
|
bool UBCFFSubsetAdaptor::UBCFFSubsetReader::parseSvgPolyline(const QDomElement &element) |
|
|
|
bool UBCFFSubsetAdaptor::UBCFFSubsetReader::parseSvgPolyline(const QDomElement &element) |
|
|
@ -441,6 +480,7 @@ bool UBCFFSubsetAdaptor::UBCFFSubsetReader::parseSvgPolyline(const QDomElement & |
|
|
|
//bounding rect lef top corner coordinates
|
|
|
|
//bounding rect lef top corner coordinates
|
|
|
|
qreal x1 = polygon.boundingRect().topLeft().x(); |
|
|
|
qreal x1 = polygon.boundingRect().topLeft().x(); |
|
|
|
qreal y1 = polygon.boundingRect().topLeft().y(); |
|
|
|
qreal y1 = polygon.boundingRect().topLeft().y(); |
|
|
|
|
|
|
|
|
|
|
|
//bounding rect dimensions
|
|
|
|
//bounding rect dimensions
|
|
|
|
qreal width = polygon.boundingRect().width(); |
|
|
|
qreal width = polygon.boundingRect().width(); |
|
|
|
qreal height = polygon.boundingRect().height(); |
|
|
|
qreal height = polygon.boundingRect().height(); |
|
|
@ -458,35 +498,72 @@ bool UBCFFSubsetAdaptor::UBCFFSubsetReader::parseSvgPolyline(const QDomElement & |
|
|
|
pen.setColor(strokeColor); |
|
|
|
pen.setColor(strokeColor); |
|
|
|
pen.setWidth(strokeWidth); |
|
|
|
pen.setWidth(strokeWidth); |
|
|
|
|
|
|
|
|
|
|
|
QSvgGenerator *generator = createSvgGenerator(width + pen.width(), height + pen.width()); |
|
|
|
QBrush brush; |
|
|
|
QPainter painter; |
|
|
|
brush.setColor(strokeColor); |
|
|
|
|
|
|
|
brush.setStyle(Qt::SolidPattern); |
|
|
|
|
|
|
|
|
|
|
|
painter.begin(generator); //drawing to svg tmp file
|
|
|
|
QUuid itemUuid(element.attribute(aId).right(QUuid().toString().length())); |
|
|
|
|
|
|
|
QUuid itemGroupUuid(element.attribute(aId).left(QUuid().toString().length()-1)); |
|
|
|
|
|
|
|
if (!itemUuid.isNull() && (itemGroupUuid!=itemUuid)) // reimported from UBZ
|
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
UBGraphicsPolygonItem *graphicsPolygon = new UBGraphicsPolygonItem(polygon); |
|
|
|
|
|
|
|
|
|
|
|
painter.translate(pen.widthF()/2 - x1, pen.widthF()/2- y1); |
|
|
|
UBGraphicsStroke *stroke = new UBGraphicsStroke(); |
|
|
|
painter.setPen(pen); |
|
|
|
graphicsPolygon->setStroke(stroke); |
|
|
|
painter.drawPolyline(polygon); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
painter.end(); |
|
|
|
graphicsPolygon->setBrush(brush); |
|
|
|
|
|
|
|
QTransform transform; |
|
|
|
|
|
|
|
QString textTransform = element.attribute(aTransform); |
|
|
|
|
|
|
|
|
|
|
|
//add resulting svg file to scene
|
|
|
|
graphicsPolygon->resetTransform(); |
|
|
|
UBGraphicsSvgItem *svgItem = mCurrentScene->addSvg(QUrl::fromLocalFile(generator->fileName())); |
|
|
|
if (!textTransform.isNull()) { |
|
|
|
QTransform transform; |
|
|
|
transform = transformFromString(textTransform, graphicsPolygon); |
|
|
|
QString textTransform = element.attribute(aTransform); |
|
|
|
} |
|
|
|
|
|
|
|
mCurrentScene->addItem(graphicsPolygon); |
|
|
|
|
|
|
|
|
|
|
|
svgItem->resetTransform(); |
|
|
|
graphicsPolygon->setUuid(itemUuid); |
|
|
|
if (!textTransform.isNull()) { |
|
|
|
mRefToUuidMap.insert(element.attribute(aId), itemUuid); |
|
|
|
transform = transformFromString(textTransform, svgItem); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
repositionSvgItem(svgItem, width +strokeWidth, height + strokeWidth, x1 + transform.m31() - strokeWidth/2, y1 + transform.m32() + strokeWidth/2, transform); |
|
|
|
|
|
|
|
hashSceneItem(element, svgItem); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (mGSectionContainer) |
|
|
|
} |
|
|
|
|
|
|
|
else // simple CFF
|
|
|
|
{ |
|
|
|
{ |
|
|
|
addItemToGSection(svgItem); |
|
|
|
QSvgGenerator *generator = createSvgGenerator(width + pen.width(), height + pen.width()); |
|
|
|
|
|
|
|
QPainter painter; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
painter.begin(generator); //drawing to svg tmp file
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
painter.translate(pen.widthF() / 2 - x1, pen.widthF() / 2 - y1); |
|
|
|
|
|
|
|
painter.setBrush(brush); |
|
|
|
|
|
|
|
painter.setPen(pen); |
|
|
|
|
|
|
|
painter.drawPolygon(polygon); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
painter.end(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//add resulting svg file to scene
|
|
|
|
|
|
|
|
UBGraphicsSvgItem *svgItem = mCurrentScene->addSvg(QUrl::fromLocalFile(generator->fileName())); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
QString uuid = QUuid::createUuid().toString(); |
|
|
|
|
|
|
|
mRefToUuidMap.insert(element.attribute(aId), uuid); |
|
|
|
|
|
|
|
svgItem->setUuid(QUuid(uuid)); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
QTransform transform; |
|
|
|
|
|
|
|
QString textTransform = element.attribute(aTransform); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
svgItem->resetTransform(); |
|
|
|
|
|
|
|
if (!textTransform.isNull()) { |
|
|
|
|
|
|
|
transform = transformFromString(textTransform, svgItem); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
repositionSvgItem(svgItem, width +strokeWidth, height + strokeWidth, x1 - strokeWidth/2 + transform.m31(), y1 + strokeWidth/2 + transform.m32(), transform); |
|
|
|
|
|
|
|
hashSceneItem(element, svgItem); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (mGSectionContainer) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
addItemToGSection(svgItem); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
delete generator; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
delete generator; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return true; |
|
|
|
return true; |
|
|
|
} |
|
|
|
} |
|
|
@ -621,6 +698,10 @@ bool UBCFFSubsetAdaptor::UBCFFSubsetReader::parseSvgText(const QDomElement &elem |
|
|
|
//add resulting svg file to scene
|
|
|
|
//add resulting svg file to scene
|
|
|
|
UBGraphicsSvgItem *svgItem = mCurrentScene->addSvg(QUrl::fromLocalFile(generator->fileName())); |
|
|
|
UBGraphicsSvgItem *svgItem = mCurrentScene->addSvg(QUrl::fromLocalFile(generator->fileName())); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
QString uuid = QUuid::createUuid().toString(); |
|
|
|
|
|
|
|
mRefToUuidMap.insert(element.attribute(aId), uuid); |
|
|
|
|
|
|
|
svgItem->setUuid(QUuid(uuid)); |
|
|
|
|
|
|
|
|
|
|
|
svgItem->resetTransform(); |
|
|
|
svgItem->resetTransform(); |
|
|
|
repositionSvgItem(svgItem, width, height, x + transform.m31(), y + transform.m32(), transform); |
|
|
|
repositionSvgItem(svgItem, width, height, x + transform.m31(), y + transform.m32(), transform); |
|
|
|
hashSceneItem(element, svgItem); |
|
|
|
hashSceneItem(element, svgItem); |
|
|
@ -734,6 +815,10 @@ bool UBCFFSubsetAdaptor::UBCFFSubsetReader::parseSvgTextarea(const QDomElement & |
|
|
|
UBGraphicsTextItem *svgItem = mCurrentScene->addTextHtml(doc.toHtml()); |
|
|
|
UBGraphicsTextItem *svgItem = mCurrentScene->addTextHtml(doc.toHtml()); |
|
|
|
svgItem->resize(width, height); |
|
|
|
svgItem->resize(width, height); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
QString uuid = QUuid::createUuid().toString(); |
|
|
|
|
|
|
|
mRefToUuidMap.insert(element.attribute(aId), uuid); |
|
|
|
|
|
|
|
svgItem->setUuid(QUuid(uuid)); |
|
|
|
|
|
|
|
|
|
|
|
QTransform transform; |
|
|
|
QTransform transform; |
|
|
|
QString textTransform = element.attribute(aTransform); |
|
|
|
QString textTransform = element.attribute(aTransform); |
|
|
|
|
|
|
|
|
|
|
@ -783,6 +868,11 @@ bool UBCFFSubsetAdaptor::UBCFFSubsetReader::parseSvgImage(const QDomElement &ele |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
UBGraphicsPixmapItem *pixItem = mCurrentScene->addPixmap(pix, NULL); |
|
|
|
UBGraphicsPixmapItem *pixItem = mCurrentScene->addPixmap(pix, NULL); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
QString uuid = QUuid::createUuid().toString(); |
|
|
|
|
|
|
|
mRefToUuidMap.insert(element.attribute(aId), uuid); |
|
|
|
|
|
|
|
pixItem->setUuid(QUuid(uuid)); |
|
|
|
|
|
|
|
|
|
|
|
QTransform transform; |
|
|
|
QTransform transform; |
|
|
|
QString textTransform = element.attribute(aTransform); |
|
|
|
QString textTransform = element.attribute(aTransform); |
|
|
|
|
|
|
|
|
|
|
@ -830,6 +920,10 @@ bool UBCFFSubsetAdaptor::UBCFFSubsetReader::parseSvgFlash(const QDomElement &ele |
|
|
|
UBGraphicsWidgetItem *flashItem = mCurrentScene->addW3CWidget(QUrl::fromLocalFile(flashUrl)); |
|
|
|
UBGraphicsWidgetItem *flashItem = mCurrentScene->addW3CWidget(QUrl::fromLocalFile(flashUrl)); |
|
|
|
flashItem->setSourceUrl(urlPath); |
|
|
|
flashItem->setSourceUrl(urlPath); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
QString uuid = QUuid::createUuid().toString(); |
|
|
|
|
|
|
|
mRefToUuidMap.insert(element.attribute(aId), uuid); |
|
|
|
|
|
|
|
flashItem->setUuid(QUuid(uuid)); |
|
|
|
|
|
|
|
|
|
|
|
QTransform transform; |
|
|
|
QTransform transform; |
|
|
|
QString textTransform = element.attribute(aTransform); |
|
|
|
QString textTransform = element.attribute(aTransform); |
|
|
|
|
|
|
|
|
|
|
@ -867,14 +961,15 @@ bool UBCFFSubsetAdaptor::UBCFFSubsetReader::parseSvgAudio(const QDomElement &ele |
|
|
|
concreteUrl = QUrl::fromLocalFile(audioPath); |
|
|
|
concreteUrl = QUrl::fromLocalFile(audioPath); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
QUuid uuid = QUuid::createUuid(); |
|
|
|
QString uuid = QUuid::createUuid().toString(); |
|
|
|
|
|
|
|
mRefToUuidMap.insert(element.attribute(aId), uuid); |
|
|
|
|
|
|
|
|
|
|
|
QString destFile; |
|
|
|
QString destFile; |
|
|
|
bool b = UBPersistenceManager::persistenceManager()->addFileToDocument( |
|
|
|
bool b = UBPersistenceManager::persistenceManager()->addFileToDocument( |
|
|
|
mCurrentScene->document(),
|
|
|
|
mCurrentScene->document(),
|
|
|
|
concreteUrl.toLocalFile(),
|
|
|
|
concreteUrl.toLocalFile(),
|
|
|
|
UBPersistenceManager::audioDirectory, |
|
|
|
UBPersistenceManager::audioDirectory, |
|
|
|
uuid, |
|
|
|
QUuid(uuid), |
|
|
|
destFile); |
|
|
|
destFile); |
|
|
|
if (!b) |
|
|
|
if (!b) |
|
|
|
{ |
|
|
|
{ |
|
|
@ -883,6 +978,7 @@ bool UBCFFSubsetAdaptor::UBCFFSubsetReader::parseSvgAudio(const QDomElement &ele |
|
|
|
concreteUrl = QUrl::fromLocalFile(destFile); |
|
|
|
concreteUrl = QUrl::fromLocalFile(destFile); |
|
|
|
|
|
|
|
|
|
|
|
UBGraphicsMediaItem *audioItem = mCurrentScene->addAudio(concreteUrl, false); |
|
|
|
UBGraphicsMediaItem *audioItem = mCurrentScene->addAudio(concreteUrl, false); |
|
|
|
|
|
|
|
|
|
|
|
QTransform transform; |
|
|
|
QTransform transform; |
|
|
|
QString textTransform = parentOfAudio.attribute(aTransform); |
|
|
|
QString textTransform = parentOfAudio.attribute(aTransform); |
|
|
|
|
|
|
|
|
|
|
@ -920,15 +1016,15 @@ bool UBCFFSubsetAdaptor::UBCFFSubsetReader::parseSvgVideo(const QDomElement &ele |
|
|
|
concreteUrl = QUrl::fromLocalFile(videoPath); |
|
|
|
concreteUrl = QUrl::fromLocalFile(videoPath); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
QUuid uuid = QUuid::createUuid(); |
|
|
|
QString uuid = QUuid::createUuid().toString(); |
|
|
|
|
|
|
|
mRefToUuidMap.insert(element.attribute(aId), uuid); |
|
|
|
|
|
|
|
|
|
|
|
QString destFile; |
|
|
|
QString destFile; |
|
|
|
bool b = UBPersistenceManager::persistenceManager()->addFileToDocument( |
|
|
|
bool b = UBPersistenceManager::persistenceManager()->addFileToDocument( |
|
|
|
mCurrentScene->document(),
|
|
|
|
mCurrentScene->document(),
|
|
|
|
concreteUrl.toLocalFile(),
|
|
|
|
concreteUrl.toLocalFile(),
|
|
|
|
UBPersistenceManager::videoDirectory, |
|
|
|
UBPersistenceManager::videoDirectory, |
|
|
|
uuid, |
|
|
|
QUuid(uuid), |
|
|
|
destFile); |
|
|
|
destFile); |
|
|
|
if (!b) |
|
|
|
if (!b) |
|
|
|
{ |
|
|
|
{ |
|
|
@ -937,6 +1033,7 @@ bool UBCFFSubsetAdaptor::UBCFFSubsetReader::parseSvgVideo(const QDomElement &ele |
|
|
|
concreteUrl = QUrl::fromLocalFile(destFile); |
|
|
|
concreteUrl = QUrl::fromLocalFile(destFile); |
|
|
|
|
|
|
|
|
|
|
|
UBGraphicsMediaItem *videoItem = mCurrentScene->addVideo(concreteUrl, false); |
|
|
|
UBGraphicsMediaItem *videoItem = mCurrentScene->addVideo(concreteUrl, false); |
|
|
|
|
|
|
|
|
|
|
|
QTransform transform; |
|
|
|
QTransform transform; |
|
|
|
QString textTransform = element.attribute(aTransform); |
|
|
|
QString textTransform = element.attribute(aTransform); |
|
|
|
|
|
|
|
|
|
|
@ -980,8 +1077,8 @@ bool UBCFFSubsetAdaptor::UBCFFSubsetReader::parseSvgElement(const QDomElement &p |
|
|
|
{ |
|
|
|
{ |
|
|
|
QString tagName = parent.tagName(); |
|
|
|
QString tagName = parent.tagName(); |
|
|
|
if (parent.namespaceURI() != svgNS) { |
|
|
|
if (parent.namespaceURI() != svgNS) { |
|
|
|
qDebug() << "Incorrect namespace, error at content file, line number" << parent.lineNumber(); |
|
|
|
qWarning() << "Incorrect namespace, error at content file, line number" << parent.lineNumber(); |
|
|
|
return false; |
|
|
|
//return false;
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (tagName == tG && !parseGSection(parent)) return false; |
|
|
|
if (tagName == tG && !parseGSection(parent)) return false; |
|
|
@ -1027,8 +1124,8 @@ bool UBCFFSubsetAdaptor::UBCFFSubsetReader::parseSvgPageset(const QDomElement &p |
|
|
|
bool UBCFFSubsetAdaptor::UBCFFSubsetReader::parseIwbMeta(const QDomElement &element) |
|
|
|
bool UBCFFSubsetAdaptor::UBCFFSubsetReader::parseIwbMeta(const QDomElement &element) |
|
|
|
{ |
|
|
|
{ |
|
|
|
if (element.namespaceURI() != iwbNS) { |
|
|
|
if (element.namespaceURI() != iwbNS) { |
|
|
|
qDebug() << "incorrect meta namespace, incorrect document"; |
|
|
|
qWarning() << "incorrect meta namespace, incorrect document"; |
|
|
|
return false; |
|
|
|
//return false;
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return true; |
|
|
|
return true; |
|
|
@ -1036,8 +1133,8 @@ bool UBCFFSubsetAdaptor::UBCFFSubsetReader::parseIwbMeta(const QDomElement &elem |
|
|
|
bool UBCFFSubsetAdaptor::UBCFFSubsetReader::parseSvg(const QDomElement &svgSection) |
|
|
|
bool UBCFFSubsetAdaptor::UBCFFSubsetReader::parseSvg(const QDomElement &svgSection) |
|
|
|
{ |
|
|
|
{ |
|
|
|
if (svgSection.namespaceURI() != svgNS) { |
|
|
|
if (svgSection.namespaceURI() != svgNS) { |
|
|
|
qDebug() << "incorrect svg namespace, incorrect document"; |
|
|
|
qWarning() << "incorrect svg namespace, incorrect document"; |
|
|
|
return false; |
|
|
|
// return false;
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
parseSvgSectionAttr(svgSection); |
|
|
|
parseSvgSectionAttr(svgSection); |
|
|
@ -1052,15 +1149,92 @@ bool UBCFFSubsetAdaptor::UBCFFSubsetReader::parseSvg(const QDomElement &svgSecti |
|
|
|
return true; |
|
|
|
return true; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
bool UBCFFSubsetAdaptor::UBCFFSubsetReader::parseIwbGroup(QDomElement &parent) |
|
|
|
UBGraphicsGroupContainerItem *UBCFFSubsetAdaptor::UBCFFSubsetReader::parseIwbGroup(QDomElement &parent) |
|
|
|
{ |
|
|
|
{ |
|
|
|
//TODO. Create groups from elements parsed by parseIwbElement() function
|
|
|
|
//TODO. Create groups from elements parsed by parseIwbElement() function
|
|
|
|
if (parent.namespaceURI() != iwbNS) { |
|
|
|
if (parent.namespaceURI() != iwbNS) { |
|
|
|
qDebug() << "incorrect iwb group namespace, incorrect document"; |
|
|
|
qWarning() << "incorrect iwb group namespace, incorrect document"; |
|
|
|
return false; |
|
|
|
// return false;
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return true; |
|
|
|
UBGraphicsGroupContainerItem *group = new UBGraphicsGroupContainerItem(); |
|
|
|
|
|
|
|
QMultiMap<QString, UBGraphicsPolygonItem *> strokesGroupsContainer;
|
|
|
|
|
|
|
|
QList<QGraphicsItem *> groupContainer;
|
|
|
|
|
|
|
|
QString currentStrokeIdentifier; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
QDomElement currentStrokeElement = parent.firstChildElement();
|
|
|
|
|
|
|
|
while (!currentStrokeElement.isNull()) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
if (tGroup == currentStrokeElement.tagName()) |
|
|
|
|
|
|
|
group->addToGroup(parseIwbGroup(currentStrokeElement)); |
|
|
|
|
|
|
|
else |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
QString ref = currentStrokeElement.attribute(aRef); |
|
|
|
|
|
|
|
QString uuid = mRefToUuidMap[ref]; |
|
|
|
|
|
|
|
if (!uuid.isEmpty()) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
if (ref.size() > QUuid().toString().length()) // create stroke group
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
currentStrokeIdentifier = ref.left(QUuid().toString().length()-1); |
|
|
|
|
|
|
|
UBGraphicsPolygonItem *strokeByUuid = qgraphicsitem_cast<UBGraphicsPolygonItem *>(mCurrentScene->itemForUuid(QUuid(ref.right(QUuid().toString().length())))); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (strokeByUuid) |
|
|
|
|
|
|
|
strokesGroupsContainer.insert(currentStrokeIdentifier, strokeByUuid); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
else // single elements in group
|
|
|
|
|
|
|
|
groupContainer.append(mCurrentScene->itemForUuid(QUuid(uuid))); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
currentStrokeElement = currentStrokeElement.nextSiblingElement(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
foreach (QString key, strokesGroupsContainer.keys().toSet()) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
UBGraphicsStrokesGroup* pStrokesGroup = new UBGraphicsStrokesGroup(); |
|
|
|
|
|
|
|
UBGraphicsStroke *currentStroke = new UBGraphicsStroke(); |
|
|
|
|
|
|
|
foreach(UBGraphicsPolygonItem* poly, strokesGroupsContainer.values(key)) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
if (poly) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
mCurrentScene->removeItem(poly); |
|
|
|
|
|
|
|
mCurrentScene->removeItemFromDeletion(poly); |
|
|
|
|
|
|
|
poly->setStrokesGroup(pStrokesGroup); |
|
|
|
|
|
|
|
poly->setStroke(currentStroke); |
|
|
|
|
|
|
|
pStrokesGroup->addToGroup(poly); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if (currentStroke->polygons().empty()) |
|
|
|
|
|
|
|
delete currentStroke; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (pStrokesGroup->childItems().count()) |
|
|
|
|
|
|
|
mCurrentScene->addItem(pStrokesGroup); |
|
|
|
|
|
|
|
else |
|
|
|
|
|
|
|
delete pStrokesGroup; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (pStrokesGroup) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
QGraphicsItem *strokeGroup = qgraphicsitem_cast<QGraphicsItem *>(pStrokesGroup); |
|
|
|
|
|
|
|
groupContainer.append(strokeGroup); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
foreach(QGraphicsItem* item, groupContainer) |
|
|
|
|
|
|
|
group->addToGroup(item); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (group->childItems().count()) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
mCurrentScene->addItem(group); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (1 == group->childItems().count()) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
group->destroy(false); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return group; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
bool UBCFFSubsetAdaptor::UBCFFSubsetReader::strToBool(QString str) |
|
|
|
bool UBCFFSubsetAdaptor::UBCFFSubsetReader::strToBool(QString str) |
|
|
@ -1071,8 +1245,8 @@ bool UBCFFSubsetAdaptor::UBCFFSubsetReader::strToBool(QString str) |
|
|
|
bool UBCFFSubsetAdaptor::UBCFFSubsetReader::parseIwbElement(QDomElement &element) |
|
|
|
bool UBCFFSubsetAdaptor::UBCFFSubsetReader::parseIwbElement(QDomElement &element) |
|
|
|
{ |
|
|
|
{ |
|
|
|
if (element.namespaceURI() != iwbNS) { |
|
|
|
if (element.namespaceURI() != iwbNS) { |
|
|
|
qDebug() << "incorrect iwb element namespace, incorrect document"; |
|
|
|
qWarning() << "incorrect iwb element namespace, incorrect document"; |
|
|
|
return false; |
|
|
|
// return false;
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
bool locked = false; |
|
|
|
bool locked = false; |
|
|
|