Merge remote-tracking branch 'origin/develop' into claudio-dev

preferencesAboutTextFull
Claudio Valerio 12 years ago
commit 52103dde55
  1. 3
      plugins/cffadaptor/src/UBCFFAdaptor.cpp
  2. 14
      src/adaptors/UBCFFSubsetAdaptor.cpp
  3. 30
      src/domain/UBGraphicsScene.cpp

@ -1794,6 +1794,7 @@ bool UBCFFAdaptor::UBToCFFConverter::parseUBZPolygon(const QDomElement &element,
if (setCommonAttributesFromUBZ(element, iwbElementPart, svgElementPart)) if (setCommonAttributesFromUBZ(element, iwbElementPart, svgElementPart))
{ {
svgElementPart.setAttribute(aStroke, svgElementPart.attribute(aFill));
addSVGElementToResultModel(svgElementPart, dstSvgList, getElementLayer(element)); addSVGElementToResultModel(svgElementPart, dstSvgList, getElementLayer(element));
if (0 < iwbElementPart.attributes().count()) if (0 < iwbElementPart.attributes().count())
@ -1827,6 +1828,7 @@ bool UBCFFAdaptor::UBToCFFConverter::parseUBZPolyline(const QDomElement &element
if (setCommonAttributesFromUBZ(element, iwbElementPart, svgElementPart)) if (setCommonAttributesFromUBZ(element, iwbElementPart, svgElementPart))
{ {
svgElementPart.setAttribute(aStroke, svgElementPart.attribute(aFill));
addSVGElementToResultModel(svgElementPart, dstSvgList, getElementLayer(element)); addSVGElementToResultModel(svgElementPart, dstSvgList, getElementLayer(element));
if (0 < iwbElementPart.attributes().count()) if (0 < iwbElementPart.attributes().count())
@ -1859,6 +1861,7 @@ bool UBCFFAdaptor::UBToCFFConverter::parseUBZLine(const QDomElement &element, QM
if (setCommonAttributesFromUBZ(element, iwbElementPart, svgElementPart)) if (setCommonAttributesFromUBZ(element, iwbElementPart, svgElementPart))
{ {
svgElementPart.setAttribute(aStroke, svgElementPart.attribute(aFill));
addSVGElementToResultModel(svgElementPart, dstSvgList, getElementLayer(element)); addSVGElementToResultModel(svgElementPart, dstSvgList, getElementLayer(element));
if (0 < iwbElementPart.attributes().count()) if (0 < iwbElementPart.attributes().count())

@ -547,7 +547,7 @@ void UBCFFSubsetAdaptor::UBCFFSubsetReader::readTextCharAttr(const QDomElement &
{ {
QString fontSz = element.attribute(aFontSize); QString fontSz = element.attribute(aFontSize);
if (!fontSz.isNull()) { if (!fontSz.isNull()) {
qreal fontSize = fontSz.toDouble() * 72 / QApplication::desktop()->physicalDpiY(); qreal fontSize = fontSz.remove("pt").toDouble();
format.setFontPointSize(fontSize); format.setFontPointSize(fontSize);
} }
QString fontColorText = element.attribute(aFill); QString fontColorText = element.attribute(aFill);
@ -712,12 +712,14 @@ bool UBCFFSubsetAdaptor::UBCFFSubsetReader::parseSvgTextarea(const QDomElement &
blockFormat.setAlignment(Qt::AlignLeft); blockFormat.setAlignment(Qt::AlignLeft);
QTextCharFormat textFormat; QTextCharFormat textFormat;
textFormat.setFontPointSize(12 * 72 / QApplication::desktop()->physicalDpiY()); // default values
textFormat.setFontPointSize(12);
textFormat.setForeground(qApp->palette().foreground().color()); textFormat.setForeground(qApp->palette().foreground().color());
textFormat.setFontFamily("Arial"); textFormat.setFontFamily("Arial");
textFormat.setFontItalic(false); textFormat.setFontItalic(false);
textFormat.setFontWeight(QFont::Normal); textFormat.setFontWeight(QFont::Normal);
// readed values
readTextBlockAttr(element, blockFormat); readTextBlockAttr(element, blockFormat);
readTextCharAttr(element, textFormat); readTextCharAttr(element, textFormat);
@ -1140,7 +1142,13 @@ void UBCFFSubsetAdaptor::UBCFFSubsetReader::repositionSvgItem(QGraphicsItem *ite
QTransform tr = item->sceneTransform(); QTransform tr = item->sceneTransform();
item->setTransform(rTransform.scale(fullScaleX, fullScaleY), true); item->setTransform(rTransform.scale(fullScaleX, fullScaleY), true);
tr = item->sceneTransform(); tr = item->sceneTransform();
QPoint pos ((int)((x + mShiftVector.x() + (newVector - oldVector).x()) * mVBTransFactor), (int)((y +mShiftVector.y() + (newVector - oldVector).y()) * mVBTransFactor)); QPoint pos;
if (UBGraphicsTextItem::Type == item->type())
pos = QPoint((int)((x + mShiftVector.x() + (newVector - oldVector).x())), (int)((y +mShiftVector.y() + (newVector - oldVector).y()) * mVBTransFactor));
else
pos = QPoint((int)((x + mShiftVector.x() + (newVector - oldVector).x()) * mVBTransFactor), (int)((y +mShiftVector.y() + (newVector - oldVector).y()) * mVBTransFactor));
item->setPos(pos); item->setPos(pos);
} }

@ -775,7 +775,9 @@ void UBGraphicsScene::eraseLineTo(const QPointF &pEndPoint, const qreal &pWidth)
QList<QGraphicsItem*> collidItems = items(eraserBoundingRect, Qt::IntersectsItemBoundingRect); QList<QGraphicsItem*> collidItems = items(eraserBoundingRect, Qt::IntersectsItemBoundingRect);
QList<UBGraphicsPolygonItem*> intersectedItems; QList<UBGraphicsPolygonItem*> intersectedItems;
QList<QPolygonF> intersectedPolygons; QList<QList<QPolygonF>> intersectedPolygons;
//qDebug() << "Start, eraser is " << eraserPath;
#pragma omp parallel for #pragma omp parallel for
for(int i=0; i<collidItems.size(); i++) for(int i=0; i<collidItems.size(); i++)
@ -786,22 +788,26 @@ void UBGraphicsScene::eraseLineTo(const QPointF &pEndPoint, const qreal &pWidth)
QPainterPath itemPainterPath; QPainterPath itemPainterPath;
itemPainterPath.addPolygon(pi->sceneTransform().map(pi->polygon())); itemPainterPath.addPolygon(pi->sceneTransform().map(pi->polygon()));
if (eraserPath.contains(itemPainterPath)) if (eraserPath.contains(itemPainterPath))
{ {
#pragma omp critical #pragma omp critical
{ {
//qDebug() << itemPainterPath << " - delete!";
// Compele remove item // Compele remove item
intersectedItems << pi; intersectedItems << pi;
intersectedPolygons << QPolygonF(); intersectedPolygons << QList<QPolygonF>();
} }
} }
else if (eraserPath.intersects(itemPainterPath)) else if (eraserPath.intersects(itemPainterPath))
{ {
QPainterPath newPath = itemPainterPath.subtracted(eraserPath); QPainterPath newPath = itemPainterPath.subtracted(eraserPath);
#pragma omp critical #pragma omp critical
{ {
//qDebug() << itemPainterPath << " - modify to - " << newPath;
intersectedItems << pi; intersectedItems << pi;
intersectedPolygons << newPath.simplified().toFillPolygon(pi->sceneTransform().inverted()); intersectedPolygons << newPath.simplified().toFillPolygons(pi->sceneTransform().inverted());
} }
} }
} }
@ -814,7 +820,23 @@ void UBGraphicsScene::eraseLineTo(const QPointF &pEndPoint, const qreal &pWidth)
} }
else else
{ {
intersectedItems[i]->setPolygon(intersectedPolygons[i]); UBGraphicsPolygonItem *pi = intersectedItems[i];
for(int j = 0; j < intersectedPolygons[i].size(); j++)
{
QPolygonF p = intersectedPolygons[i][j];
if (j==0)
pi->setPolygon(intersectedPolygons[i][j]);
else
{
UBGraphicsPolygonItem* polygonItem = new UBGraphicsPolygonItem(intersectedPolygons[i][j], pi->parentItem());
pi->copyItemParameters(polygonItem);
polygonItem->setStroke(pi->stroke());
polygonItem->setStrokesGroup(pi->strokesGroup());
pi->strokesGroup()->addToGroup(polygonItem);
}
}
} }
} }

Loading…
Cancel
Save