def _points(self): points = [] for row in self.rows: fs = row.split(',') if fs[0] == 'CO' and fs[1].startswith('Coord Order:'): coordorder = fs[1].split(':')[-1].strip() if fs[0] == 'ST': x = fs[6] # FIXME NEZ coord order shouldn't be hardcoded y = fs[7] z = fs[5] bp = BasePoint(x=x, y=y, z=z, ih=0) if fs[0] == 'SS': angle = fs[4] z_angle = fs[5] dist = fs[3] th = fs[2] pid = fs[1] try: text = fs[7] except IndexError: text = fs[-1] p = PolarPoint(dist=dist, angle=angle, z_angle=z_angle, th=th, angle_type='gon', base_point=bp, pid=pid, text=text, coordorder=coordorder) points.append(p.to_point()) return points
def _points(self): points = [] bp = BasePoint(x=0, y=0, z=0, ih=0) for row in self.rows: fs = row.split('+') try: pid = fs[1][:-3] except IndexError: continue text = fs[-1][0:5] try: th = float(fs[0][:-1]) except ValueError: continue coordorder = 'NEZ' dist = float(fs[2].split('m')[0]) angle = float(fs[3][:-1]) / 10000 z_angle = float(fs[4][:-3]) / 10000 p = PolarPoint(dist=dist, angle=angle, z_angle=z_angle, th=th, angle_type='deg', base_point=bp, pid=pid, text=text, coordorder=coordorder) points.append(p.to_point().tuplepoint) return points
def _points(self): points = [] bp = BasePoint(x=0, y=0, z=0, ih=0, b_zero_st=0.0) for row in self.rows: fs = row.split("+") try: pid = fs[1][:-3] except IndexError: continue text = fs[-1][0:5] try: th = float(fs[0][:-1]) except ValueError: continue coordorder = "NEZ" dist = float(fs[2].split("m")[0]) angle = deg_to_gon(float(fs[3][:-1]) / 10000) z_angle = deg_to_gon(float(fs[4][:-3]) / 10000) p = PolarPoint( angle_unit="gon", dist=dist, angle=angle, z_angle=z_angle, th=th, base_point=bp, pid=pid, text=text, coordorder=coordorder, ) f = Feature(p.to_point(), desc=text, id=pid) points.append(f) return points
def _points(self): points = [] bp = BasePoint(x=0, y=0, z=0, ih=0, b_zero_st=0.0) for row in self.rows: fs = row.split('+') try: pid = fs[1][:-3] except IndexError: continue text = fs[-1][0:5] try: th = float(fs[0][:-1]) except ValueError: continue coordorder = 'NEZ' dist = float(fs[2].split('m')[0]) angle = deg_to_gon(float(fs[3][:-1]) / 10000) z_angle = deg_to_gon(float(fs[4][:-3]) / 10000) p = PolarPoint(angle_unit="gon", dist=dist, angle=angle, z_angle=z_angle, th=th, base_point=bp, pid=pid, text=text, coordorder=coordorder) f = Feature(p.to_point(), desc=text, id=pid) points.append(f) return points
def get_point(self, line): '''Extract GSI data. Based on the "GSI ONLINE for Leica TPS" document.''' tokens = line.split() tdict = {} for t in tokens: t = t.lstrip('*') data = { 'wordindex': t[0:2], 'info': t[2:6], 'sign': t[6], 'data': t[7:], } tdict[data['wordindex']] = data try: pid = tdict['11']['info'] text = tdict['11']['data'].lstrip('0') except KeyError: return None try: x = tdict['81']['sign'] + tdict['81']['data'] y = tdict['82']['sign'] + tdict['82']['data'] z = tdict['83']['sign'] + tdict['83']['data'] except KeyError: try: #angle_type = tdict['21']['info'] angle = float(tdict['21']['sign'] + tdict['21']['data']) / 100000 z_angle = float(tdict['22']['sign'] + tdict['22']['data']) / 100000 dist = float(tdict['31']['sign'] + tdict['31']['data']) / 1000 th = float(tdict['87']['sign'] + tdict['87']['data']) / 1000 ih = float(tdict['88']['sign'] + tdict['88']['data']) / 1000 except KeyError: return None else: bp = BasePoint(x=0.0, y=0.0, z=0.0, ih=ih) p = PolarPoint(dist=dist, angle=angle, z_angle=z_angle, th=th, angle_type='deg', base_point=bp, pid=pid, text=text, coordorder='NEZ') return p.to_point() else: x, y, z = [float(c) / 1000 for c in (x, y, z)] p = Point(pid, x, y, z, text) return p
def get_point(self, line): '''Extract GSI data. Based on the "GSI ONLINE for Leica TPS" document.''' tokens = line.split() tdict = {} for t in tokens: t = t.lstrip('*') data = { 'wordindex': t[0:2], 'info': t[2:6], 'sign': t[6], 'data': t[7:], } tdict[data['wordindex']] = data try: pid = tdict['11']['info'] text = tdict['11']['data'].lstrip('0') except KeyError: return None try: x = tdict['81']['sign'] + tdict['81']['data'] y = tdict['82']['sign'] + tdict['82']['data'] z = tdict['83']['sign'] + tdict['83']['data'] except KeyError: try: #angle_type = tdict['21']['info'] angle = float(tdict['21']['sign'] + tdict['21']['data'])/100000 z_angle = float(tdict['22']['sign'] + tdict['22']['data'])/100000 dist = float(tdict['31']['sign'] + tdict['31']['data'])/1000 th = float(tdict['87']['sign'] + tdict['87']['data'])/1000 ih = float(tdict['88']['sign'] + tdict['88']['data'])/1000 except KeyError: return None else: bp = BasePoint(x=0.0, y=0.0, z=0.0, ih=ih) p = PolarPoint(dist=dist, angle=angle, z_angle=z_angle, th=th, angle_type='deg', base_point=bp, pid=pid, text=text, coordorder='NEZ' ) return p.to_point() else: x, y, z = [float(c)/1000 for c in (x, y, z)] p = Point(pid, x, y, z, text) return p