diff --git a/extensions/topreader.py b/extensions/topreader.py index 9ba72f7..6977253 100755 --- a/extensions/topreader.py +++ b/extensions/topreader.py @@ -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): @@ -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) @@ -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): @@ -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="") @@ -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':