Refactored MapScene clean-up code
[situare] / src / map / mapscene.h
index 4ba5896..7c6c446 100644 (file)
@@ -43,14 +43,64 @@ public:
     MapScene(QObject *parent = 0);
 
 /*******************************************************************************
- * CLASS SPECIFIC MEMBER FUNCTIONS AND SLOTS
+ * MEMBER FUNCTIONS AND SLOTS
  ******************************************************************************/
+public:
     /**
     * @brief Add MapTile item to scene
     *
     * @param mapTile Map tile item to be added
+    * @param hashKey Hash key for the tile
     */
-    void addMapTile(MapTile *mapTile);
+    void addTile(MapTile *mapTile, QString hashKey);
+
+    /**
+    * @brief Returns if tile mathcing hash key is already in the scene
+    *
+    * @param hashKey
+    * @return True if tile was in the scene, otherwise false
+    */
+    bool isTileInScene(QString hashKey);
+
+    /**
+    * @brief Remove tiles which are out of view bounds.
+    *
+    * @param viewRect Current view rect
+    */
+    void removeOutOfViewTiles(QRect viewRect);
+
+    /**
+    * @brief Remove tiles which are stacked.
+    *
+    * Iterate through tiles which are under this map tile and remove obscured
+    * tiles.
+    *
+    * @param newTile new tile covering old tiles
+    * @param viewRect Current view rect
+    */
+    void removeStackedTiles(MapTile *newTile, QRect viewRect);
+
+    /**
+    * @brief Remove tile.
+    *
+    * Removes tile from scene and list of current tiles in scene.
+    * @param tile MapTile to remove
+    */
+    void removeTile(MapTile *tile);
+
+    /**
+    * @brief Set drawing order of all tiles in the scene
+    *
+    * Check MapTile::setSceneLevel for more information.
+    * @param zoomLevel Current zoom level
+    */
+    void setTilesDrawingLevels(int zoomLevel);
+
+/*******************************************************************************
+ * DATA MEMBERS
+ ******************************************************************************/
+private:
+    QHash<QString, MapTile *> m_mapTilesInScene;  ///< List of map tiles in map scene
 };
 
 #endif // MAPSCENE_H