Skip to content

Commit 85efc38

Browse files
authored
Merge pull request #62 from OgreTransporter/master
Various fixes
2 parents 6905910 + b2fd891 commit 85efc38

6 files changed

Lines changed: 42 additions & 16 deletions

File tree

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
cmake_minimum_required(VERSION 3.0 FATAL_ERROR)
1+
cmake_minimum_required(VERSION 3.10 FATAL_ERROR)
22

33
project(QGeoView LANGUAGES C CXX)
44

lib/include/QGeoView/QGVGlobal.h

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,9 @@ class QGV_LIB_DECL GeoPos
121121
static QString lonToString(double lon, const QString& format = "[+-]d");
122122
static QString latToString(double lat, const QString& format = "[+-]d");
123123

124+
bool operator==(const GeoPos& rhs);
125+
bool operator!=(const GeoPos& rhs);
126+
124127
private:
125128
bool mEmpty;
126129
double mLat;
@@ -141,14 +144,17 @@ class QGV_LIB_DECL GeoRect
141144
GeoPos bottomLeft() const;
142145
GeoPos bottomRight() const;
143146
double lonLeft() const;
144-
double lonRigth() const;
147+
double lonRight() const;
145148
double latBottom() const;
146149
double latTop() const;
147150

148151
bool contains(GeoPos const& pos) const;
149152
bool contains(GeoRect const& rect) const;
150153
bool intersects(GeoRect const& rect) const;
151154

155+
bool operator==(const GeoRect& rhs);
156+
bool operator!=(const GeoRect& rhs);
157+
152158
private:
153159
GeoPos mTopLeft;
154160
GeoPos mBottomRight;

lib/src/QGVGlobal.cpp

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,16 @@ QString GeoPos::latToString(double lat, const QString& format)
156156
return result;
157157
}
158158

159+
bool GeoPos::operator==(const GeoPos& rhs)
160+
{
161+
return (mEmpty && rhs.mEmpty) || (mLat == rhs.mLat && mLon == rhs.mLon);
162+
}
163+
164+
bool GeoPos::operator!=(const GeoPos& rhs)
165+
{
166+
return !(*this == rhs);
167+
}
168+
159169
GeoRect::GeoRect()
160170
{
161171
}
@@ -202,7 +212,7 @@ double GeoRect::lonLeft() const
202212
return mTopLeft.longitude();
203213
}
204214

205-
double GeoRect::lonRigth() const
215+
double GeoRect::lonRight() const
206216
{
207217
return mBottomRight.longitude();
208218
}
@@ -219,13 +229,13 @@ double GeoRect::latTop() const
219229

