An interactive map visualization application built with C++, SFML, and ImGui. This project displays road networks and allows for interactive exploration of map data.
- Interactive Map Display: Visualize road networks with different colors for different road types
- A Pathfinding Algorithm*: Complete implementation with optimal path finding
- Node Selection: Click on nodes to select them and view connections
- Path Visualization: Real-time path rendering with distance and statistics
- Customizable Colors: Adjust colors for different road types through the GUI
- Zoom and Pan: Navigate the map using mouse controls
- Real-time Rendering: Efficient rendering using SFML vertex arrays
- Comprehensive Error Handling: Robust data validation and error reporting
- Unit Testing: Complete test suite for core functionality
- Professional Documentation: Detailed code documentation and API references
- SFML 3.0.2: Graphics, window, and input handling
- ImGui: Immediate mode GUI
- C++20: Modern C++ features
- OpenGL: Graphics rendering
Make sure you have the following installed:
# Install SFML via Homebrew (macOS)
brew install sfml
# Or install via package manager on other systems
# Ubuntu/Debian: sudo apt-get install libsfml-dev
# Fedora: sudo dnf install SFML-devel# Clean previous build
make clean
# Build the project
make
# Or build and run in one command
make run-
Run the application:
cd bin ./sfmlgame -
Navigation:
- Right-click and drag: Pan around the map
- Mouse wheel: Zoom in/out
- Left-click: Select nodes
-
GUI Controls:
- Way Info Tab: View statistics, toggle way/node display, set start/goal nodes
- Colors Tab: Customize colors for different road types
-
Path Planning:
- Click on nodes to select them
- Use "Set Start" and "Set Goal" buttons to define path endpoints
- Click "Start Search" to find optimal path using A* algorithm
- View path statistics: length, distance, nodes explored
src/
├── main.cpp # Application entry point
├── GUI.hpp # Main GUI and rendering class
├── MapData.hpp # Data structures for map nodes and ways
├── ViewController.hpp # Camera/view control logic
└── imgui/ # ImGui library files
bin/
├── sfmlgame # Compiled executable
├── ways.txt # Map data (CSV format)
├── fonts/ # Font assets
└── imgui.ini # ImGui configuration
The application loads map data from bin/ways.txt, which contains CSV data with the following structure:
- Road information (ID, type, name, etc.)
- Node coordinates
- Road connectivity
The application supports different road types with customizable colors:
- footway: Walking paths (green)
- residential: Residential streets (yellow)
- motorway_link: Highway connections (magenta)
- primary: Primary roads (red)
- secondary: Secondary roads (light gray)
- tertiary: Tertiary roads (gray)
Run the comprehensive unit test suite:
# Run all tests
make test
# Clean test files
make test-cleanThe test suite covers:
- Node creation and ID generation
- Way parsing from CSV data
- NodeData and WayData functionality
- Error handling and validation
- Enhanced Pathfinding: The A* algorithm is fully implemented and can be extended with different heuristics
- Additional Road Types: Add new types to the
m_colorOptionsvector - UI Enhancements: Extend the ImGui interface in the
imgui()method - Performance Optimizations: Add spatial indexing or other optimizations
- Uses modern C++20 features
- SFML for graphics and input
- ImGui for immediate mode GUI
- Efficient rendering with vertex arrays
See LICENSE file for details.