SANKORE-459

preferencesAboutTextFull
Anatoly Mihalchenko 13 years ago
parent 7f26289b50
commit 9c8a49f8c6
  1. 20
      src/adaptors/UBSvgSubsetAdaptor.h
  2. 12
      src/frameworks/UBGeometryUtils.cpp
  3. 2
      src/frameworks/UBGeometryUtils.h

@ -164,19 +164,29 @@ class UBSvgSubsetAdaptor
void strokeToSvgPolyline(UBGraphicsStroke* stroke, bool groupHoldsInfo); void strokeToSvgPolyline(UBGraphicsStroke* stroke, bool groupHoldsInfo);
void strokeToSvgPolygon(UBGraphicsStroke* stroke, bool groupHoldsInfo); void strokeToSvgPolygon(UBGraphicsStroke* stroke, bool groupHoldsInfo);
inline QString pointsToSvgPointsAttribute(const QVector<QPointF> points) inline QString pointsToSvgPointsAttribute(QVector<QPointF> points)
{ {
const QVector<QPointF> crashedPoints = UBGeometryUtils::crashPointList(points); UBGeometryUtils::crashPointList(points);
int pointsCount = crashedPoints.size(); int pointsCount = points.size();
QString svgPoints; QString svgPoints;
int length = 0; int length = 0;
QString sBuf; QString sBuf;
for(int j = 0; j < pointsCount; j++) for(int j = 0; j < pointsCount; j++)
{ {
const QPointF & point = crashedPoints.at(j); sBuf = "%1,%2 ";
sBuf.sprintf("%.2f,%.2f ", point.x(), point.y()); const QPointF & point = points.at(j);
QString temp1 = "%1", temp2 = "%2";
temp1 = temp1.arg(point.x());
temp2 = temp2.arg(point.y());
QLocale loc(QLocale::C);
sBuf = sBuf.arg(loc.toFloat(temp1)).arg(loc.toFloat(temp2));
svgPoints.insert(length, sBuf); svgPoints.insert(length, sBuf);
length += sBuf.length(); length += sBuf.length();
} }

@ -205,22 +205,20 @@ QRectF UBGeometryUtils::lineToInnerRect(const QLineF& pLine, const qreal& pWidth
} }
QVector<QPointF> UBGeometryUtils::crashPointList(const QVector<QPointF> points) void UBGeometryUtils::crashPointList(QVector<QPointF> &points)
{ {
QVector<QPointF> result(points); // QVector<QPointF> result(points);
int position = 1; int position = 1;
while(position < result.size()) while(position < points.size())
{ {
if (result.at(position) == result.at(position - 1)) if (points.at(position) == points.at(position - 1))
{ {
result.remove(position); points.remove(position);
} }
else else
{ {
++position; ++position;
} }
} }
return result;
} }

@ -36,7 +36,7 @@ class UBGeometryUtils
static QPointF pointConstrainedInRect(QPointF point, QRectF rect); static QPointF pointConstrainedInRect(QPointF point, QRectF rect);
static QPoint pointConstrainedInRect(QPoint point, QRect rect); static QPoint pointConstrainedInRect(QPoint point, QRect rect);
static QVector<QPointF> crashPointList(const QVector<QPointF> points); static void crashPointList(QVector<QPointF> &points);
}; };
#endif /* UBGEOMETRYUTILS_H_ */ #endif /* UBGEOMETRYUTILS_H_ */

Loading…
Cancel
Save