When working with qlandkartgegt I met some problems and created small
patches to fix them.
The first patch fixes processing of route calculation reply from
MapQuest. If a route request contains intermediate points, the reply
includes several <leg> elements. The original code processes only the
first leg of all. The patch processes all legs.
The second patch fixes numerous warnings "Warning: QImage::setColor:
Index out of bound" and crash in displaying Garmin maps from
http://velo100.ru/gps/download (site in Russian) with stranger.typ.
diff -r -u qlandkartegt-1.7.6/src/CRoute.cpp qlandkartegt-1.7.6.new/src/CRoute.cpp
--- qlandkartegt-1.7.6/src/CRoute.cpp 2013-03-27 13:40:34.000000000 +0400
+++ qlandkartegt-1.7.6.new/src/CRoute.cpp 2014-05-24 08:35:55.433128949 +0400
@@ -469,14 +469,18 @@
ttime = time.text().toUInt();
// build list of maneuvers
- QDomElement legs = route.firstChildElement("legs");
- QDomElement leg = legs.firstChildElement("leg");
- QDomNodeList maneuvers = leg.firstChildElement("maneuvers").elementsByTagName("maneuver");
- const qint32 M = maneuvers.size();
- for(int i = 0; i < M; i++)
+ QDomNodeList legs = route.firstChildElement("legs").elementsByTagName("leg");
+ const qint32 L = legs.size();
+ for(int j = 0; j < L; j++)
{
- QDomNode maneuver = maneuvers.item(i);
- instructions << maneuver.firstChildElement("narrative").text();
+ QDomNode leg = legs.item(j);
+ QDomNodeList maneuvers = leg.firstChildElement("maneuvers").elementsByTagName("maneuver");
+ const qint32 M = maneuvers.size();
+ for(int i = 0; i < M; i++)
+ {
+ QDomNode maneuver = maneuvers.item(i);
+ instructions << maneuver.firstChildElement("narrative").text();
+ }
}
// read the shape
diff -r -u qlandkartegt-1.7.7/src/CMapTDB.cpp qlandkartegt-1.7.7.new/src/CMapTDB.cpp
--- qlandkartegt-1.7.7/src/CMapTDB.cpp 2014-06-16 14:52:49.000000000 +0400
+++ qlandkartegt-1.7.7.new/src/CMapTDB.cpp 2015-01-05 11:20:34.076049445 +0300
@@ -3000,7 +3000,7 @@
void CMapTDB::drawLabels(QPainter& p, const QVector<strlbl_t> &lbls)
{
QFont f = CResources::self().getMapFont();
- QVector<QFont> fonts(5, f);
+ QVector<QFont> fonts(8, f);
fonts[IGarminTyp::eSmall].setPointSize(f.pointSize() - 2);
fonts[IGarminTyp::eLarge].setPointSize(f.pointSize() + 2);
diff -r -u qlandkartegt-1.7.7/src/IGarminTyp.cpp qlandkartegt-1.7.7.new/src/IGarminTyp.cpp
--- qlandkartegt-1.7.7/src/IGarminTyp.cpp 2015-01-05 11:25:30.007360223 +0300
+++ qlandkartegt-1.7.7.new/src/IGarminTyp.cpp 2015-01-05 11:22:34.000000000 +0300
@@ -1030,6 +1030,8 @@
reg = reg >> 28;
bits -= 28;
}
+ if(maxcolor > 256)
+ maxcolor=256;
for(; i < maxcolor; ++i)
{
img.setColor(i,qRgba(0,0,0,0));
@@ -1045,6 +1047,8 @@
in >> b >> g >> r;
img.setColor(i, qRgb(r,g,b));
}
+ if(maxcolor > 256)
+ maxcolor=256;
for(; i < maxcolor; ++i)
{
img.setColor(i,qRgba(0,0,0,0));
------------------------------------------------------------------------------
Dive into the World of Parallel Programming! The Go Parallel Website,
sponsored by Intel and developed in partnership with Slashdot Media, is your
hub for all things parallel software development, from weekly thought
leadership blogs to news, videos, case studies, tutorials and more. Take a
look and join the conversation now. http://goparallel.sourceforge.net
_______________________________________________
Qlandkartegt-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/qlandkartegt-users