Skip to content

Commit

Permalink
top -> xvi-ee
Browse files Browse the repository at this point in the history
PocketTopo -> XVI extended elevation dump

Closes #14
  • Loading branch information
speleo3 committed Jun 13, 2024
1 parent 9d0ed28 commit 860e087
Showing 1 changed file with 27 additions and 7 deletions.
34 changes: 27 additions & 7 deletions extensions/topreader.py
Original file line number Diff line number Diff line change
Expand Up @@ -1006,7 +1006,7 @@ def write_layer(parent: EtreeElement,
FACTOR = 50 # 2.0 world-cm per px


def dump_xvi(top, *, file=sys.stdout):
def dump_xvi(top, *, file=sys.stdout, view="outline"):
'''Dump drawing as XVI.
'''
def pnt2xvi(pnt):
Expand Down Expand Up @@ -1042,8 +1042,16 @@ def process_shot(s, do_splays):
length_proj = s[KEY_TAPE] * math.cos(math.radians(s['clino']))
true_bearing = get_true_bearing(s, top)

delta_x = length_proj * math.sin(math.radians(true_bearing))
delta_y = length_proj * math.cos(math.radians(true_bearing))
if sideview:
compass_delta = 1.0
# TODO is_splay, like in dump_svg
if s[KEY_EXTEND] == EXTEND_LEFT:
compass_delta *= -1
delta_x = length_proj * compass_delta
delta_y = s[KEY_TAPE] * math.sin(math.radians(s['clino']))
else:
delta_x = length_proj * math.sin(math.radians(true_bearing))
delta_y = length_proj * math.cos(math.radians(true_bearing))

pnt_from = frompoints[s['from']]
pnt_to = (pnt_from[0] + delta_x, pnt_from[1] - delta_y)
Expand Down Expand Up @@ -1135,9 +1143,9 @@ def write_grid_spacing():
file.write('set XVIgrids {1.0 m}\n')

write_grid_spacing()
frompoints = write_shots_and_stations(top)
write_sketchlines(top, frompoints=frompoints)
write_grid(top)
frompoints = write_shots_and_stations(top, view)
write_sketchlines(top, view, frompoints=frompoints)
write_grid(top, view)


def dump_th2(top, *, file=sys.stdout, with_xvi: bool = False):
Expand Down Expand Up @@ -1319,7 +1327,17 @@ def main(argv=None):
argparser.add_argument(
"--dump",
help="dump file to stdout",
choices=('json', 'svg', 'svx', 'th', 'th2', 'tro', 'xvi', 'th2-xvi'),
choices=(
'json',
'svg',
'svx',
'th',
'th2',
'tro',
'xvi',
'xvi-ee',
'th2-xvi',
),
)
argparser.add_argument("--view", help="open viewer application", choices=('aven', 'inkscape'))
argparser.add_argument("--surveyname", help="survey name for survex dump", default="")
Expand Down Expand Up @@ -1353,6 +1371,8 @@ def main(argv=None):
dump_svg(top)
elif args.dump == 'xvi':
dump_xvi(top)
elif args.dump == 'xvi-ee':
dump_xvi(top, view="sideview")
elif args.dump == 'th2':
dump_th2(top)
elif args.dump == 'th2-xvi':
Expand Down

0 comments on commit 860e087

Please sign in to comment.