forked from organicmaps/organicmaps
Drules dumper for debugging style refactorings
This commit is contained in:
parent
083151ce2f
commit
58a66a2f35
1 changed files with 28 additions and 0 deletions
28
tools/python/stylesheet/drules_dump.py
Executable file
28
tools/python/stylesheet/drules_dump.py
Executable file
|
@ -0,0 +1,28 @@
|
|||
#!/usr/bin/python
|
||||
# Dumps hashes of protobuffed drules
|
||||
import sys, re
|
||||
import itertools
|
||||
import drules_struct_pb2
|
||||
|
||||
if len(sys.argv) < 2:
|
||||
print 'Usage: {} <drules_proto.bin>'.format(sys.argv[0])
|
||||
sys.exit(1)
|
||||
|
||||
drules = drules_struct_pb2.ContainerProto()
|
||||
drules.ParseFromString(open(sys.argv[1]).read())
|
||||
result = []
|
||||
|
||||
for elem in drules.cont:
|
||||
if not elem.element:
|
||||
continue
|
||||
for el in elem.element:
|
||||
zoom = el.scale
|
||||
if zoom <= 0:
|
||||
continue
|
||||
for l in itertools.chain(el.lines, (el.caption, el.path_text, el.circle, el.area, el.symbol)):
|
||||
if l.HasField('priority'):
|
||||
l.ClearField('priority')
|
||||
result.append('{} z{}: {}'.format(elem.name, zoom, re.sub(r'[\r\n\s]+', ' ', str(el))))
|
||||
|
||||
for line in sorted(result):
|
||||
print line
|
Loading…
Add table
Reference in a new issue