--- /dev/null
+# git-ls-files --others --exclude-from=.git/info/exclude
+# Lines that start with '#' are comments.
+# For a project mostly in C, the following would be a good set of
+# exclude patterns (uncomment them if you want to use them):
+# *.[oa]
+# *~
+
+*.[oa]
+*~
+moc_*
+*.moc
+*.pro.user
+Makefile
--- /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
+ as published by the Free Software Foundation; either version 2
+ of the License, or (at your option) any later version.
+
+ 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 <math.h>
+
+#include "mapengine.h"
+#include "maptile.h"
+
+MapEngine::MapEngine()
+{
+}
+
+MapEngine::MapEngine(MapView *mapView)
+{
+// m_mapView = mapView;
+// m_mapScene = new MapScene();
+// mapView->setScene(m_mapScene);
+//
+// /// \todo remove debug data
+// for (int x=4261; x<=4264; x++) {
+// for (int y=9352; y<=9353; y++) {
+// MapTile *mapTile = new MapTile();
+// mapTile->setZoomLevel(14);
+// mapTile->setTileXY(x, y);
+// mapTile->setPixmap(QPixmap("/home/ramosam-local/situare/src/map/static_test_tiles/14_9352_4261.png"));
+// mapTile->setOffset((x-4261)*256, (y-9352)*256);
+// m_mapScene->addMapTile(mapTile);
+// }
+// }
+}
+
+QPoint MapEngine::convertTileNumberToSceneCoordinate(int zoomLevel, QPoint tileNumber)
+{
+ int x = tileNumber.x() * TILE_SIZE_X * pow(2, MAX_ZOOM_LEVEL - zoomLevel);
+ int y = tileNumber.y() * TILE_SIZE_Y * pow(2, MAX_ZOOM_LEVEL - zoomLevel);
+
+ return QPoint(x, y);
+}
--- /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
+ as published by the Free Software Foundation; either version 2
+ of the License, or (at your option) any later version.
+
+ 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 MAPENGINE_H
+#define MAPENGINE_H
+
+#include "mapview.h"
+#include "mapscene.h"
+
+class MapEngine
+{
+public:
+ MapEngine();
+ MapEngine(MapView *mapView);
+ QPoint convertTileNumberToSceneCoordinate(int zoomLevel, QPoint tileNumber);
+
+public:
+ static const int TILE_SIZE_X = 256;
+ static const int TILE_SIZE_Y = 256;
+ static const int MAX_ZOOM_LEVEL = 18;
+
+private:
+ MapView *m_mapView;
+ MapScene *m_mapScene;
+};
+
+#endif // MAPENGINE_H
--- /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
+ as published by the Free Software Foundation; either version 2
+ of the License, or (at your option) any later version.
+
+ 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 "mapscene.h"
+
+MapScene::MapScene(QObject *parent) : QGraphicsScene(parent)
+{
+}
+
+void MapScene::addMapTile(MapTile *mapTile)
+{
+// /// \todo set offset & transfor (=zoom)
+// mapTile->setOffset(x, y);
+// //mapTile->setTransform();
+// addItem(mapTile);
+}
--- /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
+ as published by the Free Software Foundation; either version 2
+ of the License, or (at your option) any later version.
+
+ 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 MAPSCENE_H
+#define MAPSCENE_H
+
+#include <QGraphicsScene>
+
+#include "map/maptile.h"
+
+
+class MapScene : public QGraphicsScene
+{
+public:
+
+ MapScene(QObject *parent = 0);
+ void addMapTile(MapTile *mapTile);
+};
+
+#endif // MAPSCENE_H
--- /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
+ as published by the Free Software Foundation; either version 2
+ of the License, or (at your option) any later version.
+
+ 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 "maptile.h"
+
+MapTile::MapTile()
+{
+}
+
+quint8 MapTile::zoomLevel()
+{
+ return m_zoomLevel;
+}
+
+void MapTile::setZoomLevel(quint8 zoomLevel)
+{
+ m_zoomLevel = zoomLevel;
+}
+
+QPoint MapTile::tileNumber()
+{
+ return m_tileNumber;
+}
+
+void MapTile::setTileNumber(QPoint tileNumber)
+{
+ m_tileNumber = tileNumber;
+}
--- /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
+ as published by the Free Software Foundation; either version 2
+ of the License, or (at your option) any later version.
+
+ 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 MAPTILE_H
+#define MAPTILE_H
+
+#include <QGraphicsPixmapItem>
+#include <QPoint>
+
+class MapTile : public QGraphicsPixmapItem
+{
+public:
+ MapTile();
+ quint8 zoomLevel();
+ void setZoomLevel(quint8 zoomLevel);
+ QPoint tileNumber();
+ void setTileNumber(QPoint tileNumber);
+
+private:
+ quint32 m_zoomLevel;
+ QPoint m_tileNumber;
+};
+
+#endif // MAPTILE_H
--- /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
+ as published by the Free Software Foundation; either version 2
+ of the License, or (at your option) any later version.
+
+ 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 "mapview.h"
+
+MapView::MapView(QWidget *parent) : QGraphicsView(parent)
+{
+ setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
+ setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
+}
--- /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
+ as published by the Free Software Foundation; either version 2
+ of the License, or (at your option) any later version.
+
+ 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 MAPVIEW_H
+#define MAPVIEW_H
+
+#include <QGraphicsView>
+
+class MapView : public QGraphicsView
+{
+public:
+ MapView(QWidget *parent = 0);
+};
+
+#endif // MAPVIEW_H
--- /dev/null
+# #####################################################################
+# Automatically generated by qmake (2.01a) Fri Mar 26 15:09:16 2010
+# #####################################################################
+CONFIG += qtestlib
+TEMPLATE = app
+TARGET =
+DEPENDPATH += .
+INCLUDEPATH += . \
+ ../../../src/
+
+# Input
+SOURCES += testmapengine.cpp \
+ ../../../src/map/mapengine.cpp
+HEADERS += ../../../src/map/mapengine.h
--- /dev/null
+#include <QtTest/QtTest>
+
+#include "map/mapengine.h"
+
+class TestMapEngine: public QObject
+{
+ Q_OBJECT
+private slots:
+ void convertTileNumberToSceneCoordinate();
+};
+
+void TestMapEngine::convertTileNumberToSceneCoordinate()
+{
+ MapEngine mapEngine;
+
+ QCOMPARE(mapEngine.convertTileNumberToSceneCoordinate(18, QPoint(0,0)), QPoint(0,0));
+ QCOMPARE(mapEngine.convertTileNumberToSceneCoordinate(18, QPoint(1,2)), QPoint(256,512));
+ QCOMPARE(mapEngine.convertTileNumberToSceneCoordinate(16, QPoint(3,4)), QPoint(3072,4096));
+}
+
+QTEST_MAIN(TestMapEngine)
+#include "testmapengine.moc"
--- /dev/null
+# #####################################################################
+# Automatically generated by qmake (2.01a) Mon Mar 29 10:06:28 2010
+# #####################################################################
+CONFIG += qtestlib
+TEMPLATE = app
+TARGET =
+DEPENDPATH += .
+INCLUDEPATH += . \
+ ../../../src/
+
+# Input
+SOURCES += testmapscene.cpp \
+ ../../../src/map/mapscene.cpp \
+ ../../../src/map/maptile.cpp
+HEADERS += ../../../src/map/mapscene.h \
+ ../../../src/map/maptile.h
--- /dev/null
+#include <QtTest/QtTest>
+
+#include "map/mapscene.h"
+#include "map/maptile.h"
+
+class TestMapScene : public QObject
+{
+ Q_OBJECT
+private slots:
+ void addMapTile();
+};
+
+void TestMapScene::addMapTile()
+{
+ MapScene mapScene;
+
+ MapTile mapTile;
+ mapTile.setZoomLevel(18);
+ mapTile.setTileNumber(QPoint(12, 47));
+
+ mapScene.addMapTile(&mapTile);
+
+ QVERIFY(mapTile.zoomLevel() == 13);
+}
+
+QTEST_MAIN(TestMapScene)
+#include "testmapscene.moc"
--- /dev/null
+# #####################################################################
+# Automatically generated by qmake (2.01a) Mon Mar 29 10:06:28 2010
+# #####################################################################
+CONFIG += qtestlib
+TEMPLATE = app
+TARGET =
+DEPENDPATH += .
+INCLUDEPATH += . \
+ ../../../src/
+
+# Input
+SOURCES += testmaptile.cpp \
+ ../../../src/map/maptile.cpp
+HEADERS += ../../../src/map/maptile.h
--- /dev/null
+#include <QtTest/QtTest>
+
+#include "map/maptile.h"
+
+class TestMapTile : public QObject
+{
+ Q_OBJECT
+private slots:
+ void zoomLevel();
+ void tileNumber();
+};
+
+void TestMapTile::zoomLevel()
+{
+ MapTile mapTile;
+ mapTile.setZoomLevel(13);
+ QVERIFY(mapTile.zoomLevel() == 13);
+}
+
+void TestMapTile::tileNumber()
+{
+ MapTile mapTile;
+ mapTile.setTileNumber(QPoint(24, 17));
+ QVERIFY(mapTile.tileNumber() == QPoint(24, 17));
+}
+
+QTEST_MAIN(TestMapTile)
+#include "testmaptile.moc"
--- /dev/null
+# #####################################################################
+# Automatically generated by qmake (2.01a) Fri Mar 26 15:22:56 2010
+# #####################################################################
+CONFIG += qtestlib
+TEMPLATE = app
+TARGET =
+DEPENDPATH += .
+INCLUDEPATH += . \
+ ../../../src/
+
+# Input
+SOURCES += testmapview.cpp \
+ ../../../src/map/mapview.cpp
+HEADERS += ../../../src/map/mapview.h
--- /dev/null
+#include <QtTest/QtTest>
+
+#include "map/mapview.h"
+
+class TestMapView: public QObject
+{
+ Q_OBJECT
+private slots:
+ void dummyTestCase();
+};
+
+void TestMapView::dummyTestCase()
+{
+ QVERIFY(true);
+}
+
+QTEST_MAIN(TestMapView)
+#include "testmapview.moc"