Renamed KKJ class to KKJGridCoordinate common_services
authorAki Koskinen <maemo@akikoskinen.info>
Sat, 17 Apr 2010 17:53:31 +0000 (20:53 +0300)
committerAki Koskinen <maemo@akikoskinen.info>
Sat, 17 Apr 2010 17:56:35 +0000 (20:56 +0300)
19 files changed:
src/coordinatesystemtransformer.cpp
src/coordinatesystemtransformer.h
src/kkj.cpp [deleted file]
src/kkj.h [deleted file]
src/kkj_p.h [deleted file]
src/kkjgridcoordinate.cpp [new file with mode: 0644]
src/kkjgridcoordinate.h [new file with mode: 0644]
src/kkjgridcoordinate_p.h [new file with mode: 0644]
src/src.pro
tests/tests.pro
tests/ut_coordinatesystemtransformer/ut_coordinatesystemtransformer.cpp
tests/ut_coordinatesystemtransformer/ut_coordinatesystemtransformer.pro
tests/ut_kkj/.gitignore [deleted file]
tests/ut_kkj/ut_kkj.cpp [deleted file]
tests/ut_kkj/ut_kkj.pro [deleted file]
tests/ut_kkjgridcoordinate/.gitignore [new file with mode: 0644]
tests/ut_kkjgridcoordinate/ut_kkjgridcoordinate.cpp [new file with mode: 0644]
tests/ut_kkjgridcoordinate/ut_kkjgridcoordinate.pro [new file with mode: 0644]
tests/util/stlhelpers.h

index 1632133..5e0c3f4 100644 (file)
@@ -155,7 +155,7 @@ public:
      * @param kkj the KKJ coordinate
      * @return the zone number or -1 on error
      */
-    static int getZoneNumberFromEasting(const KKJ &kkj);
+    static int getZoneNumberFromEasting(const KKJGridCoordinate &kkj);
 
     /**
      * Determines a zone number from the KKJ longitude value. If the longitude is not within any of
@@ -192,7 +192,7 @@ const double KKJZone::KKJ_ZONE_INFO[6][2] = { {18.0,  500000.0},  // zone 0
                                               {33.0, 5500000.0} };// zone 5
 
 
-int KKJZone::getZoneNumberFromEasting(const KKJ &kkj) {
+int KKJZone::getZoneNumberFromEasting(const KKJGridCoordinate &kkj) {
     int zoneNumber = floor(kkj.easting() / 1000000.0);
     if (zoneNumber < MIN_ZONE || zoneNumber > MAX_ZONE) {
         zoneNumber = -1;
@@ -274,7 +274,7 @@ KKJGeoCoordinate transformToKKJGeoCoordinate(const QGeoCoordinate &fromCoordinat
  * @param zoneNumber the zone number in which the input coordinate resides
  * @return the transformed coordinate
  */
