func (p *IGCParser) parseB(line string, f *Flight) error { if len(line) < 37 { return fmt.Errorf("line too short :: %v", line) } pt := NewPoint() var err error pt.Time, err = time.Parse(TimeFormat, line[1:7]) if err != nil { return err } pt.Latitude = spatial.DMD2Decimal(line[7:15]) pt.Longitude = spatial.DMD2Decimal(line[15:24]) if line[24] == 'A' || line[24] == 'V' { pt.FixValidity = line[24] } else { return fmt.Errorf("invalid fix validity :: %v", line[24]) } pt.PressureAltitude, err = strconv.ParseInt(line[25:30], 10, 64) if err != nil { return err } pt.GNSSAltitude, err = strconv.ParseInt(line[30:35], 10, 64) if err != nil { return err } for _, f := range p.IFields { pt.IData[f.tlc] = line[f.start-1 : f.end] } pt.NumSatellites = p.numSat f.Points = append(f.Points, pt) return nil }
func (p *IGCParser) taskPoint(line string) (Point, error) { if len(line) < 18 { return Point{}, fmt.Errorf("line too short :: %v", line) } return Point{ Latitude: spatial.DMD2Decimal(line[1:9]), Longitude: spatial.DMD2Decimal(line[9:18]), Description: line[18:], }, nil }