Backup of the lines as object

preferencesAboutTextFull
shibakaneki 13 years ago
parent 6f9472ad91
commit a77036d6fb
  1. 28
      src/adaptors/UBSvgSubsetAdaptor.cpp

@ -43,6 +43,7 @@
#include "board/UBBoardView.h" #include "board/UBBoardView.h"
#include "board/UBBoardController.h" #include "board/UBBoardController.h"
#include "board/UBDrawingController.h"
#include "frameworks/UBFileSystemUtils.h" #include "frameworks/UBFileSystemUtils.h"
#include "frameworks/UBStringUtils.h" #include "frameworks/UBStringUtils.h"
@ -312,6 +313,8 @@ UBGraphicsScene* UBSvgSubsetAdaptor::UBSvgSubsetReader::loadScene()
mFileVersion = 40100; // default to 4.1.0 mFileVersion = 40100; // default to 4.1.0
UBGraphicsStroke* annotationGroup = 0; UBGraphicsStroke* annotationGroup = 0;
UBGraphicsStrokesGroup* strokesGroup = 0;
UBDrawingController* dc = UBDrawingController::drawingController();
while (!mXmlReader.atEnd()) while (!mXmlReader.atEnd())
{ {
@ -434,6 +437,10 @@ UBGraphicsScene* UBSvgSubsetAdaptor::UBSvgSubsetReader::loadScene()
else else
annotationGroup = new UBGraphicsStroke(); annotationGroup = new UBGraphicsStroke();
if(eDrawingMode_Vector == dc->drawingMode()){
strokesGroup = new UBGraphicsStrokesGroup();
}
QStringRef ubZValue = mXmlReader.attributes().value(mNamespaceUri, "z-value"); QStringRef ubZValue = mXmlReader.attributes().value(mNamespaceUri, "z-value");
if (!ubZValue.isNull()) if (!ubZValue.isNull())
@ -476,7 +483,13 @@ UBGraphicsScene* UBSvgSubsetAdaptor::UBSvgSubsetReader::loadScene()
polygonItem->setStroke(annotationGroup); polygonItem->setStroke(annotationGroup);
} }
scene->addItem(polygonItem); if(eDrawingMode_Vector == dc->drawingMode()){
if(strokesGroup){
strokesGroup->addToGroup(polygonItem);
}
}else{
scene->addItem(polygonItem);
}
polygonItem->setData(UBGraphicsItemData::ItemLayerType, QVariant(UBItemLayerType::Graphic)); polygonItem->setData(UBGraphicsItemData::ItemLayerType, QVariant(UBItemLayerType::Graphic));
@ -495,7 +508,13 @@ UBGraphicsScene* UBSvgSubsetAdaptor::UBSvgSubsetReader::loadScene()
polygonItem->setStroke(annotationGroup); polygonItem->setStroke(annotationGroup);
} }
scene->addItem(polygonItem); if(eDrawingMode_Vector == dc->drawingMode()){
if(strokesGroup){
strokesGroup->addToGroup(polygonItem);
}
}else{
scene->addItem(polygonItem);
}
polygonItem->setData(UBGraphicsItemData::ItemLayerType, QVariant(UBItemLayerType::Graphic)); polygonItem->setData(UBGraphicsItemData::ItemLayerType, QVariant(UBItemLayerType::Graphic));
polygonItem->show(); polygonItem->show();
@ -817,6 +836,10 @@ UBGraphicsScene* UBSvgSubsetAdaptor::UBSvgSubsetReader::loadScene()
{ {
if (mXmlReader.name() == "g") if (mXmlReader.name() == "g")
{ {
if(strokesGroup && scene){
scene->addItem(strokesGroup);
}
if (annotationGroup) if (annotationGroup)
{ {
if (!annotationGroup->polygons().empty()) if (!annotationGroup->polygons().empty())
@ -932,7 +955,6 @@ bool UBSvgSubsetAdaptor::UBSvgSubsetWriter::persistScene()
{ {
QGraphicsItem *item = items.takeFirst(); QGraphicsItem *item = items.takeFirst();
UBGraphicsPolygonItem *polygonItem = qgraphicsitem_cast<UBGraphicsPolygonItem*> (item); UBGraphicsPolygonItem *polygonItem = qgraphicsitem_cast<UBGraphicsPolygonItem*> (item);
if (polygonItem && polygonItem->isVisible()) if (polygonItem && polygonItem->isVisible())

Loading…
Cancel
Save