-KKJ transformToKKJGridCoordinate(const KKJGeoCoordinate &fromCoordinate) {
+KKJGridCoordinate transformToKKJGridCoordinate(const KKJGeoCoordinate &fromCoordinate) {
     int zoneNumber = KKJZone::getZoneNumberFromLongitude(fromCoordinate);
     double Lo = radians(fromCoordinate.longitude()) - radians(KKJZone::getCentralMeridianOfZone(zoneNumber));
     double cosLa = cos(radians(fromCoordinate.latitude()));
@@ -290,7 +290,7 @@ KKJ transformToKKJGridCoordinate(const KKJGeoCoordinate &fromCoordinate) {
 
     unsigned int outY = A1 * LaF - A2 * sin(2.0 * LaF) + A3 * sin(4.0 * LaF) - A4 * sin(6.0 * LaF);
     unsigned int outX = HayfordEllipsoid::c * log(t + sqrt(1.0 + t * t)) + 500000.0 + zoneNumber * 1000000.0;
-    return KKJ(outY, outX);
+    return KKJGridCoordinate(outY, outX);
 }
 
 /**
@@ -298,7 +298,7 @@ KKJ transformToKKJGridCoordinate(const KKJGeoCoordinate &fromCoordinate) {
  * @param fromCoordinate the input coordinate
  * @return the transformed coordinate
  */
-KKJGeoCoordinate transformToKKJGeoCoordinate(const KKJ &fromCoordinate) {
+KKJGeoCoordinate transformToKKJGeoCoordinate(const KKJGridCoordinate &fromCoordinate) {
     // Scan iteratively the target area, until find matching
     // KKJ coordinate value. Area is defined with Hayford Ellipsoid.
     double minLo = 18.5;
@@ -315,7 +315,7 @@ KKJGeoCoordinate transformToKKJGeoCoordinate(const KKJ &fromCoordinate) {
         double deltaLa = maxLa - minLa;
         ret.setLongitude(minLo + 0.5 * deltaLo);
         ret.setLatitude(minLa + 0.5 * deltaLa);
-        KKJ kkj = transformToKKJGridCoordinate(ret);
+        KKJGridCoordinate kkj = transformToKKJGridCoordinate(ret);
         if (kkj.northing() < fromCoordinate.northing()) {
             minLa = minLa + 0.45 * deltaLa;
         } else {
@@ -335,13 +335,13 @@ KKJGeoCoordinate transformToKKJGeoCoordinate(const KKJ &fromCoordinate) {
 }
 
 
-KKJ CoordinateSystemTransformer::transformToKKJ(const QGeoCoordinate &fromCoordinate)
+KKJGridCoordinate CoordinateSystemTransformer::transformToKKJ(const QGeoCoordinate &fromCoordinate)
 {
     KKJGeoCoordinate tmpKKJ = transformToKKJGeoCoordinate(fromCoordinate);
     return transformToKKJGridCoordinate(tmpKKJ);
 }
 
-QGeoCoordinate CoordinateSystemTransformer::transformToWGS84(const KKJ &fromCoordinate)
+QGeoCoordinate CoordinateSystemTransformer::transformToWGS84(const KKJGridCoordinate &fromCoordinate)
 {
     KKJGeoCoordinate tmpKKJ = transformToKKJGeoCoordinate(fromCoordinate);
     return transformToWGS84GeoCoordinate(tmpKKJ);
index b8f9dfe..4481d64 100644 (file)
@@ -1,7 +1,7 @@
 #ifndef COORDINATESYSTEMTRANSFORMER_H
 #define COORDINATESYSTEMTRANSFORMER_H
 
-#include "kkj.h"
+#include "kkjgridcoordinate.h"
 #include <QGeoCoordinate>
 
 /**
@@ -16,7 +16,7 @@ public:
      * @param fromCoordinate the WGS84 coordinate that will be transformed.
      * @return the transformed coordinate in KKJ coordinate system.
      */
-    static KKJ transformToKKJ(const QTM_NAMESPACE::QGeoCoordinate &fromCoordinate);
+    static KKJGridCoordinate transformToKKJ(const QTM_NAMESPACE::QGeoCoordinate &fromCoordinate);
 
     /**
      * Makes a coordinate transformation from KKJ rectangular grid coordinate system
@@ -24,7 +24,7 @@ public:
      * @param fromCoordinate the KKJ coordinate that will be transformed.
      * @return the transformed coordinate in WGS84 coordinate system.
      */
-    static QTM_NAMESPACE::QGeoCoordinate transformToWGS84(const KKJ &fromCoordinate);
+    static QTM_NAMESPACE::QGeoCoordinate transformToWGS84(const KKJGridCoordinate &fromCoordinate);
 };
 
 #endif // COORDINATESYSTEMTRANSFORMER_H
diff --git a/src/kkj.cpp b/src/kkj.cpp
deleted file mode 100644 (file)
index 5948293..0000000
+++ /dev/null
@@ -1,59 +0,0 @@
-#include "kkj.h"
-#include "kkj_p.h"
-
-KKJPrivate::~KKJPrivate()
-{
-}
-
-void KKJPrivate::init(unsigned int northing, unsigned int easting)
-{
-    this->northing = northing;
-    this->easting = easting;
-}
-
-
-KKJ::KKJ(unsigned int northing, unsigned int easting) :
-        d_ptr(new KKJPrivate)
-{
-    Q_D(KKJ);
-    d->q_ptr = this;
-    d->init(northing, easting);
-}
-
-KKJ::KKJ(KKJPrivate &dd, unsigned int northing, unsigned int easting) :
-        d_ptr(&dd)
-{
-    Q_D(KKJ);
-    d->q_ptr = this;
-    d->init(northing, easting);
-}
-
-KKJ::~KKJ()
-{
-}
-
-bool KKJ::operator==(const KKJ &rhs) const
-{
-    return northing() == rhs.northing() && easting() == rhs.easting();
-}
-
-KKJ& KKJ::operator=(const KKJ &rhs)
-{
-    Q_D(KKJ);
-    d->northing = rhs.northing();
-    d->easting = rhs.easting();
-
-    return *this;
-}
-
-unsigned int KKJ::northing() const
-{
-    Q_D(const KKJ);
-    return d->northing;
-}
-
-unsigned int KKJ::easting() const
-{
-    Q_D(const KKJ);
-    return d->easting;
-}
diff --git a/src/kkj.h b/src/kkj.h
deleted file mode 100644 (file)
index 898cc5f..0000000
--- a/src/kkj.h
+++ /dev/null
@@ -1,73 +0,0 @@
-#ifndef KKJ_H
-#define KKJ_H
-
-#include <QtGlobal>
-
-class KKJPrivate;
-
-/**
- * A class representing the Finnish KKJ coordinate.
- * This is the rectangular grid coordinate version.
- */
-class KKJ
-{
-public:
-    /**
-     * Constructs a new KKJ coordinate with the given values.
-     * @param northing the northing coordinate.
-     * @param easting the easting coordinate.
-     */
-    KKJ(unsigned int northing, unsigned int easting);
-
-    /**
-     * Destructor.
-     */
-    virtual ~KKJ();
-
-    /**
-     * Equals operator.
-     * Tests the equality of this coordinate and another coordinate and returns \c true
-     * if the coordinates represent the same position.
-     * @param rhs the other coordinate to test against.
-     * @return \c true if the coordinates are the same, \c false otherwise.
-     */
-    bool operator==(const KKJ &rhs) const;
-
-    /**
-     * Assignment operator.
-     * @param rhs the object that is copied.
-     * @return this object.
-     */
-    KKJ& operator=(const KKJ &rhs);
-
-    /**
-     * Returns the northing of the coordinate.
-     * @return the northing.
-     */
-    unsigned int northing() const;
-
-    /**
-     * Returns the easting of the coordinate.
-     * @return the easting.
-     */
-    unsigned int easting() const;
-
-protected:
-    /**
-     * Constructs a new KKJ coordinate with the given values.
-     * @param dd a private implementation member.
-     * @param northing the northing coordinate.
-     * @param easting the easting coordinate.
-     */
-    KKJ(KKJPrivate &dd, unsigned int northing, unsigned int easting);
-
-
-private:
-    /// Pointer to the private member
-    KKJPrivate *const d_ptr;
-
-    Q_DECLARE_PRIVATE(KKJ)
-
-};
-
-#endif // KKJ_H
diff --git a/src/kkj_p.h b/src/kkj_p.h
deleted file mode 100644 (file)
index 61b7fa5..0000000
+++ /dev/null
@@ -1,40 +0,0 @@
-#ifndef KKJ_P_H
-#define KKJ_P_H
-
-#include <QtGlobal>
-
-class KKJ;
-
-/**
- * A private member class for class KKJ.
- */
-class KKJPrivate
-{
-public:
-    /**
-     * Destructor.
-     */
-    virtual ~KKJPrivate();
-
-private:
-    /**
-     * Initializes the private class.
-     * @param northing the northing of the coordinate.
-     * @param easting the easting of the coordinate.
-     */
-    void init(unsigned int northing, unsigned int easting);
-
-    /// The northing of the coordinate.
-    unsigned int northing;
-
-    /// The easting of the coordinate.
-    unsigned int easting;
-
-    /// The concrete class owning this private implementation member.
-    KKJ *q_ptr;
-
-    Q_DECLARE_PUBLIC(KKJ)
-
-};
-
-#endif // KKJ_P_H
diff --git a/src/kkjgridcoordinate.cpp b/src/kkjgridcoordinate.cpp
new file mode 100644 (file)
index 0000000..f7ae6bf
--- /dev/null
@@ -0,0 +1,59 @@
+#include "kkjgridcoordinate.h"
+#include "kkjgridcoordinate_p.h"
+
+KKJGridCoordinatePrivate::~KKJGridCoordinatePrivate()
+{
+}
+
+void KKJGridCoordinatePrivate::init(unsigned int northing, unsigned int easting)
+{
+    this->northing = northing;
+    this->easting = easting;
+}
+
+
+KKJGridCoordinate::KKJGridCoordinate(unsigned int northing, unsigned int easting) :
+        d_ptr(new KKJGridCoordinatePrivate)
+{
+    Q_D(KKJGridCoordinate);
+    d->q_ptr = this;
+    d->init(northing, easting);
+}
+
+KKJGridCoordinate::KKJGridCoordinate(KKJGridCoordinatePrivate &dd, unsigned int northing, unsigned int easting) :
+        d_ptr(&dd)
+{
+    Q_D(KKJGridCoordinate);
+    d->q_ptr = this;
+    d->init(northing, easting);
+}
+
+KKJGridCoordinate::~KKJGridCoordinate()
+{
+}
+
+bool KKJGridCoordinate::operator==(const KKJGridCoordinate &rhs) const
+{
+    return northing() == rhs.northing() && easting() == rhs.easting();
+}
+
+KKJGridCoordinate& KKJGridCoordinate::operator=(const KKJGridCoordinate &rhs)
+{
+    Q_D(KKJGridCoordinate);
+    d->northing = rhs.northing();
+    d->easting = rhs.easting();
+
+    return *this;
+}
+
+unsigned int KKJGridCoordinate::northing() const
+{
+    Q_D(const KKJGridCoordinate);
+    return d->northing;
+}
+
+unsigned int KKJGridCoordinate::easting() const
+{
+    Q_D(const KKJGridCoordinate);
+    return d->easting;
+}
diff --git a/src/kkjgridcoordinate.h b/src/kkjgridcoordinate.h
new file mode 100644 (file)
index 0000000..75c69d2
--- /dev/null
@@ -0,0 +1,73 @@
+#ifndef KKJGRIDCOORDINATE_H
+#define KKJGRIDCOORDINATE_H
+
+#include <QtGlobal>
+
+class KKJGridCoordinatePrivate;
+
+/**
+ * A class representing the Finnish KKJ coordinate.
+ * This is the rectangular grid coordinate version.
+ */
+class KKJGridCoordinate
+{
+public:
+    /**
+     * Constructs a new KKJ coordinate with the given values.
+     * @param northing the northing coordinate.
+     * @param easting the easting coordinate.
+     */
+    KKJGridCoordinate(unsigned int northing, unsigned int easting);
+
+    /**
+     * Destructor.
+     */
+    virtual ~KKJGridCoordinate();
+
+    /**
+     * Equals operator.
+     * Tests the equality of this coordinate and another coordinate and returns \c true
+     * if the coordinates represent the same position.
+     * @param rhs the other coordinate to test against.
+     * @return \c true if the coordinates are the same, \c false otherwise.
+     */
+    bool operator==(const KKJGridCoordinate &rhs) const;
+
+    /**
+     * Assignment operator.
+     * @param rhs the object that is copied.
+     * @return this object.
+     */
+    KKJGridCoordinate& operator=(const KKJGridCoordinate &rhs);
+
+    /**
+     * Returns the northing of the coordinate.
+     * @return the northing.
+     */
+    unsigned int northing() const;
+
+    /**
+     * Returns the easting of the coordinate.
+     * @return the easting.
+     */
+    unsigned int easting() const;
+
+protected:
+    /**
+     * Constructs a new KKJ coordinate with the given values.
+     * @param dd a private implementation member.
+     * @param northing the northing coordinate.
+     * @param easting the easting coordinate.
+     */
+    KKJGridCoordinate(KKJGridCoordinatePrivate &dd, unsigned int northing, unsigned int easting);
+
+
+private:
+    /// Pointer to the private member
+    KKJGridCoordinatePrivate *const d_ptr;
+
+    Q_DECLARE_PRIVATE(KKJGridCoordinate)
+
+};
+
+#endif // KKJGRIDCOORDINATE_H
diff --git a/src/kkjgridcoordinate_p.h b/src/kkjgridcoordinate_p.h
new file mode 100644 (file)
index 0000000..bc09530
--- /dev/null
@@ -0,0 +1,40 @@
+#ifndef KKJGRIDCOORDINATE_P_H
+#define KKJGRIDCOORDINATE_P_H
+
+#include <QtGlobal>
+
+class KKJGridCoordinate;
+
+/**
+ * A private member class for class KKJGridCoordinate.
+ */
+class KKJGridCoordinatePrivate
+{
+public:
+    /**
+     * Destructor.
+     */
+    virtual ~KKJGridCoordinatePrivate();
+
+private:
+    /**
+     * Initializes the private class.
+     * @param northing the northing of the coordinate.
+     * @param easting the easting of the coordinate.
+     */
+    void init(unsigned int northing, unsigned int easting);
+
+    /// The northing of the coordinate.
+    unsigned int northing;
+
+    /// The easting of the coordinate.
+    unsigned int easting;
+
+    /// The concrete class owning this private implementation member.
+    KKJGridCoordinate *q_ptr;
+
+    Q_DECLARE_PUBLIC(KKJGridCoordinate)
+
+};
+
+#endif // KKJGRIDCOORDINATE_P_H
index 854efac..3f7c5dc 100644 (file)
@@ -2,11 +2,14 @@ TEMPLATE = lib
 TARGET = ptascommon
 
 INSTALL_HEADERS = \
-    kkj.h
+    coordinatesystemtransformer.h \
+    kkjgridcoordinate.h \
+
 PRIVATE_HEADERS = \
-    kkj_p.h
+    kkjgridcoordinate_p.h
 HEADERS += \
     $$INSTALL_HEADERS \
     $$PRIVATE_HEADERS
 SOURCES += \
-    kkj.cpp
+    coordinatesystemtransformer.cpp \
+    kkjgridcoordinate.cpp
index 573f500..dec74ce 100644 (file)
@@ -1,7 +1,7 @@
 TEMPLATE = subdirs
 SUBDIRS = \
     ut_coordinatesystemtransformer \
-    ut_kkj
+    ut_kkjgridcoordinate
 
 check.target = check
 check.CONFIG = recursive
index 4658d60..691bfa3 100644 (file)
 class CoordinateSystemTransformerTest : public ::testing::Test
 {
 public:
-    QList<QPair<QTM_NAMESPACE::QGeoCoordinate, KKJ> > testData;
+    QList<QPair<QTM_NAMESPACE::QGeoCoordinate, KKJGridCoordinate> > testData;
 
     CoordinateSystemTransformerTest() {
-        testData << qMakePair(QTM_NAMESPACE::QGeoCoordinate(60.2528, 25.02051), KKJ(6682815, 2556686));
-        testData << qMakePair(QTM_NAMESPACE::QGeoCoordinate(60.18713, 24.832), KKJ(6675352, 2546340));
-        testData << qMakePair(QTM_NAMESPACE::QGeoCoordinate(60.27414, 25.04465), KKJ(6685213, 2557985));
-        testData << qMakePair(QTM_NAMESPACE::QGeoCoordinate(60.2507, 25.01767), KKJ(6682578, 2556532));
-        testData << qMakePair(QTM_NAMESPACE::QGeoCoordinate(60.2902, 24.44804), KKJ(6686629, 2524959));
-        testData << qMakePair(QTM_NAMESPACE::QGeoCoordinate(60.35033, 25.06718), KKJ(6693721, 2559094));
-        testData << qMakePair(QTM_NAMESPACE::QGeoCoordinate(60.25471, 25.02373), KKJ(6683030, 2556861));
-        testData << qMakePair(QTM_NAMESPACE::QGeoCoordinate(60.25417, 25.0242), KKJ(6682971, 2556888));
-        testData << qMakePair(QTM_NAMESPACE::QGeoCoordinate(60.39737, 25.08981), KKJ(6698983, 2560257));
-        testData << qMakePair(QTM_NAMESPACE::QGeoCoordinate(60.28923, 25.12709), KKJ(6686969, 2562518));
-        testData << qMakePair(QTM_NAMESPACE::QGeoCoordinate(60.1727, 24.65643), KKJ(6673635, 2536615));
-        testData << qMakePair(QTM_NAMESPACE::QGeoCoordinate(60.35133, 25.06764), KKJ(6693833, 2559118));
-        testData << qMakePair(QTM_NAMESPACE::QGeoCoordinate(60.34949, 25.06874), KKJ(6693629, 2559182));
-        testData << qMakePair(QTM_NAMESPACE::QGeoCoordinate(60.25119, 25.02518), KKJ(6682640, 2556947));
-        testData << qMakePair(QTM_NAMESPACE::QGeoCoordinate(60.25196, 25.02294), KKJ(6682723, 2556822));
-        testData << qMakePair(QTM_NAMESPACE::QGeoCoordinate(60.34929, 25.06705), KKJ(6693605, 2559089));
-        testData << qMakePair(QTM_NAMESPACE::QGeoCoordinate(60.18855, 24.83393), KKJ(6675512, 2546445));
-        testData << qMakePair(QTM_NAMESPACE::QGeoCoordinate(60.25091, 25.02547), KKJ(6682609, 2556964));
-        testData << qMakePair(QTM_NAMESPACE::QGeoCoordinate(60.25321, 25.0215), KKJ(6682861, 2556740));
-        testData << qMakePair(QTM_NAMESPACE::QGeoCoordinate(60.35291, 25.06559), KKJ(6694007, 2559002));
+        testData << qMakePair(QTM_NAMESPACE::QGeoCoordinate(60.2528, 25.02051), KKJGridCoordinate(6682815, 2556686));
+        testData << qMakePair(QTM_NAMESPACE::QGeoCoordinate(60.18713, 24.832), KKJGridCoordinate(6675352, 2546340));
+        testData << qMakePair(QTM_NAMESPACE::QGeoCoordinate(60.27414, 25.04465), KKJGridCoordinate(6685213, 2557985));
+        testData << qMakePair(QTM_NAMESPACE::QGeoCoordinate(60.2507, 25.01767), KKJGridCoordinate(6682578, 2556532));
+        testData << qMakePair(QTM_NAMESPACE::QGeoCoordinate(60.2902, 24.44804), KKJGridCoordinate(6686629, 2524959));
+        testData << qMakePair(QTM_NAMESPACE::QGeoCoordinate(60.35033, 25.06718), KKJGridCoordinate(6693721, 2559094));
+        testData << qMakePair(QTM_NAMESPACE::QGeoCoordinate(60.25471, 25.02373), KKJGridCoordinate(6683030, 2556861));
+        testData << qMakePair(QTM_NAMESPACE::QGeoCoordinate(60.25417, 25.0242), KKJGridCoordinate(6682971, 2556888));
+        testData << qMakePair(QTM_NAMESPACE::QGeoCoordinate(60.39737, 25.08981), KKJGridCoordinate(6698983, 2560257));
+        testData << qMakePair(QTM_NAMESPACE::QGeoCoordinate(60.28923, 25.12709), KKJGridCoordinate(6686969, 2562518));
+        testData << qMakePair(QTM_NAMESPACE::QGeoCoordinate(60.1727, 24.65643), KKJGridCoordinate(6673635, 2536615));
+        testData << qMakePair(QTM_NAMESPACE::QGeoCoordinate(60.35133, 25.06764), KKJGridCoordinate(6693833, 2559118));
+        testData << qMakePair(QTM_NAMESPACE::QGeoCoordinate(60.34949, 25.06874), KKJGridCoordinate(6693629, 2559182));
+        testData << qMakePair(QTM_NAMESPACE::QGeoCoordinate(60.25119, 25.02518), KKJGridCoordinate(6682640, 2556947));
+        testData << qMakePair(QTM_NAMESPACE::QGeoCoordinate(60.25196, 25.02294), KKJGridCoordinate(6682723, 2556822));
+        testData << qMakePair(QTM_NAMESPACE::QGeoCoordinate(60.34929, 25.06705), KKJGridCoordinate(6693605, 2559089));
+        testData << qMakePair(QTM_NAMESPACE::QGeoCoordinate(60.18855, 24.83393), KKJGridCoordinate(6675512, 2546445));
+        testData << qMakePair(QTM_NAMESPACE::QGeoCoordinate(60.25091, 25.02547), KKJGridCoordinate(6682609, 2556964));
+        testData << qMakePair(QTM_NAMESPACE::QGeoCoordinate(60.25321, 25.0215), KKJGridCoordinate(6682861, 2556740));
+        testData << qMakePair(QTM_NAMESPACE::QGeoCoordinate(60.35291, 25.06559), KKJGridCoordinate(6694007, 2559002));
     }
 };
 
 TEST_F(CoordinateSystemTransformerTest, WGS84CoordinatesToKKJCoordinates)
 {
-    QListIterator<QPair<QTM_NAMESPACE::QGeoCoordinate, KKJ> > it(testData);
+    QListIterator<QPair<QTM_NAMESPACE::QGeoCoordinate, KKJGridCoordinate> > it(testData);
     while (it.hasNext()) {
-        const QPair<QTM_NAMESPACE::QGeoCoordinate, KKJ> &datum = it.next();
-        KKJ result = CoordinateSystemTransformer::transformToKKJ(datum.first);
-        KKJ expected = datum.second;
+        const QPair<QTM_NAMESPACE::QGeoCoordinate, KKJGridCoordinate> &datum = it.next();
+        KKJGridCoordinate result = CoordinateSystemTransformer::transformToKKJ(datum.first);
+        KKJGridCoordinate expected = datum.second;
         // Allow one unit difference from the expected
         int northDiff = abs((long)expected.northing() - (long)result.northing());
         int eastDiff = abs((long)expected.easting() - (long)result.easting());
@@ -53,9 +53,9 @@ TEST_F(CoordinateSystemTransformerTest, WGS84CoordinatesToKKJCoordinates)
 
 TEST_F(CoordinateSystemTransformerTest, KKJCoordinatesToWGS84Coordinates)
 {
-    QListIterator<QPair<QTM_NAMESPACE::QGeoCoordinate, KKJ> > it(testData);
+    QListIterator<QPair<QTM_NAMESPACE::QGeoCoordinate, KKJGridCoordinate> > it(testData);
     while (it.hasNext()) {
-        const QPair<QTM_NAMESPACE::QGeoCoordinate, KKJ> &datum = it.next();
+        const QPair<QTM_NAMESPACE::QGeoCoordinate, KKJGridCoordinate> &datum = it.next();
         QTM_NAMESPACE::QGeoCoordinate result = CoordinateSystemTransformer::transformToWGS84(datum.second);
         QTM_NAMESPACE::QGeoCoordinate expected = datum.first;
         // Allow small difference from the expected
index 213f01d..68a67df 100644 (file)
@@ -13,10 +13,10 @@ MOC_DIR = .moc
 SOURCES += \
     ut_coordinatesystemtransformer.cpp \
     $$SRCDIR/coordinatesystemtransformer.cpp \
-    $$SRCDIR/kkj.cpp
+    $$SRCDIR/kkjgridcoordinate.cpp
 HEADERS += \
     $$SRCDIR/coordinatesystemtransformer.h \
-    $$SRCDIR/kkj.h
+    $$SRCDIR/kkjgridcoordinate.h
 
 include(../gmock.pri)
 include(../check.pri)
diff --git a/tests/ut_kkj/.gitignore b/tests/ut_kkj/.gitignore
deleted file mode 100644 (file)
index a044d76..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-Makefile
-ut_kkj
diff --git a/tests/ut_kkj/ut_kkj.cpp b/tests/ut_kkj/ut_kkj.cpp
deleted file mode 100644 (file)
index 6988ac6..0000000
+++ /dev/null
@@ -1,62 +0,0 @@
-#include "kkj.h"
-
-#include <gmock/gmock.h>
-#include <gtest/gtest.h>
-
-#include "stlhelpers.h"
-
-class KKJTest : public ::testing::Test
-{
-public:
-    const unsigned int northing;
-    const unsigned int easting;
-
-    KKJTest() :
-        northing(6682815),
-        easting(2556686)
-    {
-    }
-};
-
-TEST_F(KKJTest, ConstructorValuesReceivedViaGetters)
-{
-    KKJ kkj(northing , easting);
-    ASSERT_EQ(northing, kkj.northing());
-    ASSERT_EQ(easting, kkj.easting());
-}
-
-TEST_F(KKJTest, EqualsOperatorReturnsTrueForEqualCoordinates)
-{
-    KKJ kkj1(northing, easting);
-    KKJ kkj2(northing, easting);
-    ASSERT_TRUE(kkj1 == kkj2);
-}
-
-TEST_F(KKJTest, EqualsOperatorReturnsFalseForCoordinatesWithDifferentNorthing)
-{
-    KKJ kkj1(northing - 1, easting);
-    KKJ kkj2(northing, easting);
-    ASSERT_FALSE(kkj1 == kkj2);
-}
-
-TEST_F(KKJTest, EqualsOperatorReturnsFalseForCoordinatesWithDifferentEasting)
-{
-    KKJ kkj1(northing, easting - 1);
-    KKJ kkj2(northing, easting);
-    ASSERT_FALSE(kkj1 == kkj2);
-}
-
-TEST_F(KKJTest, AssignmentOperator)
-{
-    const KKJ kkj1(northing, easting);
-    KKJ kkj2(0, 0);
-    kkj2 = kkj1;
-    ASSERT_EQ(northing, kkj2.northing());
-    ASSERT_EQ(easting, kkj2.easting());
-}
-
-int main(int argc, char *argv[])
-{
-    ::testing::InitGoogleMock(&argc, argv);
-    return RUN_ALL_TESTS();
-}
diff --git a/tests/ut_kkj/ut_kkj.pro b/tests/ut_kkj/ut_kkj.pro
deleted file mode 100644 (file)
index 2f6c4c4..0000000
+++ /dev/null
@@ -1,17 +0,0 @@
-include(../ut_common.pri)
-
-TARGET = ut_kkj
-QT += testlib
-QT -= gui
-CONFIG += console
-CONFIG -= app_bundle
-TEMPLATE = app
-OBJECTS_DIR = .obj
-MOC_DIR = .moc
-SOURCES += ut_kkj.cpp \
-    $$SRCDIR/kkj.cpp
-HEADERS += \
-    $$SRCDIR/kkj.h
-
-include(../gmock.pri)
-include(../check.pri)
diff --git a/tests/ut_kkjgridcoordinate/.gitignore b/tests/ut_kkjgridcoordinate/.gitignore
new file mode 100644 (file)
index 0000000..6e53cac
--- /dev/null
@@ -0,0 +1 @@
+ut_kkjgridcoordinate
diff --git a/tests/ut_kkjgridcoordinate/ut_kkjgridcoordinate.cpp b/tests/ut_kkjgridcoordinate/ut_kkjgridcoordinate.cpp
new file mode 100644 (file)
index 0000000..4468115
--- /dev/null
@@ -0,0 +1,62 @@
+#include "kkjgridcoordinate.h"
+
+#include <gmock/gmock.h>
+#include <gtest/gtest.h>
+
+#include "stlhelpers.h"
+
+class KKJGridCoordinateTest : public ::testing::Test
+{
+public:
+    const unsigned int northing;
+    const unsigned int easting;
+
+    KKJGridCoordinateTest() :
+        northing(6682815),
+        easting(2556686)
+    {
+    }
+};
+
+TEST_F(KKJGridCoordinateTest, ConstructorValuesReceivedViaGetters)
+{
+    KKJGridCoordinate kkj(northing , easting);
+    ASSERT_EQ(northing, kkj.northing());
+    ASSERT_EQ(easting, kkj.easting());
+}
+
+TEST_F(KKJGridCoordinateTest, EqualsOperatorReturnsTrueForEqualCoordinates)
+{
+    KKJGridCoordinate kkj1(northing, easting);
+    KKJGridCoordinate kkj2(northing, easting);
+    ASSERT_TRUE(kkj1 == kkj2);
+}
+
+TEST_F(KKJGridCoordinateTest, EqualsOperatorReturnsFalseForCoordinatesWithDifferentNorthing)
+{
+    KKJGridCoordinate kkj1(northing - 1, easting);
+    KKJGridCoordinate kkj2(northing, easting);
+    ASSERT_FALSE(kkj1 == kkj2);
+}
+
+TEST_F(KKJGridCoordinateTest, EqualsOperatorReturnsFalseForCoordinatesWithDifferentEasting)
+{
+    KKJGridCoordinate kkj1(northing, easting - 1);
+    KKJGridCoordinate kkj2(northing, easting);
+    ASSERT_FALSE(kkj1 == kkj2);
+}
+
+TEST_F(KKJGridCoordinateTest, AssignmentOperator)
+{
+    const KKJGridCoordinate kkj1(northing, easting);
+    KKJGridCoordinate kkj2(0, 0);
+    kkj2 = kkj1;
+    ASSERT_EQ(northing, kkj2.northing());
+    ASSERT_EQ(easting, kkj2.easting());
+}
+
+int main(int argc, char *argv[])
+{
+    ::testing::InitGoogleMock(&argc, argv);
+    return RUN_ALL_TESTS();
+}
diff --git a/tests/ut_kkjgridcoordinate/ut_kkjgridcoordinate.pro b/tests/ut_kkjgridcoordinate/ut_kkjgridcoordinate.pro
new file mode 100644 (file)
index 0000000..3a42739
--- /dev/null
@@ -0,0 +1,19 @@
+include(../ut_common.pri)
+
+TARGET = ut_kkjgridcoordinate
+QT += testlib
+QT -= gui
+CONFIG += console \
+    mobility
+CONFIG -= app_bundle
+MOBILITY = location
+TEMPLATE = app
+OBJECTS_DIR = .obj
+MOC_DIR = .moc
+SOURCES += ut_kkjgridcoordinate.cpp \
+    $$SRCDIR/kkjgridcoordinate.cpp
+HEADERS += \
+    $$SRCDIR/kkjgridcoordinate.h
+
+include(../gmock.pri)
+include(../check.pri)
index d51798b..da2aac3 100644 (file)
@@ -2,10 +2,10 @@
 #define STLHELPERS_H
 
 #include <ostream>
-#include "kkj.h"
+#include "kkjgridcoordinate.h"
 #include <QGeoCoordinate>
 
-std::ostream& operator<<(std::ostream& stream, const KKJ &val)
+std::ostream& operator<<(std::ostream& stream, const KKJGridCoordinate &val)
 {
     stream << val.northing() << ", " << val.easting();
     return stream;