220230
bool GeoRect::contains(GeoPos const& pos) const
221231
{
222-
return (lonLeft() <= pos.longitude() && pos.longitude() < lonRigth() && latBottom() < pos.latitude() &&
232+
return (lonLeft() <= pos.longitude() && pos.longitude() < lonRight() && latBottom() < pos.latitude() &&
223233
pos.latitude() <= latTop());
224234
}
225235

226236
bool GeoRect::contains(GeoRect const& rect) const
227237
{
228-
return (lonLeft() <= rect.lonLeft() && rect.lonRigth() <= lonRigth() && latBottom() <= rect.latBottom() &&
238+
return (lonLeft() <= rect.lonLeft() && rect.lonRight() <= lonRight() && latBottom() <= rect.latBottom() &&
229239
rect.latTop() <= latTop());
230240
}
231241

@@ -236,6 +246,16 @@ bool GeoRect::intersects(const GeoRect& rect) const
236246
rect.contains(bottomLeft()) || rect.contains(bottomRight());
237247
}
238248

249+
bool GeoRect::operator==(const GeoRect& rhs)
250+
{
251+
return mTopLeft == rhs.mTopLeft && mBottomRight == rhs.mBottomRight;
252+
}
253+
254+
bool GeoRect::operator!=(const GeoRect& rhs)
255+
{
256+
return !(*this == rhs);
257+
}
258+
239259
GeoTilePos::GeoTilePos()
240260
: mZoom(-1)
241261
{

lib/src/QGVLayerBDGEx.cpp

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,13 @@
2323
namespace {
2424
// clang-format off
2525
const QStringList URLTemplates = {
26-
"http://bdgex.eb.mil.br/mapcache?request=GetMap&service=WMS&version=1.1.1&layers=ctm25&srs=EPSG%3A4326&bbox=lonLeft,latBottom,lonRigth,latTop&width=WIDTH&height=HEIGHT&format=image%2Fpng",
27-
"http://bdgex.eb.mil.br/mapcache?request=GetMap&service=WMS&version=1.1.1&layers=ctm50&srs=EPSG%3A4326&bbox=lonLeft,latBottom,lonRigth,latTop&width=WIDTH&height=HEIGHT&format=image%2Fpng",
28-
"http://bdgex.eb.mil.br/mapcache?request=GetMap&service=WMS&version=1.1.1&layers=ctm100&srs=EPSG%3A4326&bbox=lonLeft,latBottom,lonRigth,latTop&width=WIDTH&height=HEIGHT&format=image%2Fpng",
29-
"http://bdgex.eb.mil.br/mapcache?request=GetMap&service=WMS&version=1.1.1&layers=ctm250&srs=EPSG%3A4326&bbox=lonLeft,latBottom,lonRigth,latTop&width=WIDTH&height=HEIGHT&format=image%2Fpng",
30-
"http://bdgex.eb.mil.br/mapcache?request=GetMap&service=WMS&version=1.1.1&layers=ctm250&srs=EPSG%3A4326&bbox=lonLeft,latBottom,lonRigth,latTop&width=WIDTH&height=HEIGHT&format=image%2Fpng",
31-
"http://bdgex.eb.mil.br/mapcache?request=GetMap&service=WMS&version=1.1.1&layers=ctmmultiescalas&srs=EPSG%3A4326&bbox=lonLeft,latBottom,lonRigth,latTop&width=WIDTH&height=HEIGHT&format=image%2Fpng",
32-
"http://bdgex.eb.mil.br/mapcache?request=GetMap&service=WMS&version=1.1.1&layers=ctmmultiescalas_mercator&srs=EPSG%3A3857&bbox=lonLeft,latBottom,lonRigth,latTop&width=WIDTH&height=HEIGHT&format=image%2Fpng"
26+
"http://bdgex.eb.mil.br/mapcache?request=GetMap&service=WMS&version=1.1.1&layers=ctm25&srs=EPSG%3A4326&bbox=lonLeft,latBottom,lonRight,latTop&width=WIDTH&height=HEIGHT&format=image%2Fpng",
27+
"http://bdgex.eb.mil.br/mapcache?request=GetMap&service=WMS&version=1.1.1&layers=ctm50&srs=EPSG%3A4326&bbox=lonLeft,latBottom,lonRight,latTop&width=WIDTH&height=HEIGHT&format=image%2Fpng",
28+
"http://bdgex.eb.mil.br/mapcache?request=GetMap&service=WMS&version=1.1.1&layers=ctm100&srs=EPSG%3A4326&bbox=lonLeft,latBottom,lonRight,latTop&width=WIDTH&height=HEIGHT&format=image%2Fpng",
29+
"http://bdgex.eb.mil.br/mapcache?request=GetMap&service=WMS&version=1.1.1&layers=ctm250&srs=EPSG%3A4326&bbox=lonLeft,latBottom,lonRight,latTop&width=WIDTH&height=HEIGHT&format=image%2Fpng",
30+
"http://bdgex.eb.mil.br/mapcache?request=GetMap&service=WMS&version=1.1.1&layers=ctm250&srs=EPSG%3A4326&bbox=lonLeft,latBottom,lonRight,latTop&width=WIDTH&height=HEIGHT&format=image%2Fpng",
31+
"http://bdgex.eb.mil.br/mapcache?request=GetMap&service=WMS&version=1.1.1&layers=ctmmultiescalas&srs=EPSG%3A4326&bbox=lonLeft,latBottom,lonRight,latTop&width=WIDTH&height=HEIGHT&format=image%2Fpng",
32+
"http://bdgex.eb.mil.br/mapcache?request=GetMap&service=WMS&version=1.1.1&layers=ctmmultiescalas_mercator&srs=EPSG%3A3857&bbox=lonLeft,latBottom,lonRight,latTop&width=WIDTH&height=HEIGHT&format=image%2Fpng"
3333
};
3434
// clang-format on
3535
}
@@ -74,9 +74,9 @@ QString QGVLayerBDGEx::tilePosToUrl(const QGV::GeoTilePos& tilePos) const
7474
QGV::GeoRect rect = tilePos.toGeoRect();
7575
url.replace("lonLeft", QString::number(rect.lonLeft(), 'f', 6));
7676
url.replace("latBottom", QString::number(rect.latBottom(), 'f', 6));
77-
url.replace("lonRigth", QString::number(rect.lonRigth(), 'f', 6));
77+
url.replace("lonRight", QString::number(rect.lonRight(), 'f', 6));
7878
url.replace("latTop", QString::number(rect.latTop(), 'f', 6));
79-
double m_width = rect.lonRigth() - rect.lonLeft();
79+
double m_width = rect.lonRight() - rect.lonLeft();
8080
double m_height = rect.latTop() - rect.latBottom();
8181
double ratio = m_width / m_height;
8282
int width_pixels = 900;

samples/fun/mainwindow.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ QPixmap MainWindow::createQGVImage() const
101101
QGVLayer* MainWindow::createQGVLayer() const
102102
{
103103
const auto target = targetQGVArea();
104-
const auto sizeLon = target.lonLeft() - target.lonRigth();
104+
const auto sizeLon = target.lonLeft() - target.lonRight();
105105
const auto sizeLat = target.latTop() - target.latBottom();
106106

107107
/*

samples/shared/helpers.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ QGV::GeoRect Helpers::randRect(QGVMap* geoMap, const QGV::GeoRect& targetArea)
5151
QGV::GeoPos Helpers::randPos(const QGV::GeoRect& targetArea)
5252
{
5353
const double latRange = targetArea.latTop() - targetArea.latBottom();
54-
const double lonRange = targetArea.lonRigth() - targetArea.lonLeft();
54+
const double lonRange = targetArea.lonRight() - targetArea.lonLeft();
5555
static const int range = 1000;
5656

5757
return { targetArea.latBottom() + latRange * (randomInt(0, range)) / range,

0 commit comments

Comments
 (0)