Hi Oliver,

I would suggest to kill the dinosaur and replace Dictionary by QMap. Can you
try this? And if track coloring still works as expected I commit that to the
repo.

yup, that does it, patch is attached.

Michael


Oliver





List,



I'm trying to bring the latest to MacPorts, but there is a compiler error

with Xcode 5.1:



https://trac.macports.org/ticket/44302#comment:3



can someone help with this error?



Thanks and regards

Michael
--- src/CGpx.cpp.orig   2014-04-02 19:23:46.000000000 +0200
+++ src/CGpx.cpp        2014-07-19 14:43:03.000000000 +0200
@@ -67,7 +67,7 @@
     for (int i=0;;++i)
     {
         QColor trackColor = CTrack::lineColors[i];
-        QString colorName = colorMap.left(trackColor);
+        QString colorName = colorMap.key(trackColor);
         if (!colorName.isEmpty()) trackColorMap.insert(colorName, i);
         if (trackColor == Qt::transparent) break;
     }
@@ -80,13 +80,13 @@
 }
 
 
-const Dictionary<QString, QColor>& CGpx::getColorMap() const
+const QMap<QString, QColor>& CGpx::getColorMap() const
 {
     return colorMap;
 }
 
 
-const Dictionary<QString, int>& CGpx::getTrackColorMap() const
+const QMap<QString, int>& CGpx::getTrackColorMap() const
 {
     return trackColorMap;
 }
--- src/CGpx.h.orig     2014-04-02 19:23:47.000000000 +0200
+++ src/CGpx.h  2014-07-19 11:39:24.000000000 +0200
@@ -24,8 +24,6 @@
 #include <QString>
 #include <QtXml/QDomDocument>
 
-#include "Dictionary.h"
-
 /// handle geo data from GPX files
 class CGpx : public QObject, public QDomDocument
 {
@@ -68,10 +66,11 @@
         void save(const QString& filename);
         void makeExtensions();
 
-        static QMap<QString,QDomElement> mapChildElements(const QDomNode& 
parent);
+        static QMap<QString,QDomElement> mapChildElements(const QDomNode&
+                                                          parent);
 
-        const Dictionary<QString, QColor>& getColorMap() const;
-        const Dictionary<QString, int>& getTrackColorMap() const;
+        const QMap<QString, QColor>& getColorMap() const;
+        const QMap<QString, int>& getTrackColorMap() const;
 
         QDomElement &getExtensions() { return extensions; }
         gpx_version version() { return file_version; }
@@ -80,8 +79,8 @@
     protected:
         void writeMetadata();
 
-        Dictionary<QString, QColor> colorMap;
-        Dictionary<QString, int> trackColorMap;
+        QMap<QString, QColor> colorMap;
+        QMap<QString, int> trackColorMap;
 
     private:
         QDomElement extensions;
--- src/CMakeLists.txt.orig     2014-05-18 15:36:36.000000000 +0200
+++ src/CMakeLists.txt  2014-07-21 21:45:56.000000000 +0200
@@ -463,7 +463,6 @@
     CImageViewer.h
     CMapRmp.h
     CMapDEMSlopeSetup.h
-    Dictionary.h
     QFileExt.h
     IExchange.h
     CExchangeGarmin.h
--- src/CTrackDB.cpp.orig       2014-04-02 19:23:46.000000000 +0200
+++ src/CTrackDB.cpp    2014-07-19 14:49:25.000000000 +0200
@@ -233,7 +233,7 @@
                 tmpelem = trackextensionmap.value(CGpx::gpxx_ns + ":" + 
"DisplayColor");
                 if (!tmpelem.isNull())
                 {
-                    int colorID = gpx.getTrackColorMap().right(tmpelem.text(), 
-1);
+                    int colorID = gpx.getTrackColorMap().value(tmpelem.text(), 
-1);
                     if (colorID >= 0) track->setColor(colorID);
                 }
             }
@@ -488,7 +488,7 @@
         QDomElement color = gpx.createElement("gpxx:DisplayColor");
         gpxx_ext.appendChild(color);
 
-        QString colname = gpx.getTrackColorMap().left(track->getColorIdx());
+        QString colname = gpx.getTrackColorMap().key(track->getColorIdx());
         QDomText _color_ = gpx.createTextNode(colname);
         color.appendChild(_color_);
 
------------------------------------------------------------------------------
Want fast and easy access to all the code in your enterprise? Index and
search up to 200,000 lines of code with a free copy of Black Duck
Code Sight - the same software that powers the world's largest code
search on Ohloh, the Black Duck Open Hub! Try it now.
http://p.sf.net/sfu/bds
_______________________________________________
Qlandkartegt-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/qlandkartegt-users

Reply via email to