22
22
#include " qgslogger.h"
23
23
#include < QTextStream>
24
24
#include < QDomDocument>
25
+ #include < QPixmap> // to find out screen resolution
25
26
26
27
typedef QgsProjectVersion PFV;
27
28
@@ -30,7 +31,9 @@ QgsProjectFileTransform::transform QgsProjectFileTransform::transformers[] = {
30
31
{PFV (0 ,8 ,0 ), PFV (0 ,8 ,1 ), &QgsProjectFileTransform::transformNull},
31
32
{PFV (0 ,8 ,1 ), PFV (0 ,9 ,0 ), &QgsProjectFileTransform::transform081to090},
32
33
{PFV (0 ,9 ,0 ), PFV (0 ,9 ,1 ), &QgsProjectFileTransform::transformNull},
33
- {PFV (0 ,9 ,1 ), PFV (0 ,10 ,0 ), &QgsProjectFileTransform::transform091to0100}
34
+ {PFV (0 ,9 ,1 ), PFV (0 ,10 ,0 ), &QgsProjectFileTransform::transform091to0100},
35
+ {PFV (0 ,9 ,2 ), PFV (0 ,10 ,0 ), &QgsProjectFileTransform::transformNull},
36
+ {PFV (0 ,10 ,0 ), PFV (0 ,11 ,0 ), &QgsProjectFileTransform::transform0100to0110}
34
37
};
35
38
36
39
bool QgsProjectFileTransform::updateRevision (QgsProjectVersion newVersion)
@@ -234,3 +237,43 @@ void QgsProjectFileTransform::transform091to0100()
234
237
235
238
};
236
239
240
+ void QgsProjectFileTransform::transform0100to0110 ()
241
+ {
242
+ if ( ! mDom .isNull () )
243
+ {
244
+ // Change 'outlinewidth' in QgsSymbol
245
+ QPixmap thePixmap;
246
+ int screenDpi = (thePixmap.logicalDpiX () + thePixmap.logicalDpiY ()) / 2 ;
247
+ double widthScaleFactor = 25.4 / screenDpi;
248
+
249
+ QDomNodeList outlineWidthList = mDom .elementsByTagName (" outlinewidth" );
250
+ for (int i = 0 ; i < outlineWidthList.size (); ++i)
251
+ {
252
+ // calculate new width
253
+ QDomElement currentOutlineElem = outlineWidthList.at (i).toElement ();
254
+ double outlineWidth = currentOutlineElem.text ().toDouble ();
255
+ outlineWidth *= widthScaleFactor;
256
+
257
+ // replace old text node
258
+ QDomNode outlineTextNode = currentOutlineElem.firstChild ();
259
+ QDomText newOutlineText = mDom .createTextNode (QString::number (outlineWidth));
260
+ currentOutlineElem.replaceChild (newOutlineText, outlineTextNode);
261
+
262
+ }
263
+
264
+ // Change 'pointsize' in QgsSymbol
265
+ QDomNodeList pointSizeList = mDom .elementsByTagName (" pointsize" );
266
+ for (int i = 0 ; i < pointSizeList.size (); ++i)
267
+ {
268
+ // calculate new size
269
+ QDomElement currentPointSizeElem = pointSizeList.at (i).toElement ();
270
+ double pointSize = currentPointSizeElem.text ().toDouble ();
271
+ pointSize *= widthScaleFactor;
272
+
273
+ // replace old text node
274
+ QDomNode pointSizeTextNode = currentPointSizeElem.firstChild ();
275
+ QDomText newPointSizeText = mDom .createTextNode (QString::number ((int )pointSize));
276
+ currentPointSizeElem.replaceChild (newPointSizeText, pointSizeTextNode);
277
+ }
278
+ }
279
+ }
0 commit comments