- Map creator GUI in python.
- Zone Counter program in c++
- Save Map as txt and use it from c++ and python.
- Create a map with MapInterface functions.
- C++ library for python wrapping
- Ubuntu 18.04
- g++ v7.5.0
- C++ standard: 17
- Build tool: Cmake
Main code includes two examples:
- Map from txt file created with python gui, then count of zone from this map
- Creating map with c++ api, then count of zone from this map.
If you want to provide another map text file created with python gui use:
./zonecounter --filepath <path>
mkdir build
cd build
cmake ..
make -j4
cd ../bin
./zonecounter
- Use python gui for map creating
- Save map as txt
- Run zonecounter with filepath argument
- C++ code
- change codes inside
createMap
function inmain.cpp
- change codes inside
Create a map inside createMap
function in main.cpp:
map.SetSize(5,5);
map.SetBorder(3,1);
map.SetBorder(3,2);
map.SetBorder(3,3);
map.SetBorder(3,4);
map.SetBorder(3,5);
Result is:
x,y index starts 1,1
- Once a map is created, create function adds border edges for all side. Like the picture below, in python gui section.
- Solve function initialize a zonePointMap which has all nonborder points.
- Solve function calls LookNeighbor function witth a zonePoint
- LookNeighbor searches all neighbor cells recursively until remain no neighbor zone points in the map.
- ZoneCounter variable is increased after LookNeighbor returned true
- These processes continue until zonePointMap is empty.
Python GUI is developed for test purposes and also It provides map visuality, map creation speed, variety.
- Python3.6
- PyQt5
python map_creator.py
Open video/test_vid.mp4
--
- MapImpl class creates border edges and stores them. This process needs to be in ZoneCounterImpl class.