-
Notifications
You must be signed in to change notification settings - Fork 0
/
run.py
executable file
·49 lines (35 loc) · 1.29 KB
/
run.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#!/bin/python
from mapLib import *
from grammar import *
import pickle
# Firstly we construct province information using provinceDef.xls/csv
# this is our base file we want to change!
a=ProvincesData('./examples/provinceDef.csv')
# In order to know in which way we want to change provinceDef.xls/csv
# We need bmp image
b=ProvincesBMP('./examples/provinces_v2.bmp')
# Get all colors (so provinces) exsiting in provinces_v2.bmp
colors = b.getColors()
# Use this info to delete all provs not existing in base provinceDef file
a.filterByColor(colors)
# Counting
a.countProvinces()
# Checking
b.checkMissing(a)
# Write the new csv file
a.write('provinceDef_v2.csv')
# after this you should transform provinceDef_v2.csv into XLS excel file and then use CK2Tools
###########################################
#
# Positions update
#
# Remember we have also positions.txt to update -> most likely we have changed the map geometry so adjustment is needed
# This instruction takes
posdata = PositionsData('./examples/positions.txt')
# Translate the positions
posdata.move(-1579,-1162)
# Use the province definitions to updated positions data
#(remember some provs are deleted from existence and we have OLD version of positions data)
posdata.update(a)
# Save updated positions data file
posdata.write('posnew.txt')