Class: Tracksperanto::Import::PFTrack

Inherits:
Base
  • Object
show all
Includes:
PFCoords
Defined in:
lib/import/pftrack.rb

Overview

TODO: this should be rewritten as a proper state-machine parser

Constant Summary collapse

CHARACTERS_OR_QUOTES =
/[AZaz"]/
INTS =
/^\d+$/

Instance Attribute Summary

Attributes inherited from Base

#height, #io, #progress_block, #width

Class Method Summary collapse

Instance Method Summary collapse

Methods included from PFCoords

#from_pfcoord, #to_pfcoord

Methods inherited from Base

autodetects_size?, inherited, #report_progress

Methods included from BlockInit

#initialize

Methods included from ZipTuples

#zip_curve_tuples

Methods included from ConstName

#const_name

Methods included from Safety

#safe_reader

Methods included from Casts

#cast_to_bool, #cast_to_float, #cast_to_int, #cast_to_string

Class Method Details

.distinct_file_extObject



10
11
12
# File 'lib/import/pftrack.rb', line 10

def self.distinct_file_ext
  ".2dt"
end

.human_nameObject



6
7
8
# File 'lib/import/pftrack.rb', line 6

def self.human_name
  "PFTrack/PFMatchit .2dt file"
end

.known_snagsObject



14
15
16
17
# File 'lib/import/pftrack.rb', line 14

def self.known_snags
  'PFTrack only exports the trackers for the solved part of the shot. To export the whole shot, ' + 
  "first delete the camera solve."
end

Instance Method Details

#each(&blk) ⇒ Object



22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/import/pftrack.rb', line 22

def each(&blk)
  until @io.eof?
    line = @io.gets
    next if (!line || line =~ /^#/)
    
    if line =~ CHARACTERS_OR_QUOTES # Tracker with a name
      name = unquote(line.strip)
      report_progress("Reading tracker #{name}")
      parse_trackers(name, @io, &blk)
    end
  end
end