@ -498,6 +498,18 @@ UBGraphicsScene* UBSvgSubsetAdaptor::UBSvgSubsetReader::loadScene()
{
{
mGroupLightBackgroundColor . setNamedColor ( ubFillOnLightBackground . toString ( ) ) ;
mGroupLightBackgroundColor . setNamedColor ( ubFillOnLightBackground . toString ( ) ) ;
}
}
QStringRef ubUuid = mXmlReader . attributes ( ) . value ( mNamespaceUri , " uuid " ) ;
if ( ! ubUuid . isNull ( ) )
strokesGroup - > setUuid ( ubUuid . toString ( ) ) ;
else
strokesGroup - > setUuid ( QUuid : : createUuid ( ) ) ;
QString uuid_stripped = strokesGroup - > uuid ( ) . toString ( ) . replace ( " } " , " " ) . replace ( " { " , " " ) ;
if ( ! mStrokesList . contains ( uuid_stripped ) )
mStrokesList . insert ( uuid_stripped , strokesGroup ) ;
}
}
else if ( mXmlReader . name ( ) = = " polygon " | | mXmlReader . name ( ) = = " line " )
else if ( mXmlReader . name ( ) = = " polygon " | | mXmlReader . name ( ) = = " line " )
{
{
@ -524,13 +536,15 @@ UBGraphicsScene* UBSvgSubsetAdaptor::UBSvgSubsetReader::loadScene()
if ( ! mStrokesList . contains ( parentId ) ) {
if ( ! mStrokesList . contains ( parentId ) ) {
group = new UBGraphicsStrokesGroup ( ) ;
group = new UBGraphicsStrokesGroup ( ) ;
mStrokesList . insert ( parentId , group ) ;
mStrokesList . insert ( parentId , group ) ;
currentStroke = new UBGraphicsStroke ( ) ;
group - > setTransform ( polygonItem - > transform ( ) ) ;
group - > setTransform ( polygonItem - > transform ( ) ) ;
UBGraphicsItem : : assignZValue ( group , polygonItem - > zValue ( ) ) ;
UBGraphicsItem : : assignZValue ( group , polygonItem - > zValue ( ) ) ;
}
}
else
else
group = mStrokesList . value ( parentId ) ;
group = mStrokesList . value ( parentId ) ;
if ( ! currentStroke )
currentStroke = new UBGraphicsStroke ( ) ;
if ( polygonItem - > transform ( ) . isIdentity ( ) )
if ( polygonItem - > transform ( ) . isIdentity ( ) )
polygonItem - > setTransform ( group - > transform ( ) ) ;
polygonItem - > setTransform ( group - > transform ( ) ) ;
@ -546,23 +560,33 @@ UBGraphicsScene* UBSvgSubsetAdaptor::UBSvgSubsetReader::loadScene()
{
{
QList < UBGraphicsPolygonItem * > polygonItems = polygonItemsFromPolylineSvg ( mScene - > isDarkBackground ( ) ? Qt : : white : Qt : : black ) ;
QList < UBGraphicsPolygonItem * > polygonItems = polygonItemsFromPolylineSvg ( mScene - > isDarkBackground ( ) ? Qt : : white : Qt : : black ) ;
QString parentId = QUuid : : createUuid ( ) . toString ( ) ;
QString parentId = mXmlReader . attributes ( ) . value ( mNamespaceUri , " parent " ) . toString ( ) ;
qDebug ( ) < < " parentID = " < < parentId ;
if ( parentId . isEmpty ( ) & & strokesGroup )
parentId = strokesGroup - > uuid ( ) . toString ( ) ;
if ( parentId . isEmpty ( ) )
parentId = QUuid : : createUuid ( ) . toString ( ) ;
foreach ( UBGraphicsPolygonItem * polygonItem , polygonItems )
foreach ( UBGraphicsPolygonItem * polygonItem , polygonItems )
{
{
polygonItem - > setData ( UBGraphicsItemData : : ItemLayerType , QVariant ( UBItemLayerType : : Graphic ) ) ;
polygonItem - > setData ( UBGraphicsItemData : : ItemLayerType , QVariant ( UBItemLayerType : : Graphic ) ) ;
UBGraphicsStrokesGroup * group ;
UBGraphicsStrokesGroup * group ;
if ( ! mStrokesList . contains ( parentId ) ) {
if ( ! mStrokesList . contains ( parentId ) ) {
group = new UBGraphicsStrokesGroup ( ) ;
group = new UBGraphicsStrokesGroup ( ) ;
mStrokesList . insert ( parentId , group ) ;
mStrokesList . insert ( parentId , group ) ;
currentStroke = new UBGraphicsStroke ( ) ;
group - > setTransform ( polygonItem - > transform ( ) ) ;
group - > setTransform ( polygonItem - > transform ( ) ) ;
UBGraphicsItem : : assignZValue ( group , polygonItem - > zValue ( ) ) ;
UBGraphicsItem : : assignZValue ( group , polygonItem - > zValue ( ) ) ;
}
}
else
else
group = mStrokesList . value ( parentId ) ;
group = mStrokesList . value ( parentId ) ;
if ( ! currentStroke )
currentStroke = new UBGraphicsStroke ( ) ;
if ( polygonItem - > transform ( ) . isIdentity ( ) )
if ( polygonItem - > transform ( ) . isIdentity ( ) )
polygonItem - > setTransform ( group - > transform ( ) ) ;
polygonItem - > setTransform ( group - > transform ( ) ) ;
@ -861,6 +885,8 @@ UBGraphicsScene* UBSvgSubsetAdaptor::UBSvgSubsetReader::loadScene()
mGroupHasInfo = false ;
mGroupHasInfo = false ;
mGroupDarkBackgroundColor = QColor ( ) ;
mGroupDarkBackgroundColor = QColor ( ) ;
mGroupLightBackgroundColor = QColor ( ) ;
mGroupLightBackgroundColor = QColor ( ) ;
strokesGroup = NULL ;
currentStroke = NULL ;
}
}
}
}
}
}
@ -1127,6 +1153,9 @@ bool UBSvgSubsetAdaptor::UBSvgSubsetWriter::persistScene(int pageIndex)
, " fill-on-dark-background " , colorOnDarkBackground . name ( ) ) ;
, " fill-on-dark-background " , colorOnDarkBackground . name ( ) ) ;
mXmlWriter . writeAttribute ( UBSettings : : uniboardDocumentNamespaceUri
mXmlWriter . writeAttribute ( UBSettings : : uniboardDocumentNamespaceUri
, " fill-on-light-background " , colorOnLightBackground . name ( ) ) ;
, " fill-on-light-background " , colorOnLightBackground . name ( ) ) ;
mXmlWriter . writeAttribute ( UBSettings : : uniboardDocumentNamespaceUri , " uuid " , UBStringUtils : : toCanonicalUuid ( sg - > uuid ( ) ) ) ;
qDebug ( ) < < " Attributes written " ;
qDebug ( ) < < " Attributes written " ;
groupHoldsInfo = true ;
groupHoldsInfo = true ;
@ -1442,6 +1471,11 @@ void UBSvgSubsetAdaptor::UBSvgSubsetWriter::strokeToSvgPolyline(UBGraphicsStroke
, " fill-on-light-background " , firstPolygonItem - > colorOnLightBackground ( ) . name ( ) ) ;
, " fill-on-light-background " , firstPolygonItem - > colorOnLightBackground ( ) . name ( ) ) ;
}
}
mXmlWriter . writeAttribute ( UBSettings : : uniboardDocumentNamespaceUri , " uuid " , UBStringUtils : : toCanonicalUuid ( firstPolygonItem - > uuid ( ) ) ) ;
if ( firstPolygonItem - > parentItem ( ) ) {
mXmlWriter . writeAttribute ( UBSettings : : uniboardDocumentNamespaceUri , " parent " , UBStringUtils : : toCanonicalUuid ( UBGraphicsItem : : getOwnUuid ( firstPolygonItem - > strokesGroup ( ) ) ) ) ;
}
mXmlWriter . writeEndElement ( ) ;
mXmlWriter . writeEndElement ( ) ;
}
}
}
}