GeoCoordinate();
/**
- * @brief Contsructs a coordinate with given latitude and longitude values
+ * @brief Constructs a coordinate with given latitude and longitude values
*
* @param latitude Latitude value
* @param longitude Longitude value
--- /dev/null
+/*
+ Situare - A location system for Facebook
+ Copyright (C) 2010 Ixonos Plc. Authors:
+
+ Sami Rämö - sami.ramo@ixonos.com
+
+ Situare is free software; you can redistribute it and/or
+ modify it under the terms of the GNU General Public License
+ version 2 as published by the Free Software Foundation.
+
+ Situare is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with Situare; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+ USA.
+*/
+
+#include <QDebug>
+
+#include "scenecoordinate.h"
+
+SceneCoordinate::SceneCoordinate() :
+ m_x(0),
+ m_y(0)
+{
+ qDebug() << __PRETTY_FUNCTION__;
+}
+
+SceneCoordinate::SceneCoordinate(double x, double y) :
+ m_x(x),
+ m_y(y)
+{
+ qDebug() << __PRETTY_FUNCTION__;
+}
+
+bool SceneCoordinate::isNull() const
+{
+ qDebug() << __PRETTY_FUNCTION__;
+
+ if (m_x == 0 && m_y == 0)
+ return true;
+
+ return false;
+}
+
+double SceneCoordinate::x() const
+{
+ qDebug() << __PRETTY_FUNCTION__;
+
+ return m_x;
+}
+
+double SceneCoordinate::y() const
+{
+ qDebug() << __PRETTY_FUNCTION__;
+
+ return m_y;
+}
+
+void SceneCoordinate::setX(double x)
+{
+ qDebug() << __PRETTY_FUNCTION__;
+
+ m_x = x;
+}
+
+void SceneCoordinate::setY(double y)
+{
+ qDebug() << __PRETTY_FUNCTION__;
+
+ m_y = y;
+}
+
+QDebug operator<<(QDebug dbg, const SceneCoordinate &coordinate)
+{
+ dbg.nospace() << "(" << coordinate.x() << ", " << coordinate.y() << ")";
+
+ return dbg.space();
+}
--- /dev/null
+/*
+ Situare - A location system for Facebook
+ Copyright (C) 2010 Ixonos Plc. Authors:
+
+ Sami Rämö - sami.ramo@ixonos.com
+
+ Situare is free software; you can redistribute it and/or
+ modify it under the terms of the GNU General Public License
+ version 2 as published by the Free Software Foundation.
+
+ Situare is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with Situare; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+ USA.
+*/
+
+
+#ifndef SCENECOORDINATE_H
+#define SCENECOORDINATE_H
+
+#include <QDebug>
+
+/**
+* @brief Scene coordinate
+*
+* @author Sami Rämö - sami.ramo@ixonos.com
+*/
+class SceneCoordinate
+{
+public:
+ /**
+ * @brief Constructs a null coordinate
+ */
+ SceneCoordinate();
+
+ /**
+ * @brief Constructs a coordinate with given x and y
+ *
+ * @param x X value
+ * @param y Y value
+ */
+ SceneCoordinate(double x, double y);
+
+ /**
+ * @brief Check if coordinate is (0.0, 0.0)
+ *
+ * @returns True if both X and Y are 0.0, otherwise false
+ */
+ bool isNull() const;
+
+ /**
+ * @brief Sets the latitude
+ *
+ * @param x X value
+ */
+ void setX(double x);
+
+ /**
+ * @brief Sets the longitude
+ *
+ * @param y Y value
+ */
+ void setY(double y);
+
+ /**
+ * @brief Returns the x value
+ *
+ * @returns x
+ */
+ double x() const;
+
+ /**
+ * @brief Returns the y value
+ *
+ * @returns y
+ */
+ double y() const;
+
+private:
+ double m_x; ///< X value
+ double m_y; ///< Y value
+};
+
+QDebug operator<<(QDebug dbg, const SceneCoordinate &c);
+
+#endif // SCENECOORDINATE_H
*/
#include <QtCore/QString>
-#include <QDebug>
#include <QtTest/QtTest>
#include "coordinates/geocoordinate.h"
--- /dev/null
+#-------------------------------------------------
+#
+# Project created by QtCreator 2010-07-13T16:06:32
+#
+#-------------------------------------------------
+
+QT += testlib
+
+QT -= gui
+
+CONFIG += console
+CONFIG -= app_bundle
+
+TEMPLATE = app
+
+
+SOURCES += testscenecoordinate.cpp \
+ ../../../src/coordinates/scenecoordinate.cpp
+DEFINES += SRCDIR=\\\"$$PWD/\\\"
+
+HEADERS += \
+ ../../../src/coordinates/scenecoordinate.h
+
+INCLUDEPATH += . \
+ ../../../src/
+
+DEFINES += QT_NO_DEBUG_OUTPUT
--- /dev/null
+/*
+ Situare - A location system for Facebook
+ Copyright (C) 2010 Ixonos Plc. Authors:
+
+ Sami Rämö - sami.ramo@ixonos.com
+
+ Situare is free software; you can redistribute it and/or
+ modify it under the terms of the GNU General Public License
+ version 2 as published by the Free Software Foundation.
+
+ Situare is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with Situare; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+ USA.
+*/
+
+#include <QtCore/QString>
+#include <QtTest/QtTest>
+
+#include "coordinates/scenecoordinate.h"
+
+const double X = 12.345678;
+const double Y = -89.765432;
+
+class TestSceneCoordinate : public QObject
+{
+ Q_OBJECT
+
+public:
+ TestSceneCoordinate();
+
+private Q_SLOTS:
+ void constructors();
+ void isNull();
+ void settersAndGetters();
+};
+
+TestSceneCoordinate::TestSceneCoordinate()
+{
+}
+
+void TestSceneCoordinate::constructors()
+{
+ SceneCoordinate coordinate;
+ QVERIFY(coordinate.isNull());
+
+ SceneCoordinate coordinate2(X, Y);
+ QCOMPARE(coordinate2.x(), X);
+ QCOMPARE(coordinate2.y(), Y);
+}
+
+void TestSceneCoordinate::isNull()
+{
+ SceneCoordinate coordinate;
+ QVERIFY(coordinate.isNull());
+ coordinate.setX(1);
+ QVERIFY(!coordinate.isNull());
+
+ SceneCoordinate coordinate2;
+ QVERIFY(coordinate2.isNull());
+ coordinate2.setY(1);
+ QVERIFY(!coordinate.isNull());
+
+ SceneCoordinate coordinate3;
+ QVERIFY(coordinate3.isNull());
+ coordinate3.setX(1);
+ coordinate3.setY(1);
+ QVERIFY(!coordinate.isNull());
+}
+
+void TestSceneCoordinate::settersAndGetters()
+{
+ SceneCoordinate coordinate;
+ QCOMPARE(coordinate.x(), (double)0);
+ QCOMPARE(coordinate.y(), (double)0);
+
+ coordinate.setX(X);
+ coordinate.setY(Y);
+
+ QCOMPARE(coordinate.x(), X);
+ QCOMPARE(coordinate.y(), Y);
+}
+
+QTEST_APPLESS_MAIN(TestSceneCoordinate);
+
+#include "testscenecoordinate.moc"